1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9980],{27781:function(t,e,i){i.r(e),i.d(e,{AbortException:function(){return _G},AnnotationEditorLayer:function(){return _z},AnnotationEditorParamsType:function(){return _j},AnnotationEditorType:function(){return _U},AnnotationEditorUIManager:function(){return _V},AnnotationLayer:function(){return _q},AnnotationMode:function(){return _X},ColorPicker:function(){return _K},DOMSVGFactory:function(){return _Y},DrawLayer:function(){return _Q},FeatureTest:function(){return _J},GlobalWorkerOptions:function(){return _Z},ImageKind:function(){return _$},InvalidPDFException:function(){return _0},MissingPDFException:function(){return _1},OPS:function(){return _2},OutputScale:function(){return _3},PDFDataRangeTransport:function(){return _5},PDFDateString:function(){return _4},PDFWorker:function(){return _6},PasswordResponses:function(){return _8},PermissionFlag:function(){return _9},PixelsPerInch:function(){return _7},RenderingCancelledException:function(){return pt},TextLayer:function(){return pe},TouchManager:function(){return pi},UnexpectedResponseException:function(){return ps},Util:function(){return pa},VerbosityLevel:function(){return pn},XfaLayer:function(){return pr},build:function(){return pl},createValidAbsoluteUrl:function(){return po},fetchData:function(){return ph},getDocument:function(){return pd},getFilenameFromUrl:function(){return pc},getPdfFilenameFromUrl:function(){return pu},getXfaPageViewport:function(){return p_},isDataScheme:function(){return pp},isPdfFile:function(){return pg},noContextMenu:function(){return pf},normalizeUnicode:function(){return pv},setLayerDimensions:function(){return pm},shadow:function(){return pw},stopEvent:function(){return pb},version:function(){return pA}});var s=i(19686),a=i(36960),n=i(47293),r=i(18467),l=i(38543),o=i(79026),h=i(73776),d=i(93925),c=i(89571),u=i(83393),_=i(81477),p=i(25566),g=i(82957).lW,f={};f.d=(t,e)=>{for(var i in e)f.o(e,i)&&!f.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},f.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var v=globalThis.pdfjsLib={};f.d(v,{AbortException:()=>q,AnnotationEditorLayer:()=>_y,AnnotationEditorParamsType:()=>k,AnnotationEditorType:()=>S,AnnotationEditorUIManager:()=>io,AnnotationLayer:()=>hr,AnnotationMode:()=>y,ColorPicker:()=>dX,DOMSVGFactory:()=>lO,DrawLayer:()=>_N,FeatureTest:()=>Q,GlobalWorkerOptions:()=>nO,ImageKind:()=>M,InvalidPDFException:()=>z,MissingPDFException:()=>j,OPS:()=>P,OutputScale:()=>tx,PDFDataRangeTransport:()=>r5,PDFDateString:()=>tm,PDFWorker:()=>ll,PasswordResponses:()=>L,PermissionFlag:()=>x,PixelsPerInch:()=>tr,RenderingCancelledException:()=>th,TextLayer:()=>rN,TouchManager:()=>i7,UnexpectedResponseException:()=>U,Util:()=>Z,VerbosityLevel:()=>R,XfaLayer:()=>lB,build:()=>lI,createValidAbsoluteUrl:()=>W,fetchData:()=>tl,getDocument:()=>r0,getFilenameFromUrl:()=>tu,getPdfFilenameFromUrl:()=>t_,getXfaPageViewport:()=>tb,isDataScheme:()=>td,isPdfFile:()=>tc,noContextMenu:()=>tf,normalizeUnicode:()=>ts,setLayerDimensions:()=>tk,shadow:()=>O,stopEvent:()=>tv,version:()=>lL});let m="object"==typeof p&&p+""=="[object process]"&&!p.versions.nw&&!(p.versions.electron&&p.type&&"browser"!==p.type),w=[1,0,0,1,0,0],b=[.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},S={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},k={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,DRAW_STEP:41},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},P={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},L={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},I=R.WARNINGS;function D(t){R.WARNINGS}function F(t){throw Error(t)}function N(t,e){t||F(e)}function W(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 O(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 H extends B{constructor(t,e){super(t,"PasswordException"),this.code=e}}class G extends B{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class z extends B{constructor(t){super(t,"InvalidPDFException")}}class j extends B{constructor(t){super(t,"MissingPDFException")}}class U extends B{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class V extends B{constructor(t){super(t,"FormatError")}}class q extends B{constructor(t){super(t,"AbortException")}}function X(t){("object"!=typeof t||(null==t?void 0:t.length)===void 0)&&F("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 K(t){"string"!=typeof t&&F("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 Y(t){let e=Object.create(null);for(let[i,s]of t)e[i]=s;return e}class Q{static get isLittleEndian(){return O(this,"isLittleEndian",function(){let t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return O(this,"isEvalSupported",function(){try{return Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return O(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get isImageDecoderSupported(){return O(this,"isImageDecoderSupported","undefined"!=typeof ImageDecoder)}static get platform(){var t,e;return"undefined"!=typeof navigator&&"string"==typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?O(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")}):O(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return O(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 J=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class Z{static makeHexColor(t,e,i){return"#".concat(J[t]).concat(J[e]).concat(J[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,Z,tt).call(Z,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,Z,tt).call(Z,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 $(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 tt(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,Z,$).call(Z,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),g=2*o;(0,_._)(this,Z,$).call(Z,t,e,i,s,a,n,r,l,(-h+p)/g,c),(0,_._)(this,Z,$).call(Z,t,e,i,s,a,n,r,l,(-h-p)/g,c)}let te=null,ti=null;function ts(t){return te||(te=/([\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,ti=new Map([["ï¬
","ſt"]])),t.replaceAll(te,(t,e,i)=>e?e.normalize("NFKC"):ti.get(i))}let ta="pdfjs_internal_id_";"function"!=typeof Promise.try&&(Promise.try=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];return new Promise(e=>{e(t(...i))})});let tn="http://www.w3.org/2000/svg";class tr{}async function tl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(tg(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)})}tr.CSS=96,tr.PDF=72,tr.PDF_TO_CSS_UNITS=tr.CSS/tr.PDF;class to{get rawDims(){let{userUnit:t,viewBox:e}=this,i=e.map(e=>e*t);return O(this,"rawDims",{pageWidth:i[2]-i[0],pageHeight:i[3]-i[1],pageX:i[0],pageY:i[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 to({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){return Z.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=Z.applyTransform([t[0],t[1]],this.transform),i=Z.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return Z.applyInverseTransform([t,e],this.transform)}constructor({viewBox:t,userUnit:e,scale:i,rotation:s,offsetX:a=0,offsetY:n=0,dontFlip:r=!1}){let l,o,h,d,c,u,_,p;this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=s,this.offsetX=a,this.offsetY=n,i*=e;let g=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((s%=360)<0&&(s+=360),s){case 180:l=-1,o=0,h=0,d=1;break;case 90:l=0,o=1,h=1,d=0;break;case 270:l=0,o=-1,h=-1,d=0;break;case 0:l=1,o=0,h=0,d=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(h=-h,d=-d),0===l?(c=Math.abs(f-t[1])*i+a,u=Math.abs(g-t[0])*i+n,_=(t[3]-t[1])*i,p=(t[2]-t[0])*i):(c=Math.abs(g-t[0])*i+a,u=Math.abs(f-t[1])*i+n,_=(t[2]-t[0])*i,p=(t[3]-t[1])*i),this.transform=[l*i,o*i,h*i,d*i,c-l*i*g-h*i*f,u-o*i*g-d*i*f],this.width=_,this.height=p}}class th extends B{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function td(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function tc(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function tu(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function t_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(td(t))return D('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 tp{time(t){t in this.started&&D("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||D("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 tg(t,e){try{let{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(t){return!1}}function tf(t){t.preventDefault()}function tv(t){t.preventDefault(),t.stopPropagation()}class tm{static
1 toDateObject(t){if(!t||"string"!=typeof t)return null;(0,d._)(this,tm,tw,(0,h._)(this,tm,tw)||RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=(0,h._)(this,tm,tw).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 tw={writable:!0,value:void 0};function tb(t,e){let{scale:i=1,rotation:s=0}=e,{width:a,height:n}=t.attributes.style;return new to({viewBox:[0,0,parseInt(a),parseInt(n)],userUnit:1,scale:i,rotation:s})}function tA(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(16711680&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):(D('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function ty(t){let{a:e,b:i,c:s,d:a,e:n,f:r}=t.getTransform();return[e,i,s,a,n,r]}function tS(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 tk(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 to){let{pageWidth:s,pageHeight:a}=e.rawDims,{style:n}=t,r=Q.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 tx{get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}constructor(){let t=window.devicePixelRatio||1;this.sx=t,this.sy=t}}var tE=new WeakMap,tM=new WeakMap,tC=new WeakMap,tT=new WeakMap,tR=new WeakMap,tP=new WeakSet,tL=new WeakSet,tI=new WeakSet,tD=new WeakSet,tF=new WeakMap;class tN{render(){let t=(0,n._)(this,tE,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=(0,s._)(this,tC)._uiManager._signal;t.addEventListener("contextmenu",tf,{signal:e}),t.addEventListener("pointerdown",(0,_._)(tN,tN,tO),{signal:e});let i=(0,n._)(this,tT,document.createElement("div"));i.className="buttons",t.append(i);let a=(0,s._)(this,tC).toolbarPosition;if(a){let{style:e}=t,i="ltr"===(0,s._)(this,tC)._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,tD,tz).call(this),t}get div(){return(0,s._)(this,tE)}hide(){var t;(0,s._)(this,tE).classList.add("hidden"),null===(t=(0,s._)(this,tM))||void 0===t||t.hideDropdown()}show(){var t;(0,s._)(this,tE).classList.remove("hidden"),null===(t=(0,s._)(this,tR))||void 0===t||t.shown()}async addAltText(t){let e=await t.render();(0,l._)(this,tI,tG).call(this,e),(0,s._)(this,tT).prepend(e,(0,s._)(this,tF)),(0,n._)(this,tR,t)}addColorPicker(t){(0,n._)(this,tM,t);let e=t.renderButton();(0,l._)(this,tI,tG).call(this,e),(0,s._)(this,tT).prepend(e,(0,s._)(this,tF))}remove(){var t;(0,s._)(this,tE).remove(),null===(t=(0,s._)(this,tM))||void 0===t||t.destroy(),(0,n._)(this,tM,null)}constructor(t){(0,o._)(this,tP),(0,o._)(this,tL),(0,o._)(this,tI),(0,o._)(this,tD),(0,a._)(this,tF,{get:tj,set:void 0}),(0,a._)(this,tE,{writable:!0,value:void 0}),(0,a._)(this,tM,{writable:!0,value: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,n._)(this,tE,null),(0,n._)(this,tM,null),(0,n._)(this,tT,null),(0,n._)(this,tR,null),(0,n._)(this,tC,t),(0,d._)(tN,tN,tW,(0,h._)(tN,tN,tW)||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 tW={writable:!0,value:null};function tO(t){t.stopPropagation()}function tB(t){(0,s._)(this,tC)._focusEventsAllowed=!1,tv(t)}function tH(t){(0,s._)(this,tC)._focusEventsAllowed=!0,tv(t)}function tG(t){let e=(0,s._)(this,tC)._uiManager._signal;t.addEventListener("focusin",(0,l._)(this,tP,tB).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,l._)(this,tL,tH).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",tf,{signal:e})}function tz(){let{editorType:t,_uiManager:e}=(0,s._)(this,tC),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",(0,h._)(tN,tN,tW)[t]),(0,l._)(this,tI,tG).call(this,i),i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),(0,s._)(this,tT).append(i)}function tj(){let t=document.createElement("div");return t.className="divider",t}var tU=new WeakMap,tV=new WeakMap,tq=new WeakMap,tX=new WeakSet,tK=new WeakSet,tY=new WeakSet;
1class tQ{show(t,e,i){let[a,r]=(0,l._)(this,tK,tZ).call(this,e,i),{style:o}=(0,n._)(this,tV,(0,s._)(this,tV)||(0,l._)(this,tX,tJ).call(this));t.append((0,s._)(this,tV)),o.insetInlineEnd="".concat(100*a,"%"),o.top="calc(".concat(100*r,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,s._)(this,tV).remove()}constructor(t){(0,o._)(this,tX),(0,o._)(this,tK),(0,o._)(this,tY),(0,a._)(this,tU,{writable:!0,value:void 0}),(0,a._)(this,tV,{writable:!0,value:void 0}),(0,a._)(this,tq,{writable:!0,value:void 0}),(0,n._)(this,tU,null),(0,n._)(this,tV,null),(0,n._)(this,tq,t)}}function tJ(){let t=(0,n._)(this,tV,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",tf,{signal:(0,s._)(this,tq)._signal});let e=(0,n._)(this,tU,document.createElement("div"));return e.className="buttons",t.append(e),(0,l._)(this,tY,t$).call(this),t}function tZ(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 t$(){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,tq)._signal;t.addEventListener("contextmenu",tf,{signal:i}),t.addEventListener("click",()=>{(0,s._)(this,tq).highlightSelection("floating_button")},{signal:i}),(0,s._)(this,tU).append(t)}function t0(t,e,i){for(let s of i)e.addEventListener(s,t[s].bind(t))}var t1=new WeakMap;class t2{get id(){return"".concat("pdfjs_internal_editor_").concat((0,r._)(this,t1).value++)}constructor(){(0,a._)(this,t1,{writable:!0,value:void 0}),(0,n._)(this,t1,0)}}var t3=new WeakMap,t5=new WeakMap,t4=new WeakMap,t6=new WeakSet;class t8{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>',O(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,t6,t9).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(a),t)}async getFromUrl(t){return(0,l._)(this,t6,t9).call(this,t,t)}async getFromBlob(t,e){let i=await e;return(0,l._)(this,t6,t9).call(this,t,i)}async getFromId(t){(0,n._)(this,t4,(0,s._)(this,t4)||new Map);let e=(0,s._)(this,t4).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,t4,(0,s._)(this,t4)||new Map);let i=(0,s._)(this,t4).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,t3),"_").concat((0,r._)(this,t5).value++),refCounter:1,isSvg:!1},(0,s._)(this,t4).set(t,i),(0,s._)(this,t4).set(i.id,i),i}getSvgUrl(t){let e=(0,s._)(this,t4).get(t);return(null==e?void 0:e.isSvg)?e.svgUrl:null}deleteId(t){var e;(0,n._)(this,t4,(0,s._)(this,t4)||new Map);let i=(0,s._)(this,t4).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,t3),"_"))}constructor(){(0,o._)(this,t6),(0,a._)(this,t3,{writable:!0,value:void 0}),(0,a._)(this,t5,{writable:!0,value:void 0}),(0,a._)(this,t4,{writable:!0,value:void 0}),(0,n._)(this,t3,function(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);return crypto.getRandomValues(t),X(t)}()),(0,n._)(this,t5,0),(0,n._)(this,t4,null)}}async function t9(t,e){(0,n._)(this,t4,(0,s._)(this,t4)||new Map);let i=(0,s._)(this,t4).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,t3),"_").concat((0,r._)(this,t5).value++),refCounter:0,isSvg:!1}),"string"==typeof e?(i.url=e,t=await tl(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=t8._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){D(t),i=null}return(0,s._)(this,t4).set(t,i),i&&(0,s._)(this,t4).set(i.id,i),i}var t7=new WeakMap,et=new WeakMap,ee=new WeakMap,ei=new WeakMap;class es{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,et))return;let d={cmd:e,undo:i,post:a,type:l};if(-1===(0,s._)(this,ei)){(0,s._)(this,t7).length>0&&((0,s._)(this,t7).length=0),(0,n._)(this,ei,0),(0,s._)(this,t7).push(d);return}if(o&&(0,s._)(this,t7)[(0,s._)(this,ei)].type===l){h&&(d.undo=(0,s._)(this,t7)[(0,s._)(this,ei)].undo),(0,s._)(this,t7)[(0,s._)(this,ei)]=d;return}let c=(0,s._)(this,ei)+1;c===(0,s._)(this,ee)?(0,s._)(this,t7).splice(0,1):((0,n._)(this,ei,c),c<(0,s._)(this,t7).length&&(0,s._)(this,t7).splice(c)),(0,s._)(this,t7).push(d)}undo(){if(-1===(0,s._)(this,ei))return;(0,n._)(this,et,!0);let{undo:t,post:e}=(0,s._)(this,t7)[(0,s._)(this,ei)];t(),null==e||e(),(0,n._)(this,et,!1),(0,n._)(this,ei,(0,s._)(this,ei)-1)}redo(){if((0,s._)(this,ei)<(0,s._)(this,t7).length-1){(0,n._)(this,ei,(0,s._)(this,ei)+1),(0,n._)(this,et,!0);let{cmd:t,post:e}=(0,s._)(this,t7)[(0,s._)(this,ei)];t(),null==e||e(),(0,n._)(this,et,!1)}}hasSomethingToUndo(){return -1!==(0,s._)(this,ei)}hasSomethingToRedo(){return(0,s._)(this,ei)<(0,s._)(this,t7).length-1}cleanType(t){if(-1!==(0,s._)(this,ei)){for(let e=(0,s._)(this,ei);e>=0;e--)if((0,s._)(this,t7)[e].type!==t){(0,s._)(this,t7).splice(e+1,(0,s._)(this,ei)-e),(0,n._)(this,ei,e);return}(0,s._)(this,t7).length=0,(0,n._)(this,ei,-1)}}destroy(){(0,n._)(this,t7,null)}constructor(t=128){(0,a._)(this,t7,{writable:!0,value:void 0}),(0,a._)(this,et,{writable:!0,value:void 0}),(0,a._)(this,ee,{writable:!0,value:void 0}),(0,a._)(this,ei,{writable:!0,value:void 0}),(0,n._)(this,t7,[]),(0,n._)(this,et,!1),(0,n._)(this,ei,-1),(0,n._)(this,ee,t)}}var ea=new WeakSet;class en{exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get((0,l._)(this,ea,er).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||tv(e))}constructor(t){(0,o._)(this,ea),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Q.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 er(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 el{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,tA(s))}e.remove()}(t),O(this,"_colors",t)}convert(t){let e=tA(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 el._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?Z.makeHexColor(...e):t}}el._colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);var eo=new WeakMap,eh=new WeakMap,ed=new WeakMap,ec=new WeakMap,eu=new WeakMap,e_=new WeakMap,ep=new WeakMap,eg=new WeakMap,ef=new WeakMap,ev=new WeakMap,em=new WeakMap,ew=new WeakMap,eb=new WeakMap,eA=new WeakMap,ey=new WeakMap,eS=new WeakMap,ek=new WeakMap,ex=new WeakMap,eE=new WeakMap,eM=new WeakMap,eC=new WeakMap,eT=new WeakMap,eR=new WeakMap,eP=new WeakMap,eL=new WeakMap,eI=new WeakMap,eD=new WeakMap,eF=new WeakMap,eN=new WeakMap,eW=new WeakMap,eO=new WeakMap,eB=new WeakMap,eH=new WeakMap,eG=new WeakMap,ez=new WeakMap,ej=new WeakMap,eU=new WeakMap,eV=new WeakMap,eq=new WeakMap,eX=new WeakMap,eK=new WeakMap,eY=ne
1w WeakMap,eQ=new WeakSet,eJ=new WeakSet,eZ=new WeakSet,e$=new WeakSet,e0=new WeakSet,e1=new WeakSet,e2=new WeakSet,e3=new WeakSet,e5=new WeakSet,e4=new WeakSet,e6=new WeakSet,e8=new WeakSet,e9=new WeakSet,e7=new WeakSet,it=new WeakSet,ie=new WeakSet,ii=new WeakSet,is=new WeakSet,ia=new WeakMap,ir=new WeakSet,il=new WeakSet;class io{static get _keyboardManager(){let t=io.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 O(this,"_keyboardManager",new en([[["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,r;for(let i of(null===(t=(0,s._)(this,eY))||void 0===t||t.resolve(),(0,n._)(this,eY,null),null===(e=(0,s._)(this,eo))||void 0===e||e.abort(),(0,n._)(this,eo,null),this._signal=null,(0,s._)(this,ec).values()))i.destroy();(0,s._)(this,ec).clear(),(0,s._)(this,ed).clear(),(0,s._)(this,ey).clear(),(0,n._)(this,eh,null),(0,s._)(this,eH).clear(),(0,s._)(this,eg).destroy(),null===(i=(0,s._)(this,eu))||void 0===i||i.destroy(),null===(a=(0,s._)(this,eP))||void 0===a||a.hide(),(0,n._)(this,eP,null),(0,s._)(this,eM)&&(clearTimeout((0,s._)(this,eM)),(0,n._)(this,eM,null)),(0,s._)(this,eq)&&(clearTimeout((0,s._)(this,eq)),(0,n._)(this,eq,null)),null===(r=this._editorUndoBar)||void 0===r||r.destroy()}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,s._)(this,eO)}get useNewAltTextFlow(){return(0,s._)(this,ek)}get useNewAltTextWhenAddingImage(){return(0,s._)(this,ex)}get hcmFilter(){return O(this,"hcmFilter",(0,s._)(this,ez)?(0,s._)(this,eE).addHCMFilter((0,s._)(this,ez).foreground,(0,s._)(this,ez).background):"none")}get direction(){return O(this,"direction",getComputedStyle((0,s._)(this,eX)).direction)}get highlightColors(){return O(this,"highlightColors",(0,s._)(this,eT)?new Map((0,s._)(this,eT).split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return O(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),(0,n._)(this,ev,t)}setMainHighlightColorPicker(t){(0,n._)(this,eW,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=(0,s._)(this,eu))||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,ex,i)}onPageChanging(t){let{pageNumber:e}=t;(0,n._)(this,em,e-1)}focusMainContainer(){(0,s._)(this,eX).focus()}findParent(t,e){for(let i of(0,s._)(this,ec).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,eK).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,s._)(this,ey).add(t)}removeShouldRescale(t){(0,s._)(this,ey).delete(t)}onScaleChanging(t){var e;let{scale:i}=t;
1for(let t of(this.commitOrRemove(),this.viewParameters.realScale=i*tr.PDF_TO_CSS_UNITS,(0,s._)(this,ey)))t.onScaleChanging();null===(e=(0,s._)(this,ev))||void 0===e||e.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,eQ,ih).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();let c=(0,l._)(this,eJ,id).call(this,h),u=(0,s._)(this,eB)===S.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(S.HIGHLIGHT,_);return}_()}addToAnnotationStorage(t){!t.isEmpty()&&(0,s._)(this,e_)&&!(0,s._)(this,e_).has(t.id)&&(0,s._)(this,e_).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,(0,s._)(this,eR)&&((0,n._)(this,eR,!1),(0,l._)(this,e0,i_).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of(0,s._)(this,eH))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,e5,im).call(this),(0,l._)(this,e6,ib).call(this)}removeEditListeners(){(0,l._)(this,e4,iw).call(this),(0,l._)(this,e8,iA).call(this)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of(0,s._)(this,eA))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,eA))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,eh))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;let i=[];for(let t of(0,s._)(this,eH)){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,eA))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){D('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,is,iM).call(this,e);(0,l._)(this,il,iR).call(this,t)},undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){D('paste: "'.concat(t.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,s._)(this,eB)===S.NONE||this.isEditorHandlingKeyboard||io._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,s._)(this,eR)&&((0,n._)(this,eR,!1),(0,l._)(this,e0,i_).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,e2,ig).call(this),(0,l._)(this,e6,ib).call(this),(0,l._)(this,e7,iS).call(this,{isEditing:(0,s._)(this,eB)!==S.NONE,isEmpty:(0,l._)(this,ir,iT).call(this),hasSomethingToUndo:(0,s._)(this,eg).hasSomethingToUndo(),hasSomethingToRedo:(0,s._)(this,eg).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,l._)(this,e3,iv).call(this),(0,l._)(this,e8,iA).call(this),(0,l._)(this,e7,iS).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,s._)(this,eA))for(let e of((0,n._)(this,eA,t),(0,s._)(this,eA)))(0,l._)(this,it,ik).call(this,e.defaultPropertiesToUpdate)}getId(){return(0,s._)(this,eL).id}get currentLayer(){return(0,s._)(this,ec).get((0,s._)(this,em))}getLayer(t){return(0,s._)(this,ec).get(t)}get currentPageIndex(){return(0,s._)(this,em)}addLayer(t){(0,s._)(this,ec).set(t.pageIndex,t),(0,s._)(this,eI)?t.enable():t.disable()}removeLayer(t){(0,s._)(this,ec).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,eY)&&(await (0,s._)(this,eY).promise,!(0,s._)(this,eY)))){if((0,n._)(this,eY,Promise.withResolvers()),(0,n._)(this,eB,t),t===S.NONE){var a;this.setEditingState(!1),(0,l._)(this,ii,iE).call(this),null===(a=this._editorUndoBar)||void 0===a||a.hide(),(0,s._)(this,eY).resolve();return}for(let e of(this.setEditingState(!0),await (0,l._)(this,ie,ix).call(this),this.unselectAll(),(0,s._)(this,ec).values())
1)e.updateMode(t);if(!e){i&&this.addNewEditorFromKeyboard(),(0,s._)(this,eY).resolve();return}for(let t of(0,s._)(this,ed).values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();(0,s._)(this,eY).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,eA)){switch(t){case k.CREATE:this.currentLayer.addNewEditor();return;case k.HIGHLIGHT_DEFAULT_COLOR:var i;null===(i=(0,s._)(this,eW))||void 0===i||i.updateColor(e);break;case k.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(0,n._)(this,ej,(0,s._)(this,ej)||new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of(0,s._)(this,eH))i.updateParams(t,e);for(let i of(0,s._)(this,eA))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,ed).values()))i.editorType===t&&i.show(e);(null===(a=null===(i=(0,s._)(this,ej))||void 0===i?void 0:i.get(k.HIGHLIGHT_SHOW_ALL))||void 0===a||a)!==e&&(0,l._)(this,it,ik).call(this,[[k.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,s._)(this,eD)!==t)for(let e of((0,n._)(this,eD,t),(0,s._)(this,ec).values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}getEditors(t){let e=[];for(let i of(0,s._)(this,ed).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return(0,s._)(this,ed).get(t)}addEditor(t){(0,s._)(this,ed).set(t.id,t)}removeEditor(t){if(t.div.contains(document.activeElement)&&((0,s._)(this,eM)&&clearTimeout((0,s._)(this,eM)),(0,n._)(this,eM,setTimeout(()=>{this.focusMainContainer(),(0,n._)(this,eM,null)},0))),(0,s._)(this,ed).delete(t.id),this.unselect(t),!t.annotationElementId||!(0,s._)(this,ew).has(t.annotationElementId)){var e;null===(e=(0,s._)(this,e_))||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,eh)!==t&&((0,n._)(this,eh,t),t&&(0,l._)(this,it,ik).call(this,t.propertiesToUpdate))}updateUI(t){(0,s._)(this,ia)===t&&(0,l._)(this,it,ik).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){(0,l._)(this,it,ik).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if((0,s._)(this,eH).has(t)){(0,s._)(this,eH).delete(t),t.unselect(),(0,l._)(this,e7,iS).call(this,{hasSelectedEditor:this.hasSelection});return}(0,s._)(this,eH).add(t),t.select(),(0,l._)(this,it,ik).call(this,t.propertiesToUpdate),(0,l._)(this,e7,iS).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;for(let i of(null===(e=(0,s._)(this,ev))||void 0===e||e.commitOrRemove(),(0,s._)(this,eH)))i!==t&&i.unselect();(0,s._)(this,eH).clear(),(0,s._)(this,eH).add(t),t.select(),(0,l._)(this,it,ik).call(this,t.propertiesToUpdate),(0,l._)(this,e7,iS).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,s._)(this,eH).has(t)}get firstSelectedEditor(){return(0,s._)(this,eH).values().next().value}unselect(t){t.unselect(),(0,s._)(this,eH).delete(t),(0,l._)(this,e7,iS).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,s._)(this,eH).size}get isEnterHandled(){return 1===(0,s._)(this,eH).size&&this.firstSelectedEditor.isEnterHandled}undo(){var t;(0,s._)(this,eg).undo(),(0,l._)(this,e7,iS).call(this,{hasSomethingToUndo:(0,s._)(this,eg).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,l._)(this,ir,iT).call(this)}),null===(t=this._editorUndoBar)||void 0===t||t.hide()}redo(){(0,s._)(this,eg).redo(),(0,l._)(this,e7,iS).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,s._)(this,eg).hasSomethingToRedo(),isEmpty:(0,l._)(this,ir,iT).call(this)})}addCommands(t){(0,s._)(this,eg).add(t),(0,l._)(this,e7,iS).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,l._)(this,ir,iT).call(this)})}cleanUndoStack(t){(0,s._)(this,eg).cleanType(t)}delete(){var t;this.commitOrRemove();let e=null===(t=this.currentLayer)||void 0===t?void 0:t.endDrawingSession(!0);if(!this.hasSelection&&!e)return;let i=e?[e]:[...(0,s._)(this,eH)],a=()=>
1{for(let t of i)(0,l._)(this,is,iM).call(this,t)};this.addCommands({cmd:()=>{var t;for(let e of(null===(t=this._editorUndoBar)||void 0===t||t.show(a,1===i.length?i[0].editorType:i.length),i))e.remove()},undo:a,mustExec:!0})}commitOrRemove(){var t;null===(t=(0,s._)(this,eh))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,s._)(this,eh)||this.hasSelection}selectAll(){for(let t of(0,s._)(this,eH))t.commit();(0,l._)(this,il,iR).call(this,(0,s._)(this,ed).values())}unselectAll(){var t;if(!((0,s._)(this,eh)&&((0,s._)(this,eh).commitOrRemove(),(0,s._)(this,eB)!==S.NONE)||(null===(t=(0,s._)(this,ev))||void 0===t?void 0:t.commitOrRemove()))&&this.hasSelection){for(let t of(0,s._)(this,eH))t.unselect();(0,s._)(this,eH).clear(),(0,l._)(this,e7,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,eV)[0]+=t,(0,s._)(this,eV)[1]+=e;let[a,r]=(0,s._)(this,eV),l=[...(0,s._)(this,eH)];for(let i of((0,s._)(this,eq)&&clearTimeout((0,s._)(this,eq)),(0,n._)(this,eq,setTimeout(()=>{(0,n._)(this,eq,null),(0,s._)(this,eV)[0]=(0,s._)(this,eV)[1]=0,this.addCommands({cmd:()=>{for(let t of l)(0,s._)(this,ed).has(t.id)&&t.translateInPage(a,r)},undo:()=>{for(let t of l)(0,s._)(this,ed).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,eb,new Map),(0,s._)(this,eH)))(0,s._)(this,eb).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!(0,s._)(this,eb))return!1;this.disableUserSelect(!1);let t=(0,s._)(this,eb);(0,n._)(this,eb,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,ed).has(t.id)){let n=(0,s._)(this,ec).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,eb))for(let i of(0,s._)(this,eb).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,eH).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,s._)(this,eh)===t}getActive(){return(0,s._)(this,eh)}getMode(){return(0,s._)(this,eB)}get imageManager(){return O(this,"imageManager",new t8)}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,ep,(0,s._)(this,ep)||new Map).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=(0,s._)(this,ep))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;let i=null===(e=(0,s._)(this,ep))||void 0===e?void 0:e.get(t.data.id);if(!i)return;let a=(0,s._)(this,e_).getRawValue(i);a&&((0,s._)(this,eB)!==S.NONE||a.hasBeenModified)&&a.renderAnnotationElement(t)}constructor(t,e,i,r,h,d,c,u,_,p,g,f,v){(0,o._)(this,eQ),(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,e4),(0,o._)(this,e6),(0,o._)(this,e8),(0,o._)(this,e9),(0,o._)(this,e7),(0,o._)(this,it),(0,o._)(this,ie),(0,o._)(this,ii),(0,o._)(this,is),(0,a._)(this,ia,{get:iC,set:void 0}),(0,o._)(this,ir),(0,o._)(this,il),(0,a._)(this,eo,{writable:!0,value:void 0}),(0,a._)(this,eh,{writable:!0,value:void 0}),(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,eg,{writable:!0,value:void 0}),(0,a._)(this,ef,{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,ew,{writable:!0,value:void 0}),(0,a._)(this,eb,{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,eS,{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,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,eP,{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,eD,{writable:!0,value:void 0}),(0,a._)(this,eF,{writable:!0,value:void 0}),(0,a._)(this,eN,{writable:!0,value:void 0}),(0,a._)(this,eW,{writable:!0,value:void 0}),(0,a._)(this,eO,{writable:!0,value:void 0}),(0,a._)(this,eB,{writable:!0,value:void 0}),(0,a._)(this,eH,{writable:!0,value:void 0}),(0,a._)(this,eG,{writable:!0,value:void 0}),(0,a._)(this,ez,{writable:!0,value:void 0}),(0,a._)(this,ej,{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,eX,{writable:!0,value:void 0}),(0,a._)(this,eK,{writable:!0,value:void 0}),(0,a._)(this,eY,{writable:!0,value:void 0}),(0,n._)(this,eo,new AbortController),(0,n._)(this,eh,null),(0,n._)(this,ed,new Map),(0,n._)(this,ec,new Map),(0,n._)(this,eu,null),(0,n._)(this,e_,null),(0,n._)(this,ep,null),(0,n._)(this,eg,new es),(0,n._)(this,ef,null),(0,n._)(this,ev,null),(0,n._)(this,em,0),(0,n._)(this,ew,new Set),(0,n._)(this,eb,null),(0,n._)(this,eA,null),(0,n._)(this,ey,new Set),this._editorUndoBar=null,(0,n._)(this,eS,!1),(0,n._)(this,ek,!1),(0,n._)(this,ex,!1),(0,n._)(this,eE,null),(0,n._)(this,eM,null),(0,n._)(this,eC,null),(0,n._)(this,eT,null),(0,n._)(this,eR,!1),(0,n._)(this,eP,null),(0,n._)(this,eL,new t2),(0,n._)(this,eI,!1),(0,n._)(this,eD,!1),(0,n._)(this,eF,null),(0,n._)(this,eN,null),(0,n._)(this,eW,null),(0,n._)(this,eO,null),(0,n._)(this,eB,S.NONE),(0,n._)(this,eH,new Set),(0,n._)(this,eG,null),(0,n._)(this,ez,null),(0,n._)(this,ej,null),(0,n._)(this,eU,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,n._)(this,eV,[0,0]),(0,n._)(this,eq,null),(0,n._)(this,eX,null),(0,n._)(this,eK,null),(0,n._)(this,eY,null);let m=this._signal=(0,s._)(this,eo).signal;(0,n._)(this,eX,t),(0,n._)(this,eK,e),(0,n._)(this,eu,i),this._eventBus=r,r._on("editingaction",this.onEditingAction.bind(this),{signal:m}),r._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),r._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),r._on("setpreference",this.onSetPreference.bind(this),{signal:m}),r._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:m}),(0,l._)(this,e1,ip).call(this),(0,l._)(this,e9,iy).call(this),(0,l._)(this,e5,im).call(this),(0,n._)(this,e_,h.annotationStorage),(0,n._)(this,eE,h.filterFactory),(0,n._)(this,ez,d),(0,n._)(this,eT,c||null),(0,n._)(this,eS,u),(0,n._)(this,ek,_),(0,n._)(this,ex,p),(0,n._)(this,eO,g||null),this.viewParameters={realScale:tr.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=f||null,this._supportsPinchToZoom=!1!==v}}function ih(t){let{anchorNode:e}=t;
1return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function id(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of(0,s._)(this,ec).values())if(e.hasTextLayer(t))return e;return null}function ic(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=(0,l._)(this,eQ,ih).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,n._)(this,eP,(0,s._)(this,eP)||new tQ(this)),(0,s._)(this,eP).show(e,i,"ltr"===this.direction))}function iu(){var t,e,i;let a=document.getSelection();if(!a||a.isCollapsed){(0,s._)(this,eG)&&(null===(e=(0,s._)(this,eP))||void 0===e||e.hide(),(0,n._)(this,eG,null),(0,l._)(this,e7,iS).call(this,{hasSelectedText:!1}));return}let{anchorNode:r}=a;if(r===(0,s._)(this,eG))return;let o=(0,l._)(this,eQ,ih).call(this,a).closest(".textLayer");if(!o){(0,s._)(this,eG)&&(null===(i=(0,s._)(this,eP))||void 0===i||i.hide(),(0,n._)(this,eG,null),(0,l._)(this,e7,iS).call(this,{hasSelectedText:!1}));return}if(null===(t=(0,s._)(this,eP))||void 0===t||t.hide(),(0,n._)(this,eG,r),(0,l._)(this,e7,iS).call(this,{hasSelectedText:!0}),((0,s._)(this,eB)===S.HIGHLIGHT||(0,s._)(this,eB)===S.NONE)&&((0,s._)(this,eB)===S.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,n._)(this,eR,this.isShiftKeyDown),!this.isShiftKeyDown)){let t=(0,s._)(this,eB)===S.HIGHLIGHT?(0,l._)(this,eJ,id).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,e0,i_).call(this,"main_toolbar"))};window.addEventListener("pointerup",a,{signal:i}),window.addEventListener("blur",a,{signal:i})}}function i_(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,s._)(this,eB)===S.HIGHLIGHT?this.highlightSelection(t):(0,s._)(this,eS)&&(0,l._)(this,eZ,ic).call(this)}function ip(){document.addEventListener("selectionchange",(0,l._)(this,e$,iu).bind(this),{signal:this._signal})}function ig(){if((0,s._)(this,eC))return;(0,n._)(this,eC,new AbortController);let t=this.combinedSignal((0,s._)(this,eC));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function iv(){var t;null===(t=(0,s._)(this,eC))||void 0===t||t.abort(),(0,n._)(this,eC,null)}function im(){if((0,s._)(this,eF))return;(0,n._)(this,eF,new AbortController);let t=this.combinedSignal((0,s._)(this,eF));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,eF))||void 0===t||t.abort(),(0,n._)(this,eF,null)}function ib(){if((0,s._)(this,ef))return;(0,n._)(this,ef,new AbortController);let t=this.combinedSignal((0,s._)(this,ef));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 iA(){var t;null===(t=(0,s._)(this,ef))||void 0===t||t.abort(),(0,n._)(this,ef,null)}function iy(){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,eU)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,s._)(this,eU),t)}),(0,s._)(this,eB)===S.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,l._)(this,it,ik).call(this,[[k.HIGHLIGHT_FREE,!0]]))}function ik(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function ix(){if(!(0,s._)(this,eI)){(0,n._)(this,eI,!0);let t=[];for(let e of(0,s._)(this,ec).values())t.push(e.enable());for(let e of(await Promise.all(t),(0,s._)(this,ed).values()))e.enable()}}function iE(){if(this.unselectAll(),(0,s._)(this,eI)){for(let t of((0,n._)(this,eI,!1),(0,s._)(this,ec).values()))t.disable();for(let t of(0,s._)(this,ed).values())t.disable()}}function iM(t){let e=(0,s._)(this,ec).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function iC(){let t=null;for(t of(0,s._)(this,eH));return t}
1function iT(){if(0===(0,s._)(this,ed).size)return!0;if(1===(0,s._)(this,ed).size)for(let t of(0,s._)(this,ed).values())return t.isEmpty();return!1}function iR(t){for(let t of(0,s._)(this,eH))t.unselect();for(let e of((0,s._)(this,eH).clear(),t))e.isEmpty()||((0,s._)(this,eH).add(e),e.select());(0,l._)(this,e7,iS).call(this,{hasSelectedEditor:this.hasSelection})}io.TRANSLATE_SMALL=1,io.TRANSLATE_BIG=10;var iP=new WeakMap,iL=new WeakMap,iI=new WeakMap,iD=new WeakMap,iF=new WeakMap,iN=new WeakMap,iW=new WeakMap,iO=new WeakMap,iB=new WeakMap,iH=new WeakMap,iG=new WeakMap,iz=new WeakMap,ij=new WeakMap,iU=new WeakSet;class iV{static initialize(t){var e;null!==(e=iV._l10n)&&void 0!==e||(iV._l10n=t)}async render(){let t=(0,n._)(this,iI,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=(0,n._)(this,iD,document.createElement("span"));t.append(e),(0,s._)(this,iz)?(t.classList.add("new"),t.setAttribute("data-l10n-id",(0,h._)(iV,iV,iq).missing),e.setAttribute("data-l10n-id",(0,h._)(iV,iV,iq)["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",tf,{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,iz)&&(0,s._)(this,iB)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:(0,s._)(this,ij)}})};return t.addEventListener("click",a,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,n._)(this,iW,!0),a(e))},{signal:i}),await (0,l._)(this,iU,iK).call(this),t}finish(){(0,s._)(this,iI)&&((0,s._)(this,iI).focus({focusVisible:(0,s._)(this,iW)}),(0,n._)(this,iW,!1))}isEmpty(){return(0,s._)(this,iz)?null===(0,s._)(this,iP):!(0,s._)(this,iP)&&!(0,s._)(this,iL)}hasData(){return(0,s._)(this,iz)?null!==(0,s._)(this,iP)||!!(0,s._)(this,iH):this.isEmpty()}get guessedText(){return(0,s._)(this,iH)}async setGuessedText(t){null===(0,s._)(this,iP)&&((0,n._)(this,iH,t),(0,n._)(this,iG,await iV._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,l._)(this,iU,iK).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(0,s._)(this,iz)||(0,s._)(this,iP)){var e;null===(e=(0,s._)(this,iO))||void 0===e||e.remove(),(0,n._)(this,iO,null);return}if(!(0,s._)(this,iO)){let t=(0,n._)(this,iO,document.createElement("div"));t.className="noAltTextBadge",(0,s._)(this,iB).div.append(t)}(0,s._)(this,iO).classList.toggle("hidden",!t)}serialize(t){let e=(0,s._)(this,iP);return t||(0,s._)(this,iH)!==e||(e=(0,s._)(this,iG)),{altText:e,decorative:(0,s._)(this,iL),guessedText:(0,s._)(this,iH),textWithDisclaimer:(0,s._)(this,iG)}}get data(){return{altText:(0,s._)(this,iP),decorative:(0,s._)(this,iL)}}set data(t){let{altText:e,decorative:i,guessedText:a,textWithDisclaimer:r,cancel:o=!1}=t;a&&((0,n._)(this,iH,a),(0,n._)(this,iG,r)),((0,s._)(this,iP)!==e||(0,s._)(this,iL)!==i)&&(o||((0,n._)(this,iP,e),(0,n._)(this,iL,i)),(0,l._)(this,iU,iK).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,s._)(this,iI)&&(!t&&(0,s._)(this,iN)&&(clearTimeout((0,s._)(this,iN)),(0,n._)(this,iN,null)),(0,s._)(this,iI).disabled=!t)}shown(){(0,s._)(this,iB)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:(0,s._)(this,ij)}})}destroy(){var t,e;null===(t=(0,s._)(this,iI))||void 0===t||t.remove(),(0,n._)(this,iI,null),(0,n._)(this,iD,null),(0,n._)(this,iF,null),null===(e=(0,s._)(this,iO))||void 0===e||e.remove(),(0,n._)(this,iO,null)}constructor(t){(0,a._)(this,ij,{get:iX,set:void 0}),(0,o._)(this,iU),(0,a._)(this,iP,{writable:!0,value:void 0}),(0,a._)(this,iL,{writable:!0,value:void 0}),(0,a._)(this,iI,{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,iN,{writable:!0,value:void 0}),(0,a._)(this,iW,{writable:!0,value:void 0}),(0,a._)(this,iO,{writable:!0,value:void 0}),(0,a._)(this,iB,{writable:!0,value:void 0}),(0,a._)(this,iH,{writable:!0,value:void 0}),(0,a._)(this,iG,{writable:!0,value:void 0}),(0,a._)(this,iz,{writable:!0,value:void 0}),(0,n._)(this,iP,null),(0,n._)(this,iL,!1),(0,n._)(this,iI,null),(0,n._)(this,iD,null),(0,n._)(this,iF,null),(0,n._)(this,iN,null),(0,n._)(this,iW,!1),(0,n._)(this,iO,null),(0,n._)(this,iB,null),(0,n._)(this,iH,null),(0,n._)(this,iG,null),(0,n._)(this,iz,!1),(0,n._)(this,iB,t),(0,n._)(this,iz,t._uiManager.useNewAltTextFlow),(0,d._)(iV,iV,iq,(0,h._)(iV,iV,iq)||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 iq={writable:!0,value:null};function iX(){return(0,s._)(this,iP)&&"added"||null===(0,s._)(this,iP)&&this.guessedText&&"review"||"missing"}async function iK(){var t,e,i;let a=(0,s._)(this,iI);if(!a)return;if((0,s._)(this,iz)){if(a.classList.toggle("done",!!(0,s._)(this,iP)),a.setAttribute("data-l10n-id",(0,h._)(iV,iV,iq)[(0,s._)(this,ij)]),null===(t=(0,s._)(this,iD))||void 0===t||t.setAttribute("data-l10n-id",(0,h._)(iV,iV,iq)["".concat((0,s._)(this,ij),"-label")]),!(0,s._)(this,iP)){null===(e=(0,s._)(this,iF))||void 0===e||e.remove();return}}else{if(!(0,s._)(this,iP)&&!(0,s._)(this,iL)){a.classList.remove("done"),null===(i=(0,s._)(this,iF))||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,iF);if(!r){(0,n._)(this,iF,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,iF).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,iF))||void 0===t||t.classList.remove("show")},{signal:t})}(0,s._)(this,iL)?r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(r.removeAttribute("data-l10n-id"),r.textContent=(0,s._)(this,iP)),r.parentNode||a.append(r);let l=(0,s._)(this,iB).getImageForAltText();null==l||l.setAttribute("aria-describedby",r.id)}iV._l10n=null;var iY=new WeakMap,iQ=new WeakMap,iJ=new WeakMap,iZ=new WeakMap,i$=new WeakMap,i0=new WeakMap,i1=new WeakMap,i2=ne
1w WeakMap,i3=new WeakMap,i5=new WeakMap,i4=new WeakMap,i6=new WeakSet,i8=new WeakSet,i9=new WeakSet;class i7{get MIN_TOUCH_DISTANCE_TO_PINCH(){return O(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var t;null===(t=(0,s._)(this,i5))||void 0===t||t.abort(),(0,n._)(this,i5,null)}constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:r=null,onPinching:h=null,onPinchEnd:d=null,signal:c}){(0,o._)(this,i6),(0,o._)(this,i8),(0,o._)(this,i9),(0,a._)(this,iY,{writable:!0,value:void 0}),(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,i4,{writable:!0,value:void 0}),(0,n._)(this,iQ,!1),(0,n._)(this,iJ,null),(0,n._)(this,i3,null),(0,n._)(this,i4,null),(0,n._)(this,iY,t),(0,n._)(this,iJ,i),(0,n._)(this,iZ,e),(0,n._)(this,i$,r),(0,n._)(this,i0,h),(0,n._)(this,i1,d),(0,n._)(this,i5,new AbortController),(0,n._)(this,i2,AbortSignal.any([c,(0,s._)(this,i5).signal])),t.addEventListener("touchstart",(0,l._)(this,i6,st).bind(this),{passive:!1,signal:(0,s._)(this,i2)})}}function st(t){var e,i,a;if((null===(e=(0,s._)(this,iZ))||void 0===e?void 0:e.call(this))||t.touches.length<2)return;if(!(0,s._)(this,i4)){(0,n._)(this,i4,new AbortController);let t=AbortSignal.any([(0,s._)(this,i2),(0,s._)(this,i4).signal]),e=(0,s._)(this,iY),a={signal:t,passive:!1};e.addEventListener("touchmove",(0,l._)(this,i8,se).bind(this),a),e.addEventListener("touchend",(0,l._)(this,i9,si).bind(this),a),e.addEventListener("touchcancel",(0,l._)(this,i9,si).bind(this),a),null===(i=(0,s._)(this,i$))||void 0===i||i.call(this)}if(tv(t),2!==t.touches.length||(null===(a=(0,s._)(this,iJ))||void 0===a?void 0:a.call(this))){(0,n._)(this,i3,null);return}let[r,o]=t.touches;r.identifier>o.identifier&&([r,o]=[o,r]),(0,n._)(this,i3,{touch0X:r.screenX,touch0Y:r.screenY,touch1X:o.screenX,touch1Y:o.screenY})}function se(t){var e;if(!(0,s._)(this,i3)||2!==t.touches.length)return;let[i,a]=t.touches;i.identifier>a.identifier&&([i,a]=[a,i]);let{screenX:r,screenY:l}=i,{screenX:o,screenY:h}=a,d=(0,s._)(this,i3),{touch0X:c,touch0Y:u,touch1X:_,touch1Y:p}=d,g=Math.hypot(o-r,h-l)||1,f=Math.hypot(_-c,p-u)||1;if(!(0,s._)(this,iQ)&&Math.abs(f-g)<=i7.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(d.touch0X=r,d.touch0Y=l,d.touch1X=o,d.touch1Y=h,t.preventDefault(),!(0,s._)(this,iQ)){(0,n._)(this,iQ,!0);return}let v=[(r+o)/2,(l+h)/2];null===(e=(0,s._)(this,i0))||void 0===e||e.call(this,v,f,g)}function si(t){var e;(0,s._)(this,i4).abort(),(0,n._)(this,i4,null),null===(e=(0,s._)(this,i1))||void 0===e||e.call(this),(0,s._)(this,i3)&&(t.preventDefault(),(0,n._)(this,i3,null),(0,n._)(this,iQ,!1))}var ss=new WeakMap,sa=new WeakMap,sn=new WeakMap,sr=new WeakMap,sl=new WeakMap,so=new WeakMap,sh=new WeakMap,sd=new WeakMap,sc=new WeakMap,su=new WeakMap,s_=new WeakMap,sp=new WeakMap,sg=new WeakMap,sf=new WeakMap,sv=new WeakMap,sm=new WeakMap,sw=new WeakMap,sb=new WeakMap,sA=new WeakMap,sy=new WeakMap,sS=new WeakMap,sk=new WeakMap,sx=new WeakMap,sE=new WeakMap,sM=new WeakSet,sC=new WeakSet,sT=new WeakSet,sR=new WeakSet,sP=new WeakSet,sL=new WeakSet,sI=new WeakSet,sD=new WeakSet,sF=new WeakSet,sN=new WeakSet,sW=new WeakSet,sO=new WeakSet,sB=new WeakSet,sH=new WeakSet,sG=new WeakSet,sz=new WeakSet,sj=new WeakSet,sU=new WeakSet;class sV{static get _resizerKeyboardManager(){let t=sV.prototype._resizeWithKeyboard,e=io.TRANSLATE_SMALL,i=io.TRANSLATE_BIG;return O(this,"_resizerKeyboardManager",new en([[["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"],sV.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return O(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new ae({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=sV._l10n)&&void 0!==i||(sV._l10n=t),sV._l10nResizer||(sV._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!==sV._borderLineWidth)return;let s=getComputedStyle(document.documentElement);sV._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){F("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,s._)(this,sx)}set _isDraggable(t){var e;(0,n._)(this,sx,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}
1setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,s._)(this,sE)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(0,l._)(this,sU,at).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&((0,s._)(this,sg)?(0,n._)(this,sg,!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,sM,sq).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,n._)(this,sf,(0,s._)(this,sf)||[this.x,this.y,this.width,this.height]),(0,l._)(this,sM,sq).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){(0,n._)(this,sf,(0,s._)(this,sf)||[this.x,this.y,this.width,this.height]);let{div:i,parentDimensions:[a,r]}=this;if(this.x+=t/a,this.y+=e/r,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:l,y:o}=this,[h,d]=this.getBaseTranslation();l+=h,o+=d;let{style:c}=i;c.left="".concat((100*l).toFixed(2),"%"),c.top="".concat((100*o).toFixed(2),"%"),this._onTranslating(l,o),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!(0,s._)(this,sf)&&((0,s._)(this,sf)[0]!==this.x||(0,s._)(this,sf)[1]!==this.y)}get _hasBeenResized(){return!!(0,s._)(this,sf)&&((0,s._)(this,sf)[2]!==this.width||(0,s._)(this,sf)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=sV,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,{div:{style:e},pageDimensions:[i,s]}=this,{x:a,y:n,width:r,height:l}=this;if(r*=i,l*=s,a*=i,n*=s,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(i-r,a)),n=Math.max(0,Math.min(s-l,n));break;case 90:a=Math.max(0,Math.min(i-l,a)),n=Math.min(s,Math.max(r,n));break;case 180:a=Math.min(i,Math.max(r,a)),n=Math.min(s,Math.max(l,n));break;case 270:a=Math.min(i,Math.max(l,a)),n=Math.max(0,Math.min(s-r,n))}this.x=a/=i,this.y=n/=s;let[o,h]=this.getBaseTranslation();a+=o,n+=h,e.left="".concat((100*a).toFixed(2),"%"),e.top="".concat((100*n).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return(0,_._)(sV,sV,sX).call(sV,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return(0,_._)(sV,sV,sX).call(sV,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){let[i,a]=this.parentDimensions,{style:n}=this.div;n.width="".concat((100*t/i).toFixed(2),"%"),(0,s._)(this,sh)||(n.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,sh)&&e.endsWith("%");if(a&&n)return;let[r,l]=this.parentDimensions;a||(t.width="".concat((100*parseFloat(i)/r).toFixed(2),"%")),(0,s._)(this,sh)||n||(t.height="".concat((100*parseFloat(e)/l).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(1e4*t)/1e4}_onResizing(){}altTextFinish(){var t;null===(t=(0,s._)(this,sn))||void 0===t||t.finish()}async addEditToolbar(){return this._editToolbar||(0,s._)(this,sm)||(this._editToolbar=new tN(this),this.div.append(this._editToolbar.render()),(0,s._)(this,sn)&&await this._editToolbar.addAltText((0,s._)(this,sn))),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,null===(t=(0,s._)(this,sn))||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,sn)||(iV.initialize(sV._l10n),(0,n._)(this,sn,new iV(this)),(0,s._)(this,ss)&&((0,s._)(this,sn).data=(0,s._)(this,ss),(0,n._)(this,ss,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=(0,s._)(this,sn))||void 0===t?void 0:t.data}set altTextData(t){(0,s._)(this,sn)&&((0,s._)(this,sn).data=t)}get guessedAltText(){var t;return null===(t=(0,s._)(this,sn))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await (null===(e=(0,s._)(this,sn))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=(0,s._)(this,sn))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!(0,s._)(this,sn)&&!(0,s._)(this,sn).isEmpty()}hasAltTextData(){var t,e;return null!==(e=null===(t=(0,s._)(this,sn))||void 0===t?void 0:t.hasData())&&void 0!==e&&e}render(){var t;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,sr)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),(0,l._)(this,sB,s4).call(this);let[e,i]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth="".concat((100*i/e).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*e/i).toFixed(2),"%"));let[a,r]=this.getInitialTranslation();return this.translate(a,r),t0(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(0,n._)(this,sk,(0,s._)(this,sk)||new i7({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:(0,l._)(this,sD,s0).bind(this),onPinching:(0,l._)(this,sF,s1).bind(this),onPinchEnd:(0,l._)(this,sN,s2).bind(this),signal:this._uiManager._signal})),null===(t=this._uiManager._editorUndoBar)||void 0===t||t.hide(),this.div}pointerdown(t){let{isMac:e}=Q.platform;if(0!==t.button||t.ctrlKey&&e){t.preventDefault();return}if((0,n._)(this,sg,!0),this._isDraggable){(0,l._)(this,sO,s5).call(this,t);return}(0,l._)(this,sW,s3).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){(0,s._)(this,sb)&&clearTimeout((0,s._)(this,sb)),(0,n._)(this,sb,setTimeout(()=>{var t;(0,n._)(this,sb,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}
1_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}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(t){}isEmpty(){return!1}enableEditMode(){(0,n._)(this,sm,!0)}disableEditMode(){(0,n._)(this,sm,!1)}isInEditMode(){return(0,s._)(this,sm)}shouldGetKeyboardEvents(){return(0,s._)(this,sw)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:a,innerWidth:n}=window;return e<n&&s>0&&t<a&&i>0}rebuild(){(0,l._)(this,sB,s4).call(this)}rotate(t){}resize(){}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],F("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,ss,t.accessibilityData);let[a,r]=s.pageDimensions,[l,o,h,d]=s.getRectInCurrentCoords(t.rect,r);return 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,e;if(null===(t=(0,s._)(this,s_))||void 0===t||t.abort(),(0,n._)(this,s_,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,s._)(this,sb)&&(clearTimeout((0,s._)(this,sb)),(0,n._)(this,sb,null)),(0,l._)(this,sU,at).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,null===(e=(0,s._)(this,sk))||void 0===e||e.destroy(),(0,n._)(this,sk,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,l._)(this,sT,sY).call(this),(0,s._)(this,sd).classList.remove("hidden"),t0(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,su,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=(0,s._)(this,sd).children;if(!(0,s._)(this,sa)){(0,n._)(this,sa,Array.from(e));let t=(0,l._)(this,sH,s6).bind(this),i=(0,l._)(this,sG,s8).bind(this),a=this._uiManager._signal;for(let e of(0,s._)(this,sa)){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,sz,s9).bind(this,s),{signal:a}),e.setAttribute("data-l10n-id",sV._l10nResizer[s])}}let i=(0,s._)(this,sa)[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,sa).length/4);if(r!==a){if(r<a)for(let t=0;t<a-r;t++)(0,s._)(this,sd).append((0,s._)(this,sd).firstChild);else if(r>a)for(let t=0;t<r-a;t++)(0,s._)(this,sd).firstChild.before((0,s._)(this,sd).lastChild);let t=0;for(let i of e){let e=(0,s._)(this,sa)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",sV._l10nResizer[e])}}(0,l._)(this,sj,s7).call(this,0),(0,n._)(this,sw,!0),(0,s._)(this,sd).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,s._)(this,sw)&&(0,l._)(this,sI,s$).call(this,(0,s._)(this,sp),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){(0,l._)(this,sU,at).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,sn))||void 0===i||i.toggleAltTextBadge(!1)}unselect(){var t,e,i,a,n;null===(t=(0,s._)(this,sd))||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,sn))||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,sv)}set isEditing(t){(0,n._)(this,sv,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){(0,n._)(this,sh,!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)},sV._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,sr,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,n._)(this,sr,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;(null==e?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}constructor(t){(0,o._)(this,sM),(0,o._)(this,sC),(0,o._)(this,sT),(0,o._)(this,sR),(0,o._)(this,sP),(0,o._)(this,sL),(0,o._)(this,sI),(0,o._)(this,sD),(0,o._)(this,sF),(0,o._)(this,sN),(0,o._)(this,sW),(0,o._)(this,sO),(0,o._)(this,sB),(0,o._)(this,sH),(0,o._)(this,sG),(0,o._)(this,sz),(0,o._)(this,sj),(0,o._)(this,sU),(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,a._)(this,sr,{writable:!0,value:void 0}),(0,a._)(this,sl,{writable:!0,value:void 0}),(0,a._)(this,so,{writable:!0,value:void 0}),(0,a._)(this,sh,{writable:!0,value:void 0}),(0,a._)(this,sd,{writable:!0,value:void 0}),(0,a._)(this,sc,{writable:!0,value:void 0}),(0,a._)(this,su,{writable:!0,value:void 0}),(0,a._)(this,s_,{writable:!0,value:void 0}),(0,a._)(this,sp,{writable:!0,value:void 0}),(0,a._)(this,sg,{writable:!0,value:void 0}),(0,a._)(this,sf,{writable:!0,value:void 0}),(0,a._)(this,sv,{writable:!0,value:void 0}),(0,a._)(this,sm,{writable:!0,value:void 0}),(0,a._)(this,sw,{writable:!0,value:void 0}),(0,a._)(this,sb,{writable:!0,value:void 0}),(0,a._)(this,sA,{writable:!0,value:void 0}),(0,a._)(this,sy,{writable:!0,value:void 0}),(0,a._)(this,sS,{writable:!0,value:void 0}),(0,a._)(this,sk,{writable:!0,value:void 0}),(0,a._)(this,sx,{writable:!0,value:void 0}),(0,a._)(this,sE,{writable:!0,value:void 0}),(0,n._)(this,ss,null),(0,n._)(this,sa,null),(0,n._)(this,sn,null),(0,n._)(this,sr,!1),(0,n._)(this,sl,null),(0,n._)(this,so,""),(0,n._)(this,sh,!1),(0,n._)(this,sd,null),(0,n._)(this,sc,null),(0,n._)(this,su,null),(0,n._)(this,s_,null),(0,n._)(this,sp,""),(0,n._)(this,sg,!1),(0,n._)(this,sf,null),(0,n._)(this,sv,!1),(0,n._)(this,sm,!1),(0,n._)(this,sw,!1),(0,n._)(this,sb,null),(0,n._)(this,sA,0),(0,n._)(this,sy,0),(0,n._)(this,sS,null),(0,n._)(this,sk,null),this._editToolbar=null,this._initialOptions=Object.create(null),this._initialData=null,this._isVisible=!0,this._uiManager=null,this._focusEventsAllowed=!0,(0,n._)(this,sx,!1),(0,n._)(this,sE,sV._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 sq(t,e,i){let[s,a]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/a,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}function sX(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 sY(){if((0,s._)(this,sd))return;(0,n._)(this,sd,document.createElement("div")),(0,s._)(this,sd).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,sd).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,l._)(this,sR,sQ).bind(this,i),{signal:e}),t.addEventListener("contextmenu",tf,{signal:e}),t.tabIndex=-1}this.div.prepend((0,s._)(this,sd))}function sQ(t,e){var i;e.preventDefault();let{isMac:a}=Q.platform;if(0!==e.button||e.ctrlKey&&a)return;null===(i=(0,s._)(this,sn))||void 0===i||i.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,(0,n._)(this,sc,[e.screenX,e.screenY]);let o=new AbortController,h=this._uiManager.combinedSignal(o);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,l._)(this,sI,s$).bind(this,t),{passive:!0,capture:!0,signal:h}),window.addEventListener("touchmove",tv,{passive:!1,signal:h}),window.addEventListener("contextmenu",tf,{signal:h}),(0,n._)(this,su,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let d=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let u=()=>{var t;o.abort(),this.parent.togglePointerEvents(!0),null===(t=(0,s._)(this,sn))||void 0===t||t.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=d,this.div.style.cursor=c,(0,l._)(this,sL,sZ).call(this)};window.addEventListener("pointerup",u,{signal:h}),window.addEventListener("blur",u,{signal:h})}function sJ(t,e,i,s){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(),this._onResized()}function sZ(){if(!(0,s._)(this,su))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:a}=(0,s._)(this,su);(0,n._)(this,su,null);let r=this.x,o=this.y,h=this.width,d=this.height;(r!==t||o!==e||h!==i||d!==a)&&this.addCommands({cmd:(0,l._)(this,sP,sJ).bind(this,r,o,h,d),undo:(0,l._)(this,sP,sJ).bind(this,t,e,i,a),mustExec:!0})}function s$(t,e){let i,a,r,o,h,d;let[c,u]=this.parentDimensions,_=this.x,p=this.y,g=this.width,f=this.height,v=sV.MIN_SIZE/c,m=sV.MIN_SIZE/u,w=(0,l._)(this,sC,sK).call(this,this.rotation),b=(t,e)=>[w[0]*t+w[2]*e,w[1]*t+w[3]*e],A=(0,l._)(this,sC,sK).call(this,360-this.rotation),y=!1,S=!1;switch(t){case"topLeft":y=!0,i=(t,e)=>
1[0,0],a=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],a=(t,e)=>[t/2,e];break;case"topRight":y=!0,i=(t,e)=>[t,0],a=(t,e)=>[0,e];break;case"middleRight":S=!0,i=(t,e)=>[t,e/2],a=(t,e)=>[0,e/2];break;case"bottomRight":y=!0,i=(t,e)=>[t,e],a=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],a=(t,e)=>[t/2,0];break;case"bottomLeft":y=!0,i=(t,e)=>[0,e],a=(t,e)=>[t,0];break;case"middleLeft":S=!0,i=(t,e)=>[0,e/2],a=(t,e)=>[t,e/2]}let k=i(g,f),x=a(g,f),E=b(...x),M=sV._round(_+E[0]),C=sV._round(p+E[1]),T=1,R=1;if(e.fromKeyboard)({deltaX:r,deltaY:o}=e);else{let{screenX:t,screenY:i}=e,[a,n]=(0,s._)(this,sc);[r,o]=this.screenToPageTranslation(t-a,i-n),(0,s._)(this,sc)[0]=t,(0,s._)(this,sc)[1]=i}if([r,o]=(h=r/c,d=o/u,[A[0]*h+A[2]*d,A[1]*h+A[3]*d]),y){let t=Math.hypot(g,f);T=R=Math.max(Math.min(Math.hypot(x[0]-k[0]-r,x[1]-k[1]-o)/t,1/g,1/f),v/g,m/f)}else S?T=Math.max(v,Math.min(1,Math.abs(x[0]-k[0]-r)))/g:R=Math.max(m,Math.min(1,Math.abs(x[1]-k[1]-o)))/f;let P=sV._round(g*T),L=sV._round(f*R),I=M-(E=b(...a(P,L)))[0],D=C-E[1];(0,n._)(this,sf,(0,s._)(this,sf)||[this.x,this.y,this.width,this.height]),this.width=P,this.height=L,this.x=I,this.y=D,this.setDims(c*P,u*L),this.fixAndSetPosition(),this._onResizing()}function s0(){var t;(0,n._)(this,su,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),null===(t=(0,s._)(this,sn))||void 0===t||t.toggle(!1),this.parent.togglePointerEvents(!1)}function s1(t,e,i){let a=i/e*.7+1-.7;if(1===a)return;let r=(0,l._)(this,sC,sK).call(this,this.rotation),o=(t,e)=>[r[0]*t+r[2]*e,r[1]*t+r[3]*e],[h,d]=this.parentDimensions,c=this.x,u=this.y,_=this.width,p=this.height;a=Math.max(Math.min(a,1/_,1/p),sV.MIN_SIZE/h/_,sV.MIN_SIZE/d/p);let g=sV._round(_*a),f=sV._round(p*a);if(g===_&&f===p)return;(0,n._)(this,sf,(0,s._)(this,sf)||[c,u,_,p]);let v=o(_/2,p/2),m=sV._round(c+v[0]),w=sV._round(u+v[1]),b=o(g/2,f/2);this.x=m-b[0],this.y=w-b[1],this.width=g,this.height=f,this.setDims(
1h*g,d*f),this.fixAndSetPosition(),this._onResizing()}function s2(){var t;null===(t=(0,s._)(this,sn))||void 0===t||t.toggle(!0),this.parent.togglePointerEvents(!0),(0,l._)(this,sL,sZ).call(this)}function s3(t){let{isMac:e}=Q.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function s5(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1,a=new AbortController,r=this._uiManager.combinedSignal(a),o={capture:!0,passive:!1,signal:r},h=t=>{a.abort(),(0,n._)(this,sl,null),(0,n._)(this,sg,!1),this._uiManager.endDragSession()||(0,l._)(this,sW,s3).call(this,t),i&&this._onStopDragging()};e&&((0,n._)(this,sA,t.clientX),(0,n._)(this,sy,t.clientY),(0,n._)(this,sl,t.pointerId),(0,n._)(this,so,t.pointerType),window.addEventListener("pointermove",t=>{i||(i=!0,this._onStartDragging());let{clientX:e,clientY:a,pointerId:r}=t;if(r!==(0,s._)(this,sl)){tv(t);return}let[l,o]=this.screenToPageTranslation(e-(0,s._)(this,sA),a-(0,s._)(this,sy));(0,n._)(this,sA,e),(0,n._)(this,sy,a),this._uiManager.dragSelectedEditors(l,o)},o),window.addEventListener("touchmove",tv,o),window.addEventListener("pointerdown",t=>{t.pointerType===(0,s._)(this,so)&&((0,s._)(this,sk)||t.isPrimary)&&h(t),tv(t)},o));let d=t=>{if(!(0,s._)(this,sl)||(0,s._)(this,sl)===t.pointerId){h(t);return}tv(t)};window.addEventListener("pointerup",d,{signal:r}),window.addEventListener("blur",d,{signal:r})}function s4(){if((0,s._)(this,s_)||!this.div)return;(0,n._)(this,s_,new AbortController);let t=this._uiManager.combinedSignal((0,s._)(this,s_));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function s6(t){sV._resizerKeyboardManager.exec(this,t)}function s8(t){var e;(0,s._)(this,sw)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,s._)(this,sd)&&(0,l._)(this,sU,at).call(this)}function s9(t){(0,n._)(this,sp,(0,s._)(this,sw)?t:"")}function s7(t){if((0,s._)(this,sa))for(let e of(0,s._)(this,sa))e.tabIndex=t}function at(){(0,n._)(this,sw,!1),(0,l._)(this,sj,s7).call(this,-1),(0,l._)(this,sL,sZ).call(this)}sV._l10n=null,sV._l10nResizer=null,sV._borderLineWidth=-1,sV._colorManager=new el,sV._zIndex=1,sV._telemetryTimeout=1e3;class ae extends sV{serialize(){return this.serializeDeleted()}constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}}class ai{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=461845907*(r=(r=3432918353*(r=n[t])&4294901760|11601*r&65535)<<15|r>>>17)&4294901760|13715*r&65535,o=5*(o=o<<13|o>>>19)+3864292196):(h^=l=461845907*(l=(l=3432918353*(l=n[t])&4294901760|11601*l&65535)<<15|l>>>17)&4294901760|13715*l&65535,h=5*(h=h<<13|h>>>19)+3864292196);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=461845907*(r=(r=3432918353*r&4294901760|11601*r&65535)<<15|r>>>17)&4294901760|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=4283543511*e&4294901760|((e<<16|(t=3981806797*t&4294901760|36045*t&65535)>>>16)*2950163797&4294901760)>>>16,t^=e>>>1,e=3301882366*e&4294901760|((e<<16|(t=444984403*t&4294901760|60499*t&65535)>>>16)*3120437893&4294901760)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}constructor(t){this.h1=t?4294967295&t:3285377520,this.h2=t?4294967295&t:3285377520}}let as=Object.freeze({map:null,hash:"",transfer:void 0});var aa=new WeakMap,an=new WeakMap,ar=new WeakMap,al=new WeakSet;class ao{getValue(t,e){let i=(0,s._)(this,ar).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,s._)(this,ar).get(t)}remove(t){if((0,s._)(this,ar).delete(t),0===(0,s._)(this,ar).size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of(0,s._)(this,ar).values())if(t instanceof sV)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=(0,s._)(this,ar).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,ar).set(t,e);
1a&&(0,l._)(this,al,ah).call(this),e instanceof sV&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return(0,s._)(this,ar).has(t)}getAll(){return(0,s._)(this,ar).size>0?Y((0,s._)(this,ar)):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return(0,s._)(this,ar).size}resetModified(){(0,s._)(this,aa)&&((0,n._)(this,aa,!1),"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new ac(this)}get serializable(){if(0===(0,s._)(this,ar).size)return as;let t=new Map,e=new ai,i=[],a=Object.create(null),n=!1;for(let[i,r]of(0,s._)(this,ar)){let s=r instanceof sV?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}:as}get editorStats(){let t=null,e=new Map;for(let n of(0,s._)(this,ar).values()){var i,a;if(!(n instanceof sV))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,an,null)}get modifiedIds(){if((0,s._)(this,an))return(0,s._)(this,an);let t=[];for(let e of(0,s._)(this,ar).values())e instanceof sV&&e.annotationElementId&&e.serialize()&&t.push(e.annotationElementId);return(0,n._)(this,an,{ids:new Set(t),hash:t.join(",")})}constructor(){(0,o._)(this,al),(0,a._)(this,aa,{writable:!0,value:void 0}),(0,a._)(this,an,{writable:!0,value:void 0}),(0,a._)(this,ar,{writable:!0,value:void 0}),(0,n._)(this,aa,!1),(0,n._)(this,an,null),(0,n._)(this,ar,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}}function ah(){(0,s._)(this,aa)||((0,n._)(this,aa,!0),"function"==typeof this.onSetModified&&this.onSetModified())}var ad=new WeakMap;class ac extends ao{get print(){F("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,s._)(this,ad)}get modifiedIds(){return O(this,"modifiedIds",{ids:new Set,hash:""})}constructor(t){super(),(0,a._)(this,ad,{writable:!0,value:void 0});let{map:e,hash:i,transfer:s}=t.serializable,r=structuredClone(e,s?{transfer:s}:null);(0,n._)(this,ad,{map:r,hash:i,transfer:s})}}var au=new WeakMap;class a_{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,au).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(!(!e||(0,s._)(this,au).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,au).add(t),null==i||i(e)}catch(t){D("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}return}F("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 D("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 O(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),O(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 O(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-1482184792+n(d,s)|0;s<d.length&&(u=u-1482184792+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 g=this._document.createElement("div");for(let e of(g.style.visibility="hidden",g.style.width=g.style.height="10px",g.style.position="absolute",g.style.top=g.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,g.append(t)}this._document.body.append(g),function t(e,i){if(++h>30){D("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,()=>{g.remove(),e.complete()})}constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){(0,a._)(this,au,{writable:!0,value:void 0}),(0,n._)(this,au,new Set),this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}}class ap{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];let s=this.loadedName+"_path_"+e;try{i=t.get(s)}catch(t){D('getPathGenerator - ignoring character: "'.concat(t,'".'))}let a=new Path2D(i||"");return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=a}constructor(t,{disableFontFace:e=!1,fontExtraProperties:i=!1,inspectFont:s=null}){for(let e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this.fontExtraProperties=!0===i,this._inspectFont=s}}let ag={DATA:1,ERROR:2},af={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function av(){}function am(t){if(t instanceof q||t instanceof z||t instanceof j||t instanceof H||t instanceof U||t instanceof G)return t;switch(t instanceof Error||"object"==typeof t&&null!==t||F('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new q(t.message);case"InvalidPDFException":return new z(t.message);case"MissingPDFException":return new j(t.message);case"PasswordException":return new H(t.message,t.code);case"UnexpectedResponseException":return new U(t.message,t.status);case"UnknownErrorException":return new G(t.message,t.details)}return new G(t.message,t.toString())}var aw=new WeakMap,ab=new WeakSet,aA=new WeakSet,ay=new WeakSet,aS=new WeakSet;class ak{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)}
1sendWithPromise(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:af.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:af.CANCEL,streamId:a,reason:am(t)}),e.promise}},i)}destroy(){var t;null===(t=(0,s._)(this,aw))||void 0===t||t.abort(),(0,n._)(this,aw,null)}constructor(t,e,i){(0,o._)(this,ab),(0,o._)(this,aA),(0,o._)(this,ay),(0,o._)(this,aS),(0,a._)(this,aw,{writable:!0,value:void 0}),(0,n._)(this,aw,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,ab,ax).bind(this),{signal:(0,s._)(this,aw).signal})}}function ax(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream){(0,l._)(this,ay,aM).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===ag.DATA)i.resolve(e.data);else if(e.callback===ag.ERROR)i.reject(am(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;Promise.try(i,e.data).then(function(i){a.postMessage({sourceName:t,targetName:s,callback:ag.DATA,callbackId:e.callbackId,data:i})},function(i){a.postMessage({sourceName:t,targetName:s,callback:ag.ERROR,callbackId:e.callbackId,reason:am(i)})});return}if(e.streamId){(0,l._)(this,aA,aE).call(this,e);return}i(e.data)}function aE(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:af.ENQUEUE,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:af.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:af.ERROR,streamId:e,reason:am(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,Promise.try(r,t.data,l).then(function(){a.postMessage({sourceName:i,targetName:s,stream:af.START_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:af.START_COMPLETE,streamId:e,reason:am(t)})})}function aM(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 af.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(am(t.reason));break;case af.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(am(t.reason));break;case af.PULL:if(!r){a.postMessage({sourceName:i,targetName:s,stream:af.PULL_COMPLETE,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,Promise.try(r.onPull||av).then(function(){a.postMessage({sourceName:i,targetName:s,stream:af.PULL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:af.PULL_COMPLETE,streamId:e,reason:am(t)})});break;case af.ENQUEUE:if(N(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case af.CLOSE:if(N(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),(0,l._)(this,aS,aC).call(this,n,e);break;case af.ERROR:N(n,"error should have stream controller"),n.controller.error(am(t.reason)),(0,l._)(this,aS,aC).call(this,n,e);break;case af.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(am(t.reason)),(0,l._)(this,aS,aC).call(this,n,e);break;case af.CANCEL:if(!r)break;let o=am(t.reason);Promise.try(r.onCancel||av,o).then(function(){a.postMessage({sourceName:i,targetName:s,stream:af.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:af.CANCEL_COMPLETE,streamId:e,reason:am(t)})}),r.sinkCapability.reject(o),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async function aC(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 aT=new WeakMap;class aR{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,aT)})}}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){F("Abstract method `_createCanvas` called.")}constructor({enableHWA:t=!1}){(0,a._)(this,aT,{writable:!0,value:void 0}),(0,n._)(this,aT,!1),(0,n._)(this,aT,t)}}class aP extends aR{_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 aL{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){F("Abstract method `_fetch` called.")}constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}}class aI extends aL{async _fetch(t){let e=await tl(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):K(e)}}class aD{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,a){return"none"}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}var aF=new WeakMap,aN=new WeakMap,aW=new WeakMap,aO=new WeakMap,aB=new WeakMap,aH=new WeakMap,aG=new WeakMap,az=new WeakMap,aj=new WeakMap,aU=new WeakMap,aV=new WeakSet,aq=new WeakSet,aX=new WeakSet,aK=new WeakSet,aY=new WeakSet,aQ=new WeakSet,aJ=new WeakSet,aZ=new WeakSet,a$=new WeakSet;class a0 extends aD{addFilter(t){if(!t)return"none";let e=(0,s._)(this,az).get(t);if(e)return e;
1let[i,a,n]=(0,l._)(this,aV,a5).call(this,t),o=1===t.length?i:"".concat(i).concat(a).concat(n);if(e=(0,s._)(this,az).get(o))return(0,s._)(this,az).set(t,e),e;let h="g_".concat((0,s._)(this,aO),"_transfer_map_").concat((0,r._)(this,aG).value++),d=(0,l._)(this,aq,a4).call(this,h);(0,s._)(this,az).set(t,d),(0,s._)(this,az).set(o,d);let c=(0,l._)(this,aY,a9).call(this,h);return(0,l._)(this,aJ,nt).call(this,i,a,n,c),d}addHCMFilter(t,e){let i="".concat(t,"-").concat(e),a="base",n=(0,s._)(this,aj).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,aj).set(a,n);if(!t||!e)return n.url;let o=(0,l._)(this,a$,ni).call(this,t);t=Z.makeHexColor(...o);let h=(0,l._)(this,a$,ni).call(this,e);if(e=Z.makeHexColor(...h),(0,s._)(this,aU).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,aO),"_hcm_filter"),_=n.filter=(0,l._)(this,aY,a9).call(this,u);(0,l._)(this,aJ,nt).call(this,c,c,c,_),(0,l._)(this,aK,a8).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,aJ,nt).call(this,p(0,5),p(1,5),p(2,5),_),n.url=(0,l._)(this,aq,a4).call(this,u),n.url}addAlphaFilter(t){let e=(0,s._)(this,az).get(t);if(e)return e;let[i]=(0,l._)(this,aV,a5).call(this,[t]),a="alpha_".concat(i);if(e=(0,s._)(this,az).get(a))return(0,s._)(this,az).set(t,e),e;let n="g_".concat((0,s._)(this,aO),"_alpha_map_").concat((0,r._)(this,aG).value++),o=(0,l._)(this,aq,a4).call(this,n);(0,s._)(this,az).set(t,o),(0,s._)(this,az).set(a,o);let h=(0,l._)(this,aY,a9).call(this,n);return(0,l._)(this,aZ,ne).call(this,i,h),o}addLuminosityFilter(t){let e,i,a=(0,s._)(this,az).get(t||"luminosity");if(a)return a;if(t?([e]=(0,l._)(this,aV,a5).call(this,[t]),i="luminosity_".concat(e)):i="luminosity",a=(0,s._)(this,az).get(i))return(0,s._)(this,az).set(t,a),a;let n="g_".concat((0,s._)(this,aO),"_luminosity_map_").concat((0,r._)(this,aG).value++),o=(0,l._)(this,aq,a4).call(this,n);(0,s._)(this,az).set(t,o),(0,s._)(this,az).set(i,o);let h=(0,l._)(this,aY,a9).call(this,n);return(0,l._)(this,aX,a6).call(this,h),t&&(0,l._)(this,aZ,ne).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,aj).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,aj).set(t,o);if(!e||!i)return o.url;let[d,c]=[e,i].map((0,l._)(this,a$,ni).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,g]=[a,n].map((0,l._)(this,a$,ni).bind(this));_<u&&([u,_,p,g]=[_,u,g,p]),(0,s._)(this,aU).style.color="";let f=(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,aO),"_hcm_").concat(t,"_filter"),m=o.filter=(0,l._)(this,aY,a9).call(this,v);return(0,l._)(this,aK,a8).call(this,m),(0,l._)(this,aJ,nt).call(this,f(p[0],g[0],5),f(p[1],g[1],5),f(p[2],g[2],5),m),o.url=(0,l._)(this,aq,a4).call(this,v),o.url}destroy(){var t,e,i,a;let r=arguments.length>0&&void 0!==arguments[0]&&arguments[0];r&&null!==(t=(0,s._)(this,aH))&&void 0!==t&&t.size||(null===(e=(0,s._)(this,aW))||void 0===e||e.parentNode.parentNode.remove(),(0,n._)(this,aW,null),null===(i=(0,s._)(this,aN))||void 0===i||i.clear(),(0,n._)(this,aN,null),null===(a=(0,s._)(this,aH))||void 0===a||a.clear(),(0,n._)(this,aH,null),(0,n._)(this,aG,0))}constructor({docId:t,ownerDocument:e=globalThis.document}){super(),(0,a._)(this,az,{get:a1,set:void 0}),(0,a._)(this,aj,{get:a2,set:void 0}),(0,a._)(this,aU,{get:a3,set:void 0}),(0,o._)(this,aV),(0,o._)(this,aq),(0,o._)(this,aX),(0,o._)(this,aK),(0,o._)(this,aY),
1(0,o._)(this,aQ),(0,o._)(this,aJ),(0,o._)(this,aZ),(0,o._)(this,a$),(0,a._)(this,aF,{writable:!0,value:void 0}),(0,a._)(this,aN,{writable:!0,value:void 0}),(0,a._)(this,aW,{writable:!0,value:void 0}),(0,a._)(this,aO,{writable:!0,value:void 0}),(0,a._)(this,aB,{writable:!0,value:void 0}),(0,a._)(this,aH,{writable:!0,value:void 0}),(0,a._)(this,aG,{writable:!0,value:void 0}),(0,n._)(this,aG,0),(0,n._)(this,aO,t),(0,n._)(this,aB,e)}}function a1(){return(0,n._)(this,aN,(0,s._)(this,aN)||new Map)}function a2(){return(0,n._)(this,aH,(0,s._)(this,aH)||new Map)}function a3(){if(!(0,s._)(this,aW)){let t=(0,s._)(this,aB).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,aB).createElementNS(tn,"svg");i.setAttribute("width",0),i.setAttribute("height",0),(0,n._)(this,aW,(0,s._)(this,aB).createElementNS(tn,"defs")),t.append(i),i.append((0,s._)(this,aW)),(0,s._)(this,aB).body.append(t)}return(0,s._)(this,aW)}function a5(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 a4(t){if(void 0===(0,s._)(this,aF)){(0,n._)(this,aF,"");let t=(0,s._)(this,aB).URL;t!==(0,s._)(this,aB).baseURI&&(td(t)?D('#createUrl: ignore "data:"-URL for performance reasons.'):(0,n._)(this,aF,t.split("#",1)[0]))}return"url(".concat((0,s._)(this,aF),"#").concat(t,")")}function a6(t){let e=(0,s._)(this,aB).createElementNS(tn,"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 a8(t){let e=(0,s._)(this,aB).createElementNS(tn,"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 a9(t){let e=(0,s._)(this,aB).createElementNS(tn,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),(0,s._)(this,aU).append(e),e}function a7(t,e,i){let a=(0,s._)(this,aB).createElementNS(tn,e);a.setAttribute("type","discrete"),a.setAttribute("tableValues",i),t.append(a)}function nt(t,e,i,a){let n=(0,s._)(this,aB).createElementNS(tn,"feComponentTransfer");a.append(n),(0,l._)(this,aQ,a7).call(this,n,"feFuncR",t),(0,l._)(this,aQ,a7).call(this,n,"feFuncG",e),(0,l._)(this,aQ,a7).call(this,n,"feFuncB",i)}function ne(t,e){let i=(0,s._)(this,aB).createElementNS(tn,"feComponentTransfer");e.append(i),(0,l._)(this,aQ,a7).call(this,i,"feFuncA",t)}function ni(t){return(0,s._)(this,aU).style.color=t,tA(getComputedStyle((0,s._)(this,aU)).getPropertyValue("color"))}class ns{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){F("Abstract method `_fetch` called.")}constructor({baseUrl:t=null}){this.baseUrl=t}}class na extends ns{async _fetch(t){return new Uint8Array(await tl(t,"arraybuffer"))}}async function nn(t){let e=p.getBuiltinModule("fs");return new Uint8Array(await e.promises.readFile(t))}m&&D("Please use the `legacy` build in Node.js environments.");class nr extends aD{}class nl extends aR{_createCanvas(t,e){return p.getBuiltinModule("module").createRequire("file:///home/jenkins/workspace/Pango%20Lingo/2.%20Release/k-issueon/CD%20Pipeline/node_modules/pdfjs-dist/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class no extends aL{async _fetch(t){return nn(t)}}class nh extends ns{async _fetch(t){return nn(t)}}let nd={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function nc(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 nu{getPattern(){F("Abstract method `getPattern` called.")}}class n_ extends nu{_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===nd.STROKE||s===nd.FILL){let n=e.current.getClippedPathBoundingBox(s,ty(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=Z.transform(i,[1,0,0,1,n[0],n[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),nc(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 nc(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 np(t,e,i,s,a,n,r,l){let o,h,d,c,u,_,p,g,f;let v=e.coords,m=e.colors,w=t.data,b=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,S=(v[s]+e.offsetX)*e.scaleX,k=(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],P=m[r+1],L=m[r+2],I=m[l],D=m[l+1],F=m[l+2],N=Math.round(y),W=Math.round(E);for(let t=N;t<=W;t++){let e;if(t<k){let e=t<y?0:(y-t)/(y-k);h=A-(A-S)*e,d=M-(M-R)*e,c=C-(C-P)*e,u=T-(T-L)*e}else{let e;h=S-(S-x)*(e=t>E?1:k===E?0:(k-t)/(k-E)),d=R-(R-I)*e,c=P-(P-D)*e,u=L-(L-F)*e}_=A-(A-x)*(e=t<y?0:t>E?1:(y-t)/(y-E)),p=M-(M-I)*e,g=C-(C-D)*e,f=T-(T-F)*e;let i=Math.round(Math.min(h,_)),s=Math.round(Math.max(h,_)),a=b*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-_))<0?e=0:e>1&&(e=1),w[a++]=d-(d-p)*e|0,w[a++]=c-(c-g)*e|0,w[a++]=u-(u-f)*e|0,w[a++]=255}}class ng extends nu{_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,_),g=p.context,f=g.createImageData(l,o);if(e){let t=f.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++)np(t,i,n[e],n[e+1],n[e+l],r[e],r[e+1],r[e+l]),np(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)np(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw Error("illegal figure")}}(f,t,c);return g.putImageData(f,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(nc(t,this._bbox),s===nd.SHADING)a=Z.singularValueDecompose2dScale(ty(t));else if(a=Z.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=Z.singularValueDecompose2dScale(this.matrix);a=[a[0]*t[0],a[1]*t[1]]}let n=this._createMeshCanvas(a,s===nd.SHADING?null:this._background,e.cachedCanvases);return s!==nd.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 nf extends nu{getPattern(){return"hotpink"}}let nv={COLORED:1,UNCOLORED:2};class nm{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),R.INFOS;let h=e[0],d=e[1],c=e[2],u=e[3],_=c-h,p=u-d,g=Z.singularValueDecompose2dScale(this.matrix),f=Z.singularValueDecompose2dScale(this.baseTransform),v=g[0]*f[0],m=g[1]*f[1],w=_,b=p,A=!1,y=!1,S=Math.ceil(o*m),k=Math.ceil(p*m);Math.ceil(l*v)>=Math.ceil(_*v)?w=l:A=!0,S>=k?b=o:y=!0;let x=this.getSizeAndScale(w,this.ctx.canvas.width,v),E=this.getSizeAndScale(b,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=ty(T.ctx),T.executeOperatorList(i),T.endDrawing(),C.restore(
1),A||y){let e=M.canvas;A&&(w=l),y&&(b=o);let i=this.getSizeAndScale(w,this.ctx.canvas.width,v),s=this.getSizeAndScale(b,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,g=y?Math.floor(p/o):0;for(let t=0;t<=u;t++)for(let i=0;i<=g;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(nm.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(ty(t.ctx),[e,i,s,a]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let s=t.ctx,a=t.current;switch(e){case nv.COLORED:let n=this.ctx;s.fillStyle=n.fillStyle,s.strokeStyle=n.strokeStyle,a.fillColor=n.fillStyle,a.strokeColor=n.strokeStyle;break;case nv.UNCOLORED:let r=Z.makeHexColor(i[0],i[1],i[2]);s.fillStyle=r,s.strokeStyle=r,a.fillColor=r,a.strokeColor=r;break;default:throw new V("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let a=i;s!==nd.SHADING&&(a=Z.transform(a,e.baseTransform),this.matrix&&(a=Z.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}}nm.MAX_PATTERN_SIZE=3e3;class nw{getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}}function nb(t,e,i,s,a,n,r,l,o,h){let[d,c,u,_,p,g]=ty(t);if(0===c&&0===u){let f=Math.round(r*d+p),v=Math.round(l*_+g),m=Math.abs(Math.round((r+o)*d+p)-f)||1,w=Math.abs(Math.round((l+h)*_+g)-v)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(_),f,v),t.drawImage(e,i,s,a,n,0,0,m,w),t.setTransform(d,c,u,_,p,g),[m,w]}if(0===d&&0===_){let f=Math.round(l*u+p),v=Math.round(r*c+g),m=Math.abs(Math.round((l+h)*u+p)-f)||1,w=Math.abs(Math.round((r+o)*c+g)-v)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,f,v),t.drawImage(e,i,s,a,n,0,0,w,m),t.setTransform(d,c,u,_,p,g),[w,m]}return t.drawImage(e,i,s,a,n,r,l,o,h),[Math.hypot(d,c)*o,Math.hypot(u,_)*h]}class nA{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]=Z.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=Z.applyTransform(e,t),s=Z.applyTransform(e.slice(2),t),a=Z.applyTransform([e[0],e[3]],t),n=Z.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){Z.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=Z.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]:nd.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[this.minX,this.minY,this.maxX,this.maxY];if(t===nd.STROKE){e||F("Stroke bounding box must include transform.");let t=Z.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=Z.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]:nd.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Z.intersect(this.clipBox,this.getPathBoundingBox(t,e))}constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=w,this.textMatrixScale=1,this.fontMatrix=b,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.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}}function ny(t,e){let i,s,a,n;if(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,g=c.data;if(e.kind===M.GRAYSCALE_1BPP){let e=p.byteLength,n=new Uint32Array(g.buffer,0,g.byteLength>>2),r=n.length,f=l+7>>3,v=Q.isLittleEndian?4278190080: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>f?l:8*t-7,a=-8&s,r=0,o=0;for(;i<a;i+=8)o=p[u++],n[_++]=128&o?4294967295:v,n[_++]=64&o?4294967295:v,n[_++]=32&o?4294967295:v,n[_++]=16&o?4294967295:v,n[_++]=8&o?4294967295:v,n[_++]=4&o?4294967295:v,n[_++]=2&o?4294967295:v,n[_++]=1&o?4294967295:v;for(;i<s;i++)0===r&&(o=p[u++],r=128),n[_++]=o&r?4294967295: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++)g.set(p.subarray(u,u+n)),u+=n,t.putImageData(c,0,s),s+=16;i<d&&(n=l*o*4,g.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--;)g[_++]=p[u++],g[_++]=p[u++],g[_++]=p[u++],g[_++]=255;t.putImageData(c,0,16*i)}else throw Error("bad image kind: ".concat(e.kind))}function nS(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=4294967295,inverseDecode:l=!1}=t,o=Q.isLittleEndian?4278190080: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 nk(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 nx(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 nE(t,e){if(e)return!0;let i=Z.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);let s=Math.fround((globalThis.devicePixelRatio||1)*tr.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}let nM=["butt","round","square"],nC=["miter","round","bevel"],nT={},nR={};var nP=new WeakSet,nL=new WeakSet,nI=new WeakSet;class nD{getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:a=null}=t,n=this.ctx.canvas.width,r=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=l,s){let t=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...ty(this.compositeCtx))}this.ctx.save(),nx(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=ty(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])!==P.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,nP,nF).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,l._)(this,nL,nN).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=ty(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||nS((a=this.cachedCanvases.getCanvas("maskCanvas",r,l)).context,t);let c=Z.transform(d,[1/r,0,0,-1/l,0,0]);c=Z.transform(c,[1,0,0,1,0,-l]);let[u,_,p,g]=Z.getAxialAlignedBoundingBox([0,0,r,l],c),f=this.cachedCanvases.getCanvas("fillCanvas",Math.round(p-u)||1,Math.round(g-_)||1),v=f.context;v.translate(-u,-_),v.transform(...c),!s&&(s=(s=this._scaleImage(a.canvas,tS(v))).img,e&&h&&e.set(i,s)),v.imageSmoothingEnabled=nE(ty(v),t.interpolate),nb(v,s,0,0,s.width,s.height,0,0,r,l),v.globalCompositeOperation="source-in";let m=Z.transform(tS(v),[1,0,0,1,-u,-_]);return v.fillStyle=h?o.getPattern(n,this,m,nd.FILL):o,v.fillRect(0,0,r,l),e&&!h&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,f.canvas)),{canvas:f.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=nM[t]}setLineJoin(t){this.ctx.lineJoin=nC[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}
1setRenderingIntent(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(...ty(this.suspendedCtx)),nk(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(),nk(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=Z.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?(nk(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(),nk(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=ty(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 P.rectangle:l=e[u++],o=e[u++];let _=e[u++],p=e[u++],g=l+_,f=o+p;n.moveTo(l,o),0===_||0===p?n.lineTo(g,f):(n.lineTo(g,o),n.lineTo(g,f),n.lineTo(l,f)),d||r.updateRectMinMax(h,[l,o,g,f]),n.closePath();break;case P.moveTo:l=e[u++],o=e[u++],n.moveTo(l,o),d||r.updatePathMinMax(h,l,o);break;case P.lineTo:l=e[u++],o=e[u++],n.lineTo(l,o),d||r.updatePathMinMax(h,l,o);break;case P.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 P.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 P.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 P.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,tS(e),nd.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,tS(e),nd.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=nT}eoClip(){this.pendingClip=nR}beginText(){this.current.textMatrix=w,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}let i=new Path2D,s=e.getTransform().invertSelf();for(let{transform:e,x:a,y:n,fontSize:r,path:l}of t)i.addPath(l,new DOMMatrix(e).preMultiplySelf(s).translate(a,n).scale(r,-r));e.clip(i),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||b,(0===a.fontMatrix[0]||0===a.fontMatrix[3])&&D("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,a){let n;let r=this.ctx,o=this.current,h=o.font,d=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,u=d&E.FILL_STROKE_MASK,_=!!(d&E.ADD_TO_PATH_FLAG),p=o.patternFill&&!h.missingFile,g=o.patternStroke&&!h.missingFile;if((h.disableFontFace||_||p||g)&&(n=h.getPathGenerator(this.commonObjs,t)),h.disableFontFace||p||g){if(r.save(),r.translate(e,i),r.scale(c,-c),u===E.FILL||u===E.FILL_STROKE){if(s){let t=r.getTransform();r.setTransform(...s),r.fill((0,l._)(this,nI,nW).call(this,n,t,s))}
1else r.fill(n)}if(u===E.STROKE||u===E.FILL_STROKE){if(a){let t=r.getTransform();r.setTransform(...a),r.stroke((0,l._)(this,nI,nW).call(this,n,t,a))}else r.lineWidth/=c,r.stroke(n)}r.restore()}else(u===E.FILL||u===E.FILL_STROKE)&&r.fillText(t,e,i),(u===E.STROKE||u===E.FILL_STROKE)&&r.strokeText(t,e,i);_&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:ty(r),x:e,y:i,fontSize:c,path:n})}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 O(this,"isFontSubpixelAAEnabled",i)}showText(t){let e,i;let s=this.current,a=s.font;if(a.isType3Font)return this.showType3Text(t);let n=s.fontSize;if(0===n)return;let r=this.ctx,l=s.fontSizeScale,o=s.charSpacing,h=s.wordSpacing,d=s.fontDirection,c=s.textHScale*d,u=t.length,_=a.vertical,p=_?1:-1,g=a.defaultVMetrics,f=n*s.fontMatrix[0],v=s.textRenderingMode===E.FILL&&!a.disableFontFace&&!s.patternFill;if(r.save(),r.transform(...s.textMatrix),r.translate(s.x,s.y+s.textRise),d>0?r.scale(c,-1):r.scale(c,1),s.patternFill){r.save();let t=s.fillColor.getPattern(r,this,tS(r),nd.FILL);e=ty(r),r.restore(),r.fillStyle=t}if(s.patternStroke){r.save();let t=s.strokeColor.getPattern(r,this,tS(r),nd.STROKE);i=ty(r),r.restore(),r.strokeStyle=t}let m=s.lineWidth,w=s.textMatrixScale;if(0===w||0===m){let t=s.textRenderingMode&E.FILL_STROKE_MASK;(t===E.STROKE||t===E.FILL_STROKE)&&(m=this.getSinglePixelWidth())}else m/=w;if(1!==l&&(r.scale(l,l),m/=l),r.lineWidth=m,a.isInvalidPDFjsFont){let e=[],i=0;for(let s of t)e.push(s.unicode),i+=s.width;r.fillText(e.join(""),0,0),s.x+=i*f*c,r.restore(),this.compose();return}let b=0,A;for(A=0;A<u;++A){let s,c;let u=t[A];if("number"==typeof u){b+=p*u*n/1e3;continue}let m=!1,w=(u.isSpace?h:0)+o,y=u.fontChar,S=u.accent,k=u.width;if(_){let t=u.vmetric||g,e=-(u.vmetric?t[1]:.5*k)*f,i=t[2]*f;k=t?-t[0]:k,s=e/l,c=(b+i)/l}else s=b/l,c=0;if(a.remeasure&&k>0){let t=1e3*r.measureText(y).width/n*l;if(k<t&&this.isFontSubpixelAAEnabled){let e=k/t;m=!0,r.save(),r.scale(e,1),s/=e}else k!==t&&(s+=(k-t)/2e3*n/l)}if(this.contentVisible&&(u.isInFont||a.missingFile)){if(v&&!S)r.fillText(y,s,c);else if(this.paintChar(y,s,c,e,i),S){let t=s+n*S.offset.x/l,a=c-n*S.offset.y/l;this.paintChar(S.fontChar,t,a,e,i)}}b+=_?k*f-w*d:k*f+w*d,m&&r.restore()}_?s.y-=b:s.x+=b*c,r.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||b,g=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<g;++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,g=l.charProcOperatorList[i.operatorListId];if(!g){D('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(g),this.restore()),s=Z.applyTransform([i.width,0],p)[0]*o+h,n.translate(s,0),r.x+=s*_}
1n.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||ty(this.ctx);e=new nm(t,i,this.ctx,{createCanvasGraphics:t=>new nD(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){this.ctx.strokeStyle=this.current.strokeColor=Z.makeHexColor(t,e,i),this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=Z.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 n_(t);case"Mesh":return new ng(t);case"Dummy":return new nf}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();let i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,tS(e),nd.SHADING);let s=tS(e);if(s){let{width:t,height:i}=e.canvas,[a,n,r,l]=Z.getAxialAlignedBoundingBox([0,0,t,i],s);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(){F("Should not call beginInlineImage")}beginImageData(){F("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=ty(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(ty(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||R.INFOS,t.knockout&&D("Knockout groups not supported.");let i=ty(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let s=Z.getAxialAlignedBoundingBox(t.bbox,ty(e)),a=[0,0,e.canvas.width,e.canvas.height],n=Math.floor((s=Z.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()),nk(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=ty(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=Z.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,nP,nF).call(this),nx(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]=Z.singularValueDecompose2dScale(ty(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),nx(this.ctx)}else nx(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,n),this.ctx.clip(),this.ctx.beginPath()}
1this.current=new nA(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),(0,l._)(this,nL,nN).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=(d[c]?4:0)+(d[c-h]?8:0);for(i=1;i<a;i++)r[t=(t>>2)+(d[c+1]?4:0)+(d[c-h+1]?8:0)]&&(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=ty(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=Z.transform(l,[e,i,s,a,n[t],n[t+1]]),[d,c]=Z.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(),nS(h,this.getObject(t,a)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,tS(e),nd.FILL):i,h.fillRect(0,0,n,r),h.restore(
1),e.save(),e.transform(...l),e.scale(1,-1),nb(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){D("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){D("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;ny(a,t),e=this.applyTransferMapsToCanvas(a)}let n=this._scaleImage(e,tS(a));a.imageSmoothingEnabled=nE(ty(a),t.interpolate),nb(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;ny(a,t),i=this.applyTransferMapsToCanvas(a)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),nb(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===nR?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=ty(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,nP),(0,o._)(this,nL),(0,o._)(this,nI),this.ctx=t,this.current=ne
1w nA(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=r||[],this.optionalContentConfig=n,this.cachedCanvases=new nw(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}}function nF(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function nN(){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}}}function nW(t,e,i){let s=new Path2D;return s.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),s}for(let t in P)void 0!==nD.prototype[t]&&(nD.prototype[P[t]]=nD.prototype[t]);class nO{static get workerPort(){return(0,h._)(this,nO,nB)}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");(0,d._)(this,nO,nB,t)}static get workerSrc(){return(0,h._)(this,nO,nH)}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");(0,d._)(this,nO,nH,t)}}var nB={writable:!0,value:null},nH={writable:!0,value:""},nG=new WeakMap,nz=new WeakMap;class nj{getRaw(){return(0,s._)(this,nz)}get(t){var e;return null!==(e=(0,s._)(this,nG).get(t))&&void 0!==e?e:null}getAll(){return Y((0,s._)(this,nG))}has(t){return(0,s._)(this,nG).has(t)}constructor({parsedData:t,rawData:e}){(0,a._)(this,nG,{writable:!0,value:void 0}),(0,a._)(this,nz,{writable:!0,value:void 0}),(0,n._)(this,nG,t),(0,n._)(this,nz,e)}}let nU=Symbol("INTERNAL");var nV=new WeakMap,nq=new WeakMap,nX=new WeakMap,nK=new WeakMap;class nY{get visible(){if((0,s._)(this,nX))return(0,s._)(this,nK);if(!(0,s._)(this,nK))return!1;let{print:t,view:e}=this.usage;return(0,s._)(this,nV)?(null==e?void 0:e.viewState)!=="OFF":!(0,s._)(this,nq)||(null==t?void 0:t.printState)!=="OFF"}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==nU&&F("Internal method `_setVisible` called."),(0,n._)(this,nX,i),(0,n._)(this,nK,e)}constructor(t,{name:e,intent:i,usage:s,rbGroups:r}){(0,a._)(this,nV,{writable:!0,value:void 0}),(0,a._)(this,nq,{writable:!0,value:void 0}),(0,a._)(this,nX,{writable:!0,value:void 0}),(0,a._)(this,nK,{writable:!0,value:void 0}),(0,n._)(this,nV,!1),(0,n._)(this,nq,!1),(0,n._)(this,nX,!1),(0,n._)(this,nK,!0),(0,n._)(this,nV,!!(t&A.DISPLAY)),(0,n._)(this,nq,!!(t&A.PRINT)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=r}}var nQ=new WeakMap,nJ=new WeakMap,nZ=new WeakMap,n$=new WeakMap,n0=new WeakSet;class n1{isVisible(t){if(0===(0,s._)(this,nJ).size)return!0;if(!t)return R.INFOS,!0;if("OCG"===t.type)return(0,s._)(this,nJ).has(t.id)?(0,s._)(this,nJ).get(t.id).visible:(D("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,l._)(this,n0,n2).call(this,t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!(0,s._)(this,nJ).has(e)){D("Optional content group not found: ".concat(e));break}if(!(0,s._)(this,nJ).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(let e of t.ids){if(!(0,s._)(this,nJ).has(e))return D("Optional content group not found: ".concat(e)),!0;if(!(0,s._)(this,nJ).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(let e of t.ids){if(!(0,s._)(this,nJ).has(e)){D("Optional content group not found: ".concat(e));break}if((0,s._)(this,nJ).get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!(0,s._)(this,nJ).has(e))return D("Optional content group not found: ".concat(e)),!0;if((0,s._)(this,nJ).get(e).visible)return!0}return!1}return D("Unknown optional content policy ".concat(t.policy,".")),!0}return D("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,nJ).get(t);if(!a){D("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,nJ).get(i))||void 0===r||r._setVisible(nU,!1,
1!0)}}a._setVisible(nU,!!e,!0),(0,n._)(this,nQ,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,nJ).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,nQ,null)}get hasInitialVisibility(){return null===(0,s._)(this,nZ)||this.getHash()===(0,s._)(this,nZ)}getOrder(){return(0,s._)(this,nJ).size?(0,s._)(this,n$)?(0,s._)(this,n$).slice():[...(0,s._)(this,nJ).keys()]:null}getGroups(){return(0,s._)(this,nJ).size>0?Y((0,s._)(this,nJ)):null}getGroup(t){return(0,s._)(this,nJ).get(t)||null}getHash(){if(null!==(0,s._)(this,nQ))return(0,s._)(this,nQ);let t=new ai;for(let[e,i]of(0,s._)(this,nJ))t.update("".concat(e,":").concat(i.visible));return(0,n._)(this,nQ,t.hexdigest())}constructor(t,e=A.DISPLAY){if((0,o._)(this,n0),(0,a._)(this,nQ,{writable:!0,value:void 0}),(0,a._)(this,nJ,{writable:!0,value:void 0}),(0,a._)(this,nZ,{writable:!0,value:void 0}),(0,a._)(this,n$,{writable:!0,value:void 0}),(0,n._)(this,nQ,null),(0,n._)(this,nJ,new Map),(0,n._)(this,nZ,null),(0,n._)(this,n$,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,n$,t.order),t.groups))(0,s._)(this,nJ).set(i.id,new nY(e,i));if("OFF"===t.baseState)for(let t of(0,s._)(this,nJ).values())t._setVisible(nU,!1);for(let e of t.on)(0,s._)(this,nJ).get(e)._setVisible(nU,!0);for(let e of t.off)(0,s._)(this,nJ).get(e)._setVisible(nU,!1);(0,n._)(this,nZ,this.getHash())}}function n2(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,n0,n2).call(this,n);else{if(!(0,s._)(this,nJ).has(n))return D("Optional content group not found: ".concat(n)),!0;e=(0,s._)(this,nJ).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 n3{_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 n5(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new n4(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;for(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 n5{_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=tc(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=a.byteLength;
1this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}}class n4{_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 n6(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 n8(t){try{return new URL(t).origin}catch(t){}return null}function n9(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 n7(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=K(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,i,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(tc(t))return t}return null}function rt(t,e){return 404===t||0===t&&e.startsWith("file:")?new j('Missing PDF "'+e+'".'):new U("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function re(t){return 200===t||206===t}function ri(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function rs(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(D("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class ra{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 rn(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new rr(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;
1for(let i of(null===(e=this._fullRequestReader)||void 0===e||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this._responseOrigin=null,this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=n6(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class rn{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:rs(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,ri(i,this._withCredentials,this._abortController)).then(e=>{if(t._responseOrigin=n8(e.url),!re(e.status))throw rt(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();let i=e.headers,{allowRangeRequests:a,suggestedLength:n}=n9({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=n||this._contentLength,this._filename=n7(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new q("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}}class rr{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:rs(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,ri(a,this._withCredentials,this._abortController)).then(e=>{let i=n8(e.url);if(i!==t._responseOrigin)throw Error('Expected range response-origin "'.concat(i,'" to match "').concat(t._responseOrigin,'".'));if(!re(e.status))throw rt(e.status,n);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}}class rl{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",N(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{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){let i=this.pendingRequests[t];if(!i)return;let s=i.xhr;if(s.readyState>
1=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===s.status&&this.isHttp){i.onError(s.status);return}let a=s.status||200;if(!(200===a&&206===i.expectedStatus)&&a!==i.expectedStatus){i.onError(s.status);return}let n=function(t){let e=t.response;return"string"!=typeof e?e:K(e).buffer}(s);if(206===a){let t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);e?i.onDone({begin:parseInt(e[1],10),chunk:n}):(D('Missing or invalid "Content-Range" header.'),i.onError(0))}else n?i.onDone({begin:0,chunk:n}):i.onError(s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}constructor({url:t,httpHeaders:e,withCredentials:i}){this._responseOrigin=null,this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=n6(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}}class ro{_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 rh(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new rd(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 rl(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}}class rh{_onHeadersReceived(){let t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=n8(e.responseURL);let i=e.getAllResponseHeaders(),s=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{allowRangeRequests:a,suggestedLength:n}=n9({responseHeaders:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=n7(s),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=rt(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(await this._headersCapability.promise,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,this._url=e.url,this._fullRequestId=t.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),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 rd{_onHeadersReceived(){var t;let e=n8(null===(t=this._manager.getRequestXhr(this._requestId))||void 0===t?void 0:t.responseURL);e!==this._manager._responseOrigin&&(this._storedError=Error('Expected range response-origin "'.concat(e,'" to match "').concat(this._manager._responseOrigin,'".')),this._onError(0))}_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){var e;
1for(let i of(null!==(e=this._storedError)&&void 0!==e||(this._storedError=rt(t,this._url)),this._requests))i.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(this._requestId),this._close()}constructor(t,e,i){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}}let rc=/^[a-z][a-z0-9\-+.]+:/i;class ru{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=new r_(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new rp(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){var e;this.source=t,this.url=(e=t.url,new URL(rc.test(e)?e:p.getBuiltinModule("url").pathToFileURL(e))),N("file:"===this.url.protocol,"PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class r_{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 q("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();let i=p.getBuiltinModule("fs");i.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new j('Missing PDF "'.concat(this._url,'".'))),this._storedError=t,this._headersCapability.reject(t)})}}class rp{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,e,i){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let s=t.source;this._isStreamingSupported=!s.disableStream;let a=p.getBuiltinModule("fs");this._setReadableStream(a.createReadStream(this._url,{start:e,end:i-1}))}}var rg=new WeakMap,rf=new WeakMap,rv=new WeakMap,rm=new WeakMap,rw=new WeakMap,rb=new WeakMap,rA=new WeakMap,ry=new WeakMap,rS=new WeakMap,rk=new WeakMap,rx=new WeakMap,rE=new WeakMap,rM=new WeakMap,rC=new WeakMap,rT=new WeakMap,rR=new WeakMap,rP=new WeakMap,rL=new WeakMap,rI=new WeakSet,rD=new WeakSet,rF=new WeakSet;class rN{static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Q.platform;return O(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,rS).read().then(e=>{var i;let{value:a,done:r}=e;if(r){(0,s._)(this,rg).resolve();return}
1(0,n._)(this,rw,null!==(i=(0,s._)(this,rw))&&void 0!==i?i:a.lang),Object.assign((0,s._)(this,rM),a.styles),(0,l._)(this,rI,rz).call(this,a.items),t()},(0,s._)(this,rg).reject)};return(0,n._)(this,rS,(0,s._)(this,rT).getReader()),(0,h._)(rN,rN,rG).add(this),t(),(0,s._)(this,rg).promise}update(t){let{viewport:e,onBefore:i=null}=t,a=e.scale*(globalThis.devicePixelRatio||1),r=e.rotation;if(r!==(0,s._)(this,rx)&&(null==i||i(),(0,n._)(this,rx,r),tk((0,s._)(this,rk),{rotation:r})),a!==(0,s._)(this,rE)){null==i||i(),(0,n._)(this,rE,a);let t={div:null,properties:null,ctx:(0,_._)(rN,rN,rV).call(rN,(0,s._)(this,rw))};for(let e of(0,s._)(this,rR))t.properties=(0,s._)(this,rP).get(e),t.div=e,(0,l._)(this,rF,rU).call(this,t)}}cancel(){var t;let e=new q("TextLayer task cancelled.");null===(t=(0,s._)(this,rS))||void 0===t||t.cancel(e).catch(()=>{}),(0,n._)(this,rS,null),(0,s._)(this,rg).reject(e)}get textDivs(){return(0,s._)(this,rR)}get textContentItemsStr(){return(0,s._)(this,rC)}static cleanup(){if(!((0,h._)(this,rN,rG).size>0)){for(let{canvas:t}of((0,h._)(this,rN,rW).clear(),(0,h._)(this,rN,rO).values()))t.remove();(0,h._)(this,rN,rO).clear()}}constructor({textContentSource:t,container:e,viewport:i}){var r;if((0,o._)(this,rI),(0,o._)(this,rD),(0,o._)(this,rF),(0,a._)(this,rg,{writable:!0,value:void 0}),(0,a._)(this,rf,{writable:!0,value:void 0}),(0,a._)(this,rv,{writable:!0,value:void 0}),(0,a._)(this,rm,{writable:!0,value:void 0}),(0,a._)(this,rw,{writable:!0,value:void 0}),(0,a._)(this,rb,{writable:!0,value:void 0}),(0,a._)(this,rA,{writable:!0,value:void 0}),(0,a._)(this,ry,{writable:!0,value:void 0}),(0,a._)(this,rS,{writable:!0,value:void 0}),(0,a._)(this,rk,{writable:!0,value:void 0}),(0,a._)(this,rx,{writable:!0,value:void 0}),(0,a._)(this,rE,{writable:!0,value:void 0}),(0,a._)(this,rM,{writable:!0,value:void 0}),(0,a._)(this,rC,{writable:!0,value:void 0}),(0,a._)(this,rT,{writable:!0,value:void 0}),(0,a._)(this,rR,{writable:!0,value:void 0}),(0,a._)(this,rP,{writable:!0,value:void 0}),(0,a._)(this,rL,{writable:!0,value:void 0}),(0,n._)(this,rg,Promise.withResolvers()),(0,n._)(this,rf,null),(0,n._)(this,rv,!1),(0,n._)(this,rm,!!(null===(r=globalThis.FontInspector)||void 0===r?void 0:r.enabled)),(0,n._)(this,rw,null),(0,n._)(this,rb,null),(0,n._)(this,rA,0),(0,n._)(this,ry,0),(0,n._)(this,rS,null),(0,n._)(this,rk,null),(0,n._)(this,rx,0),(0,n._)(this,rE,0),(0,n._)(this,rM,Object.create(null)),(0,n._)(this,rC,[]),(0,n._)(this,rT,null),(0,n._)(this,rR,[]),(0,n._)(this,rP,new WeakMap),(0,n._)(this,rL,null),t instanceof ReadableStream)(0,n._)(this,rT,t);else if("object"==typeof t)(0,n._)(this,rT,new ReadableStream({start(e){e.enqueue(t),e.close()}}));else throw Error('No "textContentSource" parameter specified.');(0,n._)(this,rf,(0,n._)(this,rk,e)),(0,n._)(this,rE,i.scale*(globalThis.devicePixelRatio||1)),(0,n._)(this,rx,i.rotation),(0,n._)(this,rb,{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,ry,l),(0,n._)(this,rA,d),(0,_._)(rN,rN,rX).call(rN),tk(e,i),(0,s._)(this,rg).promise.finally(()=>{(0,h._)(rN,rN,rG).delete(this),(0,n._)(this,rb,null),(0,n._)(this,rM,null)}).catch(()=>{})}}var rW={writable:!0,value:new Map},rO={writable:!0,value:new Map},rB={writable:!0,value:new WeakMap},rH={writable:!0,value:null},rG={writable:!0,value:new Set};function rz(t){var e,i;if((0,s._)(this,rv))return;null!==(i=(e=(0,s._)(this,rb)).ctx)&&void 0!==i||(e.ctx=(0,_._)(rN,rN,rV).call(rN,(0,s._)(this,rw)));let a=(0,s._)(this,rR),r=(0,s._)(this,rC);for(let e of t){if(a.length>1e5){D("Ignoring additional textDivs for performance reasons."),(0,n._)(this,rv,!0);return}if(void 0===e.str){if("beginMarkedContentProps"===e.type||"beginMarkedContent"===e.type){let t=(0,s._)(this,rf);(0,n._)(this,rf,document.createElement("span")),(0,s._)(this,rf).classList.add("markedContent"),null!==e.id&&(0,s._)(this,rf).setAttribute("id","".concat(e.id)),t.append((0,s._)(this,rf))}else"endMarkedContent"===e.type&&(0,n._)(this,rf,(0,s._)(this,rf).parentNode);continue}
1r.push(e.str),(0,l._)(this,rD,rj).call(this,e)}}function rj(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,rR).push(a);let r=Z.transform((0,s._)(this,rL),t.transform),o=Math.atan2(r[1],r[0]),d=(0,s._)(this,rM)[t.fontName];d.vertical&&(o+=Math.PI/2);let c=(0,s._)(this,rm)&&d.fontSubstitution||d.fontFamily;c=rN.fontFamilyMap.get(c)||c;let u=Math.hypot(r[2],r[3]),p=u*(0,_._)(rN,rN,rK).call(rN,c,(0,s._)(this,rw));0===o?(e=r[4],i=r[5]-p):(e=r[4]+p*Math.sin(o),i=r[5]-p*Math.cos(o));let g="calc(var(--scale-factor)*",f=a.style;(0,s._)(this,rf)===(0,s._)(this,rk)?(f.left="".concat((100*e/(0,s._)(this,ry)).toFixed(2),"%"),f.top="".concat((100*i/(0,s._)(this,rA)).toFixed(2),"%")):(f.left="".concat(g).concat(e.toFixed(2),"px)"),f.top="".concat(g).concat(i.toFixed(2),"px)")),f.fontSize="".concat(g).concat(((0,h._)(rN,rN,rH)*u).toFixed(2),"px)"),f.fontFamily=c,n.fontSize=u,a.setAttribute("role","presentation"),a.textContent=t.str,a.dir=t.dir,(0,s._)(this,rm)&&(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,rP).set(a,n),(0,s._)(this,rb).div=a,(0,s._)(this,rb).properties=n,(0,l._)(this,rF,rU).call(this,(0,s._)(this,rb)),n.hasText&&(0,s._)(this,rf).append(a),n.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),(0,s._)(this,rf).append(t)}}function rU(t){let{div:e,properties:i,ctx:a}=t,{style:n}=e,r="";if((0,h._)(rN,rN,rH)>1&&(r="scale(".concat(1/(0,h._)(rN,rN,rH),")")),0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=n,{canvasWidth:l,fontSize:o}=i;(0,_._)(rN,rN,rq).call(rN,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 rV(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,h._)(this,rN,rO).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,rN,rO).set(t,e),(0,h._)(this,rN,rB).set(e,{size:0,family:""})}return e}function rq(t,e,i){let s=(0,h._)(this,rN,rB).get(t);(e!==s.size||i!==s.family)&&(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)}function rX(){if(null!==(0,h._)(this,rN,rH))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,rN,rH,t.getBoundingClientRect().height),t.remove()}function rK(t,e){let i=(0,h._)(this,rN,rW).get(t);if(i)return i;let s=(0,_._)(this,rN,rV).call(rN,e);s.canvas.width=s.canvas.height=30,(0,_._)(this,rN,rq).call(rN,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,rN,rW).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,rN,rW).set(t,o),o}class rY{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(!rY.shouldBuildText(n))return;(null==i?void 0:null===(s=i.attributes)||void 0===s?void 0:s.textContent)?a=i.attributes.textContent:i.value&&(
1a=i.value)}if(null!==a&&e.push({str:a}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}let rQ=m?nl:aP,rJ=m?no:aI,rZ=m?nr:a0,r$=m?nh:na;function r0(){var t,e;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof i||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});let s=new r2,{docId:a}=s,n=i.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.")}(i.url):null,r=i.data?function(t){if(m&&void 0!==g&&t instanceof g)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 K(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.")}(i.data):null,l=i.httpHeaders||null,o=!0===i.withCredentials,h=null!==(t=i.password)&&void 0!==t?t:null,d=i.range instanceof r5?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:65536,u=i.worker instanceof ll?i.worker:null,_=i.verbosity,p="string"!=typeof i.docBaseUrl||td(i.docBaseUrl)?null:i.docBaseUrl,f="string"==typeof i.cMapUrl?i.cMapUrl:null,v=!1!==i.cMapPacked,w=i.CMapReaderFactory||rJ,b="string"==typeof i.standardFontDataUrl?i.standardFontDataUrl:null,A=i.StandardFontDataFactory||r$,y=!0!==i.stopAtErrors,S=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,k=!1!==i.isEvalSupported,x="boolean"==typeof i.isOffscreenCanvasSupported?i.isOffscreenCanvasSupported:!m,E="boolean"==typeof i.isImageDecoderSupported?i.isImageDecoderSupported:!m&&(Q.platform.isFirefox||!globalThis.chrome),M=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,C="boolean"==typeof i.disableFontFace?i.disableFontFace:m,T=!0===i.fontExtraProperties,R=!0===i.enableXfa,P=i.ownerDocument||globalThis.document,L=!0===i.disableRange,D=!0===i.disableStream,F=!0===i.disableAutoFetch,N=!0===i.pdfBug,W=i.CanvasFactory||rQ,O=i.FilterFactory||rZ,B=!0===i.enableHWA,H=d?d.length:null!==(e=i.length)&&void 0!==e?e:NaN,G="boolean"==typeof i.useSystemFonts?i.useSystemFonts:!m&&!C,z="boolean"==typeof i.useWorkerFetch?i.useWorkerFetch:w===aI&&A===na&&f&&b&&tg(f,document.baseURI)&&tg(b,document.baseURI);Number.isInteger(_)&&(I=_);let j={canvasFactory:new W({ownerDocument:P,enableHWA:B}),filterFactory:new O({docId:a,ownerDocument:P}),cMapReaderFactory:z?null:new w({baseUrl:f,isCompressed:v}),standardFontDataFactory:z?null:new A({baseUrl:b})};if(!u){let t={verbosity:_,port:nO.workerPort};u=t.port?ll.fromPort(t):new ll(t),s._worker=u}let U={docId:a,apiVersion:"4.10.38",data:r,password:h,disableAutoFetch:F,rangeChunkSize:c,length:H,docBaseUrl:p,enableXfa:R,evaluatorOptions:{maxImageSize:S,disableFontFace:C,ignoreErrors:y,isEvalSupported:k,isOffscreenCanvasSupported:x,isImageDecoderSupported:E,canvasMaxAreaInBytes:M,fontExtraProperties:T,useSystemFonts:G,cMapUrl:z?f:null,standardFontDataUrl:z?b:null}},V={disableFontFace:C,fontExtraProperties:T,ownerDocument:P,pdfBug:N,styleElement:null,loadingParams:{disableAutoFetch:F,enableXfa:R}};return u.promise.then(function(){let t;if(s.destroyed)throw Error("Loading aborted");if(u.destroyed)throw Error("Worker was destroyed");let e=u.messageHandler.sendWithPromise("GetDocRequest",U,r?[r.buffer]:null);if(d)t=new n3(d,{disableRange:L,disableStream:D});else if(!r){let e;if(!n)throw Error("getDocument - no `url` parameter provided.");if(m){if(tg(n)){if("undefined"==typeof fetch||"undefined"==typeof Response||!("body"in Response.prototype))throw Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");e=ra}else e=ru}else e=tg(n)?ra:ro;t=new e({url:n,length:H,httpHeaders:l,withCredentials:o,rangeChunkSize:c,disableRange:L,disableStream:D})}return e.then(e=>{if(s.destroyed)throw Error("Loading aborted");if(u.destroyed)throw Error("Worker was destroyed");let i=new ak(a,e,u.port),n=new lw(i,s,t,V,j);s._transport=n,i.send("Ready",null)})}).catch(s._capability.reject),s}function r1(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 r2{get promise(){return this._capability.promise}async destroy(){var t,e,i,s;this.destroyed=!0;try{(null===(e=this._worker)||void 0===e?void 0:e.port)&&(this._worker._pendingDestroy=!0),await (null===(i=this._transport)||void 0===i?void 0:i.destroy())}catch(t){throw(null===(s=this._worker)||void 0===s?void 0:s.port)&&delete this._worker._pendingDestroy,t}this._transport=null,null===(t=this._worker)||void 0===t||t.destroy(),this._worker=null}constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((0,c._)(r2,r2,r3).value++),this.destroyed=!1,this.onPassword=null,this.onProgress=null}}var r3={writable:!0,value:0};class r5{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){F("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 r4{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 O(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}
1=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}constructor(t,e){this._pdfInfo=t,this._transport=e}}var r6=new WeakMap,r8=new WeakMap,r9=new WeakSet,r7=new WeakSet;class lt{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 to({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return O(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:g=null,isEditing:f=!1}=t;null===(e=this._stats)||void 0===e||e.time("Overall");let v=this._transport.getRenderingIntent(o,h,g,f),{renderingIntent:m,cacheKey:w}=v;(0,n._)(this,r8,!1),(0,l._)(this,r7,li).call(this),u||(u=this._transport.getOptionalContentConfig(m));let b=this._intentStates.get(w);b||(b=Object.create(null),this._intentStates.set(w,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);let S=!!(m&A.PRINT);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(s=this._stats)||void 0===s||s.time("Page Request"),this._pumpOperatorList(v));let k=t=>{if(b.renderTasks.delete(x),(this._maybeCleanupAfterRender||S)&&(0,n._)(this,r8,!0),(0,l._)(this,r9,le).call(this,!S),t?(x.capability.reject(t),this._abortOperatorList({intentState:b,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 lR({callback:k,params:{canvasContext:a,viewport:r,transform:d,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:_,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:p});((i=b).renderTasks||(i.renderTasks=new Set)).add(x);let E=x.task;return Promise.all([b.displayReadyCapability.promise,u]).then(t=>{var e;let[i,s]=t;if(this.destroyed){k();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(k),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]:{}
1,n=this._transport.getRenderingIntent(e,i,s,a,!0),r=this._intentStates.get(n.cacheKey);if(r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),!r.opListReadCapability){var l,o;(t=Object.create(null)).operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(t))},r.opListReadCapability=Promise.withResolvers(),((o=r).renderTasks||(o.renderTasks=new Set)).add(t),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||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=>rY.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,r8,!1),(0,l._)(this,r7,li).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,n._)(this,r8,!0);let e=(0,l._)(this,r9,le).call(this,!1);return t&&e&&this._stats&&(this._stats=new tp),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();t.lastChunk&&(0,l._)(this,r9,le).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,r9,le).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 th){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 q(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,r9),(0,o._)(this,r7),(0,a._)(this,r6,{writable:!0,value:void 0}),(0,a._)(this,r8,{writable:!0,value:void 0}),(0,n._)(this,r6,null),(0,n._)(this,r8,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new tp:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new lx,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}}function le(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,l._)(this,r7,li).call(this),!(0,s._)(this,r8)||this.destroyed)return!1;if(t)return(0,n._)(this,r6,setTimeout(()=>{(0,n._)(this,r6,null),(0,l._)(this,r9,le).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,r8,!1),!0}function li(){(0,s._)(this,r6)&&(clearTimeout((0,s._)(this,r6)),(0,n._)(this,r6,null))}var ls=new WeakMap,la=new WeakMap;class ln{postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};(0,s._)(this,la).then(()=>{for(let[t]of(0,s._)(this,ls))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){D("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,ls).set(e,a)}removeEventListener(t,e){let i=(0,s._)(this,ls).get(e);null==i||i(),(0,s._)(this,ls).delete(e)}terminate(){for(let[,t]of(0,s._)(this,ls))null==t||t();(0,s._)(this,ls).clear()}constructor(){(0,a._)(this,ls,{writable:!0,value:void 0}),(0,a._)(this,la,{writable:!0,value:void 0}),(0,n._)(this,ls,new Map),(0,n._)(this,la,Promise.resolve())}}var lr=new WeakSet;class ll{get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new ak("main","worker",t),this._messageHandler.on("ready",function(){}),(0,l._)(this,lr,lu).call(this)}_initialize(){if((0,h._)(ll,ll,ld)||(0,h._)(ll,ll,lo)){this._setupFakeWorker();return}let{workerSrc:t}=ll;try{ll._isSameOrigin(window.location.href,t)||(t=ll._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new ak("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,lr,lu).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){R.INFOS}this._setupFakeWorker()}_setupFakeWorker(){(0,h._)(ll,ll,ld)||(D("Setting up fake worker."),(0,d._)(ll,ll,ld,!0)),ll._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let e=new ln;this._port=e;let i="fake".concat((0,c._)(ll,ll,lh).value++),s=new ak(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new ak(i,i+"_worker",e),(0,l._)(this,lr,lu).call(this)}).catch(t=>{this._readyCapability.reject(Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}destroy(){var t,e,i;this.destroyed=!0,null===(t=this._webWorker)||void 0===t||t.terminate(),this._webWorker=null,null===(e=(0,h._)(ll,ll,lc))||void 0===e||e.delete(this._port),this._port=null,null===(i=this._messageHandler)||void 0===i||i.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,ll,lc))||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 ll(t)}static get workerSrc(){if(nO.workerSrc)return nO.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return O(this,"_setupFakeWorkerGlobal",(async()=>(0,h._)(this,ll,lo)?(0,h._)(this,ll,lo):(await import(this.workerSrc)).WorkerMessageHandler)())}constructor({name:t=null,port:e=null,verbosity:i=I}={}){if((0,o._)(this,lr),this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){var s;if(null===(s=(0,h._)(ll,ll,lc))||void 0===s?void 0:s.has(e))throw Error("Cannot use more than one PDFWorker per port.");(0,d._)(ll,ll,lc,(0,h._)(ll,ll,lc)||new WeakMap).set(e,this),this._initializeFromPort(e);return}this._initialize()}}var lo={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},lh={writable:!0,value:0},ld={writable:!0,value:!1},lc={writable:!0,value:void 0};function lu(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}m&&((0,d._)(ll,ll,ld,!0),nO.workerSrc||(nO.workerSrc="./pdf.worker.mjs")),ll._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},ll._createCDNWrapper=t=>URL.createObjectURL(new Blob(['await import("'.concat(t,'");')],{type:"text/javascript"}));var l_=new WeakMap,lp=new WeakMap,lg=new WeakMap,lf=new WeakMap,lv=new WeakMap,lm=new WeakSet;class lw{get annotationStorage(){return O(this,"annotationStorage",new ao)}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=as;switch(t){case"any":n=A.ANY;break;case"display":break;case"print":n=A.PRINT;break;default:D("getRenderingIntent - invalid intent: ".concat(t))}let l=n&A.PRINT&&i instanceof ac?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:D("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,lv))||void 0===t||t.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let t of(0,s._)(this,lp).values())e.push(t._destroy());(0,s._)(this,lp).clear(),(0,s._)(this,lg).clear(),(0,s._)(this,lf).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t,e;this.commonObjs.clear(),this.fontLoader.clear(),(0,s._)(this,l_).clear(),this.filterFactory.destroy(),rN.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new q("Worker was terminated.")),null===(e=this.messageHandler)||void 0===e||e.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 r4(i,this))}),t.on("DocException",t=>{e._capability.reject(am(t))}
1),t.on("PasswordRequest",t=>{(0,n._)(this,lv,Promise.withResolvers());try{if(!e.onPassword)throw am(t);e.onPassword(t=>{t instanceof Error?(0,s._)(this,lv).reject(t):(0,s._)(this,lv).resolve({password:t})},t.code)}catch(t){(0,s._)(this,lv).reject(t)}return(0,s._)(this,lv).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,lp).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;D("Error during font loading: ".concat(t)),this.commonObjs.resolve(i,t);break}let d=new ap(n,{disableFontFace:l,fontExtraProperties:o,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,lp).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,lp).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&&D("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,lg).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,lf).set(i.refStr,t);let a=new lt(e,i,this,this._params.pdfBug);return(0,s._)(this,lp).set(e,a),a});return(0,s._)(this,lg).set(e,a),a}getPageIndex(t){return r1(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,lm,lb).call(this,"GetFieldObjects")}hasJSActions(){return(0,l._)(this,lm,lb).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,lm,lb).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,lm,lb).call(this,"GetOptionalContentConfig").then(e=>new n1(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=(0,s._)(this,l_).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 nj(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,l_).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,lp).values()))if(!t.cleanup())throw Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."));this.commonObjs.clear(),t||this.fontLoader.clear(),(0,s._)(this,l_).clear(),this.filterFactory.destroy(!0),rN.cleanup()}}cachedPageNumber(t){var e;if(!r1(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,lf).get(i))&&void 0!==e?e:null}constructor(t,e,i,s,r){(0,o._)(this,lm),(0,a._)(this,l_,{writable:!0,value:void 0}),(0,a._)(this,lp,{writable:!0,value:void 0}),(0,a._)(this,lg,{writable:!0,value:void 0}),(0,a._)(this,lf,{writable:!0,value:void 0}),(0,a._)(this,lv,{writable:!0,value:void 0}),(0,n._)(this,l_,new Map),(0,n._)(this,lp,new Map),(0,n._)(this,lg,new Map),(0,n._)(this,lf,new Map),(0,n._)(this,lv,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new lx,this.fontLoader=new a_({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 lb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,s._)(this,l_).get(t);if(i)return i;let a=this.messageHandler.sendWithPromise(t,e);return(0,s._)(this,l_).set(t,a),a}let lA=Symbol("INITIAL_DATA");var ly=new WeakMap,lS=new WeakSet;let lk=Symbol.iterator;class lx{get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){let i=(0,l._)(this,lS,lE).call(this,t);return i.promise.then(()=>e(i.data)),null}let i=(0,s._)(this,ly)[t];if(!i||i.data===lA)throw Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){let e=(0,s._)(this,ly)[t];return!!e&&e.data!==lA}delete(t){let e=(0,s._)(this,ly)[t];return!!e&&e.data!==lA&&(delete s._(this,ly)[t],!0)}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,l._)(this,lS,lE).call(this,t);i.data=e,i.resolve()}clear(){for(let e in(0,s._)(this,ly)){var t;let{data:i}=(0,s._)(this,ly)[e];null==i||null===(t=i.bitmap)||void 0===t||t.close()}(0,n._)(this,ly,Object.create(null))}*[lk](){for(let t in(0,s._)(this,ly)){let{data:e}=(0,s._)(this,ly)[t];e!==lA&&(yield[t,e])}}constructor(){(0,o._)(this,lS),(0,a._)(this,ly,{writable:!0,value:void 0}),(0,n._)(this,ly,Object.create(null))}}function lE(t){var e;return(e=(0,s._)(this,ly))[t]||(e[t]={...Promise.withResolvers(),data:lA})}var lM=new WeakMap;class lC{get promise(){return(0,s._)(this,lM).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,s._)(this,lM).cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=(0,s._)(this,lM).operatorList;if(!t)return!1;let{annotationCanvasMap:e}=(0,s._)(this,lM);return t.form||t.canvas&&(null==e?void 0:e.size)>0}constructor(t){(0,a._)(this,lM,{writable:!0,value:void 0}),(0,n._)(this,lM,null),(0,n._)(this,lM,t),this.onContinue=null}}var lT=new WeakMap;class lR{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._)(lR,lR,lP).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._)(lR,lR,lP).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 nD(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:a},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:r,transparency:s,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||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,lT)&&(window.cancelAnimationFrame((0,s._)(this,lT)),(0,n._)(this,lT,null)),(0,h._)(lR,lR,lP).delete(this._canvas),this.callback(e||new th("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,lT,window.requestAnimationFrame(()=>{(0,n._)(this,lT,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._)(lR,lR,lP).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,lT,{writable:!0,value:void 0}),(0,n._)(this,lT,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 lC(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 lP={writable:!0,value:new WeakSet};let lL="4.10.38",lI="f9bea397f";function lD(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function lF(t){return Math.max(0,Math.min(255,255*t))}class lN{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=lF(e),e,e]}static G_HTML(t){let[e]=t,i=lD(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(lF)}static RGB_HTML(t){return"#".concat(t.map(lD).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[lF(1-Math.min(1,e+a)),lF(1-Math.min(1,s+a)),lF(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;return["CMYK",a,n,r,Math.min(a,n,r)]}}class lW{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){F("Abstract method `_createSVG` called.")}}class lO extends lW{_createSVG(t){return document.createElementNS(tn,t)}}class lB{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&&rY.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&&rY.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 lH=new WeakSet;function lG(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class lz{static create(t){switch(t.data.annotationType){case C.LINK:return new lZ(t);case C.TEXT:return new l2(t);case C.WIDGET:switch(t.data.fieldType){case"Tx":return new l5(t);case"Btn":if(t.data.radioButton)return new l8(t);if(t.data.checkBox)return new l6(t);return new l9(t);case"Ch":return new l7(t);case"Sig":return new l4(t)}return new l3(t);case C.POPUP:return new ot(t);case C.FREETEXT:return new oB(t);case C.LINE:return new oG(t);case C.SQUARE:return new oj(t);case C.CIRCLE:return new oV(t);case C.POLYLINE:return new oX(t);case C.CARET:return new oY(t);case C.INK:return new o$(t);case C.POLYGON:return new oK(t);case C.HIGHLIGHT:return new o1(t);case C.UNDERLINE:return new o2(t);case C.SQUIGGLY:return new o3(t);case C.STRIKEOUT:return new o5(t);case C.STAMP:return new o4(t);case C.FILEATTACHMENT:return new o9(t);default:return new lX(t)}}}var lj=new WeakMap,lU=new WeakMap,lV=new WeakMap,lq=new WeakSet;class lX{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 lX._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;(0,n._)(this,lj,(0,s._)(this,lj)||{rect:this.data.rect.slice(0)});let{rect:i}=t;i&&(0,l._)(this,lq,lK).call(this,i),null===(e=(0,s._)(this,lV))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;(0,s._)(this,lj)&&((0,l._)(this,lq,lK).call(this,(0,s._)(this,lj).rect),null===(t=(0,s._)(this,lV))||void 0===t||t.popup.resetEdited(),(0,n._)(this,lj,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 l3||(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 ot){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;if(t>0||i>0){let e="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))");r.borderRadius=e}else if(this instanceof l8){let t="calc(".concat(l,"px * var(--scale-factor)) / calc(").concat(o,"px * var(--scale-factor))");r.borderRadius=t}switch(e.borderStyle.style){case T.SOLID:r.borderStyle="solid";break;case T.DASHED:r.borderStyle="dashed";break;case T.BEVELED:D("Unimplemented border style: beveled");break;case T.INSET:D("Unimplemented border style: inset");break;case T.UNDERLINE:r.borderBottomStyle="solid"}let s=e.borderColor||null;s?((0,n._)(this,lU,!0),r.borderColor=Z.makeHexColor(0|s[0],0|s[1],0|s[2])):r.borderWidth=0}let h=Z.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;
1return 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]=lN["".concat(a,"_HTML")](n),this.annotationStorage.setValue(this.data.id,{[e]:lN["".concat(a,"_rgb")](n)})};return O(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,lU)){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,g=(r-n)/h,f=(a-l)/o,v=(n-c)/h;u.setAttribute("x",p),u.setAttribute("y",g),u.setAttribute("width",f),u.setAttribute("height",v),_.append(u),null==t||t.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(g,'" width="').concat(f,'" height="').concat(v,'"/>'))}(0,s._)(this,lU)&&(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,lV,new ot({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(){F("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&&!lH.has(r)){D("_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&&lH.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,lq),(0,a._)(this,lj,{writable:!0,value:void 0}),(0,a._)(this,lU,{writable:!0,value:void 0}),(0,a._)(this,lV,{writable:!0,value:void 0}),(0,n._)(this,lj,null),(0,n._)(this,lU,!1),(0,n._)(this,lV,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 lY=new WeakSet,lQ=new WeakSet,lJ=new WeakSet;class lZ extends lX{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,lQ,l0).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?((0,l._)(this,lJ,l1).c
1all(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("linkAnnotation"),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,lY,l$).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),(0,l._)(this,lY,l$).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,lY,l$).call(this)}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,l._)(this,lY,l$).call(this),!this._fieldObjects){D('_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(!lH.has(i)){D("_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,lY),(0,o._)(this,lQ),(0,o._)(this,lJ),this.isTooltipOnly=t.data.isTooltipOnly}}function l$(){this.container.setAttribute("data-internal-link","")}function l0(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,lY,l$).call(this)}function l1(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),(0,l._)(this,lY,l$).call(this)}class l2 extends lX{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 l3 extends lX{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 Q.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}
1a&&(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))}}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":Z.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);e=Math.min(s,n(t/(Math.round(t/(1.35*s))||1)/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=Z.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 l5 extends l3{setPropertyOnSiblings(t,e,i,s){let a=this.annotationStorage;
1for(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),lH.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)&&(r=r.slice(0,a),n.value=h.userValue=r,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;if(!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}
1case"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 l4 extends l3{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class l6 extends l3{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 lH.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 l8 extends l3{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(lH.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 l9 extends lZ{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 l7 extends l3{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");lH.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 ot extends lX{render(){this.container.classList.add("popupAnnotation");let t=this.popup=new oT({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(ta).concat(t)).join(",")),this.container}constructor(t){let{data:e,elements:i}=t;super(t,{isRenderable:lX._hasPopupData(e)}),this.elements=i,this.popup=null}}var oe=new WeakMap,oi=new WeakMap,os=new WeakMap,oa=new WeakMap,on=new WeakMap,or=new WeakMap,ol=new WeakMap,oo=new WeakMap,oh=new WeakMap,od=new WeakMap,oc=new WeakMap,ou=new WeakMap,o_=new WeakMap,op=new WeakMap,og=new WeakMap,of=new WeakMap,ov=new WeakMap,om=new WeakMap,ow=new WeakMap,ob=new WeakMap,oA=new WeakMap,oy=new WeakMap,oS=new WeakSet,ok=new WeakSet,ox=new WeakSet,oE=new WeakSet,oM=new WeakSet,oC=new WeakSet;
1class oT{render(){if((0,s._)(this,o_))return;let t=(0,n._)(this,o_,document.createElement("div"));if(t.className="popup",(0,s._)(this,on)){let e=t.style.outlineColor=Z.makeHexColor(...(0,s._)(this,on));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=Z.makeHexColor(...(0,s._)(this,on).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,ov),t.append(e),(0,s._)(this,oo)){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,oo).valueOf()})),e.append(t)}let a=(0,s._)(this,ob);if(a)lB.render({xfaHtml:a,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let e=this._formatContents((0,s._)(this,ol));t.append(e)}(0,s._)(this,or).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,om,(0,s._)(this,om)||{contentsObj:(0,s._)(this,ol),richText:(0,s._)(this,of)}),i&&(0,n._)(this,op,null),a&&((0,n._)(this,of,(0,l._)(this,oS,oI).call(this,a)),(0,n._)(this,ol,null)),null===(e=(0,s._)(this,o_))||void 0===e||e.remove(),(0,n._)(this,o_,null)}resetEdited(){var t;(0,s._)(this,om)&&({contentsObj:(0,u._)(this,ol).value,richText:(0,u._)(this,of).value}=(0,s._)(this,om),(0,n._)(this,om,null),null===(t=(0,s._)(this,o_))||void 0===t||t.remove(),(0,n._)(this,o_,null),(0,n._)(this,op,null))}forceHide(){(0,n._)(this,ow,this.isVisible),(0,s._)(this,ow)&&((0,s._)(this,or).hidden=!0)}maybeShow(){(0,s._)(this,ow)&&((0,s._)(this,o_)||(0,l._)(this,oM,oW).call(this),(0,n._)(this,ow,!1),(0,s._)(this,or).hidden=!1)}get isVisible(){return!1===(0,s._)(this,or).hidden}constructor({container:t,color:e,elements:i,titleObj:r,modificationDate:h,contentsObj:d,richText:c,parent:u,rect:_,parentRect:p,open:g}){for(let g of((0,a._)(this,ob,{get:oR,set:void 0}),(0,a._)(this,oA,{get:oP,set:void 0}),(0,a._)(this,oy,{get:oL,set:void 0}),(0,o._)(this,oS),(0,o._)(this,ok),(0,o._)(this,ox),(0,o._)(this,oE),(0,o._)(this,oM),(0,o._)(this,oC),(0,a._)(this,oe,{writable:!0,value:void 0}),(0,a._)(this,oi,{writable:!0,value:void 0}),(0,a._)(this,os,{writable:!0,value:void 0}),(0,a._)(this,oa,{writable:!0,value:void 0}),(0,a._)(this,on,{writable:!0,value:void 0}),(0,a._)(this,or,{writable:!0,value:void 0}),(0,a._)(this,ol,{writable:!0,value:void 0}),(0,a._)(this,oo,{writable:!0,value:void 0}),(0,a._)(this,oh,{writable:!0,value:void 0}),(0,a._)(this,od,{writable:!0,value:void 0}),(0,a._)(this,oc,{writable:!0,value:void 0}),(0,a._)(this,ou,{writable:!0,value:void 0}),(0,a._)(this,o_,{writable:!0,value:void 0}),(0,a._)(this,op,{writable:!0,value:void 0}),(0,a._)(this,og,{writable:!0,value:void 0}),(0,a._)(this,of,{writable:!0,value:void 0}),(0,a._)(this,ov,{writable:!0,value:void 0}),(0,a._)(this,om,{writable:!0,value:void 0}),(0,a._)(this,ow,{writable:!0,value:void 0}),(0,n._)(this,oe,(0,l._)(this,ok,oD).bind(this)),(0,n._)(this,oi,(0,l._)(this,oC,oO).bind(this)),(0,n._)(this,os,(0,l._)(this,oM,oW).bind(this)),(0,n._)(this,oa,(0,l._)(this,oE,oN).bind(this)),(0,n._)(this,on,null),(0,n._)(this,or,null),(0,n._)(this,ol,null),(0,n._)(this,oo,null),(0,n._)(this,oh,null),(0,n._)(this,od,null),(0,n._)(this,oc,null),(0,n._)(this,ou,!1),(0,n._)(this,o_,null),(0,n._)(this,op,null),(0,n._)(this,og,null),(0,n._)(this,of,null),(0,n._)(this,ov,null),(0,n._)(this,om,null),(0,n._)(this,ow,!1),(0,n._)(this,or,t),(0,n._)(this,ov,r),(0,n._)(this,ol,d),(0,n._)(this,of,c),(0,n._)(this,od,u),(0,n._)(this,on,e),(0,n._)(this,og,_),(0,n._)(this,oc,p),(0,n._)(this,oh,i),(0,n._)(this,oo,tm.toDateObject(h)),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))g.addEventListener("click",(0,s._)(this,oa)),g.addEventListener("mouseenter",(0,s._)(this,os)),g.addEventListener("mouseleave",(0,s._)(this,oi)),g.classList.add("popupTriggerArea");for(let t of i){var f;null===(f=t.container)||void 0===f||f.addEventListener("keydown",(0,s._)(this,oe))}(0,s._)(this,or).hidden=!0,g&&(0,l._)(this,oE,oN).call(this)}}function oR(){let t=(0,s._)(this,of),e=(0,s._)(this,ol);return(null==t?void 0:t.str)&&(!(null==e?void 0:e.str)||e.str===t.str)&&(0,s._)(this,of).html||null}function oP(){var t,e,i;return(null===(i=(0,s._)(this,ob))||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,ob))||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 oI(t){let e=[],i={style:{color:(0,s._)(this,oy),fontSize:(0,s._)(this,oA)?"calc(".concat((0,s._)(this,oA),"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 oD(t){!(!t.altKey&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&("Enter"===t.key||"Escape"===t.key&&(0,s._)(this,ou)))||(0,l._)(this,oE,oN).call(this)}function oF(){if(null!==(0,s._)(this,op))return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:a,pageY:r}}}=(0,s._)(this,od),l=!!(0,s._)(this,oc),o=l?(0,s._)(this,oc):(0,s._)(this,og);for(let t of(0,s._)(this,oh))if(!o||null!==Z.intersect(t.data.rect,o)){o=t.data.rect,l=!0;break}let h=Z.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,op,[100*(c-a)/e,100*(u-r)/i]);let{style:_}=(0,s._)(this,or);_.left="".concat((0,s._)(this,op)[0],"%"),_.top="".concat((0,s._)(this,op)[1],"%")}function oN(){(0,n._)(this,ou,!(0,s._)(this,ou)),(0,s._)(this,ou)?((0,l._)(this,oM,oW).call(this),(0,s._)(this,or).addEventListener("click",(0,s._)(this,oa)),(0,s._)(this,or).addEventListener("keydown",(0,s._)(this,oe))):((0,l._)(this,oC,oO).call(this),(0,s._)(this,or).removeEventListener("click",(0,s._)(this,oa)),(0,s._)(this,or).removeEventListener("keydown",(0,s._)(this,oe)))}function oW(){(0,s._)(this,o_)||this.render(),this.isVisible?(0,s._)(this,ou)&&(0,s._)(this,or).classList.add("focused"):((0,l._)(this,ox,oF).call(this),(0,s._)(this,or).hidden=!1,(0,s._)(this,or).style.zIndex=parseInt((0,s._)(this,or).style.zIndex)+1e3)}function oO(){(0,s._)(this,or).classList.remove("focused"),!(0,s._)(this,ou)&&this.isVisible&&((0,s._)(this,or).hidden=!0,(0,s._)(this,or).style.zIndex=parseInt((0,s._)(this,or).style.zIndex)-1e3)}
1class oB extends lX{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=S.FREETEXT}}var oH=new WeakMap;class oG extends lX{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,oH,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,oH)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,oH,{writable:!0,value:void 0}),(0,n._)(this,oH,null)}}var oz=new WeakMap;class oj extends lX{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,oz,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,oz)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,oz,{writable:!0,value:void 0}),(0,n._)(this,oz,null)}}var oU=new WeakMap;class oV extends lX{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,oU,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,oU)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,oU,{writable:!0,value:void 0}),(0,n._)(this,oU,null)}}var oq=new WeakMap;class oX extends lX{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,oq,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,oq)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,oq,{writable:!0,value:void 0}),(0,n._)(this,oq,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}}class oK extends oX{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class oY extends lX{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 oQ=new WeakMap,oJ=new WeakMap,oZ=new WeakSet;class o$ extends lX{render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,rotation:e,inkLists:i,borderStyle:a,popupRef:r}}=this,{transform:o,width:h,height:d}=(0,l._)(this,oZ,o0).call(this,e,t),c=this.svgFactory.create(h,d,!0),u=(0,n._)(this,oQ,this.svgFactory.createElement("svg:g"));c.append(u),u.setAttribute("stroke-width",a.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(let t=0,e=i.length;t<e;t++){let e=this.svgFactory.createElement(this.svgElementName);(0,s._)(this,oJ).push(e),e.setAttribute("points",i[t].join(",")),u.append(e)}return!r&&this.hasPopupData&&this._createPopup(),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:i,rect:a}=t,n=(0,s._)(this,oQ);if(e>=0&&n.setAttribute("stroke-width",e||1),i)for(let t=0,e=(0,s._)(this,oJ).length;t<e;t++)(0,s._)(this,oJ)[t].setAttribute("points",i[t].join(","));if(a){let{transform:t,width:e,height:i}=(0,l._)(this,oZ,o0).call(this,this.data.rotation,a);n.parentElement.setAttribute("viewBox","0 0 ".concat(e," ").concat(i)),n.setAttribute("transform",t)}}getElementsToTriggerPopup(){return(0,s._)(this,oJ)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,o._)(this,oZ),(0,a._)(this,oQ,{writable:!0,value:void 0}),(0,a._)(this,oJ,{writable:!0,value:void 0}),(0,n._)(this,oQ,null),(0,n._)(this,oJ,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?S.HIGHLIGHT:S.INK}}function o0(t,e){switch(t){case 90:return{transform:"rotate(90) translate(".concat(-e[0],",").concat(e[1],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:"rotate(180) translate(".concat(-e[2],",").concat(e[1],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:"rotate(270) translate(".concat(-e[2],",").concat(e[3],") scale(1,-1)"),width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:"translate(".concat(-e[0],",").concat(e[3],") scale(1,-1)"),width:e[2]-e[0],height:e[3]-e[1]}}}class o1 extends lX{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=S.HIGHLIGHT}}class o2 extends lX{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 o3 extends lX{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 o5 extends lX{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 o4 extends lX{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=S.STAMP}}var o6=new WeakMap,o8=new WeakSet;class o9 extends lX{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,o8,o7).bind(this)),(0,n._)(this,o6,t);let{isMac:s}=Q.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&(0,l._)(this,o8,o7).c
1all(this)}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return(0,s._)(this,o6)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){var e;super(t,{isRenderable:!0}),(0,o._)(this,o8),(0,a._)(this,o6,{writable:!0,value:void 0}),(0,n._)(this,o6,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 o7(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var ht=new WeakMap,he=new WeakMap,hi=new WeakMap,hs=new WeakMap,ha=new WeakSet,hn=new WeakSet;class hr{hasEditableAnnotations(){return(0,s._)(this,hi).size>0}async render(t){let{annotations:e}=t,i=this.div;tk(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 lO,annotationStorage:t.annotationStorage||new ao,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=lz.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,ha,hl).call(this,o,t.id),i._isEditable){var r;(0,s._)(this,hi).set(i.data.id,i),null===(r=this._annotationEditorUIManager)||void 0===r||r.renderAnnotationElement(i)}}(0,l._)(this,hn,ho).call(this)}update(t){let{viewport:e}=t,i=this.div;this.viewport=e,tk(i,{rotation:e.rotation}),(0,l._)(this,hn,ho).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,s._)(this,hi).values())}getEditableAnnotation(t){return(0,s._)(this,hi).get(t)}constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:r,viewport:l,structTreeLayer:h}){(0,o._)(this,ha),(0,o._)(this,hn),(0,a._)(this,ht,{writable:!0,value:void 0}),(0,a._)(this,he,{writable:!0,value:void 0}),(0,a._)(this,hi,{writable:!0,value:void 0}),(0,a._)(this,hs,{writable:!0,value:void 0}),(0,n._)(this,ht,null),(0,n._)(this,he,null),(0,n._)(this,hi,new Map),(0,n._)(this,hs,null),this.div=t,(0,n._)(this,ht,e),(0,n._)(this,he,i),(0,n._)(this,hs,h||null),this.page=r,this.viewport=l,this.zIndex=0,this._annotationEditorUIManager=s}}async function hl(t,e){var i,a;let n=t.firstChild||t,r=n.id="".concat(ta).concat(e),l=await (null===(i=(0,s._)(this,hs))||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,ht))||void 0===a||a.moveElementInDOM(this.div,t,n,!1)}function ho(){if(!(0,s._)(this,he))return;let t=this.div;for(let[e,i]of(0,s._)(this,he)){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,he).clear()}let hh=/\r\n?|\n/g;var hd=new WeakMap,hc=new WeakMap,hu=new WeakMap,h_=new WeakMap,hp=new WeakMap,hg=new WeakSet,hf=new WeakSet,hv=new WeakSet,hm=new WeakSet,hw=new WeakSet,hb=new WeakSet,hA=new WeakSet;class hy extends sV{static get _keyboardManager(){let t=hy.prototype,e=t=>t.isEmpty(),i=io.TRANSLATE_SMALL,s=io.TRANSLATE_BIG;return O(this,"_keyboardManager",new en([[["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){sV.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
1static updateDefaultParams(t,e){switch(t){case k.FREETEXT_SIZE:hy._defaultFontSize=e;break;case k.FREETEXT_COLOR:hy._defaultColor=e}}updateParams(t,e){switch(t){case k.FREETEXT_SIZE:(0,l._)(this,hg,hS).call(this,e);break;case k.FREETEXT_COLOR:(0,l._)(this,hf,hk).call(this,e)}}static get defaultPropertiesToUpdate(){return[[k.FREETEXT_SIZE,hy._defaultFontSize],[k.FREETEXT_COLOR,hy._defaultColor||sV._defaultLineColor]]}get propertiesToUpdate(){return[[k.FREETEXT_SIZE,(0,s._)(this,hp)],[k.FREETEXT_COLOR,(0,s._)(this,hd)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-hy._internalPadding*t,-(hy._internalPadding+(0,s._)(this,hp))*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(S.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,n._)(this,h_,new AbortController);let t=this._uiManager.combinedSignal((0,s._)(this,h_));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,hu)),this._isDraggable=!0,null===(t=(0,s._)(this,h_))||void 0===t||t.abort(),(0,n._)(this,h_,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(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(null===(e=this._initialOptions)||void 0===e?void 0:e.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,hc),e=(0,n._)(this,hc,(0,l._)(this,hv,hx).call(this).trimEnd());if(t===e)return;let i=t=>{if((0,n._)(this,hc,t),!t){this.remove();return}(0,l._)(this,hw,hC).call(this),this._uiManager.rebuild(this),(0,l._)(this,hm,hE).call(this)};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,l._)(this,hm,hE).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){hy._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,hu)),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,hp),"px * var(--scale-factor))"),i.color=(0,s._)(this,hd),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),t0(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,hw,hC).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,_._)(hy,hy,hR).call(hy,e.getData("text")||"").replaceAll(hh,"\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(hh,"")),t!==this.editorDiv){let e=d;for(let i of this.editorDiv.childNodes){if(i===t){e=c;continue}e.push((0,_._)(hy,hy,hM).call(hy,i))}}d.push(o.nodeValue.slice(0,h).replaceAll(hh,""))}else if(o===this.editorDiv){let t=d,e=0;for(let i of this.editorDiv.childNodes)e++===h&&(t=c),t.push((0,_._)(hy,hy,hM).call(hy,i))}(0,n._)(this,hc,"".concat(d.join("\n")).concat(s).concat(c.join("\n"))),(0,l._)(this,hw,hC).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 oB){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:S.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,hp,t.fontSize),(0,n._)(a,hd,Z.makeHexColor(...t.color)),(0,n._)(a,hc,(0,_._)(hy,hy,hR).call(hy,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=hy._internalPadding*this.parentScale,i=this.getRect(e,e),a=sV._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:(0,s._)(this,hd)),n={annotationType:S.FREETEXT,color:a,fontSize:(0,s._)(this,hp),value:(0,l._)(this,hb,hT).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!(0,l._)(this,hA,hP).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,hp),"px * var(--scale-factor))"),i.color=(0,s._)(this,hd),e.replaceChildren(),(0,s._)(this,hc).split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let a=hy._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(a,a),popupContent:(0,s._)(this,hc)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}constructor(t){super({...t,name:"freeTextEditor"}),(0,o._)(this,hg),(0,o._)(this,hf),(0,o._)(this,hv),(0,o._)(this,hm),(0,o._)(this,hw),(0,o._)(this,hb),(0,o._)(this,hA),(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,n._)(this,hc,""),(0,n._)(this,hu,"".concat(this.id,"-editor")),(0,n._)(this,h_,null),(0,n._)(this,hd,t.color||hy._defaultColor||sV._defaultLineColor),(0,n._)(this,hp,t.fontSize||hy._defaultFontSize)}}function hS(t){let e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-(0,s._)(this,hp))*this.parentScale),(0,n._)(this,hp,t),(0,l._)(this,hm,hE).call(this)},i=(0,s._)(this,hp);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:k.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function hk(t){let e=t=>{(0,n._)(this,hd,this.editorDiv.style.color=t)},i=(0,s._)(this,hd);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:k.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function hx(){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,_._)(hy,hy,hM).call(hy,i)),e=i);return t.join("\n")}function hE(){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 hM(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(hh,"")}function hC(){if(this.editorDiv.replaceChildren(),(0,s._)(this,hc))for(let t of(0,s._)(this,hc).split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function hT(){return(0,s._)(this,hc).replaceAll("\xa0"," ")}function hR(t){return t.replaceAll(" ","\xa0")}function hP(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}hy._freeTextDefaultContent="",hy._internalPadding=0,hy._defaultColor=null,hy._defaultFontSize=10,hy._type="freetext",hy._editorType=S.FREETEXT;class hL{toSVGPath(){F("Abstract method `toSVGPath` must be implemented.")}get box(){F("Abstract getter `box` must be implemented.")}serialize(t,e){F("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,s,a,n){n||(n=new Float32Array(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}static _rescaleAndSwap(t,e,i,s,a,n){n||(n=new Float32Array(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}static _translate(t,e,i,s){s||(s=new Float32Array(t.length));for(let a=0,n=t.length;a<n;a+=2)s[a]=e+t[a],s[a+1]=i+t[a+1];return s}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,s,a){switch(a){case 90:return[1-e/i,t/s];case 180:return[1-t/i,1-e/s];case 270:return[e/i,1-t/s];default:return[t/i,e/s]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,s,a,n){return[(t+5*i)/6,(e+5*s)/6,(5*i+a)/6,(5*s+n)/6,(i+a)/2,(s+n)/2]}}hL.PRECISION=1e-4;var hI=new WeakMap,hD=new WeakMap,hF=new WeakMap,hN=new WeakMap,hW=new WeakMap,hO=new WeakMap,hB=new WeakMap,hH=new WeakMap,hG=new WeakMap,hz=new WeakMap,hj=new WeakMap,hU=new WeakMap,hV=new WeakMap,hq=new WeakSet,hX=new WeakSet,hK=new WeakSet,hY=new WeakSet,hQ=new WeakSet,hJ=new WeakSet,hZ=new WeakSet;class h${isEmpty(){return isNaN((0,s._)(this,hO)[8])}add(t){var e;let{x:i,y:a}=t;(0,n._)(this,hB,i),(0,n._)(this,hH,a);let[r,l,o,h]=(0,s._)(this,hI),[d,c,u,_]=(0,s._)(this,hO).subarray(8,12),p=i-u,g=a-_,f=Math.hypot(p,g);if(f<(0,s._)(this,hG))return!1;let v=f-(0,s._)(this,hz),m=v/f,w=m*p,b=m*g,A=d,y=c;d=u,c=_,u+=w,_+=b,null===(e=(0,s._)(this,hV))||void 0===e||e.push(i,a);let S=-b/v*(0,s._)(this,hU),k=w/v*(0,s._)(this,hU);return((0,s._)(this,hO).set((0,s._)(this,hO).subarray(2,8),0),(0,s._)(this,hO).set([u+S,_+k],4),(0,s._)(this,hO).set((0,s._)(this,hO).subarray(14,18),12),(0,s._)(this,hO).set([u-S,_-k],16),isNaN((0,s._)(this,hO)[6]))?(0===(0,s._)(this,hW).length&&((0,s._)(this,hO).set([d+S,c+k],2),(0,s._)(this,hW).push(NaN,NaN,NaN,NaN,(d+S-r)/o,(c+k-l)/h),(0,s._)(this,hO).set([d-S,c-k],14),(0,s._)(this,hD).push(NaN,NaN,NaN,NaN,(d-S-r)/o,(c-k-l)/h)),(0,s._)(this,hO).set([A,y,d,c,u,_],6),!this.isEmpty()):(((0,s._)(this,hO).set([A,y,d,c,u,_],6),Math.abs(Math.atan2(y-c,A-d)-Math.atan2(b,w))<Math.PI/2)?([d,c,u,_]=(0,s._)(this,hO).subarray(2,6),(0,s._)(this,hW).push(NaN,NaN,NaN,NaN,((d+u)/2-r)/o,((c+_)/2-l)/h),[d,c,A,y]=(0,s._)(this,hO).subarray(14,18),(0,s._)(this,hD).push(NaN,NaN,NaN,NaN,((A+d)/2-r)/o,((y+c)/2-l)/h)):([A,y,d,c,u,_]=(0,s._)(this,hO).subarray(0,6),(0,s._)(this,hW).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,hO).subarray(12,18),(0,s._)(this,hD).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)
1),!0)}toSVGPath(){if(this.isEmpty())return"";let t=(0,s._)(this,hW),e=(0,s._)(this,hD);if(isNaN((0,s._)(this,hO)[6])&&!this.isEmpty())return(0,l._)(this,hX,h3).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,hY,h4).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,hK,h5).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,a,n){return new dl(t,e,i,s,a,n)}getOutlines(){var t,e;let i=(0,s._)(this,hW),a=(0,s._)(this,hD),n=(0,s._)(this,hO),[r,o,h,d]=(0,s._)(this,hI),c=new Float32Array((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,hB)-r)/h,c[c.length-1]=((0,s._)(this,hH)-o)/d,isNaN(n[6])&&!this.isEmpty())return(0,l._)(this,hQ,h6).call(this,c);let u=new Float32Array((0,s._)(this,hW).length+24+(0,s._)(this,hD).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,hZ,h9).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,hJ,h8).call(this,u,_),this.newFreeDrawOutline(u,c,(0,s._)(this,hI),(0,s._)(this,hj),(0,s._)(this,hF),(0,s._)(this,hN))}constructor({x:t,y:e},i,r,l,d,c=0){(0,o._)(this,hq),(0,o._)(this,hX),(0,o._)(this,hK),(0,o._)(this,hY),(0,o._)(this,hQ),(0,o._)(this,hJ),(0,o._)(this,hZ),(0,a._)(this,hI,{writable:!0,value:void 0}),(0,a._)(this,hD,{writable:!0,value:void 0}),(0,a._)(this,hF,{writable:!0,value:void 0}),(0,a._)(this,hN,{writable:!0,value:void 0}),(0,a._)(this,hW,{writable:!0,value:void 0}),(0,a._)(this,hO,{writable:!0,value:void 0}),(0,a._)(this,hB,{writable:!0,value:void 0}),(0,a._)(this,hH,{writable:!0,value:void 0}),(0,a._)(this,hG,{writable:!0,value:void 0}),(0,a._)(this,hz,{writable:!0,value:void 0}),(0,a._)(this,hj,{writable:!0,value:void 0}),(0,a._)(this,hU,{writable:!0,value:void 0}),(0,a._)(this,hV,{writable:!0,value:void 0}),(0,n._)(this,hD,[]),(0,n._)(this,hW,[]),(0,n._)(this,hO,new Float32Array(18)),(0,n._)(this,hV,[]),(0,n._)(this,hI,i),(0,n._)(this,hU,l*r),(0,n._)(this,hN,d),(0,s._)(this,hO).set([NaN,NaN,NaN,NaN,t,e],6),(0,n._)(this,hF,c),(0,n._)(this,hz,(0,h._)(h$,h$,h0)*r),(0,n._)(this,hG,(0,h._)(h$,h$,h1)*r),(0,n._)(this,hj,r),(0,s._)(this,hV).push(t,e)}}var h0={writable:!0,value:8},h1={writable:!0,value:(0,h._)(h$,h$,h0)+(0,h._)(h$,h$,{writable:!0,value:2})};function h2(){let t=(0,s._)(this,hO).subarray(4,6),e=(0,s._)(this,hO).subarray(16,18),[i,a,n,r]=(0,s._)(this,hI);return[((0,s._)(this,hB)+(t[0]-e[0])/2-i)/n,((0,s._)(this,hH)+(t[1]-e[1])/2-a)/r,((0,s._)(this,hB)+(e[0]-t[0])/2-i)/n,((0,s._)(this,hH)+(e[1]-t[1])/2-a)/r]}function h3(){let[t,e,i,a]=(0,s._)(this,hI),[n,r,o,h]=(0,l._)(this,hq,h2).call(this);return"M".concat(((0,s._)(this,hO)[2]-t)/i," ").concat(((0,s._)(this,hO)[3]-e)/a," L").concat(((0,s._)(this,hO)[4]-t)/i," ").concat(((0,s._)(this,hO)[5]-e)/a," L").concat(n," ").concat(r," L").concat(o," ").concat(h," L").concat(((0,s._)(this,hO)[16]-t)/i," ").concat(((0,s._)(this,hO)[17]-e)/a," L").concat(((0,s._)(this,hO)[14]-t)/i," ").concat(((0,s._)(this,hO)[15]-e)/a," Z")}function h5(t){let e=(0,s._)(this,hD);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function h4(t){let[e,i,a,n]=(0,s._)(this,hI),r=(0,s._)(this,hO).subarray(4,6),o=(0,s._)(this,hO).subarray(16,18),[h,d,c,u]=(0,l._)(this,hq,h2).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 h6(t){let e=(0,s._)(this,hO),[i,a,n,r]=(0,s._)(this,hI),[o,h,d,c]=(0,l._)(this,hq,h2).call(this),u=new Float32Array(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,hI),(0,s._)(this,hj),(0,s._)(this,hF),(0,s._)(this,hN))}function h8(t,e){let i=(0,s._)(this,hD);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function h9(t,e){let i=(0,s._)(this,hO).subarray(4,6),a=(0,s._)(this,hO).subarray(16,18),[n,r,o,h]=(0,s._)(this,hI),[d,c,u,_]=(0,l._)(this,hq,h2).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 h7=new WeakMap,dt=new WeakMap,de=new WeakMap,di=new WeakMap,ds=new WeakMap,da=new WeakMap,dn=new WeakMap,dr=new WeakSet;class dl extends hL{toSVGPath(){let t=["M".concat((0,s._)(this,dn)[4]," ").concat((0,s._)(this,dn)[5])];for(let e=6,i=(0,s._)(this,dn).length;e<i;e+=6){if(isNaN((0,s._)(this,dn)[e])){t.push("L".concat((0,s._)(this,dn)[e+4]," ").concat((0,s._)(this,dn)[e+5]));continue}t.push("C".concat((0,s._)(this,dn)[e]," ").concat((0,s._)(this,dn)[e+1]," ").concat((0,s._)(this,dn)[e+2]," ").concat((0,s._)(this,dn)[e+3]," ").concat((0,s._)(this,dn)[e+4]," ").concat((0,s._)(this,dn)[e+5]))}return t.push("Z"),t.join(" ")}serialize(t,e){let i,a,[n,r,l,o]=t,h=l-n,d=o-r;switch(e){case 0:i=hL._rescale((0,s._)(this,dn),n,o,h,-d),a=hL._rescale((0,s._)(this,ds),n,o,h,-d);break;case 90:i=hL._rescaleAndSwap((0,s._)(this,dn),n,r,h,d),a=hL._rescaleAndSwap((0,s._)(this,ds),n,r,h,d);break;case 180:i=hL._rescale((0,s._)(this,dn),l,r,-h,d),a=hL._rescale((0,s._)(this,ds),l,r,-h,d);break;case 270:i=hL._rescaleAndSwap((0,s._)(this,dn),l,o,-h,-d),a=hL._rescaleAndSwap((0,s._)(this,ds),l,o,-h,-d)}return{outline:Array.from(i),points:[Array.from(a)]}}get box(){return(0,s._)(this,dt)}newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new h$(t,e,i,s,a,n)}getNewOutline(t,e){let[i,a,n,r]=(0,s._)(this,dt),[l,o,h,d]=(0,s._)(this,h7),c=n*h,u=r*d,_=i*h+l,p=a*
1d+o,g=this.newOutliner({x:(0,s._)(this,ds)[0]*c+_,y:(0,s._)(this,ds)[1]*u+p},(0,s._)(this,h7),(0,s._)(this,da),t,(0,s._)(this,di),null!=e?e:(0,s._)(this,de));for(let t=2;t<(0,s._)(this,ds).length;t+=2)g.add({x:(0,s._)(this,ds)[t]*c+_,y:(0,s._)(this,ds)[t+1]*u+p});return g.getOutlines()}constructor(t,e,i,r,h,d){super(),(0,o._)(this,dr),(0,a._)(this,h7,{writable:!0,value:void 0}),(0,a._)(this,dt,{writable:!0,value:void 0}),(0,a._)(this,de,{writable:!0,value:void 0}),(0,a._)(this,di,{writable:!0,value:void 0}),(0,a._)(this,ds,{writable:!0,value:void 0}),(0,a._)(this,da,{writable:!0,value:void 0}),(0,a._)(this,dn,{writable:!0,value:void 0}),(0,n._)(this,dt,new Float32Array(4)),(0,n._)(this,dn,t),(0,n._)(this,ds,e),(0,n._)(this,h7,i),(0,n._)(this,da,r),(0,n._)(this,de,h),(0,n._)(this,di,d),this.lastPoint=[NaN,NaN],(0,l._)(this,dr,dh).call(this,d);let[c,u,_,p]=(0,s._)(this,dt);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 dh(t){let e=(0,s._)(this,dn),i=e[4],a=e[5],n=i,r=a,l=i,o=a,h=i,d=a,c=t?Math.max:Math.min;for(let t=6,s=e.length;t<s;t+=6){if(isNaN(e[t]))n=Math.min(n,e[t+4]),r=Math.min(r,e[t+5]),l=Math.max(l,e[t+4]),o=Math.max(o,e[t+5]),d<e[t+5]?(h=e[t+4],d=e[t+5]):d===e[t+5]&&(h=c(h,e[t+4]));else{let s=Z.bezierBoundingBox(i,a,...e.slice(t,t+6));n=Math.min(n,s[0]),r=Math.min(r,s[1]),l=Math.max(l,s[2]),o=Math.max(o,s[3]),d<s[3]?(h=s[2],d=s[3]):d===s[3]&&(h=c(h,s[2]))}i=e[t+4],a=e[t+5]}let u=(0,s._)(this,dt);u[0]=n-(0,s._)(this,de),u[1]=r-(0,s._)(this,de),u[2]=l-n+2*(0,s._)(this,de),u[3]=o-r+2*(0,s._)(this,de),this.lastPoint=[h,d]}var dd=new WeakMap,dc=new WeakMap,du=new WeakMap,d_=new WeakMap,dp=new WeakSet,dg=new WeakSet,df=new WeakSet,dv=new WeakSet,dm=new WeakSet;class dw{getOutlines(){(0,s._)(this,du).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of(0,s._)(this,du))e[3]?(t.push(...(0,l._)(this,dm,dk).call(this,e)),(0,l._)(this,df,dy).call(this,e)):((0,l._)(this,dv,dS).call(this,e),t.push(...(0,l._)(this,dm,dk).call(this,e)));return(0,l._)(this,dp,db).call(this,t)}constructor(t,e=0,i=0,r=!0){(0,o._)(this,dp),(0,o._)(this,dg),(0,o._)(this,df),(0,o._)(this,dv),(0,o._)(this,dm),(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,n._)(this,du,[]),(0,n._)(this,d_,[]);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],g=[o,u,_,!1];(0,s._)(this,du).push(p,g),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,g=d-i,f=(0,s._)(this,du).at(r?-1:-2),v=[f[0],f[2]];for(let t of(0,s._)(this,du)){let[e,i,s]=t;t[0]=(e-p)/u,t[1]=(i-g)/_,t[2]=(s-g)/_}(0,n._)(this,dd,new Float32Array([p,g,u,_])),(0,n._)(this,dc,v)}}function db(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 dM(n,(0,s._)(this,dd),(0,s._)(this,dc))}function dA(t){let e=(0,s._)(this,d_),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 dy(t){let[,e,i]=t,a=(0,l._)(this,dg,dA).call(this,e);(0,s._)(this,d_).splice(a,0,[e,i])}function dS(t){let[,e,i]=t,a=(0,l._)(this,dg,dA).call(this,e);for(let t=a;t<(0,s._)(this,d_).length;t++){let[a,n]=(0,s._)(this,d_)[t];if(a!==e)break;if(a===e&&n===i){(0,s._)(this,d_).splice(t,1);return}}for(let t=a-1;t>=0;t--){let[a,n]=(0,s._)(this,d_)[t];if(a!==e)break;if(a===e&&n===i){(0,s._)(this,d_).splice(t,1);return}}}function dk(t){let[e,i,a]=t,n=[[e,i,a]],r=(0,l._)(this,dg,dA).call(this,a);for(let t=0;t<r;t++){let[i,a]=(0,s._)(this,d_)[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 dx=new WeakMap,dE=new WeakMap;class dM extends hL{toSVGPath(){let t=[];for(let e of(0,s._)(this,dE)){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,dE)){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,dx)}get classNamesForOutlining(){return["highlightOutline"]}constructor(t,e,i){super(),(0,a._)(this,dx,{writable:!0,value:void 0}),(0,a._)(this,dE,{writable:!0,value:void 0}),(0,n._)(this,dE,t),(0,n._)(this,dx,e),this.lastPoint=i}}class dC extends h${newFreeDrawOutline(t,e,i,s,a,n){return new dT(t,e,i,s,a,n)}}class dT extends dl{newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;
1return new dC(t,e,i,s,a,n)}}var dR=new WeakMap,dP=new WeakMap,dL=new WeakMap,dI=new WeakMap,dD=new WeakMap,dF=new WeakMap,dN=new WeakMap,dW=new WeakMap,dO=new WeakMap,dB=new WeakMap,dH=new WeakMap,dG=new WeakSet,dz=new WeakSet,dj=new WeakSet,dU=new WeakSet,dV=new WeakSet,dq=new WeakMap;class dX{static get _keyboardManager(){return O(this,"_keyboardManager",new en([[["Escape","mac+Escape"],dX.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],dX.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],dX.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],dX.prototype._moveToPrevious],[["Home","mac+Home"],dX.prototype._moveToBeginning],[["End","mac+End"],dX.prototype._moveToEnd]]))}renderButton(){let t=(0,n._)(this,dR,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,dB)._signal;t.addEventListener("click",(0,l._)(this,dU,dZ).bind(this),{signal:e}),t.addEventListener("keydown",(0,l._)(this,dj,dJ).bind(this),{signal:e});let i=(0,n._)(this,dP,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=(0,s._)(this,dL),t.append(i),t}renderMainDropdown(){let t=(0,n._)(this,dI,(0,l._)(this,dG,dY).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===(0,s._)(this,dR)){(0,l._)(this,dU,dZ).call(this,t);return}let e=t.target.getAttribute("data-color");e&&(0,l._)(this,dz,dQ).call(this,e,t)}_moveToNext(t){var e,i;if(!(0,s._)(this,dq)){(0,l._)(this,dU,dZ).call(this,t);return}if(t.target===(0,s._)(this,dR)){null===(i=(0,s._)(this,dI).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,dI))||void 0===e?void 0:e.firstChild)||t.target===(0,s._)(this,dR)){(0,s._)(this,dq)&&this._hideDropdownFromKeyboard();return}(0,s._)(this,dq)||(0,l._)(this,dU,dZ).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()}_moveToBeginning(t){var e;if(!(0,s._)(this,dq)){(0,l._)(this,dU,dZ).call(this,t);return}null===(e=(0,s._)(this,dI).firstChild)||void 0===e||e.focus()}_moveToEnd(t){var e;if(!(0,s._)(this,dq)){(0,l._)(this,dU,dZ).call(this,t);return}null===(e=(0,s._)(this,dI).lastChild)||void 0===e||e.focus()}hideDropdown(){var t,e;null===(t=(0,s._)(this,dI))||void 0===t||t.classList.add("hidden"),null===(e=(0,s._)(this,dO))||void 0===e||e.abort(),(0,n._)(this,dO,null)}_hideDropdownFromKeyboard(){if(!(0,s._)(this,dF)){if(!(0,s._)(this,dq)){var t;null===(t=(0,s._)(this,dN))||void 0===t||t.unselect();return}this.hideDropdown(),(0,s._)(this,dR).focus({preventScroll:!0,focusVisible:(0,s._)(this,dD)})}}updateColor(t){if((0,s._)(this,dP)&&((0,s._)(this,dP).style.backgroundColor=t),!(0,s._)(this,dI))return;let e=(0,s._)(this,dB).highlightColors.values();for(let i of(0,s._)(this,dI).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=(0,s._)(this,dR))||void 0===t||t.remove(),(0,n._)(this,dR,null),(0,n._)(this,dP,null),null===(e=(0,s._)(this,dI))||void 0===e||e.remove(),(0,n._)(this,dI,null)}constructor({editor:t=null,uiManager:e=null}){var i;(0,o._)(this,dG),(0,o._)(this,dz),(0,o._)(this,dj),(0,o._)(this,dU),(0,o._)(this,dV),(0,a._)(this,dq,{get:d0,set:void 0}),(0,a._)(this,dR,{writable:!0,value:void 0}),(0,a._)(this,dP,{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,dD,{writable:!0,value:void 0}),(0,a._)(this,dF,{writable:!0,value:void 0}),(0,a._)(this,dN,{writable:!0,value:void 0}),(0,a._)(this,dW,{writable:!0,value:void 0}),(0,a._)(this,dO,{writable:!0,value:void 0}),(0,a._)(this,dB,{writable:!0,value:void 0}),(0,a._)(this,dH,{writable:!0,value:void 0}),(0,n._)(this,dR,null),(0,n._)(this,dP,null),(0,n._)(this,dI,null),(0,n._)(this,dD,!1),(0,n._)(this,dF,!1),(0,n._)(this,dN,null),(0,n._)(this,dO,null),(0,n._)(this,dB,null),t?((0,n._)(this,dF,!1),(0,n._)(this,dH,k.HIGHLIGHT_COLOR),(0,n._)(this,dN,t)):((0,n._)(this,dF,!0),(0,n._)(this,dH,k.HIGHLIGHT_DEFAULT_COLOR)),(0,n._)(this,dB,(null==t?void 0:t._uiManager)||e),(0,n._)(this,dW,(0,s._)(this,dB)._eventBus),(0,n._)(this,dL,(null==t?void 0:t.color)||(null===(i=(0,s._)(this,dB))||void 0===i?void 0:i.highlightColors.values().next().value)||"#FFFF98"),(0,d._)(dX,dX,dK,(0,h._)(dX,dX,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 dY(){let t=document.createElement("div"),e=(0,s._)(this,dB)._signal;for(let[i,a]of(t.addEventListener("contextmenu",tf,{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,dB).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._)(dX,dX,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,dL)),n.addEventListener("click",(0,l._)(this,dz,dQ).bind(this,a),{signal:e}),t.append(n)}return t.addEventListener("keydown",(0,l._)(this,dj,dJ).bind(this),{signal:e}),t}function dQ(t,e){e.stopPropagation(),(0,s._)(this,dW).dispatch("switchannotationeditorparams",{source:this,type:(0,s._)(this,dH),value:t})}function dJ(t){dX._keyboardManager.exec(this,t)}function dZ(t){if((0,s._)(this,dq)){this.hideDropdown();return}if((0,n._)(this,dD,0===t.detail),(0,s._)(this,dO)||((0,n._)(this,dO,new AbortController),window.addEventListener("pointerdown",(0,l._)(this,dV,d$).bind(this),{signal:(0,s._)(this,dB).combinedSignal((0,s._)(this,dO))})),(0,s._)(this,dI)){(0,s._)(this,dI).classList.remove("hidden");return}let e=(0,n._)(this,dI,(0,l._)(this,dG,dY).call(this));(0,s._)(this,dR).append(e)}function d$(t){var e;null!==(e=(0,s._)(this,dI))&&void 0!==e&&e.contains(t.target)||this.hideDropdown()}function d0(){return(0,s._)(this,dI)&&!(0,s._)(this,dI).classList.contains("hidden")}var d1=new WeakMap,d2=new WeakMap,d3=new WeakMap,d5=new WeakMap,d4=new WeakMap,d6=new WeakMap,d8=new WeakMap,d9=new WeakMap,d7=new WeakMap,ct=new WeakMap,ce=new WeakMap,ci=new WeakMap,cs=new WeakMap,ca=new WeakMap,cn=new WeakMap,cr=new WeakMap,cl=new WeakMap,co=new WeakMap,ch=new WeakSet,cd=new WeakSet,cc=new WeakSet,cu=new WeakSet,c_=new WeakSet,cp=new WeakSet,cg=new WeakSet,cf=new WeakSet,cv=new WeakSet,cm=new WeakSet,cw=new WeakSet,cb=new WeakSet,cA=new WeakSet;class cy extends sV{static get _keyboardManager(){let t=cy.prototype;return O(this,"_keyboardManager",new en([[["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,ci)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:(0,s._)(this,cl),methodOfCreation:(0,s._)(this,co)}}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;sV.initialize(t,e),cy._defaultColor||(cy._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case k.HIGHLIGHT_DEFAULT_COLOR:cy._defaultColor=e;break;case k.HIGHLIGHT_THICKNESS:cy._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,s._)(this,cs)}updateParams(t,e){switch(t){case k.HIGHLIGHT_COLOR:(0,l._)(this,cc,cx).call(this,e);break;case k.HIGHLIGHT_THICKNESS:(0,l._)(this,cu,cE).call(this,e)}}static get defaultPropertiesToUpdate(){return[[k.HIGHLIGHT_DEFAULT_COLOR,cy._defaultColor],[k.HIGHLIGHT_THICKNESS,cy._defaultThickness]]}get propertiesToUpdate(){return[[k.HIGHLIGHT_COLOR,this.color||cy._defaultColor],[k.HIGHLIGHT_THICKNESS,(0,s._)(this,cl)||cy._defaultThickness],[k.HIGHLIGHT_FREE,(0,s._)(this,ci)]]}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&((0,n._)(this,d4,new dX({editor:this})),t.addColorPicker((0,s._)(this,d4))),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,cm,cI).c
1all(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,l._)(this,cm,cI).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){(0,l._)(this,cp,cC).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,l._)(this,cg,cT).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,l._)(this,cp,cC).call(this);else if(t){var i;(0,l._)(this,cg,cT).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,ci)?(t=(t-this.rotation+360)%360,e=(0,_._)(cy,cy,cR).call(cy,(0,s._)(this,ct).box,t)):e=(0,_._)(cy,cy,cR).call(cy,[this.x,this.y,this.width,this.height],t),i.updateProperties((0,s._)(this,ce),{bbox:e,root:{"data-main-rotation":t}}),i.updateProperties((0,s._)(this,cn),{bbox:(0,_._)(cy,cy,cR).call(cy,(0,s._)(this,d6).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();(0,s._)(this,cr)&&(t.setAttribute("aria-label",(0,s._)(this,cr)),t.setAttribute("role","mark")),(0,s._)(this,ci)?t.classList.add("free"):this.div.addEventListener("keydown",(0,l._)(this,cf,cP).bind(this),{signal:this._uiManager._signal});let e=(0,n._)(this,d7,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,s._)(this,d5);let[i,a]=this.parentDimensions;return this.setDims(this.width*i,this.height*a),t0(this,(0,s._)(this,d7),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){if(!this.isSelected){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,s._)(this,cn),{rootClass:{hovered:!0}})}}pointerleave(){if(!this.isSelected){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,s._)(this,cn),{rootClass:{hovered:!1}})}}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,l._)(this,cv,cL).call(this,!0);break;case 1:case 3:(0,l._)(this,cv,cL).call(this,!1)}}select(){var t;super.select(),(0,s._)(this,cn)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,s._)(this,cn),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),(0,s._)(this,cn)&&(null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties((0,s._)(this,cn),{rootClass:{selected:!1}}),(0,s._)(this,ci)||(0,l._)(this,cv,cL).call(this,!1))}get _mustFixPosition(){return!(0,s._)(this,ci)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.updateProperties((0,s._)(this,ce),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties((0,s._)(this,cn),{rootClass:{hidden:!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,cy,cW).call(cy,t,e)};window.addEventListener("blur",u,{signal:c}),window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("pointerdown",tv,{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",tf,{signal:c}),s.addEventListener("pointermove",(0,_._)(this,cy,cN).bind(this,t),{signal:c}),this._freeHighlight=new dC({x:a,y:n},[r,l,o,h],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(t,e,i){let a=null;if(t instanceof o1){let{data:{quadPoints:e,rect:i,rotation:s,id:n,color:r,opacity:l,popupRef:o},parent:{page:{pageNumber:h}}}=t;a=t={annotationType:S.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 o$){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:S.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=Z.makeHexColor(...r),(0,n._)(c,ca,d||1),h&&(0,n._)(c,cl,t.thickness),c.annotationElementId=t.id||null,c._initialData=a;let[u,_]=c.pageDimensions,[p,g]=c.pageTranslation;if(o){let t=(0,n._)(c,d3,[]);for(let e=0;e<o.length;e+=8)t.push({x:(o[e]-p)/u,y:1-(o[e+1]-g)/_,width:(o[e+2]-o[e])/u,height:(o[e+1]-o[e+5])/_});(0,l._)(c,ch,cS).call(c),(0,l._)(c,cg,cT).call(c),c.rotate(c.rotation)}else if(h){(0,n._)(c,ci,!0);let t=h[0],i={x:t[0]-p,y:_-(t[1]-g)},a=new dC(i,[0,0,u,_],1,(0,s._)(c,cl)/2,!0,.001);for(let e=0,s=t.length;e<s;e+=2)i.x=t[e]-p,i.y=_-(t[e+1]-g),a.add(i);let{id:r,clipPathId:o}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:c.color,"fill-opacity":c._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:a.toSVGPath()}},!0,!0);(0,l._)(c,cd,ck).call(c,{highlightOutlines:a.getOutlines(),highlightId:r,clipPathId:o}),(0,l._)(c,cg,cT).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=sV._colorManager.convert(this.color),a={annotationType:S.HIGHLIGHT,color:i,opacity:(0,s._)(this,ca),thickness:(0,s._)(this,cl),quadPoints:(0,l._)(this,cw,cD).call(this),outlines:(0,l._)(this,cb,cF).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:(0,l._)(this,cm,cI).c
1all(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!(0,l._)(this,cA,cO).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,ch),(0,o._)(this,cd),(0,o._)(this,cc),(0,o._)(this,cu),(0,o._)(this,c_),(0,o._)(this,cp),(0,o._)(this,cg),(0,o._)(this,cf),(0,o._)(this,cv),(0,o._)(this,cm),(0,o._)(this,cw),(0,o._)(this,cb),(0,o._)(this,cA),(0,a._)(this,d1,{writable:!0,value:void 0}),(0,a._)(this,d2,{writable:!0,value:void 0}),(0,a._)(this,d3,{writable:!0,value:void 0}),(0,a._)(this,d5,{writable:!0,value:void 0}),(0,a._)(this,d4,{writable:!0,value:void 0}),(0,a._)(this,d6,{writable:!0,value:void 0}),(0,a._)(this,d8,{writable:!0,value:void 0}),(0,a._)(this,d9,{writable:!0,value:void 0}),(0,a._)(this,d7,{writable:!0,value:void 0}),(0,a._)(this,ct,{writable:!0,value:void 0}),(0,a._)(this,ce,{writable:!0,value:void 0}),(0,a._)(this,ci,{writable:!0,value:void 0}),(0,a._)(this,cs,{writable:!0,value:void 0}),(0,a._)(this,ca,{writable:!0,value:void 0}),(0,a._)(this,cn,{writable:!0,value:void 0}),(0,a._)(this,cr,{writable:!0,value:void 0}),(0,a._)(this,cl,{writable:!0,value:void 0}),(0,a._)(this,co,{writable:!0,value:void 0}),(0,n._)(this,d1,null),(0,n._)(this,d2,0),(0,n._)(this,d5,null),(0,n._)(this,d4,null),(0,n._)(this,d6,null),(0,n._)(this,d8,null),(0,n._)(this,d9,0),(0,n._)(this,d7,null),(0,n._)(this,ct,null),(0,n._)(this,ce,null),(0,n._)(this,ci,!1),(0,n._)(this,cs,null),(0,n._)(this,cn,null),(0,n._)(this,cr,""),(0,n._)(this,co,""),this.color=t.color||cy._defaultColor,(0,n._)(this,cl,t.thickness||cy._defaultThickness),(0,n._)(this,ca,t.opacity||cy._defaultOpacity),(0,n._)(this,d3,t.boxes||null),(0,n._)(this,co,t.methodOfCreation||""),(0,n._)(this,cr,t.text||""),this._isDraggable=!1,t.highlightId>-1?((0,n._)(this,ci,!0),(0,l._)(this,cd,ck).call(this,t),(0,l._)(this,cg,cT).call(this)):(0,s._)(this,d3)&&((0,n._)(this,d1,t.anchorNode),(0,n._)(this,d2,t.anchorOffset),(0,n._)(this,d8,t.focusNode),(0,n._)(this,d9,t.focusOffset),(0,l._)(this,ch,cS).call(this),(0,l._)(this,cg,cT).call(this),this.rotate(this.rotation))}}function cS(){let t=new dw((0,s._)(this,d3),.001);(0,n._)(this,ct,t.getOutlines()),[this.x,this.y,this.width,this.height]=(0,s._)(this,ct).box;let e=new dw((0,s._)(this,d3),.0025,.001,"ltr"===this._uiManager.direction);(0,n._)(this,d6,e.getOutlines());let{lastPoint:i}=(0,s._)(this,d6);(0,n._)(this,cs,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function ck(t){let{highlightOutlines:e,highlightId:i,clipPathId:a}=t;if((0,n._)(this,ct,e),(0,n._)(this,d6,e.getNewOutline((0,s._)(this,cl)/2+1.5,.0025)),i>=0)(0,n._)(this,ce,i),(0,n._)(this,d5,a),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),(0,n._)(this,cn,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:(0,s._)(this,d6).box,path:{d:(0,s._)(this,d6).toSVGPath()}},!0));else if(this.parent){let t=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties((0,s._)(this,ce),{bbox:(0,_._)(cy,cy,cR).call(cy,(0,s._)(this,ct).box,(t-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties((0,s._)(this,cn),{bbox:(0,_._)(cy,cy,cR).call(cy,(0,s._)(this,d6).box,t),path:{d:(0,s._)(this,d6).toSVGPath()}})}let[r,l,o,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,d6);(0,n._)(this,cs,[(d[0]-r)/o,(d[1]-l)/h])}function cx(t){let e=(t,e)=>{var i,a;this.color=t,(0,n._)(this,ca,e),null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties((0,s._)(this,ce),{root:{fill:t,"fill-opacity":e}}),null===(a=(0,s._)(this,d4))||void 0===a||a.updateColor(t)},i=this.color,a=(0,s._)(this,ca);this.addCommands({cmd:e.bind(this,t,cy._defaultOpacity),undo:e.bind(this,i,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:k.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,cl),i=t=>
1{(0,n._)(this,cl,t),(0,l._)(this,c_,cM).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:k.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function cM(t){if(!(0,s._)(this,ci))return;(0,l._)(this,cd,ck).call(this,{highlightOutlines:(0,s._)(this,ct).getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function cC(){null!==(0,s._)(this,ce)&&this.parent&&(this.parent.drawLayer.remove((0,s._)(this,ce)),(0,n._)(this,ce,null),this.parent.drawLayer.remove((0,s._)(this,cn)),(0,n._)(this,cn,null))}function cT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===(0,s._)(this,ce)&&({id:(0,u._)(this,ce).value,clipPathId:(0,u._)(this,d5).value}=t.drawLayer.draw({bbox:(0,s._)(this,ct).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":(0,s._)(this,ca)},rootClass:{highlight:!0,free:(0,s._)(this,ci)},path:{d:(0,s._)(this,ct).toSVGPath()}},!1,!0),(0,n._)(this,cn,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:(0,s._)(this,ci)},bbox:(0,s._)(this,d6).box,path:{d:(0,s._)(this,d6).toSVGPath()}},(0,s._)(this,ci))),(0,s._)(this,d7)&&((0,s._)(this,d7).style.clipPath=(0,s._)(this,d5)))}function cR(t,e){let[i,s,a,n]=t;switch(e){case 90:return[1-s-n,i,n,a];case 180:return[1-i-a,1-s-n,a,n];case 270:return[s,1-i-a,n,a]}return[i,s,a,n]}function cP(t){cy._keyboardManager.exec(this,t)}function cL(t){if(!(0,s._)(this,d1))return;let e=window.getSelection();t?e.setPosition((0,s._)(this,d1),(0,s._)(this,d2)):e.setPosition((0,s._)(this,d8),(0,s._)(this,d9))}function cI(){return(0,s._)(this,ci)?this.rotation:0}function cD(){if((0,s._)(this,ci))return null;let[t,e]=this.pageDimensions,[i,a]=this.pageTranslation,n=(0,s._)(this,d3),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)*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 cF(t){return(0,s._)(this,ct).serialize(t,(0,l._)(this,cm,cI).call(this))}function cN(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}function cW(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 cO(t){let{color:e}=this._initialData;return t.color.some((t,i)=>t!==e[i])}cy._defaultColor=null,cy._defaultOpacity=1,cy._defaultThickness=12,cy._type="highlight",cy._editorType=S.HIGHLIGHT,cy._freeHighlightId=-1,cy._freeHighlight=null,cy._freeHighlightClipId="";var cB=new WeakMap;class cH{updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,i]of Object.entries(t))this.updateProperty(e,i)}updateSVGProperty(t,e){(0,s._)(this,cB)[t]=e}toSVGProperties(){let t=(0,s._)(this,cB);return(0,n._)(this,cB,Object.create(null)),{root:t}}reset(){(0,n._)(this,cB,Object.create(null))}updateAll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this.updateProperties(t)}clone(){F("Not implemented")}constructor(){(0,a._)(this,cB,{writable:!0,value:void 0}),(0,n._)(this,cB,Object.create(null))}}var cG=new WeakMap,cz=new WeakMap,cj=new WeakSet,cU=new WeakSet,cV=new WeakSet,cq=new WeakSet,cX=new WeakSet,cK=new WeakSet,cY=new WeakSet,cQ=new WeakSet;class cJ extends sV{static _mergeSVGProperties(t,e){let i=new Set(Object.keys(t));for(let[s,a]of Object.entries(e))i.has(s)?Object.assign(t[s],a):t[s]=a;return t}static getDefaultDrawingOptions(t){F("Not implemented")}static get typesMap(){F("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){let i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&((0,h._)(cJ,cJ,cZ).updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[i,s]of this.typesMap)t.push([i,e[s]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[i,s]of this.constructor.typesMap)t.push([i,e[s]]);return t}_updateProperty(t,e,i){let a=this._drawingOptions,n=a[e],r=t=>{var i;a.updateProperty(e,t);let n=(0,s._)(this,cG).updateProperty(e,t);n&&(0,l._)(this,cY,ue).call(this,n),null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,a.toSVGProperties())};this.addCommands({cmd:r.bind(this,i),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,cJ._mergeSVGProperties((0,s._)(this,cG).getPathResizingSVGProperties((0,l._)(this,cK,ut).call(this)),{bbox:(0,l._)(this,cQ,ui).call(this)}))}_onResized(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,cJ._mergeSVGProperties((0,s._)(this,cG).getPathResizedSVGProperties((0,l._)(this,cK,ut).call(this)),{bbox:(0,l._)(this,cQ,ui).call(this)}))}_onTranslating(t,e){var i;null===(i=this.parent)||void 0===i||i.drawLayer.updateProperties(this._drawId,{bbox:(0,l._)(this,cQ,ui).call(this,t,e)})}_onTranslated(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,cJ._mergeSVGProperties((0,s._)(this,cG).getPathTranslatedSVGProperties((0,l._)(this,cK,ut).call(this),this.parentDimensions),{bbox:(0,l._)(this,cQ,ui).call(this)}))}_onStartDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;null===(t=this.parent)||void 0===t||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,(0,s._)(this,cz)&&((0,n._)(this,cz,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){(0,l._)(this,cV,c8).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,l._)(this,cq,c9).call(this),(0,l._)(this,cY,ue).call(this,(0,s._)(this,cG).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)this._uiManager.removeShouldRescale(this),(0,l._)(this,cV,c8).call(this);else if(t){var i;this._uiManager.addShouldRescale(this),(0,l._)(this,cq,c9).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),e&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,cJ._mergeSVGProperties({bbox:(0,l._)(this,cQ,ui).call(this)},(0,s._)(this,cG).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&(0,l._)(this,cY,ue).call(this,(0,s._)(this,cG).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}
1render(){if(this.div)return this.div;let t=super.render();t.classList.add("draw");let e=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal";let[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),this._uiManager.addShouldRescale(this),this.disableEditing(),t}static createDrawerInstance(t,e,i,s,a){F("Not implemented")}static startDrawing(t,e,i,s){var a,n;let{target:r,offsetX:l,offsetY:o,pointerId:c,pointerType:u}=s;if((0,h._)(cJ,cJ,c2)&&(0,h._)(cJ,cJ,c2)!==u)return;let{viewport:{rotation:_}}=t,{width:p,height:g}=r.getBoundingClientRect(),f=(0,d._)(cJ,cJ,c$,new AbortController),v=t.combinedSignal(f);if((0,d._)(cJ,cJ,c1,(0,h._)(cJ,cJ,c1)||c),(0,d._)(cJ,cJ,c2,null!==(n=(0,h._)(cJ,cJ,c2))&&void 0!==n?n:u),window.addEventListener("pointerup",t=>{if((0,h._)(cJ,cJ,c1)===t.pointerId)this._endDraw(t);else{var e;null===(e=(0,h._)(cJ,cJ,c3))||void 0===e||e.delete(t.pointerId)}},{signal:v}),window.addEventListener("pointercancel",t=>{if((0,h._)(cJ,cJ,c1)===t.pointerId)this._currentParent.endDrawingSession();else{var e;null===(e=(0,h._)(cJ,cJ,c3))||void 0===e||e.delete(t.pointerId)}},{signal:v}),window.addEventListener("pointerdown",t=>{(0,h._)(cJ,cJ,c2)===t.pointerType&&((0,d._)(cJ,cJ,c3,(0,h._)(cJ,cJ,c3)||new Set).add(t.pointerId),(0,h._)(cJ,cJ,cZ).isCancellable()&&((0,h._)(cJ,cJ,cZ).removeLastElement(),(0,h._)(cJ,cJ,cZ).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:v}),window.addEventListener("contextmenu",tf,{signal:v}),r.addEventListener("pointermove",this._drawMove.bind(this),{signal:v}),r.addEventListener("touchmove",t=>{t.timeStamp===(0,h._)(cJ,cJ,c5)&&tv(t)},{signal:v}),t.toggleDrawing(),null===(a=e._editorUndoBar)||void 0===a||a.hide(),(0,h._)(cJ,cJ,cZ)){t.drawLayer.updateProperties(this._currentDrawId,(0,h._)(cJ,cJ,cZ).startNew(l,o,p,g,_));return}e.updateUIForDefaultProperties(this),(0,d._)(cJ,cJ,cZ,this.createDrawerInstance(l,o,p,g,_)),(0,d._)(cJ,cJ,c0,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties((0,h._)(cJ,cJ,c0).toSVGProperties(),(0,h._)(cJ,cJ,cZ).defaultSVGProperties),!0,!1)}static _drawMove(t){var e;if((0,d._)(cJ,cJ,c5,-1),!(0,h._)(cJ,cJ,cZ))return;let{offsetX:i,offsetY:s,pointerId:a}=t;if((0,h._)(cJ,cJ,c1)===a){if((null===(e=(0,h._)(cJ,cJ,c3))||void 0===e?void 0:e.size)>=1){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,(0,h._)(cJ,cJ,cZ).add(i,s)),(0,d._)(cJ,cJ,c5,t.timeStamp),tv(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,(0,d._)(cJ,cJ,cZ,null),(0,d._)(cJ,cJ,c0,null),(0,d._)(cJ,cJ,c2,null),(0,d._)(cJ,cJ,c5,NaN)),(0,h._)(cJ,cJ,c$)&&((0,h._)(cJ,cJ,c$).abort(),(0,d._)(cJ,cJ,c$,null),(0,d._)(cJ,cJ,c1,NaN),(0,d._)(cJ,cJ,c3,null))}static _endDraw(t){let e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),t&&e.drawLayer.updateProperties(this._currentDrawId,(0,h._)(cJ,cJ,cZ).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let t=(0,h._)(cJ,cJ,cZ),i=this._currentDrawId,s=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(s))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:k.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(k.DRAW_STEP),!(0,h._)(cJ,cJ,cZ).isEmpty()){let{pageDimensions:[i,s],scale:a}=e,n=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:(0,h._)(cJ,cJ,cZ).getOutlines(i*a,s*a,a,this._INNER_MARGIN),drawingOptions:(0,h._)(cJ,cJ,c0),mustBeCommitted:!t});return this._cleanup(!0),n}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,s,a,n){F("Not implemented")}static async deserialize(t,e,i){let{rawDims:{pageWidth:s,pageHeight:a,pageX:n,pageY:r}}=e.viewport,o=this.deserializeDraw(n,r,s,a,this._INNER_MARGIN,t),h=await super.deserialize(t,e,i);return h.createDrawingOptions(t),(0,l._)(h,cj,c4).call(h,{drawOutlines:o}),(0,l._)(h,cq,c9).call(h),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){let[e,i]=this.pageTranslation,[a,n]=this.pageDimensions;
1return(0,s._)(this,cG).serialize([e,i,a,n],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}constructor(t){super(t),(0,o._)(this,cj),(0,o._)(this,cU),(0,o._)(this,cV),(0,o._)(this,cq),(0,o._)(this,cX),(0,o._)(this,cK),(0,o._)(this,cY),(0,o._)(this,cQ),(0,a._)(this,cG,{writable:!0,value:void 0}),(0,a._)(this,cz,{writable:!0,value:void 0}),(0,n._)(this,cG,null),this._drawId=null,(0,n._)(this,cz,t.mustBeCommitted||!1),t.drawOutlines&&((0,l._)(this,cj,c4).call(this,t),(0,l._)(this,cq,c9).call(this))}}cJ._currentDrawId=-1,cJ._currentParent=null;var cZ={writable:!0,value:null},c$={writable:!0,value:null},c0={writable:!0,value:null},c1={writable:!0,value:NaN},c2={writable:!0,value:null},c3={writable:!0,value:null},c5={writable:!0,value:NaN};function c4(t){let{drawOutlines:e,drawId:i,drawingOptions:s}=t;(0,n._)(this,cG,e),this._drawingOptions||(this._drawingOptions=s),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=(0,l._)(this,cU,c6).call(this,e,this.parent),(0,l._)(this,cY,ue).call(this,e.box)}function c6(t,e){let{id:i}=e.drawLayer.draw(cJ._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}function c8(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}function c9(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;if(null===this._drawId||this.parent!==t){if(null!==this._drawId){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=(0,l._)(this,cU,c6).call(this,(0,s._)(this,cG),t)}}function c7(t){let[e,i,s,a]=t,{parentDimensions:[n,r],rotation:l}=this;switch(l){case 90:return[i,1-e,r/n*s,n/r*a];case 180:return[1-e,1-i,s,a];case 270:return[1-i,e,r/n*s,n/r*a];default:return[e,i,s,a]}}function ut(){let{x:t,y:e,width:i,height:s,parentDimensions:[a,n],rotation:r}=this;switch(r){case 90:return[1-e,t,a/n*i,n/a*s];case 180:return[1-t,1-e,i,s];case 270:return[e,1-t,a/n*i,n/a*s];default:return[t,e,i,s]}}function ue(t){if([this.x,this.y,this.width,this.height]=(0,l._)(this,cX,c7).call(this,t),this.div){this.fixAndSetPosition();let[t,e]=this.parentDimensions;this.setDims(this.width*t,this.height*e)}this._onResized()}function ui(){let{x:t,y:e,width:i,height:s,rotation:a,parentRotation:n,parentDimensions:[r,l]}=this;switch((4*a+n)/90){case 1:return[1-e-s,t,s,i];case 2:return[1-t-i,1-e-s,i,s];case 3:return[e,1-t-i,s,i];case 4:return[t,e-r/l*i,l/r*s,r/l*i];case 5:return[1-e,t,r/l*i,l/r*s];case 6:return[1-t-l/r*s,1-e,l/r*s,r/l*i];case 7:return[e-r/l*i,1-t-l/r*s,r/l*i,l/r*s];case 8:return[t-i,e-s,i,s];case 9:return[1-e,t-i,s,i];case 10:return[1-t,1-e,i,s];case 11:return[e-s,1-t,s,i];case 12:return[t-l/r*s,e,l/r*s,r/l*i];case 13:return[1-e-r/l*i,t-l/r*s,r/l*i,l/r*s];case 14:return[1-t,1-e-r/l*i,l/r*s,r/l*i];case 15:return[e,1-t,r/l*i,l/r*s];default:return[t,e,i,s]}}cJ._INNER_MARGIN=3;var us=new WeakMap,ua=new WeakMap,un=new WeakMap,ur=new WeakMap,ul=new WeakMap,uo=new WeakMap,uh=new WeakMap,ud=new WeakMap,uc=new WeakMap,uu=new WeakMap,u_=new WeakMap,up=new WeakSet;class ug{updateProperty(t,e){"stroke-width"===t&&(0,n._)(this,ul,e)}isEmpty(){return!(0,s._)(this,un)||0===(0,s._)(this,un).length}isCancellable(){return(0,s._)(this,uo).length<=10}add(t,e){[t,e]=(0,l._)(this,up,uf).call(this,t,e);let[i,a,n,r]=(0,s._)(this,us).subarray(2,6),o=t-n,h=e-r;return 2>=Math.hypot((0,s._)(this,uu)*o,(0,s._)(this,u_)*h)?null:(((0,s._)(this,uo).push(t,e),isNaN(i))?((0,s._)(this,us).set([n,r,t,e],2),(0,s._)(this,ua).push(NaN,NaN,NaN,NaN,t,e)):(isNaN((0,s._)(this,us)[0])&&(0,s._)(this,ua).splice(6,6),(0,s._)(this,us).set([i,a,n,r,t,e],0),(0,s._)(this,ua).push(...hL.createBezierPoints(i,a,n,r,t,e))),{path:{d:this.toSVGPath()}})}end(t,e){return this.add(t,e)||(2===(0,s._)(this,uo).length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,a,r){(0,n._)(this,uu,i),(0,n._)(this,u_,a),(0,n._)(this,ur,r),[t,e]=(0,l._)(this,up,uf).call(this,t,e);let o=(0,n._)(this,ua,[NaN,NaN,NaN,NaN,t,e]);(0,n._)(this,uo,[t,e]);let h=(0,s._)(this,un).at(-1);return h&&(h.line=new Float32Array(h.line),h.points=new Float32Array(h.points)),(0,s._)(this,un).push({line:o,points:(0,s._)(this,uo)}),(0,s._)(this,us).set(o,0),(0,n._)(this,ud,0),this.toSVGPath(),null}getLastElement(){return(0,s._)(this,un).at(-1)}setLastElement(t){return(0,s._)(this,un)?((0,s._)(this,un).push(t),(0,n._)(this,ua,t.line),(0,n._)(this,uo,t.points),(0,n._)(this,ud,0),{path:{d:this.toSVGPath()}}):(0,s._)(this,uc).setLastElement(t)}removeLastElement(){if(!(0,s._)(this,un))return(0,s._)(this,uc).removeLastElement();(0,s._)(this,un).pop(),(0,n._)(this,uh,"");for(let t=0,e=(0,s._)(this,un).length;t<e;t++){let{line:e,points:i}=(0,s._)(this,un)[t];(0,n._)(this,ua,e),(0,n._)(this,uo,i),(0,n._)(this,ud,0),this.toSVGPath()}return{path:{d:(0,s._)(this,uh)}}}toSVGPath(){let t=hL.svgRound((0,s._)(this,ua)[4]),e=hL.svgRound((0,s._)(this,ua)[5]);if(2===(0,s._)(this,uo).length)return(0,n._)(this,uh,"".concat((0,s._)(this,uh)," M ").concat(t," ").concat(e," Z")),(0,s._)(this,uh);if((0,s._)(this,uo).length<=6){let i=(0,s._)(this,uh).lastIndexOf("M");(0,n._)(this,uh,"".concat((0,s._)(this,uh).slice(0,i)," M ").concat(t," ").concat(e)),(0,n._)(this,ud,6)}if(4===(0,s._)(this,uo).length){let t=hL.svgRound((0,s._)(this,ua)[10]),e=hL.svgRound((0,s._)(this,ua)[11]);return(0,n._)(this,uh,"".concat((0,s._)(this,uh)," L ").concat(t," ").concat(e)),(0,n._)(this,ud,12),(0,s._)(this,uh)}let i=[];0===(0,s._)(this,ud)&&(i.push("M ".concat(t," ").concat(e)),(0,n._)(this,ud,6));for(let t=(0,s._)(this,ud),e=(0,s._)(this,ua).length;t<e;t+=6){let[e,a,n,r,l,o]=(0,s._)(this,ua).slice(t,t+6).map(hL.svgRound);i.push("C".concat(e," ").concat(a," ").concat(n," ").concat(r," ").concat(l," ").concat(o))}return(0,n._)(this,uh,(0,s._)(this,uh)+i.join(" ")),(0,n._)(this,ud,(0,s._)(this,ua).length),(0,s._)(this,uh)}getOutlines(t,e,i,a){let r=(0,s._)(this,un).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),(0,s._)(this,uc).build((0,s._)(this,un),t,e,i,(0,s._)(this,ur),(0,s._)(this,ul),a),(0,n._)(this,us,null),(0,n._)(this,ua,null),(0,n._)(this,un,null),(0,n._)(this,uh,null),(0,s._)(this,uc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}constructor(t,e,i,r,h,d){(0,o._)(this,up),(0,a._)(this,us,{writable:!0,value:void 0}),(0,a._)(this,ua,{writable:!0,value:void 0}),(0,a._)(this,un,{writable:!0,value:void 0}),(0,a._)(this,ur,{writable:!0,value:void 0}),(0,a._)(this,ul,{writable:!0,value:void 0}),(0,a._)(this,uo,{writable:!0,value:void 0}),(0,a._)(this,uh,{writable:!0,value:void 0}),(0,a._)(this,ud,{writable:!0,value:void 0}),(0,a._)(this,uc,{writable:!0,value:void 0}),(0,a._)(this,uu,{writable:!0,value:void 0}),(0,a._)(this,u_,{writable:!0,value:void 0}),(0,n._)(this,us,new Float64Array(6)),(0,n._)(this,uh,""),(0,n._)(this,ud,0),(0,n._)(this,uc,new uR),(0,n._)(this,uu,i),(0,n._)(this,u_,r),(0,n._)(this,ur,h),(0,n._)(this,ul,d),[t,e]=(0,l._)(this,up,uf).call(this,t,e);let c=(0,n._)(this,ua,[NaN,NaN,NaN,NaN,t,e]);(0,n._)(this,uo,[t,e]),(0,n._)(this,un,[{line:c,points:(0,s._)(this,uo)}]),(0,s._)(this,us).set(c,0)}}function uf(t,e){return hL._normalizePoint(t,e,(0,s._)(this,uu),(0,s._)(this,u_),(0,s._)(this,ur))}var uv=new WeakMap,um=new WeakMap,uw=new WeakMap,ub=new WeakMap,uA=new WeakMap,uy=new WeakMap,uS=new WeakMap,uk=new WeakMap,ux=new WeakMap,uE=new WeakSet,uM=new WeakSet,uC=new WeakSet,uT=new WeakSet;class uR extends hL{build(t,e,i,s,a,r,o){(0,n._)(this,uA,e),(0,n._)(this,uy,i),(0,n._)(this,uS,s),(0,n._)(this,uk,a),(0,n._)(this,ux,r),(0,n._)(this,uw,null!=o?o:0),(0,n._)(this,ub,t),(0,l._)(this,uC,uI).call(this)}setLastElement(t){return(0,s._)(this,ub).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return(0,s._)(this,ub).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of(0,s._)(this,ub)){if(t.push("M".concat(hL.svgRound(e[4])," ").concat(hL.svgRound(e[5]))),6===e.length){t.push("Z");continue}if(12===e.length){t.push("L".concat(hL.svgRound(e[10])," ").concat(hL.svgRound(e[11])));continue}for(let i=6,s=e.length;i<s;i+=6){let[s,a,n,r,l,o]=e.subarray(i,i+6).map(hL.svgRound);t.push("C".concat(s," ").concat(a," ").concat(n," ").concat(r," ").concat(l," ").concat(o))}}return t.join("")}serialize(t,e){let i,a,n,r,o,h,d,c,u,[_,p,g,f]=t,v=[],m=[],[w,b,A,y]=(0,l._)(this,uM,uL).call(this);switch((0,s._)(this,uk)){case 0:u=hL._rescale,i=_,a=p+f,n=g,r=-f,o=_+w*g,h=p+(1-b-y)*f,d=_+(w+A)*g,c=p+(1-b)*f;break;case 90:u=hL._rescaleAndSwap,i=_,a=p,n=g,r=f,o=_+b*g,h=p+w*f,d=_+(b+y)*g,c=p+(w+A)*f;break;case 180:u=hL._rescale,i=_+g,a=p,n=-g,r=f,o=_+(1-w-A)*g,h=p+b*f,d=_+(1-w)*g,c=p+(b+y)*f;break;case 270:u=hL._rescaleAndSwap,i=_+g,a=p+f,n=-g,r=-f,o=_+(1-b-y)*g,h=p+(1-w-A)*f,d=_+(1-b)*g,c=p+(1-w)*f}for(let{line:t,points:l}of(0,s._)(this,ub))v.push(u(t,i,a,n,r,e?Array(t.length):null)),m.push(u(l,i,a,n,r,e?Array(l.length):null));return{lines:v,points:m,rect:[o,h,d,c]}}static deserialize(t,e,i,s,a,n){let r,l,o,h,d,{paths:{lines:c,points:u},rotation:_,thickness:p}=n,g=[];switch(_){case 0:d=hL._rescale,r=-t/i,l=e/s+1,o=1/i,h=-1/s;break;case 90:d=hL._rescaleAndSwap,r=-e/s,l=-t/i,o=1/s,h=1/i;break;case 180:d=hL._rescale,r=t/i+1,l=-e/s,o=-1/i,h=1/s;break;case 270:d=hL._rescaleAndSwap,r=e/s+1,l=t/i+1,o=-1/s,h=-1/i}if(!c)for(let t of(c=[],u)){let e=t.length;if(2===e){c.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1]]));continue}if(4===e){c.push(new Float32Array([NaN,NaN,NaN,NaN,t[0],t[1],NaN,NaN,NaN,NaN,t[2],t[3]]));continue}let i=new Float32Array(3*(e-2));c.push(i);let[s,a,n,r]=t.subarray(0,4);i.set([NaN,NaN,NaN,NaN,s,a],0);for(let l=4;l<e;l+=2){let e=t[l],o=t[l+1];i.set(hL.createBezierPoints(s,a,n,r,e,o),(l-2)*3),[s,a,n,r]=[n,r,e,o]}}for(let t=0,e=c.length;t<e;t++)g.push({line:d(c[t].map(t=>null!=t?t:NaN),r,l,o,h),points:d(u[t].map(t=>null!=t?t:NaN),r,l,o,h)});let f=new uR;return f.build(g,i,s,1,_,p,a),f}get box(){return(0,s._)(this,uv)}updateProperty(t,e){return"stroke-width"===t?(0,l._)(this,uT,uD).call(this,e):null}updateParentDimensions(t,e){let[i,a]=t,[r,o]=(0,l._)(this,uE,uP).call(this);(0,n._)(this,uA,i),(0,n._)(this,uy,a),(0,n._)(this,uS,e);let[h,d]=(0,l._)(this,uE,uP).call(this),c=h-r,u=d-o,_=(0,s._)(this,uv);return _[0]-=c,_[1]-=u,_[2]+=2*c,_[3]+=2*u,_}updateRotation(t){return(0,n._)(this,um,t),{path:{transform:this.rotationTransform}}}get viewBox(){return(0,s._)(this,uv).map(hL.svgRound).join(" ")}get defaultProperties(){let[t,e]=(0,s._)(this,uv);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(hL.svgRound(t)," ").concat(hL.svgRound(e))}}}get rotationTransform(){let[,,t,e]=(0,s._)(this,uv),i=0,a=0,n=0,r=0,l=0,o=0;switch((0,s._)(this,um)){case 90:a=e/t,n=-t/e,l=t;break;case 180:i=-1,r=-1,l=t,o=e;break;case 270:a=-e/t,n=t/e,o=e;break;default:return""}return"matrix(".concat(i," ").concat(a," ").concat(n," ").concat(r," ").concat(hL.svgRound(l)," ").concat(hL.svgRound(o),")")}getPathResizingSVGProperties(t){let[e,i,a,n]=t,[r,o]=(0,l._)(this,uE,uP).call(this),[h,d,c,u]=(0,s._)(this,uv);return Math.abs(c-r)<=hL.PRECISION||Math.abs(u-o)<=hL.PRECISION?{path:{"transform-origin":"".concat(hL.svgRound(e)," ").concat(hL.svgRound(i)),transform:"".concat(this.rotationTransform," translate(").concat(e+a/2-(h+c/2)," ").concat(i+n/2-(d+u/2),")")}}:{path:{"transform-origin":"".concat(hL.svgRound(h)," ").concat(hL.svgRound(d)),transform:"".concat(this.rotationTransform," scale(").concat(c/a," ").concat(u/n,") ")+"translate(".concat(hL.svgRound(r)," ").concat(hL.svgRound(o),") scale(").concat((a-2*r)/(c-2*r)," ").concat((n-2*o)/(u-2*o),") ")+"translate(".concat(hL.svgRound(-r)," ").concat(hL.svgRound(-o),")")}}}getPathResizedSVGProperties(t){let[e,i,a,n]=t,[r,o]=(0,l._)(this,uE,uP).call(this),h=(0,s._)(this,uv),[d,c,u,_]=h;if(h[0]=e,h[1]=i,h[2]=a,h[3]=n,Math.abs(u-r)<=hL.PRECISION||Math.abs(_-o)<=hL.PRECISION){let t=e+a/2-(d+u/2),r=i+n/2-(c+_/2);for(let{line:e,points:i}of(0,s._)(this,ub))hL._translate(e,t,r,e),hL._translate(i,t,r,i);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(hL.svgRound(e)," ").concat(hL.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}let p=(a-2*r)/(u-2*r),g=(n-2*o)/(_-2*o),f=-p*(d+r)+e+r,v=-g*(c+o)+i+o;if(1!==p||1!==g||0!==f||0!==v)for(let{line:t,points:e}of(0,s._)(this,ub))hL._rescale(t,f,v,p,g,t),hL._rescale(e,f,v,p,g,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":"".concat(hL.svgRound(e)," ").concat(hL.svgRound(i)),transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties(t,e){let[i,a]=t,[r,l]=e,o=(0,s._)(this,uv),h=i-o[0],d=a-o[1];if((0,s._)(this,uA)===r&&(0,s._)(this,uy)===l)for(let{line:t,points:e}of(0,s._)(this,ub))hL._translate(t,h,d,t),hL._translate(e,h,d,e);else{let t=(0,s._)(this,uA)/r,e=(0,s._)(this,uy)/l;for(let{line:i,points:a}of((0,n._)(this,uA,r),(0,n._)(this,uy,l),(0,s._)(this,ub)))hL._rescale(i,h,d,t,e,i),hL._rescale(a,h,d,t,e,a);o[2]*=t,o[3]*=e}return o[0]=i,o[1]=a,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":"".concat(hL.svgRound(i)," ").concat(hL.svgRound(a))}}}get defaultSVGProperties(){let t=(0,s._)(this,uv);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":"".concat(hL.svgRound(t[0])," ").concat(hL.svgRound(t[1])),transform:this.rotationTransform||null},bbox:t}}constructor(...t){super(...t),(0,o._)(this,uE),(0,o._)(this,uM),(0,o._)(this,uC),(0,o._)(this,uT),(0,a._)(this,uv,{writable:!0,value:void 0}),(0,a._)(this,um,{writable:!0,value:void 0}),(0,a._)(this,uw,{writable:!0,value:void 0}),(0,a._)(this,ub,{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,uS,{writable:!0,value:void 0}),(0,a._)(this,uk,{writable:!0,value:void 0}),(0,a._)(this,ux,{writable:!0,value:void 0}),(0,n._)(this,um,0)}}function uP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s._)(this,ux),e=(0,s._)(this,uw)+t/2*(0,s._)(this,uS);return(0,s._)(this,uk)%180==0?[e/(0,s._)(this,uA),e/(0,s._)(this,uy)]:[e/(0,s._)(this,uy),e/(0,s._)(this,uA)]}function uL(){let[t,e,i,a]=(0,s._)(this,uv),[n,r]=(0,l._)(this,uE,uP).call(this,0);return[t+n,e+r,i-2*n,a-2*r]}function uI(){let t=(0,n._)(this,uv,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:e}of(0,s._)(this,ub)){if(e.length<=12){for(let i=4,s=e.length;i<s;i+=6){let[s,a]=e.subarray(i,i+2);t[0]=Math.min(t[0],s),t[1]=Math.min(t[1],a),t[2]=Math.max(t[2],s),t[3]=Math.max(t[3],a)}continue}let i=e[4],s=e[5];for(let a=6,n=e.length;a<n;a+=6){let[n,r,l,o,h,d]=e.subarray(a,a+6);Z.bezierBoundingBox(i,s,n,r,l,o,h,d,t),i=h,s=d}}let[e,i]=(0,l._)(this,uE,uP).call(this);t[0]=Math.min(1,Math.max(0,t[0]-e)),t[1]=Math.min(1,Math.max(0,t[1]-i)),t[2]=Math.min(1,Math.max(0,t[2]+e)),t[3]=Math.min(1,Math.max(0,t[3]+i)),t[2]-=t[0],t[3]-=t[1]}function uD(t){let[e,i]=(0,l._)(this,uE,uP).call(this);(0,n._)(this,ux,t);let[a,r]=(0,l._)(this,uE,uP).call(this),[o,h]=[a-e,r-i],d=(0,s._)(this,uv);return d[0]-=o,d[1]-=h,d[2]+=2*o,d[3]+=2*h,d}var uF=new WeakMap;class uN extends cH{updateSVGProperty(t,e){"stroke-width"===t&&(null!=e||(e=this["stroke-width"]),e*=(0,s._)(this,uF).realScale),super.updateSVGProperty(t,e)}clone(){let t=new uN((0,s._)(this,uF));return t.updateAll(this),t}constructor(t){super(),(0,a._)(this,uF,{writable:!0,value:void 0}),(0,n._)(this,uF,t),super.updateProperties({fill:"none",stroke:sV._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}}var uW=new WeakSet;class uO extends cJ{static initialize(t,e){sV.initialize(t,e),this._defaultDrawingOptions=new uN(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return O(this,"typesMap",new Map([[k.INK_THICKNESS,"stroke-width"],[k.INK_COLOR,"stroke"],[k.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,s,a){return new ug(t,e,i,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,s,a,n){return uR.deserialize(t,e,i,s,a,n)}static async deserialize(t,e,i){let s=null;if(t instanceof o$){let{dat
1a:{inkLists:e,rect:i,rotation:a,id:n,color:r,opacity:l,borderStyle:{rawWidth:o},popupRef:h},parent:{page:{pageNumber:d}}}=t;s=t={annotationType:S.INK,color:Array.from(r),thickness:o,opacity:l,paths:{points:e},boxes:null,pageIndex:d-1,rect:i.slice(0),rotation:a,id:n,deleted:!1,popupRef:h}}let a=await super.deserialize(t,e,i);return a.annotationElementId=t.id||null,a._initialData=s,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions(t){let{color:e,thickness:i,opacity:s}=t;this._drawingOptions=uO.getDefaultDrawingOptions({stroke:Z.makeHexColor(...e),"stroke-width":i,"stroke-opacity":s})}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:i,rect:s}=this.serializeDraw(t),{_drawingOptions:{stroke:a,"stroke-opacity":n,"stroke-width":r}}=this,o={annotationType:S.INK,color:sV._colorManager.convert(a),opacity:n,thickness:r,paths:{lines:e,points:i},pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?o:this.annotationElementId&&!(0,l._)(this,uW,uB).call(this,o)?null:(o.id=this.annotationElementId,o)}renderAnnotationElement(t){let{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e}),null}constructor(t){super({...t,name:"inkEditor"}),(0,o._)(this,uW),this._willKeepAspectRatio=!0}}function uB(t){let{color:e,thickness:i,opacity:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==s||t.pageIndex!==a}uO._type="ink",uO._editorType=S.INK,uO._defaultDrawingOptions=null;var uH=new WeakMap,uG=new WeakMap,uz=new WeakMap,uj=new WeakMap,uU=new WeakMap,uV=new WeakMap,uq=new WeakMap,uX=new WeakMap,uK=new WeakMap,uY=new WeakMap,uQ=new WeakSet,uJ=new WeakSet,uZ=new WeakSet,u$=new WeakSet,u0=new WeakSet,u1=new WeakSet,u2=new WeakSet,u3=new WeakSet;class u5 extends sV{static initialize(t,e){sV.initialize(t,e)}static get supportedTypes(){return O(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>"image/".concat(t)))}static get supportedTypesStr(){return O(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(S.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,channels: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,uG)){var t;(0,n._)(this,uH,null),this._uiManager.imageManager.deleteId((0,s._)(this,uG)),null===(t=(0,s._)(this,uq))||void 0===t||t.remove(),(0,n._)(this,uq,null),(0,s._)(this,uX)&&(clearTimeout((0,s._)(this,uX)),(0,n._)(this,uX,null))}super.remove()}rebuild(){if(!this.parent){(0,s._)(this,uG)&&(0,l._)(this,uZ,u8).call(this);return}super.rebuild(),null!==this.div&&((0,s._)(this,uG)&&null===(0,s._)(this,uq)&&(0,l._)(this,uZ,u8).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!((0,s._)(this,uz)||(0,s._)(this,uH)||(0,s._)(this,uj)||(0,s._)(this,uU)||(0,s._)(this,uG))}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,uH)?(0,l._)(this,u$,u9).call(this):(0,l._)(this,uZ,u8).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._uiManager.addShouldRescale(this),this.div}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==(0,s._)(this,uX)&&clearTimeout((0,s._)(this,uX)),(0,n._)(this,uX,setTimeout(()=>{(0,n._)(this,uX,null),(0,l._)(this,u1,_t).call(this)},200)))}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,uH),r=new tx,o=(0,s._)(this,uH),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);
1(0,s._)(this,uK)||(o=(0,l._)(this,u0,u7).call(this,t,i));let p=c.getContext("2d");p.filter=this._uiManager.hcmFilter;let g="white",f="#cfcfd8";"none"!==this._uiManager.hcmFilter?f="black":(null===(u=(_=window).matchMedia)||void 0===u?void 0:u.call(_,"(prefers-color-scheme: dark)").matches)&&(g="#8f8f9d",f="#42414d");let v=15*r.sx,m=15*r.sy,w=new OffscreenCanvas(2*v,2*m),b=w.getContext("2d");b.fillStyle=g,b.fillRect(0,0,2*v,2*m),b.fillStyle=f,b.fillRect(0,0,v,m),b.fillRect(v,m,v,m),p.fillStyle=p.createPattern(w,"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,uH),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,uK)||(o=(0,l._)(this,u0,u7).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,uq)}static async deserialize(t,e,i){let s=null;if(t instanceof o4){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(ta).concat(l)))||void 0===a?void 0:a.get("aria-label"))||"";s=t={annotationType:S.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,uG,d),o&&(0,n._)(r,uH,o)):(0,n._)(r,uj,h),(0,n._)(r,uK,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,uY,!!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:S.STAMP,bitmapId:(0,s._)(this,uG),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:(0,s._)(this,uK),structTreeParentId:this._structTreeParentId};if(e)return a.bitmapUrl=(0,l._)(this,u2,_e).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,u3,_i).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,uK)?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(i.stamps.has((0,s._)(this,uG))){if((0,s._)(this,uK)){let t=i.stamps.get((0,s._)(this,uG));o>t.area&&(t.area=o,t.serialized.bitmap.close(),t.serialized.bitmap=(0,l._)(this,u2,_e).call(this,!1))}}else i.stamps.set((0,s._)(this,uG),{area:o,serialized:a}),a.bitmap=(0,l._)(this,u2,_e).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,uQ),(0,o._)(this,uJ),(0,o._)(this,uZ),(0,o._)(this,u$),(0,o._)(this,u0),(0,o._)(this,u1),(0,o._)(this,u2),(0,o._)(this,u3),(0,a._)(this,uH,{writable:!0,value:void 0}),(0,a._)(this,uG,{writable:!0,value:void 0}),(0,a._)(this,uz,{writable:!0,value:void 0}),(0,a._)(this,uj,{writable:!0,value:void 0}),(0,a._)(this,uU,{writable:!0,value:void 0}),(0,a._)(this,uV,{writable:!0,value:void 0}),(0,a._)(this,uq,{writable:!0,value:void 0}),(0,a._)(this,uX,{writable:!0,value:void 0}),(0,a._)(this,uK,{writable:!0,value:void 0}),(0,a._)(this,uY,{writable:!0,value:void 0}),(0,n._)(this,uH,null),(0,n._)(this,uG,null),(0,n._)(this,uz,null),(0,n._)(this,uj,null),(0,n._)(this,uU,null),(0,n._)(this,uV,""),(0,n._)(this,uq,null),(0,n._)(this,uX,null),(0,n._)(this,uK,!1),(0,n._)(this,uY,!1),(0,n._)(this,uj,t.bitmapUrl),(0,n._)(this,uU,t.bitmapFile)}}function u4(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t){this.remove();return}(0,n._)(this,uH,t.bitmap),e||((0,n._)(this,uG,t.id),(0,n._)(this,uK,t.isSvg)),t.file&&(0,n._)(this,uV,t.file.name),(0,l._)(this,u$,u9).call(this)}function u6(){if((0,n._)(this,uz,null),this._uiManager.enableWaiting(!1),(0,s._)(this,uq)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,s._)(this,uH)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,s._)(this,uH)){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 u8(){if((0,s._)(this,uG)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId((0,s._)(this,uG)).then(t=>(0,l._)(this,uQ,u4).call(this,t,!0)).finally(()=>
1(0,l._)(this,uJ,u6).call(this));return}if((0,s._)(this,uj)){let t=(0,s._)(this,uj);(0,n._)(this,uj,null),this._uiManager.enableWaiting(!0),(0,n._)(this,uz,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,l._)(this,uQ,u4).call(this,t)).finally(()=>(0,l._)(this,uJ,u6).call(this)));return}if((0,s._)(this,uU)){let t=(0,s._)(this,uU);(0,n._)(this,uU,null),this._uiManager.enableWaiting(!0),(0,n._)(this,uz,this._uiManager.imageManager.getFromFile(t).then(t=>(0,l._)(this,uQ,u4).call(this,t)).finally(()=>(0,l._)(this,uJ,u6).call(this)));return}let t=document.createElement("input");t.type="file",t.accept=u5.supportedTypesStr;let e=this._uiManager._signal;(0,n._)(this,uz,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,uQ,u4).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,l._)(this,uJ,u6).call(this))),t.click()}function u9(){var t;let{div:e}=this,{width:i,height:a}=(0,s._)(this,uH),[r,o]=this.pageDimensions;if(this.width)i=this.width*r,a=this.height*o;else if(i>.75*r||a>.75*o){let t=Math.min(.75*r/i,.75*o/a);i*=t,a*=t}let[h,d]=this.parentDimensions;this.setDims(i*h/r,a*d/o),this._uiManager.enableWaiting(!1);let c=(0,n._)(this,uq,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=i/r,this.height=a/o,(null===(t=this._initialOptions)||void 0===t?void 0:t.isCentered)?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),(0,l._)(this,u1,_t).call(this),(0,s._)(this,uY)||(this.parent.addUndoableEditor(this),(0,n._)(this,uY,!0)),this._reportTelemetry({action:"inserted_image"}),(0,s._)(this,uV)&&c.setAttribute("aria-label",(0,s._)(this,uV))}function u7(t,e){let{width:i,height:a}=(0,s._)(this,uH),n=i,r=a,l=(0,s._)(this,uH);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 _t(){let[t,e]=this.parentDimensions,{width:i,height:a}=this,n=new tx,r=Math.ceil(i*t*n.sx),o=Math.ceil(a*e*n.sy),h=(0,s._)(this,uq);if(!h||h.width===r&&h.height===o)return;h.width=r,h.height=o;let d=(0,s._)(this,uK)?(0,s._)(this,uH):(0,l._)(this,u0,u7).call(this,r,o),c=h.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(d,0,0,d.width,d.height,0,0,r,o)}function _e(t){if(t){if((0,s._)(this,uK)){let t=this._uiManager.imageManager.getSvgUrl((0,s._)(this,uG));if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=(0,s._)(this,uH),t.getContext("2d").drawImage((0,s._)(this,uH),0,0),t.toDataURL()}if((0,s._)(this,uK)){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*tr.PDF_TO_CSS_UNITS),a=Math.round(this.height*e*tr.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,a);return n.getContext("2d").drawImage((0,s._)(this,uH),0,0,(0,s._)(this,uH).width,(0,s._)(this,uH).height,0,0,i,a),n.transferToImageBitmap()}return structuredClone((0,s._)(this,uH))}function _i(t){var e;let{pageIndex:i,accessibilityData:{altText:s}}=this._initialData,a=t.pageIndex===i,n=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===s;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&a&&n,isSameAltText:n}}u5._type="stamp",u5._editorType=S.STAMP;var _s=new WeakMap,_a=new WeakMap,_n=new WeakMap,_r=new WeakMap,_l=new WeakMap,_o=new WeakMap,_h=new WeakMap,_d=new WeakMap,_c=new WeakMap,_u=new WeakMap,__=new WeakMap,_p=new WeakMap,_g=new WeakMap,_f=new WeakMap,_v=new WeakSet,_m=new WeakMap,_w=new WeakSet,_b=new WeakSet,_A=new WeakSet;class _y{get isEmpty(){return 0===(0,s._)(this,_o).size}get isInvisible(){return this.isEmpty&&(0,s._)(this,_f).getMode()===S.NONE}updateToolbar(t){(0,s._)(this,_f).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s._)(this,_f).getMode();switch((0,l._)(this,_A,_C).call(this),t){case S.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case S.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case S.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._)(_y,_y,_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,_p))||void 0===e?void 0:e.div)}setEditingState(t){(0,s._)(this,_f).setEditingState(t)}addCommands(t){(0,s._)(this,_f).addCommands(t)}cleanUndoStack(t){(0,s._)(this,_f).cleanUndoStack(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,_n))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){(0,n._)(this,_c,!0),this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of(0,s._)(this,_o).values())e.enableEditing(),e.show(!0),e.annotationElementId&&((0,s._)(this,_f).removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if(!(0,s._)(this,_n)){(0,n._)(this,_c,!1);return}for(let e of(0,s._)(this,_n).getEditableAnnotations()){if(e.hide(),(0,s._)(this,_f).isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=await this.deserialize(e);
1i&&(this.addOrRebuild(i),i.enableEditing())}(0,n._)(this,_c,!1)}disable(){(0,n._)(this,_d,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let a of(0,s._)(this,_o).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,_n))for(let i of(0,s._)(this,_n).getEditableAnnotations()){let{id:a}=i.data;if((0,s._)(this,_f).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,_f).addChangedExistingAnnotation(n),n.renderAnnotationElement(i)&&n.show(!1)),i.show()}(0,l._)(this,_A,_C).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:a}=this.div;for(let t of(0,h._)(_y,_y,_S).values())a.remove("".concat(t._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,n._)(this,_d,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,s._)(this,_n))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,s._)(this,_f).getActive()!==t&&(0,s._)(this,_f).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(null===(t=(0,s._)(this,_p))||void 0===t?void 0:t.div)&&!(0,s._)(this,_g)){(0,n._)(this,_g,new AbortController);let t=(0,s._)(this,_f).combinedSignal((0,s._)(this,_g));(0,s._)(this,_p).div.addEventListener("pointerdown",(0,l._)(this,_v,_k).bind(this),{signal:t}),(0,s._)(this,_p).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(null===(t=(0,s._)(this,_p))||void 0===t?void 0:t.div)&&(0,s._)(this,_g)&&((0,s._)(this,_g).abort(),(0,n._)(this,_g,null),(0,s._)(this,_p).div.classList.remove("highlighting"))}enableClick(){if((0,s._)(this,_r))return;(0,n._)(this,_r,new AbortController);let t=(0,s._)(this,_f).combinedSignal((0,s._)(this,_r));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;null===(t=(0,s._)(this,_r))||void 0===t||t.abort(),(0,n._)(this,_r,null)}attach(t){(0,s._)(this,_o).set(t.id,t);let{annotationElementId:e}=t;e&&(0,s._)(this,_f).isDeletedAnnotationElement(e)&&(0,s._)(this,_f).removeDeletedAnnotationElement(t)}detach(t){var e;(0,s._)(this,_o).delete(t.id),null===(e=(0,s._)(this,_s))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,s._)(this,_d)&&t.annotationElementId&&(0,s._)(this,_f).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,s._)(this,_f).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,s._)(this,_f).addDeletedAnnotationElement(t.annotationElementId),sV.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,_f).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,_c)),(0,s._)(this,_f).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,_l)&&(t._focusEventsAllowed=!1,(0,n._)(this,_l,setTimeout(()=>{(0,n._)(this,_l,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,s._)(this,_f)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=(0,s._)(this,_s))||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,_f).getId()}combinedSignal(t){return(0,s._)(this,_f).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=(0,s._)(this,_m))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){(0,s._)(this,_f).updateToolbar(t),(0,s._)(this,_f).updateMode(t);let{offsetX:i,offsetY:a}=(0,l._)(this,_b,_M).call(this),n=this.getNextId(),r=(0,l._)(this,_w,_E).call(this,{parent:this,id:n,x:i,y:a,uiManager:(0,s._)(this,_f),isCentered:!0,...e});r&&this.add(r)}async deserialize(t){var e,i;return await (null===(e=(0,h._)(_y,_y,_S).get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,s._)(this,_f)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this.getNextId(),n=(0,l._)(this,_w,_E).call(this,{parent:this,id:a,x:t.offsetX,y:t.offsetY,uiManager:(0,s._)(this,_f),isCentered:e,...i});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor((0,l._)(this,_b,_M).call(this),!0)}setSelected(t){(0,s._)(this,_f).setSelected(t)}toggleSelected(t){(0,s._)(this,_f).toggleSelected(t)}unselect(t){(0,s._)(this,_f).unselect(t)}pointerup(t){var e;let{isMac:i}=Q.platform;if(0===t.button&&(!t.ctrlKey||!i)&&t.target===this.div&&(0,s._)(this,_h)&&((0,n._)(this,_h,!1),null===(e=(0,s._)(this,_m))||void 0===e||!e.isDrawer||!(0,s._)(this,_m).supportMultipleDrawings)){if(!(0,s._)(this,_a)){(0,n._)(this,_a,!0);return}if((0,s._)(this,_f).getMode()===S.STAMP){(0,s._)(this,_f).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){var e;if((0,s._)(this,_f).getMode()===S.HIGHLIGHT&&this.enableTextSelection(),(0,s._)(this,_h)){(0,n._)(this,_h,!1);return}let{isMac:i}=Q.platform;if(0!==t.button||t.ctrlKey&&i||t.target!==this.div)return;if((0,n._)(this,_h,!0),null===(e=(0,s._)(this,_m))||void 0===e?void 0:e.isDrawer){this.startDrawingSession(t);return}let a=(0,s._)(this,_f).getActive();(0,n._)(this,_a,!a||a.isEmpty())}startDrawingSession(t){if(this.div.focus(),(0,s._)(this,_u)){(0,s._)(this,_m).startDrawing(this,(0,s._)(this,_f),!1,t);return}(0,s._)(this,_f).setCurrentDrawingSession(this),(0,n._)(this,_u,new AbortController);let e=(0,s._)(this,_f).combinedSignal((0,s._)(this,_u));this.div.addEventListener("blur",t=>{let{relatedTarget:e}=t;e&&!this.div.contains(e)&&((0,n._)(this,__,null),this.commitOrRemove())},{signal:e}),(0,s._)(this,_m).startDrawing(this,(0,s._)(this,_f),!1,t)}pause(t){if(t){let{activeElement:t}=document;this.div.contains(t)&&(0,n._)(this,__,t);return}(0,s._)(this,__)&&setTimeout(()=>{var t;null===(t=(0,s._)(this,__))||void 0===t||t.focus(),(0,n._)(this,__,null)},0)}endDrawingSession(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(0,s._)(this,_u)?((0,s._)(this,_f).setCurrentDrawingSession(null),(0,s._)(this,_u).abort(),(0,n._)(this,_u,null),(0,n._)(this,__,null),(0,s._)(this,_m).endDrawing(t)):null}findNewParent(t,e,i){let a=(0,s._)(this,_f).findParent(e,i);return null!==a&&a!==this&&(a.changeParent(t),!0)}commitOrRemove(){return!!(0,s._)(this,_u)&&(this.endDrawingSession(),!0)}onScaleChanging(){(0,s._)(this,_u)&&(0,s._)(this,_m).onScaleChangingWhenDrawing(this)}destroy(){var t,e;for(let i of(this.commitOrRemove(),(null===(t=(0,s._)(this,_f).getActive())||void 0===t?void 0:t.parent)===this&&((0,s._)(this,_f).commitOrRemove(),(0,s._)(this,_f).setActiveEditor(null)),(0,s._)(this,_l)&&(clearTimeout((0,s._)(this,_l)),(0,n._)(this,_l,null)),(0,s._)(this,_o).values())
1)null===(e=(0,s._)(this,_s))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,(0,s._)(this,_o).clear(),(0,s._)(this,_f).removeLayer(this)}render(t){let{viewport:e}=t;for(let t of(this.viewport=e,tk(this.div,e),(0,s._)(this,_f).getEditors(this.pageIndex)))this.add(t),t.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,s._)(this,_f).commitOrRemove(),(0,l._)(this,_A,_C).call(this);let i=this.viewport.rotation,a=e.rotation;if(this.viewport=e,tk(this.div,{rotation:a}),i!==a)for(let t of(0,s._)(this,_o).values())t.rotate(a)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,s._)(this,_f).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,_v),(0,a._)(this,_m,{get:_x,set:void 0}),(0,o._)(this,_w),(0,o._)(this,_b),(0,o._)(this,_A),(0,a._)(this,_s,{writable:!0,value:void 0}),(0,a._)(this,_a,{writable:!0,value:void 0}),(0,a._)(this,_n,{writable:!0,value:void 0}),(0,a._)(this,_r,{writable:!0,value:void 0}),(0,a._)(this,_l,{writable:!0,value:void 0}),(0,a._)(this,_o,{writable:!0,value:void 0}),(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,a._)(this,__,{writable:!0,value:void 0}),(0,a._)(this,_p,{writable:!0,value:void 0}),(0,a._)(this,_g,{writable:!0,value:void 0}),(0,a._)(this,_f,{writable:!0,value:void 0}),(0,n._)(this,_a,!1),(0,n._)(this,_n,null),(0,n._)(this,_r,null),(0,n._)(this,_l,null),(0,n._)(this,_o,new Map),(0,n._)(this,_h,!1),(0,n._)(this,_d,!1),(0,n._)(this,_c,!1),(0,n._)(this,_u,null),(0,n._)(this,__,null),(0,n._)(this,_p,null),(0,n._)(this,_g,null);let g=[...(0,h._)(_y,_y,_S).values()];if(!_y._initialized)for(let e of(_y._initialized=!0,g))e.initialize(p,t);t.registerEditorTypes(g),(0,n._)(this,_f,t),this.pageIndex=e,this.div=i,(0,n._)(this,_s,l),(0,n._)(this,_n,d),this.viewport=_,(0,n._)(this,_p,u),this.drawLayer=c,this._structTree=r,(0,s._)(this,_f).addLayer(this)}}_y._initialized=!1;var _S={writable:!0,value:new Map([hy,uO,u5,cy].map(t=>[t._editorType,t]))};function _k(t){(0,s._)(this,_f).unselectAll();let{target:e}=t;if(e===(0,s._)(this,_p).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,s._)(this,_p).div.contains(e)){let{isMac:e}=Q.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,s._)(this,_f).showAllEditors("highlight",!0,!0),(0,s._)(this,_p).div.classList.add("free"),this.toggleDrawing(),cy.startHighlighting(this,"ltr"===(0,s._)(this,_f).direction,{target:(0,s._)(this,_p).div,x:t.x,y:t.y}),(0,s._)(this,_p).div.addEventListener("pointerup",()=>{(0,s._)(this,_p).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:(0,s._)(this,_f)._signal}),t.preventDefault()}}function _x(){return(0,h._)(_y,_y,_S).get((0,s._)(this,_f).getMode())}function _E(t){let e=(0,s._)(this,_m);return e?new e.prototype.constructor(t):null}function _M(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),a=Math.min(window.innerWidth,t+i),n=Math.min(window.innerHeight,e+s),r=(Math.max(0,t)+a)/2-t,l=(Math.max(0,e)+n)/2-e,[o,h]=this.viewport.rotation%180==0?[r,l]:[l,r];return{offsetX:o,offsetY:h}}function _C(){for(let t of(0,s._)(this,_o).values())t.isEmpty()&&t.remove()}var _T=new WeakMap,_R=new WeakMap,_P=new WeakMap,_L=new WeakMap,_I=new WeakSet,_D=new WeakSet,_F=new WeakSet;class _N{setParent(t){if(!(0,s._)(this,_T)){(0,n._)(this,_T,t);return}if((0,s._)(this,_T)!==t){if((0,s._)(this,_P).size>0)for(let e of(0,s._)(this,_P).values())e.remove(),t.append(e);(0,n._)(this,_T,t)}}static get _svgFactory(){return O(this,"_svgFactory",new lO)}draw(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=(0,r._)(this,_R).value++,n=(0,l._)(this,_I,_O).call(this),o=_N._svgFactory.createElement("defs");n.append(o);let h=_N._svgFactory.createElement("path");o.append(h);let d="path_p".concat(this.pageIndex,"_").concat(a);h.setAttribute("id",d),h.setAttribute("vector-effect","non-scaling-stroke"),e&&(0,s._)(this,_L).set(a,h);let c=i?(0,l._)(this,_D,_B).call(this,o,d):null,u=_N._svgFactory.createElement("use");return n.append(u),u.setAttribute("href","#".concat(d)),this.updateProperties(n,t),(0,s._)(this,_P).set(a,n),{id:a,clipPathId:"url(#".concat(c,")")}}drawOutline(t,e){let i;let a=(0,r._)(this,_R).value++,n=(0,l._)(this,_I,_O).call(this),o=_N._svgFactory.createElement("defs");n.append(o);let h=_N._svgFactory.createElement("path");o.append(h);let d="path_p".concat(this.pageIndex,"_").concat(a);if(h.setAttribute("id",d),h.setAttribute("vector-effect","non-scaling-stroke"),e){let t=_N._svgFactory.createElement("mask");o.append(t),i="mask_p".concat(this.pageIndex,"_").concat(a),t.setAttribute("id",i),t.setAttribute("maskUnits","objectBoundingBox");let e=_N._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");let s=_N._svgFactory.createElement("use");t.append(s),s.setAttribute("href","#".concat(d)),s.setAttribute("stroke","none"),s.setAttribute("fill","black"),s.setAttribute("fill-rule","nonzero"),s.classList.add("mask")}let c=_N._svgFactory.createElement("use");n.append(c),c.setAttribute("href","#".concat(d)),i&&c.setAttribute("mask","url(#".concat(i,")"));let u=c.cloneNode();return n.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),this.updateProperties(n,t),(0,s._)(this,_P).set(a,n),a}finalizeDraw(t,e){(0,s._)(this,_L).delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:i,bbox:a,rootClass:n,path:r}=e,o="number"==typeof t?(0,s._)(this,_P).get(t):t;if(o){if(i&&(0,l._)(this,_F,_H).call(this,o,i),a&&(0,_._)(_N,_N,_W).call(_N,o,a),n){let{classList:t}=o;for(let[e,i]of Object.entries(n))t.toggle(e,i)}if(r){let t=o.firstChild.firstChild;(0,l._)(this,_F,_H).call(this,t,r)}}}updateParent(t,e){if(e===this)return;let i=(0,s._)(this,_P).get(t);i&&((0,s._)(e,_T).append(i),(0,s._)(this,_P).delete(t),(0,s._)(e,_P).set(t,i))}remove(t){(0,s._)(this,_L).delete(t),null!==(0,s._)(this,_T)&&((0,s._)(this,_P).get(t).remove(),(0,s._)(this,_P).delete(t))}destroy(){for(let t of((0,n._)(this,_T,null),(0,s._)(this,_P).values())
1)t.remove();(0,s._)(this,_P).clear(),(0,s._)(this,_L).clear()}constructor({pageIndex:t}){(0,o._)(this,_I),(0,o._)(this,_D),(0,o._)(this,_F),(0,a._)(this,_T,{writable:!0,value:void 0}),(0,a._)(this,_R,{writable:!0,value:void 0}),(0,a._)(this,_P,{writable:!0,value:void 0}),(0,a._)(this,_L,{writable:!0,value:void 0}),(0,n._)(this,_T,null),(0,n._)(this,_R,0),(0,n._)(this,_P,new Map),(0,n._)(this,_L,new Map),this.pageIndex=t}}function _W(t,e){let[i,s,a,n]=e,{style:r}=t;r.top="".concat(100*s,"%"),r.left="".concat(100*i,"%"),r.width="".concat(100*a,"%"),r.height="".concat(100*n,"%")}function _O(){let t=_N._svgFactory.create(1,1,!0);return(0,s._)(this,_T).append(t),t.setAttribute("aria-hidden",!0),t}function _B(t,e){let i=_N._svgFactory.createElement("clipPath");t.append(i);let s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=_N._svgFactory.createElement("use");return i.append(a),a.setAttribute("href","#".concat(e)),a.classList.add("clip"),s}function _H(t,e){for(let[i,s]of Object.entries(e))null===s?t.removeAttribute(i):t.setAttribute(i,s)}globalThis.pdfjsTestingUtils={HighlightOutliner:dw};var _G=v.AbortException,_z=v.AnnotationEditorLayer,_j=v.AnnotationEditorParamsType,_U=v.AnnotationEditorType,_V=v.AnnotationEditorUIManager,_q=v.AnnotationLayer,_X=v.AnnotationMode,_K=v.ColorPicker,_Y=v.DOMSVGFactory,_Q=v.DrawLayer,_J=v.FeatureTest,_Z=v.GlobalWorkerOptions,_$=v.ImageKind,_0=v.InvalidPDFException,_1=v.MissingPDFException,_2=v.OPS,_3=v.OutputScale,_5=v.PDFDataRangeTransport,_4=v.PDFDateString,_6=v.PDFWorker,_8=v.PasswordResponses,_9=v.PermissionFlag,_7=v.PixelsPerInch,pt=v.RenderingCancelledException,pe=v.TextLayer,pi=v.TouchManager,ps=v.UnexpectedResponseException,pa=v.Util,pn=v.VerbosityLevel,pr=v.XfaLayer,pl=v.build,po=v.createValidAbsoluteUrl,ph=v.fetchData,pd=v.getDocument,pc=v.getFilenameFromUrl,pu=v.getPdfFilenameFromUrl,p_=v.getXfaPageViewport,pp=v.isDataScheme,pg=v.isPdfFile,pf=v.noContextMenu,pv=v.normalizeUnicode,pm=v.setLayerDimensions,pw=v.shadow,pb=v.stopEvent,pA=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.