1var fy=Object.defineProperty;var Kp=d=>{throw TypeError(d)};var py=(d,t,e)=>t in d?fy(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var k=(d,t,e)=>py(d,typeof t!="symbol"?t+"":t,e),Xu=(d,t,e)=>t.has(d)||Kp("Cannot "+e);var n=(d,t,e)=>(Xu(d,t,"read from private field"),e?e.call(d):t.get(d)),g=(d,t,e)=>t.has(d)?Kp("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(d):t.set(d,e),f=(d,t,e,s)=>(Xu(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e),b=(d,t,e)=>(Xu(d,t,"access private method"),e);var Jt=(d,t,e,s)=>({set _(i){f(d,t,i,e)},get _(){return n(d,t,s)}});import{r as G,g as gy}from"./leaflet-FFNg8B63.js";var Ig={exports:{}},Iu={};/** 2 * @license React 3 * react-jsx-runtime.production.min.js 4 * 5 * Copyright (c) Facebook, Inc. and its affiliates. 6 * 7 * This source code is licensed under the MIT license found in the 8 * LICENSE file in the root directory of this source tree. 9 */var my=G,by=Symbol.for("react.element"),yy=Symbol.for("react.fragment"),Ay=Object.prototype.hasOwnProperty,wy=my.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,vy={key:!0,ref:!0,__self:!0,__source:!0};function Fg(d,t,e){var s,i={},r=null,a=null;e!==void 0&&(r=""+e),t.key!==void 0&&(r=""+t.key),t.ref!==void 0&&(a=t.ref);for(s in t)Ay.call(t,s)&&!vy.hasOwnProperty(s)&&(i[s]=t[s]);if(d&&d.defaultProps)for(s in t=d.defaultProps,t)i[s]===void 0&&(i[s]=t[s]);return{$$typeof:by,type:d,key:r,ref:a,props:i,_owner:wy.current}}Iu.Fragment=yy;Iu.jsx=Fg;Iu.jsxs=Fg;Ig.exports=Iu;var jt=Ig.exports;function Ng(d){var t,e,s="";if(typeof d=="string"||typeof d=="number")s+=d;else if(typeof d=="object")if(Array.isArray(d)){var i=d.length;for(t=0;t<i;t++)d[t]&&(e=Ng(d[t]))&&(s&&(s+=" "),s+=e)}else for(e in d)d[e]&&(s&&(s+=" "),s+=e);return s}function Fu(){for(var d,t,e=0,s="",i=arguments.length;e<i;e++)(d=arguments[e])&&(t=Ng(d))&&(s&&(s+=" "),s+=t);return s}const Oe=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),sf=[.001,0,0,.001,0,0],qu=1.35,bs={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},xi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},yh="pdfjs_internal_editor_",X={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},st={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},Og={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},fe={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},bh={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Gt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Ja={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},ad={ERRORS:0,WARNINGS:1,INFOS:5},Ul={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,rawFillPath:94},gd={moveTo:0,lineTo:1,curveTo:2,closePath:3},Bg={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Nu=ad.WARNINGS;function Ey(d){Number.isInteger(d)&&(Nu=d)}function Sy(){return Nu}function Ou(d){Nu>=ad.INFOS&&console.info(`Info: ${d}`)}function q(d){Nu>=ad.WARNINGS&&console.warn(`Warning: ${d}`)}function _t(d){throw new Error(d)}function it(d,t){d||_t(t)}function _y(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Rp(d,t=null,e=null){if(!d)return null;
9if(e&&typeof d=="string"){if(e.addDefaultProtocol&&d.startsWith("www.")){const i=d.match(/\./g);(i==null?void 0:i.length)>=2&&(d=`http://${d}`)}if(e.tryConvertEncoding)try{d=Ry(d)}catch{}}const s=t?URL.parse(d,t):URL.parse(d);return _y(s)?s:null}function kp(d,t,e=!1){const s=URL.parse(d);return s?(s.hash=t,s.href):e&&Rp(d,"http://example.com")?d.split("#",1)[0]+`${t?`#${t}`:""}`:""}function J(d,t,e,s=!1){return Object.defineProperty(d,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const Wa=function(){function t(e,s){this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class Jp extends Wa{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Yu extends Wa{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class iu extends Wa{constructor(t){super(t,"InvalidPDFException")}}class Ah extends Wa{constructor(t,e,s){super(t,"ResponseException"),this.status=e,this.missing=s}}class Cy extends Wa{constructor(t){super(t,"FormatError")}}class An extends Wa{constructor(t){super(t,"AbortException")}}function Hg(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&&_t("Invalid argument for bytesToString");const t=d.length,e=8192;if(t<e)return String.fromCharCode.apply(null,d);const s=[];for(let i=0;i<t;i+=e){const r=Math.min(i+e,t),a=d.subarray(i,r);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function od(d){typeof d!="string"&&_t("Invalid argument for stringToBytes");const t=d.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=d.charCodeAt(s)&255;return e}function Ty(d){return String.fromCharCode(d>>24&255,d>>16&255,d>>8&255,d&255)}function xy(){const d=new Uint8Array(4);return d[0]=1,new Uint32Array(d.buffer,0,1)[0]===1}function Py(){try{return new Function(""),!0}catch{return!1}}class de{static get isLittleEndian(){return J(this,"isLittleEndian",xy())}static get isEvalSupported(){return J(this,"isEvalSupported",Py())}static get isOffscreenCanvasSupported(){return J(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return J(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return J(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){var t,e;return J(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const Ku=Array.from(Array(256).keys(),d=>d.toString(16).padStart(2,"0"));var bn,Cd,nf;class H{static makeHexColor(t,e,s){return`#${Ku[t]}${Ku[e]}${Ku[s]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[2],e[2]=s),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[1],e[1]=s,s=e[2],e[2]=e[3],e[3]=s,t[1]<0&&(s=e[1],e[1]=e[3],e[3]=s),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[2],e[2]=s),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 multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,s=0){const i=t[s],r=t[s+1];t[s]=i*e[0]+r*e[2]+e[4],t[s+1]=i*e[1]+r*e[3]+e[5]}static applyTransformToBezier(t,e,s=0){const i=e[0],r=e[1],a=e[2],o=e[3],l=e[4],h=e[5];for(let c=0;c<6;c+=2){const u=t[s+c],p=t[s+c+1];t[s+c]=u*i+p*a+l,t[s+c+1]=u*r+p*o+h}}static applyInverseTransform(t,e){const s=t[0],i=t[1],r=e[0]*e[3]-e[1]*e[2];t[0]=(s*e[3]-i*e[2]+e[2]*e[5]-e[4]*e[3])/r,t[1]=(-s*e[1]+i*e[0]+e[4]*e[1]-e[5]*e[0])/r}static axialAlignedBoundingBox(t,e,s){const i=e[0],r=e[1],a=e[2],o=e[3],l=e[4],h=e[5],c=t[0],u=t[1],p=t[2],m=t[3];let A=i*c+l,y=A,v=i*p+l,w=v,E=o*u+h,S=E,_=o*m+h,C=_;if(r!==0||a!==0){const T=r*c,x=r*p,P=a*u,R=a*m;A+=P,w+=P,v+=R,y+=R,E+=T,C+=T,_+=x,S+=x}s[0]=Math.min(s[0],A,v,y,w),s[1]=Math.min(s[1],E,_,S,C),s[2]=Math.max(s[2],A,v,y,w),s[3]=Math.max(s[3],E,_,S,C)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const s=t[0],i=t[1],r=t[2],a=t[3],o=s**2+i**2,l=s*r+i*a,h=r**2+
9a**2,c=(o+h)/2,u=Math.sqrt(c**2-(o*h-l**2));e[0]=Math.sqrt(c+u||1),e[1]=Math.sqrt(c-u||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>a?null:[s,r,i,a]}static pointBoundingBox(t,e,s){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}static rectBoundingBox(t,e,s,i,r){r[0]=Math.min(r[0],t,s),r[1]=Math.min(r[1],e,i),r[2]=Math.max(r[2],t,s),r[3]=Math.max(r[3],e,i)}static bezierBoundingBox(t,e,s,i,r,a,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),b(this,bn,nf).call(this,t,s,r,o,e,i,a,l,3*(-t+3*(s-r)+o),6*(t-2*s+r),3*(s-t),h),b(this,bn,nf).call(this,t,s,r,o,e,i,a,l,3*(-e+3*(i-a)+l),6*(e-2*i+a),3*(i-e),h)}}bn=new WeakSet,Cd=function(t,e,s,i,r,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,p=h*h,m=p*h,A=u*(u*(u*t+3*h*e)+3*p*s)+m*i,y=u*(u*(u*r+3*h*a)+3*p*o)+m*l;c[0]=Math.min(c[0],A),c[1]=Math.min(c[1],y),c[2]=Math.max(c[2],A),c[3]=Math.max(c[3],y)},nf=function(t,e,s,i,r,a,o,l,h,c,u,p){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&b(this,bn,Cd).call(this,t,e,s,i,r,a,o,l,-u/c,p);return}const m=c**2-4*u*h;if(m<0)return;const A=Math.sqrt(m),y=2*h;b(this,bn,Cd).call(this,t,e,s,i,r,a,o,l,(-c+A)/y,p),b(this,bn,Cd).call(this,t,e,s,i,r,a,o,l,(-c-A)/y,p)},g(H,bn);function Ry(d){return decodeURIComponent(escape(d))}let Ju=null,Qp=null;function Ug(d){return Ju||(Ju=/([\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,Qp=new Map([["ï¬
","ſt"]])),d.replaceAll(Ju,(t,e,s)=>e?e.normalize("NFKC"):Qp.get(s))}function Mp(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),Hg(d)}const Dp="pdfjs_internal_id_";function ky(d,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[s,i,...r]=e;if(!d(s)&&!Number.isInteger(s)||!t(i))return!1;const a=r.length;let o=!0;switch(i.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of r)if(!(typeof l=="number"||o&&l===null))return!1;return!0}function ke(d,t,e){return Math.min(Math.max(d,t),e)}function $g(d){return Uint8Array.prototype.toBase64?d.toBase64():btoa(Hg(d))}function My(d){return Uint8Array.fromBase64?Uint8Array.fromBase64(d):od(atob(d))}typeof Promise.try!="function"&&(Promise.try=function(d,...t){return new Promise(e=>{e(d(...t))})});typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(d){return d.reduce((t,e)=>t+e,0)});class wh{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(r){var l;if(!r)return;let a=null;const o=r.name;if(o==="#text")a=r.value;else if(wh.shouldBuildText(o))(l=r==null?void 0:r.attributes)!=null&&l.textContent?a=r.attributes.textContent:r.value&&(a=r.value);else return;if(a!==null&&e.push({str:a}),!!r.children)for(const h of r.children)i(h)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}class Lp{static setupStorage(t,e,s,i,r){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),r==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})});break;case"input":if(s.attributes.type==="radio"||s.attributes.type==="checkbox"){if(a.value===s.attributes.xfaOn?t.setAttribute("checked",!0):a.value===s.attributes.xfaOff&&t.removeAttribute("checked"),r==="print")break;t.addEventListener("change",o=>{i.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),r==="print")break;t.addEventListener("input",o=>{i.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of s.children)o.attributes.value===a.value?o.attributes.selected=!0:o.attributes.hasOwnProperty("selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;i.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:r}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[l,h]of Object.entries(a))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&r.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,p;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,r=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:r,linkService:s});const o=r!=="richText",l=t.div;if(l.append(a),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=m}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];
9if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&wh.shouldBuildText(i.name)&&h.push(m)}return{textDivs:h}}const c=[[i,-1,a]];for(;c.length>0;){const[m,A,y]=c.at(-1);if(A+1===m.children.length){c.pop();continue}const v=m.children[++c.at(-1)[1]];if(v===null)continue;const{name:w}=v;if(w==="#text"){const S=document.createTextNode(v.value);h.push(S),y.append(S);continue}const E=(u=v==null?void 0:v.attributes)!=null&&u.xmlns?document.createElementNS(v.attributes.xmlns,w):document.createElement(w);if(y.append(E),v.attributes&&this.setAttributes({html:E,element:v,storage:e,intent:r,linkService:s}),((p=v.children)==null?void 0:p.length)>0)c.push([v,-1,E]);else if(v.value){const S=document.createTextNode(v.value);o&&wh.shouldBuildText(w)&&h.push(S),E.append(S)}}for(const m of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Mi="http://www.w3.org/2000/svg",Rr=class Rr{};k(Rr,"CSS",96),k(Rr,"PDF",72),k(Rr,"PDF_TO_CSS_UNITS",Rr.CSS/Rr.PDF);let wn=Rr;async function Gl(d,t="text"){if(Kl(d,document.baseURI)){const e=await fetch(d);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,s)=>{const i=new XMLHttpRequest;i.open("GET",d,!0),i.responseType=t,i.onreadystatechange=()=>{if(i.readyState===XMLHttpRequest.DONE){if(i.status===200||i.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(i.response);return}e(i.responseText);return}s(new Error(i.statusText))}},i.send(null)})}class ld{constructor({viewBox:t,userUnit:e,scale:s,rotation:i,offsetX:r=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=i,this.offsetX=r,this.offsetY=a,s*=e;const l=(t[2]+t[0])/2,h=(t[3]+t[1])/2;let c,u,p,m;switch(i%=360,i<0&&(i+=360),i){case 180:c=-1,u=0,p=0,m=1;break;case 90:c=0,u=1,p=1,m=0;break;case 270:c=0,u=-1,p=-1,m=0;break;case 0:c=1,u=0,p=0,m=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(p=-p,m=-m);let A,y,v,w;c===0?(A=Math.abs(h-t[1])*s+r,y=Math.abs(l-t[0])*s+a,v=(t[3]-t[1])*s,w=(t[2]-t[0])*s):(A=Math.abs(l-t[0])*s+r,y=Math.abs(h-t[1])*s+a,v=(t[2]-t[0])*s,w=(t[3]-t[1])*s),this.transform=[c*s,u*s,p*s,m*s,A-c*s*l-p*s*h,y-u*s*l-m*s*h],this.width=v,this.height=w}get rawDims(){const t=this.viewBox;return J(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:r=!1}={}){return new ld({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:r})}convertToViewportPoint(t,e){const s=[t,e];return H.applyTransform(s,this.transform),s}convertToViewportRectangle(t){const e=[t[0],t[1]];H.applyTransform(e,this.transform);const s=[t[2],t[3]];return H.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){const s=[t,e];return H.applyInverseTransform(s,this.transform),s}}class Bu extends Wa{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function hd(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function Hu(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function jg(d){return[d]=d.split(/[#?]/,1),d.substring(d.lastIndexOf("/")+1)}function Gg(d,t="document.pdf"){if(typeof d!="string")return t;if(hd(d))return q('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const s=(o=>{try{return new URL(o)}catch{try{return new URL(decodeURIComponent(o))}catch{try{return new URL(o,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{return null}}}}})(d);if(!s)return t;const i=o=>{try{let l=decodeURIComponent(o);return l.includes("/")?(l=l.split("/").at(-1),l.test(/^\.pdf$/i)?l:o):l}catch{return o}},r=/\.pdf$/i,a=s.pathname.split("/").at(-1);if(r.test(a))return i(a);if(s.searchParams.size>0){const o=Array.from(s.searchParams.values()).reverse();for(const h of o)if(r.test(h))return i(h);const l=Array.from(s.searchParams.keys()).reverse();for(const h of l)if(r.test(h))return i(h)}if(s.hash){const l=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(s.hash);if(l)return i(l[0])}return t}class Zp{constructor(){k(this,"started",Object.create(null));k(this,"times",[])}time(t){t in this.started&&q(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||q(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:s}of this.times)e=Math.max(s.length,e);for(const{name:s,start:i,end:r}of this.times)t.push(`${s.padEnd(e)} ${r-i}ms 10`);return t.join("")}}function Kl(d,t){const e=t?URL.parse(d,t):URL.parse(d);return(e==null?void 0:e.protocol)==="http:"||(e==null?void 0:e.protocol)==="https:"}function vs(d){d.preventDefault()}function Ft(d){d.preventDefault(),d.stopPropagation()}function Dy(d){console.log("Deprecated API usage: "+d)}var Th;class vh{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;n(this,Th)||f(this,Th,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=n(this,Th).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";
10let 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,h==="-"?(a+=c,o+=u):h==="+"&&(a-=c,o-=u),new Date(Date.UTC(s,i,r,a,o,l))}}Th=new WeakMap,g(vh,Th);function zg(d,{scale:t=1,rotation:e=0}){const{width:s,height:i}=d.attributes.style,r=[0,0,parseInt(s),parseInt(i)];return new ld({viewBox:r,userUnit:1,scale:t,rotation:e})}function zl(d){if(d.startsWith("#")){const t=parseInt(d.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return d.startsWith("rgb(")?d.slice(4,-1).split(",").map(t=>parseInt(t)):d.startsWith("rgba(")?d.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(q(`Not a valid color format: "${d}"`),[0,0,0])}function Ly(d){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of d.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;d.set(e,zl(s))}t.remove()}function It(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform();return[t,e,s,i,r,a]}function ei(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform().invertSelf();return[t,e,s,i,r,a]}function vr(d,t,e=!1,s=!0){if(t instanceof ld){const{pageWidth:i,pageHeight:r}=t.rawDims,{style:a}=d,o=de.isCSSRoundSupported,l=`var(--total-scale-factor) * ${i}px`,h=`var(--total-scale-factor) * ${r}px`,c=o?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,u=o?`round(down, ${h}, var(--scale-round-y))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=c,a.height=u):(a.width=u,a.height=c)}s&&d.setAttribute("data-main-rotation",t.rotation)}class Zs{constructor(){const{pixelRatio:t}=Zs;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,s,i,r=-1){let a=1/0,o=1/0,l=1/0;s=Zs.capPixels(s,r),s>0&&(a=Math.sqrt(s/(t*e))),i!==-1&&(o=i/t,l=i/e);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}}const nu=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Iy{static get isDarkMode(){var t;return J(this,"isDarkMode",!!((t=window==null?void 0:window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches))}}class Vg{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:s}=window.getComputedStyle(t);return t.remove(),J(this,"commentForegroundColor",zl(s))}}function Wg(d,t,e,s){s=Math.min(Math.max(s??1,0),1);const i=255*(1-s);return d=Math.round(d*s+i),t=Math.round(t*s+i),e=Math.round(e*s+i),[d,t,e]}function tg(d,t){const e=d[0]/255,s=d[1]/255,i=d[2]/255,r=Math.max(e,s,i),a=Math.min(e,s,i),o=(r+a)/2;if(r===a)t[0]=t[1]=0;else{const l=r-a;switch(t[1]=o<.5?l/(r+a):l/(2-r-a),r){case e:t[0]=((s-i)/l+(s<i?6:0))*60;break;case s:t[0]=((i-e)/l+2)*60;break;case i:t[0]=((e-s)/l+4)*60;break}}t[2]=o}function rf(d,t){const e=d[0],s=d[1],i=d[2],r=(1-Math.abs(2*i-1))*s,a=r*(1-Math.abs(e/60%2-1)),o=i-r/2;switch(Math.floor(e/60)){case 0:t[0]=r+o,t[1]=a+o,t[2]=o;break;case 1:t[0]=a+o,t[1]=r+o,t[2]=o;break;case 2:t[0]=o,t[1]=r+o,t[2]=a+o;break;case 3:t[0]=o,t[1]=a+o,t[2]=r+o;break;case 4:t[0]=a+o,t[1]=o,t[2]=r+o;break;case 5:case 6:t[0]=r+o,t[1]=o,t[2]=a+o;break}}function eg(d){return d<=.03928?d/12.92:((d+.055)/1.055)**2.4}function sg(d,t,e){rf(d,e),e.map(eg);const s=.2126*e[0]+.7152*e[1]+.0722*e[2];rf(t,e),e.map(eg);const i=.2126*e[0]+.7152*e[1]+.0722*e[2];return s>i?(s+.05)/(i+.05):(i+.05)/(s+.05)}const ig=new Map;function Xg(d,t){const e=d[0]+d[1]*256+d[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776;let s=ig.get(e);if(s)return s;const i=new Float32Array(9),r=i.subarray(0,3),a=i.subarray(3,6);tg(d,a);const o=i.subarray(6,9);tg(t,o);const l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),sg(a,o,r)<h){let c,u;l?(c=a[2],u=1):(c=0,u=a[2]);const p=.005;for(;u-c>p;){const m=a[2]=(c+u)/2;l===sg(a,o,r)<h?c=m:u=m}a[2]=l?u:c}return rf(a,r),s=H.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),ig.set(e,s),s}function Ip({html:d,dir:t,className:e},s){const i=document.createDocumentFragment();
10if(typeof d=="string"){const r=document.createElement("p");r.dir=t||"auto";const a=d.split(/(?:\r\n?|\n)/);for(let o=0,l=a.length;o<l;++o){const h=a[o];r.append(document.createTextNode(h)),o<l-1&&r.append(document.createElement("br"))}i.append(r)}else Lp.render({xfaHtml:d,div:i,intent:"richText"});i.firstChild.classList.add("richText",e),s.append(i)}var xn,Pn,_s,Cs,xh,Rn,po,go,Ph,gu,qg,ve,Yg,Kg,Qa,Jl;const Ii=class Ii{constructor(t){g(this,ve);g(this,xn,null);g(this,Pn,null);g(this,_s);g(this,Cs,null);g(this,xh,null);g(this,Rn,null);g(this,po,null);g(this,go,null);f(this,_s,t),n(Ii,Ph)||f(Ii,Ph,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",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=f(this,xn,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=n(this,_s)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",vs,{signal:e}),t.addEventListener("pointerdown",b(Ii,gu,qg),{signal:e}));const s=f(this,Cs,document.createElement("div"));s.className="buttons",t.append(s);const i=n(this,_s).toolbarPosition;if(i){const{style:r}=t,a=n(this,_s)._uiManager.direction==="ltr"?1-i[0]:i[0];r.insetInlineEnd=`${100*a}%`,r.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return n(this,xn)}hide(){var t;n(this,xn).classList.add("hidden"),(t=n(this,Pn))==null||t.hideDropdown()}show(){var t,e;n(this,xn).classList.remove("hidden"),(t=n(this,xh))==null||t.shown(),(e=n(this,Rn))==null||e.shown()}addDeleteButton(){const{editorType:t,_uiManager:e}=n(this,_s),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",n(Ii,Ph)[t]),b(this,ve,Qa).call(this,s)&&s.addEventListener("click",i=>{e.delete()},{signal:e._signal}),n(this,Cs).append(s)}async addAltText(t){const e=await t.render();b(this,ve,Qa).call(this,e),n(this,Cs).append(e,n(this,ve,Jl)),f(this,xh,t)}addComment(t,e=null){if(n(this,Rn))return;const s=t.renderForToolbar();if(!s)return;b(this,ve,Qa).call(this,s);const i=f(this,po,n(this,ve,Jl));e?(n(this,Cs).insertBefore(s,e),n(this,Cs).insertBefore(i,e)):n(this,Cs).append(s,i),f(this,Rn,t),t.toolbar=this}addColorPicker(t){if(n(this,Pn))return;f(this,Pn,t);const e=t.renderButton();b(this,ve,Qa).call(this,e),n(this,Cs).append(e,n(this,ve,Jl))}async addEditSignatureButton(t){const e=f(this,go,await t.renderEditButton(n(this,_s)));b(this,ve,Qa).call(this,e),n(this,Cs).append(e,n(this,ve,Jl))}removeButton(t){var e,s;switch(t){case"comment":(e=n(this,Rn))==null||e.removeToolbarCommentButton(),f(this,Rn,null),(s=n(this,po))==null||s.remove(),f(this,po,null);break}}async addButton(t,e){switch(t){case"colorPicker":this.addColorPicker(e);break;case"altText":await this.addAltText(e);break;case"editSignature":await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(e);break}}async addButtonBefore(t,e,s){const i=n(this,Cs).querySelector(s);i&&t==="comment"&&this.addComment(e,i)}updateEditSignatureButton(t){n(this,go)&&(n(this,go).title=t)}remove(){var t;n(this,xn).remove(),(t=n(this,Pn))==null||t.destroy(),f(this,Pn,null)}};xn=new WeakMap,Pn=new WeakMap,_s=new WeakMap,Cs=new WeakMap,xh=new WeakMap,Rn=new WeakMap,po=new WeakMap,go=new WeakMap,Ph=new WeakMap,gu=new WeakSet,qg=function(t){t.stopPropagation()},ve=new WeakSet,Yg=function(t){n(this,_s)._focusEventsAllowed=!1,Ft(t)},Kg=function(t){n(this,_s)._focusEventsAllowed=!0,Ft(t)},Qa=function(t){const e=n(this,_s)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,ve,Yg).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,ve,Kg).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",vs,{signal:e}),!0)},Jl=function(){const t=document.createElement("div");return t.className="divider",t},g(Ii,gu),g(Ii,Ph,null);let af=Ii;var Rh,Dr,Ni,vn,Jg,Qg,of;class Fy{constructor(t){g(this,vn);g(this,Rh,null);g(this,Dr,null);g(this,Ni);f(this,Ni,t)}show(t,e,s){const[i,r]=b(this,vn,Qg).call(this,e,s),{style:a}=n(this,Dr)||f(this,Dr,b(this,vn,Jg).call(this));t.append(n(this,Dr)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){n(this,Dr).remove()}}Rh=new WeakMap,Dr=new WeakMap,Ni=new WeakMap,vn=new WeakSet,Jg=function(){const t=f(this,Dr,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=n(this,Ni)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",vs,{signal:e});const s=f(this,Rh,document.createElement("div"));return s.className="buttons",t.append(s),n(this,Ni).hasCommentManager()&&b(this,vn,of).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{n(this,Ni).commentSelection("floating_button")}),b(this,vn,of).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{n(this,Ni).highlightSelection("floating_button")}),t},Qg=function(t,e){let s=0,i=0;for(const r of t){const a=r.y+r.height;if(a<s)continue;const o=r.x+(e?r.width:0);if(a>s){i=o,s=a;continue}e?o>i&&(i=o):o<i&&(i=o)}return[e?1-i:i,s]},of=function(t,e,s,i){const r=document.createElement("button");r.classList.add("basic",t),r.tabIndex=0,r.setAttribute("data-l10n-id",e);const a=document.createElement("span");r.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",s);const o=n(this,Ni)._signal;o instanceof AbortSignal&&!o.aborted&&(r.addEventListener("contextmenu",vs,{signal:o}),r.addEventListener("click",i,{signal:o})),n(this,Rh).append(r)};function Zg(d,t,e){for(const s of e)t.addEventListener(s,d[s].bind(d))}var mu;class Ny{constructor(){g(this,mu,0)}get id(){return`${yh}${Jt(this,mu)._++}`}}mu=new WeakMap;var mo,kh,_e,bo,Td;const Vp=class Vp{constructor(){g(this,bo);g(this,mo,Mp());g(this,kh,0);g(this,_e,null)}static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),i=new Image;i.src=t;const r=i.decode().then(()=>(s.drawImage(i,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0));return J(this,"_isSVGFittingCanvas",r)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:r}=t;return b(this,bo,Td).call(this,`${e}_${s}_${i}_${r}`,t)}async getFromUrl(t){return b(this,bo,Td).call(this,t,t)}async getFromBlob(t,e){const s=await e;return b(this,bo,Td).call(this,t,s)}async getFromId(t){n(this,_e)||f(this,_e,new Map);const e=n(this,_e).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){const{blobPromise:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){n(this,_e)||f(this,_e,new Map);let s=n(this,_e).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const i=new OffscreenCanvas(e.width,e.height);return i.getContext("2d").drawImage(e,0,0),s={bitmap:i.transferToImageBitmap(),id:`image_${n(this,mo)}_${Jt(this,kh)._++}`,refCounter:1,isSvg:!1},n(this,_e).set(t,s),n(this,_e).set(s.id,s),s}getSvgUrl(t){const e=n(this,_e).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var i;n(this,_e)||f(this,_e,new Map);const e=n(this,_e).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:s}=e;if(!e.url&&!e.file){const r=new OffscreenCanvas(s.width,s.height);r.getContext("bitmaprenderer").transferFromImageBitmap(s),e.blobPromise=r.convertToBlob()}(i=s.close)==null||i.call(s),e.bitmap=null}isValidId(t){return t.startsWith(`image_${n(this,mo)}_`)}};mo=new WeakMap,kh=new WeakMap,_e=new WeakMap,bo=new WeakSet,Td=async function(t,e){n(this,_e)||f(this,_e,new Map);let s=n(this,_e).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${n(this,mo)}_${Jt(this,kh)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Gl(e,"blob")):e instanceof File?i=s.file=e:e instanceof Blob&&(i=e),i.type==="image/svg+xml"){const r=Vp._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>
10{s.bitmap=o,s.isSvg=!0,h()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await r?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(i),await l}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){q(i),s=null}return n(this,_e).set(t,s),s&&n(this,_e).set(s.id,s),s};let lf=Vp;var zt,kn,Mh,Lt;class Oy{constructor(t=128){g(this,zt,[]);g(this,kn,!1);g(this,Mh);g(this,Lt,-1);f(this,Mh,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),n(this,kn))return;const l={cmd:t,undo:e,post:s,type:r};if(n(this,Lt)===-1){n(this,zt).length>0&&(n(this,zt).length=0),f(this,Lt,0),n(this,zt).push(l);return}if(a&&n(this,zt)[n(this,Lt)].type===r){o&&(l.undo=n(this,zt)[n(this,Lt)].undo),n(this,zt)[n(this,Lt)]=l;return}const h=n(this,Lt)+1;h===n(this,Mh)?n(this,zt).splice(0,1):(f(this,Lt,h),h<n(this,zt).length&&n(this,zt).splice(h)),n(this,zt).push(l)}undo(){if(n(this,Lt)===-1)return;f(this,kn,!0);const{undo:t,post:e}=n(this,zt)[n(this,Lt)];t(),e==null||e(),f(this,kn,!1),f(this,Lt,n(this,Lt)-1)}redo(){if(n(this,Lt)<n(this,zt).length-1){f(this,Lt,n(this,Lt)+1),f(this,kn,!0);const{cmd:t,post:e}=n(this,zt)[n(this,Lt)];t(),e==null||e(),f(this,kn,!1)}}hasSomethingToUndo(){return n(this,Lt)!==-1}hasSomethingToRedo(){return n(this,Lt)<n(this,zt).length-1}cleanType(t){if(n(this,Lt)!==-1){for(let e=n(this,Lt);e>=0;e--)if(n(this,zt)[e].type!==t){n(this,zt).splice(e+1,n(this,Lt)-e),f(this,Lt,e);return}n(this,zt).length=0,f(this,Lt,-1)}}destroy(){f(this,zt,null)}}zt=new WeakMap,kn=new WeakMap,Mh=new WeakMap,Lt=new WeakMap;var bu,tm;class cd{constructor(t){g(this,bu);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=de.platform;for(const[s,i,r={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:r}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:r}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(b(this,bu,tm).call(this,e));if(!s)return;const{callback:i,options:{bubbles:r=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),r||Ft(e))}}bu=new WeakSet,tm=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const yu=class yu{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return Ly(t),J(this,"_colors",t)}convert(t){const e=zl(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((r,a)=>r===e[a]))return yu._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?H.makeHexColor(...e):t}};k(yu,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let hf=yu;var yo,ts,Ao,Ot,Zt,wo,Ts,vo,xs,Ce,Mn,Dn,Eo,Ln,ni,Ps,Lr,Dh,Lh,So,Ih,ri,In,_o,Fn,ai,Au,Nn,Co,Fh,On,Ir,To,Bn,Nh,Xt,dt,Oi,Hn,Un,Oh,xo,Bh,$n,oi,Bi,Hh,Uh,Rs,L,xd,cf,em,sm,Ql,im,nm,rm,df,am,uf,ff,om,De,Di,lm,hm,pf,cm,Zl,gf;const ao=class ao{constructor(t,e,s,i,r,a,o,l,h,c,u,p,m,A,y,v){g(this,L);g(this,yo,new AbortController);g(this,ts,null);g(this,Ao,null);g(this,Ot,new Map);g(this,Zt,new Map);g(this,wo,null);g(this,Ts,null);g(this,vo,null);g(this,xs,new Oy);g(this,Ce,null);g(this,Mn,null);g(this,Dn,null);g(this,Eo,0);g(this,Ln,new Set);g(this,ni,null);g(this,Ps,null);g(this,Lr,new Set);k(this,"_editorUndoBar",null);g(this,Dh,!1);g(this,Lh,!1);g(this,So,!1);g(this,Ih,null);g(this,ri,null);g(this,In,null);g(this,_o,null);g(this,Fn,!1);g(this,ai,null);g(this,Au,new Ny);g(this,Nn,!1);g(this,Co,!1);g(this,Fh,!1);g(this,On,null);g(this,Ir,null);g(this,To,null);g(this,Bn,null);g(this,Nh,null);g(this,Xt,X.NONE);g(this,dt,new Set);g(this,Oi,null);g(this,Hn,null);g(this,Un,null);g(this,Oh,null);g(this,xo,null);g(this,Bh,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});g(this,$n,[0,0]);g(this,oi,null);g(this,Bi,null);g(this,Hh,null);g(this,Uh,null);g(this,Rs,null);const w=this._signal=n(this,yo).signal;f(this,Bi,t),f(this,Hh,e),f(this,Uh,s),f(this,wo,i),f(this,Ce,r),f(this,Hn,a),f(this,xo,l),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:w}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),o._on("setpreference",this.onSetPreference.bind(this),{signal:w}),o._on("switchannotationeditorparams",E=>this.updateParams(E.type,E.value),{signal:w}),window.addEventListener("pointerdown",()=>{f(this,Co,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{f(this,Co,!1)},{capture:!0,signal:w}),b(this,L,im).call(this),b(this,L,om).call(this),b(this,L,df).call(this),f(this,Ts,l.annotationStorage),f(this,Ih,l.filterFactory),f(this,Un,h),f(this,_o,c||null),f(this,Dh,u),f(this,Lh,p),f(this,So,m),f(this,Nh,A||null),this.viewParameters={realScale:wn.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=v!==!1,r==null||r.setSidebarUiManager(this)}static get _keyboardManager(){const t=ao.prototype,e=a=>n(a,Bi).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},i=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return J(this,"_keyboardManager",new cd([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],t.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:s}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,Bi).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,Bi).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var t,e,s,i,r,a,o,l,h;(t=n(this,Rs))==null||t.resolve(),f(this,Rs,null),(e=n(this,yo))==null||e.abort(),f(this,yo,null),this._signal=null;for(const c of n(this,Zt).values())c.destroy();n(this,Zt).clear(),n(this,Ot).clear(),n(this,Lr).clear(),(s=n(this,Bn))==null||s.clear(),f(this,ts,null),n(this,dt).clear(),n(this,xs).destroy(),(i=n(this,wo))==null||i.destroy(),(r=n(this,Ce))==null||r.destroy(),(a=n(this,Hn))==null||a.destroy(),(o=n(this,ai))==null||o.hide(),f(this,ai,null),(l=n(this,To))==null||l.destroy(),f(this,To,null),f(this,Ao,null),n(this,ri)&&
10(clearTimeout(n(this,ri)),f(this,ri,null)),n(this,oi)&&(clearTimeout(n(this,oi)),f(this,oi,null)),(h=this._editorUndoBar)==null||h.destroy(),f(this,xo,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return n(this,Nh)}get useNewAltTextFlow(){return n(this,Lh)}get useNewAltTextWhenAddingImage(){return n(this,So)}get hcmFilter(){return J(this,"hcmFilter",n(this,Un)?n(this,Ih).addHCMFilter(n(this,Un).foreground,n(this,Un).background):"none")}get direction(){return J(this,"direction",getComputedStyle(n(this,Bi)).direction)}get _highlightColors(){return J(this,"_highlightColors",n(this,_o)?new Map(n(this,_o).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return J(this,"highlightColors",null);const e=new Map,s=!!n(this,Un);for(const[i,r]of t){const a=i.endsWith("_HCM");if(s&&a){e.set(i.replace("_HCM",""),r);continue}!s&&!a&&e.set(i,r)}return J(this,"highlightColors",e)}get highlightColorNames(){return J(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),f(this,Dn,t)}setMainHighlightColorPicker(t){f(this,To,t)}editAltText(t,e=!1){var s;(s=n(this,wo))==null||s.editAltText(this,t,e)}hasCommentManager(){return!!n(this,Ce)}editComment(t,e,s,i){var r;(r=n(this,Ce))==null||r.showDialog(this,t,e,s,i)}selectComment(t,e){const s=n(this,Zt).get(t),i=s==null?void 0:s.getEditorByUID(e);i==null||i.toggleComment(!0,!0)}updateComment(t){var e;(e=n(this,Ce))==null||e.updateComment(t.getData())}updatePopupColor(t){var e;(e=n(this,Ce))==null||e.updatePopupColor(t)}removeComment(t){var e;(e=n(this,Ce))==null||e.removeComments([t.uid])}toggleComment(t,e,s=void 0){var i;(i=n(this,Ce))==null||i.toggleCommentPopup(t,e,s)}makeCommentColor(t,e){var s;return t&&((s=n(this,Ce))==null?void 0:s.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return((t=n(this,Ce))==null?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if(n(this,Zt).has(t-1))return;const{resolve:e,promise:s}=Promise.withResolvers(),i=r=>{r.pageNumber===t&&(this._eventBus._off("editorsrendered",i),e())};this._eventBus.on("editorsrendered",i),await s}getSignature(t){var e;(e=n(this,Hn))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return n(this,Hn)}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({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":f(this,So,e);break}}onPageChanging({pageNumber:t}){f(this,Eo,t-1)}focusMainContainer(){n(this,Bi).focus()}findParent(t,e){for(const s of n(this,Zt).values()){const{x:i,y:r,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=r&&e<=r+o)return s}return null}disableUserSelect(t=!1){n(this,Hh).classList.toggle("noUserSelect",t)}addShouldRescale(t){n(this,Lr).add(t)}removeShouldRescale(t){n(this,Lr).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*wn.PDF_TO_CSS_UNITS;for(const s of n(this,Lr))s.onScaleChanging();(e=n(this,Dn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){const s=document.getSelection();if(!s||s.isCollapsed)return;const{anchorNode:i,anchorOffset:r,focusNode:a,focusOffset:o}=s,l=s.toString(),c=b(this,L,xd).call(this,s).closest(".textLayer"),u=this.getSelectionBoxes(c);if(!u)return;s.empty();const p=b(this,L,cf).call(this,c),m=n(this,Xt)===X.NONE,A=()=>{const y=p==null?void 0:p.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:u,anchorNode:i,anchorOffset:r,focusNode:a,focusOffset:o,text:l});m&&this.showAllEditors("highlight",!0,!0),e&&(y==null||y.editComment())};if(m){this.switchToMode(X.HIGHLIGHT,A);return}A()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!n(this,Ts))return null;const e=`${yh}${t}`,s=n(this,Ts).getRawValue(e);return s&&n(this,Ts).remove(e),s}
10addToAnnotationStorage(t){!t.isEmpty()&&n(this,Ts)&&!n(this,Ts).has(t.id)&&n(this,Ts).setValue(t.id,t)}a11yAlert(t,e=null){const s=n(this,Uh);s&&(s.setAttribute("data-l10n-id",t),e?s.setAttribute("data-l10n-args",JSON.stringify(e)):s.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,n(this,Fn)&&(f(this,Fn,!1),b(this,L,Ql).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of n(this,dt))if(e.div.contains(t)){f(this,Ir,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!n(this,Ir))return;const[t,e]=n(this,Ir);f(this,Ir,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,L,df).call(this),b(this,L,uf).call(this)}removeEditListeners(){b(this,L,am).call(this),b(this,L,ff).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of n(this,Ps))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of n(this,Ps))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=n(this,ts))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of n(this,dt)){const r=i.serialize(!0);r&&e.push(r)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const a of n(this,Ps))if(a.isHandlingMimeForPasting(r.type)){a.paste(r,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(r){q(`paste: "${r.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const r=[];for(const l of s){const h=await i.deserialize(l);if(!h)return;r.push(h)}const a=()=>{for(const l of r)b(this,L,pf).call(this,l);b(this,L,gf).call(this,r)},o=()=>{for(const l of r)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(r){q(`paste: "${r.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),n(this,Xt)!==X.NONE&&!this.isEditorHandlingKeyboard&&ao._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,n(this,Fn)&&(f(this,Fn,!1),b(this,L,Ql).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}setEditingState(t){t?(b(this,L,nm).call(this),b(this,L,uf).call(this),b(this,L,De).call(this,{isEditing:n(this,Xt)!==X.NONE,isEmpty:b(this,L,Zl).call(this),hasSomethingToUndo:n(this,xs).hasSomethingToUndo(),hasSomethingToRedo:n(this,xs).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,L,rm).call(this),b(this,L,ff).call(this),b(this,L,De).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!n(this,Ps)){f(this,Ps,t);for(const e of n(this,Ps))b(this,L,Di).call(this,e.defaultPropertiesToUpdate)}}getId(){return n(this,Au).id}get currentLayer(){return n(this,Zt).get(n(this,Eo))}getLayer(t){return n(this,Zt).get(t)}get currentPageIndex(){return n(this,Eo)}addLayer(t){n(this,Zt).set(t.pageIndex,t),n(this,Nn)?t.enable():t.disable()}removeLayer(t){n(this,Zt).delete(t.pageIndex)}async updateMode(t,e=null,s=!1,i=!1,r=!1){var a,o,l,h,c,u;if(n(this,Xt)!==t&&!(n(this,Rs)&&(await n(this,Rs).promise,!n(this,Rs)))){if(f(this,Rs,Promise.withResolvers()),(a=n(this,Dn))==null||a.commitOrRemove(),n(this,Xt)===X.POPUP&&((o=n(this,Ce))==null||o.hideSidebar()),(l=n(this,Ce))==null||l.destroyPopup(),f(this,Xt,t),t===X.NONE){this.setEditingState(!1),b(this,L,hm).call(this);for(const p of n(this,Ot).values())p.hideStandaloneCommentButton();(h=this._editorUndoBar)==null||h.hide(),this.toggleComment(null),n(this,Rs).resolve();return}for(const p of n(this,Ot).values())p.addStandaloneCommentButton();t===X.SIGNATURE&&await((c=n(this,Hn))==null?void 0:c.loadSignatures()),this.setEditingState(!0),await b(this,L,lm).call(this),this.unselectAll();for(const p of n(this,Zt).values())p.updateMode(t);if(t===X.POPUP){n(this,Ao)||f(this,Ao,await n(this,xo).getAnnotationsByType(new Set(n(this,Ps).map(A=>A._editorType))));const p=new Set,m=[];for(const A of n(this,Ot).values()){const{annotationElementId:y,hasComment:v,deleted:w}=A;y&&p.add(y),v&&!w&&m.push(A.getData())}for(const A of n(this,Ao)){const{id:y,popupRef:v,contentsObj:w}=A;v&&(w!=null&&w.str)&&!p.has(y)&&!n(this,Ln).has(y)&&m.push(A)}(u=n(this,Ce))==null||u.showSidebar(m)}if(!e){s&&this.addNewEditorFromKeyboard(),n(this,Rs).resolve();return}for(const p of n(this,Ot).values())p.uid===e?(this.setSelected(p),r?p.editComment():i?p.enterInEditMode():p.focus()):p.unselect();n(this,Rs).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==n(this,Xt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(n(this,Ps)){switch(t){case st.CREATE:this.currentLayer.addNewEditor(e);return;case st.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(n(this,Oh)||f(this,Oh,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(const s of n(this,dt))s.updateParams(t,e);else for(const s of n(this,Ps))s.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var r;for(const a of n(this,Ot).values())a.editorType===t&&a.show(e);(((r=n(this,Oh))==null?void 0:r.get(st.HIGHLIGHT_SHOW_ALL))??!0)!==e&&b(this,L,Di).call(this,[[st.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(n(this,Fh)!==t){f(this,Fh,t);for(const e of n(this,Zt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of n(this,Ot).values())e.pageIndex===t&&(yield e)}getEditor(t){return n(this,Ot).get(t)}addEditor(t){n(this,Ot).set(t.id,t)}removeEditor(t){var e,s;t.div.contains(document.activeElement)&&(n(this,ri)&&clearTimeout(n(this,ri)),f(this,ri,setTimeout(()=>{this.focusMainContainer(),f(this,ri,null)},0))),n(this,Ot).delete(t.id),t.annotationElementId&&((e=n(this,Bn))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!n(this,Ln).has(t.annotationElementId))&&((s=n(this,Ts))==null||s.remove(t.id))}addDeletedAnnotationElement(t){n(this,Ln).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}
10isDeletedAnnotationElement(t){return n(this,Ln).has(t)}removeDeletedAnnotationElement(t){n(this,Ln).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){n(this,ts)!==t&&(f(this,ts,t),t&&b(this,L,Di).call(this,t.propertiesToUpdate))}updateUI(t){n(this,L,cm)===t&&b(this,L,Di).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,L,Di).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(n(this,dt).has(t)){n(this,dt).delete(t),t.unselect(),b(this,L,De).call(this,{hasSelectedEditor:this.hasSelection});return}n(this,dt).add(t),t.select(),b(this,L,Di).call(this,t.propertiesToUpdate),b(this,L,De).call(this,{hasSelectedEditor:!0})}setSelected(t){var e;this.updateToolbar({mode:t.mode,editId:t.id}),(e=n(this,Dn))==null||e.commitOrRemove();for(const s of n(this,dt))s!==t&&s.unselect();n(this,dt).clear(),n(this,dt).add(t),t.select(),b(this,L,Di).call(this,t.propertiesToUpdate),b(this,L,De).call(this,{hasSelectedEditor:!0})}isSelected(t){return n(this,dt).has(t)}get firstSelectedEditor(){return n(this,dt).values().next().value}unselect(t){t.unselect(),n(this,dt).delete(t),b(this,L,De).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return n(this,dt).size!==0}get isEnterHandled(){return n(this,dt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;n(this,xs).undo(),b(this,L,De).call(this,{hasSomethingToUndo:n(this,xs).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,L,Zl).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){n(this,xs).redo(),b(this,L,De).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:n(this,xs).hasSomethingToRedo(),isEmpty:b(this,L,Zl).call(this)})}addCommands(t){n(this,xs).add(t),b(this,L,De).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,L,Zl).call(this)})}cleanUndoStack(t){n(this,xs).cleanType(t)}delete(){var r;this.commitOrRemove();const t=(r=this.currentLayer)==null?void 0:r.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...n(this,dt)],s=()=>{var a;(a=this._editorUndoBar)==null||a.show(i,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},i=()=>{for(const a of e)b(this,L,pf).call(this,a)};this.addCommands({cmd:s,undo:i,mustExec:!0})}commitOrRemove(){var t;(t=n(this,ts))==null||t.commitOrRemove()}hasSomethingToControl(){return n(this,ts)||this.hasSelection}selectAll(){for(const t of n(this,dt))t.commit();b(this,L,gf).call(this,n(this,Ot).values())}unselectAll(){var t;if(!(n(this,ts)&&(n(this,ts).commitOrRemove(),n(this,Xt)!==X.NONE))&&!((t=n(this,Dn))!=null&&t.commitOrRemove())&&this.hasSelection){for(const e of n(this,dt))e.unselect();n(this,dt).clear(),b(this,L,De).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;n(this,$n)[0]+=t,n(this,$n)[1]+=e;const[i,r]=n(this,$n),a=[...n(this,dt)],o=1e3;n(this,oi)&&clearTimeout(n(this,oi)),f(this,oi,setTimeout(()=>{f(this,oi,null),n(this,$n)[0]=n(this,$n)[1]=0,this.addCommands({cmd:()=>{for(const l of a)n(this,Ot).has(l.id)&&(l.translateInPage(i,r),l.translationDone())},undo:()=>{for(const l of a)n(this,Ot).has(l.id)&&(l.translateInPage(-i,-r),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),f(this,ni,new Map);for(const t of n(this,dt))n(this,ni).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!n(this,ni))return!1;this.disableUserSelect(!1);const t=n(this,ni);f(this,ni,null);let e=!1;for(const[{x:i,y:r,pageIndex:a},o]of t)o.newX=i,o.newY=r,o.newPageIndex=a,e||(e=i!==o.savedX||r!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,r,a,o)=>{if(n(this,Ot).has(i.id)){const l=n(this,Zt).get(o);l?i._setParentAndPosition(l,r,a):(i.pageIndex=o,i.x=r,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:r,newY:a,newPageIndex:o}]of t)s(i,r,a,o)},undo:()=>{for(const[i,{savedX:r,savedY:a,savedPageIndex:o}]of t)s(i,r,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(n(this,ni))for(const s of n(this,ni).keys())s.drag(t,e)}rebuild(t){if(t.parent===null){const 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((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||n(this,dt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return n(this,ts)===t}getActive(){return n(this,ts)}getMode(){return n(this,Xt)}isEditingMode(){return n(this,Xt)!==X.NONE}get imageManager(){return J(this,"imageManager",new lf)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,c=e.rangeCount;h<c;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:s,y:i,width:r,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,c,u,p)=>({x:(c-i)/a,y:1-(h+u-s)/r,width:p/a,height:u/r});break;case"180":o=(h,c,u,p)=>({x:1-(h+u-s)/r,y:1-(c+p-i)/a,width:u/r,height:p/a});break;case"270":o=(h,c,u,p)=>({x:1-(c+p-i)/a,y:(h-s)/r,width:p/a,height:u/r});break;default:o=(h,c,u,p)=>({x:(h-s)/r,y:(c-i)/a,width:u/r,height:p/a});break}const l=[];for(let h=0,c=e.rangeCount;h<c;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:p,y:m,width:A,height:y}of u.getClientRects())A===0||y===0||l.push(o(p,m,A,y))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(n(this,vo)||f(this,vo,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=n(this,vo))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=n(this,vo))==null?void 0:i.get(t.data.id);if(!e)return;const s=n(this,Ts).getRawValue(e);s&&(n(this,Xt)===X.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}setMissingCanvas(t,e,s){var r;const i=(r=n(this,Bn))==null?void 0:r.get(t);i&&(i.setCanvas(e,s),n(this,Bn).delete(t))}addMissingCanvas(t,e){(n(this,Bn)||f(this,Bn,new Map)).set(t,e)}};yo=new WeakMap,ts=new WeakMap,Ao=new WeakMap,Ot=new WeakMap,Zt=new WeakMap,wo=new WeakMap,Ts=new WeakMap,vo=new WeakMap,xs=new WeakMap,Ce=new WeakMap,Mn=new WeakMap,Dn=new WeakMap,Eo=new WeakMap,Ln=new WeakMap,ni=new WeakMap,Ps=new WeakMap,Lr=new WeakMap,Dh=new WeakMap,Lh=new WeakMap,So=new WeakMap,Ih=new WeakMap,ri=new WeakMap,In=new WeakMap,_o=new WeakMap,Fn=new WeakMap,ai=new WeakMap,Au=new WeakMap,Nn=new WeakMap,Co=new WeakMap,Fh=new WeakMap,On=new WeakMap,Ir=new WeakMap,To=new WeakMap,Bn=new WeakMap,Nh=new WeakMap,Xt=new WeakMap,dt=new WeakMap,Oi=new WeakMap,Hn=new WeakMap,Un=new WeakMap,Oh=new WeakMap,xo=new WeakMap,Bh=new WeakMap,$n=new WeakMap,oi=new WeakMap,Bi=new WeakMap,Hh=new WeakMap,Uh=new WeakMap,Rs=new WeakMap,L=new WeakSet,xd=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},cf=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const s of n(this,Zt).values())if(s.hasTextLayer(t))return s;return null},em=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;
10const s=b(this,L,xd).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(n(this,ai)||f(this,ai,new Fy(this)),n(this,ai).show(s,i,this.direction==="ltr"))},sm=function(){var r,a,o;const t=document.getSelection();if(!t||t.isCollapsed){n(this,Oi)&&((r=n(this,ai))==null||r.hide(),f(this,Oi,null),b(this,L,De).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===n(this,Oi))return;const i=b(this,L,xd).call(this,t).closest(".textLayer");if(!i){n(this,Oi)&&((a=n(this,ai))==null||a.hide(),f(this,Oi,null),b(this,L,De).call(this,{hasSelectedText:!1}));return}if((o=n(this,ai))==null||o.hide(),f(this,Oi,e),b(this,L,De).call(this,{hasSelectedText:!0}),!(n(this,Xt)!==X.HIGHLIGHT&&n(this,Xt)!==X.NONE)&&(n(this,Xt)===X.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),f(this,Fn,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=n(this,Xt)===X.HIGHLIGHT?b(this,L,cf).call(this,i):null;if(l==null||l.toggleDrawing(),n(this,Co)){const h=new AbortController,c=this.combinedSignal(h),u=p=>{p.type==="pointerup"&&p.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&b(this,L,Ql).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("blur",u,{signal:c})}else l==null||l.toggleDrawing(!0),b(this,L,Ql).call(this,"main_toolbar")}},Ql=function(t=""){n(this,Xt)===X.HIGHLIGHT?this.highlightSelection(t):n(this,Dh)&&b(this,L,em).call(this)},im=function(){document.addEventListener("selectionchange",b(this,L,sm).bind(this),{signal:this._signal})},nm=function(){if(n(this,In))return;f(this,In,new AbortController);const t=this.combinedSignal(n(this,In));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},rm=function(){var t;(t=n(this,In))==null||t.abort(),f(this,In,null)},df=function(){if(n(this,On))return;f(this,On,new AbortController);const t=this.combinedSignal(n(this,On));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},am=function(){var t;(t=n(this,On))==null||t.abort(),f(this,On,null)},uf=function(){if(n(this,Mn))return;f(this,Mn,new AbortController);const t=this.combinedSignal(n(this,Mn));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})},ff=function(){var t;(t=n(this,Mn))==null||t.abort(),f(this,Mn,null)},om=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},De=function(t){Object.entries(t).some(([s,i])=>n(this,Bh)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(n(this,Bh),t)}),n(this,Xt)===X.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,L,Di).call(this,[[st.HIGHLIGHT_FREE,!0]]))},Di=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},lm=async function(){if(!n(this,Nn)){f(this,Nn,!0);const t=[];for(const e of n(this,Zt).values())t.push(e.enable());await Promise.all(t);for(const e of n(this,Ot).values())e.enable()}},hm=function(){if(this.unselectAll(),n(this,Nn)){f(this,Nn,!1);for(const t of n(this,Zt).values())t.disable();for(const t of n(this,Ot).values())t.disable()}},pf=function(t){const e=n(this,Zt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},cm=function(){let t=null;for(t of n(this,dt));return t},Zl=function(){if(n(this,Ot).size===0)return!0;if(n(this,Ot).size===1)for(const t of n(this,Ot).values())return t.isEmpty();return!1},gf=function(t){for(const e of n(this,dt))e.unselect();n(this,dt).clear();for(const e of t)e.isEmpty()||(n(this,dt).add(e),e.select());b(this,L,De).call(this,{hasSelectedEditor:this.hasSelection})},k(ao,"TRANSLATE_SMALL",1),k(ao,"TRANSLATE_BIG",10);let Er=ao;var ne,li,Hs,Po,hi,es,Ro,ci,je,Hi,Fr,di,jn,Qs,th,Pd;const Le=class Le{constructor(t){g(this,Qs);g(this,ne,null);g(this,li,!1);g(this,Hs,null);g(this,Po,null);g(this,hi,null);g(this,es,null);g(this,Ro,!1);g(this,ci,null);g(this,je,null);g(this,Hi,null);g(this,Fr,null);g(this,di,!1);f(this,je,t),f(this,di,t._uiManager.useNewAltTextFlow),n(Le,jn)||f(Le,jn,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){Le._l10n??(Le._l10n=t)}async render(){const t=f(this,Hs,document.createElement("button"));t.className="altText",t.tabIndex="0";
10const e=f(this,Po,document.createElement("span"));t.append(e),n(this,di)?(t.classList.add("new"),t.setAttribute("data-l10n-id",n(Le,jn).missing),e.setAttribute("data-l10n-id",n(Le,jn)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=n(this,je)._uiManager._signal;t.addEventListener("contextmenu",vs,{signal:s}),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:s});const i=r=>{r.preventDefault(),n(this,je)._uiManager.editAltText(n(this,je)),n(this,di)&&n(this,je)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:n(this,Qs,th)}})};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(f(this,Ro,!0),i(r))},{signal:s}),await b(this,Qs,Pd).call(this),t}finish(){n(this,Hs)&&(n(this,Hs).focus({focusVisible:n(this,Ro)}),f(this,Ro,!1))}isEmpty(){return n(this,di)?n(this,ne)===null:!n(this,ne)&&!n(this,li)}hasData(){return n(this,di)?n(this,ne)!==null||!!n(this,Hi):this.isEmpty()}get guessedText(){return n(this,Hi)}async setGuessedText(t){n(this,ne)===null&&(f(this,Hi,t),f(this,Fr,await Le._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Qs,Pd).call(this))}toggleAltTextBadge(t=!1){var e;if(!n(this,di)||n(this,ne)){(e=n(this,ci))==null||e.remove(),f(this,ci,null);return}if(!n(this,ci)){const s=f(this,ci,document.createElement("div"));s.className="noAltTextBadge",n(this,je).div.append(s)}n(this,ci).classList.toggle("hidden",!t)}serialize(t){let e=n(this,ne);return!t&&n(this,Hi)===e&&(e=n(this,Fr)),{altText:e,decorative:n(this,li),guessedText:n(this,Hi),textWithDisclaimer:n(this,Fr)}}get data(){return{altText:n(this,ne),decorative:n(this,li)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:i,cancel:r=!1}){s&&(f(this,Hi,s),f(this,Fr,i)),!(n(this,ne)===t&&n(this,li)===e)&&(r||(f(this,ne,t),f(this,li,e)),b(this,Qs,Pd).call(this))}toggle(t=!1){n(this,Hs)&&(!t&&n(this,es)&&(clearTimeout(n(this,es)),f(this,es,null)),n(this,Hs).disabled=!t)}shown(){n(this,je)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:n(this,Qs,th)}})}destroy(){var t,e;(t=n(this,Hs))==null||t.remove(),f(this,Hs,null),f(this,Po,null),f(this,hi,null),(e=n(this,ci))==null||e.remove(),f(this,ci,null)}};ne=new WeakMap,li=new WeakMap,Hs=new WeakMap,Po=new WeakMap,hi=new WeakMap,es=new WeakMap,Ro=new WeakMap,ci=new WeakMap,je=new WeakMap,Hi=new WeakMap,Fr=new WeakMap,di=new WeakMap,jn=new WeakMap,Qs=new WeakSet,th=function(){return n(this,ne)&&"added"||n(this,ne)===null&&this.guessedText&&"review"||"missing"},Pd=async function(){var i,r,a;const t=n(this,Hs);if(!t)return;if(n(this,di)){if(t.classList.toggle("done",!!n(this,ne)),t.setAttribute("data-l10n-id",n(Le,jn)[n(this,Qs,th)]),(i=n(this,Po))==null||i.setAttribute("data-l10n-id",n(Le,jn)[`${n(this,Qs,th)}-label`]),!n(this,ne)){(r=n(this,hi))==null||r.remove();return}}else{if(!n(this,ne)&&!n(this,li)){t.classList.remove("done"),(a=n(this,hi))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=n(this,hi);if(!e){f(this,hi,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${n(this,je).id}`;const o=100,l=n(this,je)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(n(this,es)),f(this,es,null)},{once:!0}),t.addEventListener("mouseenter",()=>{f(this,es,setTimeout(()=>{f(this,es,null),n(this,hi).classList.add("show"),n(this,je)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;n(this,es)&&(clearTimeout(n(this,es)),f(this,es,null)),(h=n(this,hi))==null||h.classList.remove("show")},{signal:l})}n(this,li)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=n(this,ne)),e.parentNode||t.append(e);const s=n(this,je).getElementForAltText();s==null||s.setAttribute("aria-describedby",e.id)},g(Le,jn,null),k(Le,"_l10n",null);let ru=Le;var pe,ks,Nr,Tt,$h,Or,Us,Br,Hr,Ur,jh,mf;class md{constructor(t){g(this,jh);g(this,pe,null);g(this,ks,null);g(this,Nr,!1);g(this,Tt,null);g(this,$h,null);g(this,Or,null);g(this,Us,null);g(this,Br,null);g(this,Hr,!1);g(this,Ur,null);f(this,Tt,t)}renderForToolbar(){const t=f(this,ks,document.createElement("button"));
10return t.className="comment",b(this,jh,mf).call(this,t,!1)}renderForStandalone(){const t=f(this,pe,document.createElement("button"));t.className="annotationCommentButton";const e=n(this,Tt).commentButtonPosition;if(e){const{style:s}=t;s.insetInlineEnd=`calc(${100*(n(this,Tt)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;const i=n(this,Tt).commentButtonColor;i&&(s.backgroundColor=i)}return b(this,jh,mf).call(this,t,!0)}focusButton(){setTimeout(()=>{var t;(t=n(this,pe)??n(this,ks))==null||t.focus()},0)}onUpdatedColor(){if(!n(this,pe))return;const t=n(this,Tt).commentButtonColor;t&&(n(this,pe).style.backgroundColor=t),n(this,Tt)._uiManager.updatePopupColor(n(this,Tt))}get commentButtonWidth(){var t;return(((t=n(this,pe))==null?void 0:t.getBoundingClientRect().width)??0)/n(this,Tt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(n(this,Ur))return n(this,Ur);if(!n(this,pe))return null;const{x:t,y:e,height:s}=n(this,pe).getBoundingClientRect(),{x:i,y:r,width:a,height:o}=n(this,Tt).parent.boundingClientRect;return[(t-i)/a,(e+s-r)/o]}set commentPopupPositionInLayer(t){f(this,Ur,t)}hasDefaultPopupPosition(){return n(this,Ur)===null}removeStandaloneCommentButton(){var t;(t=n(this,pe))==null||t.remove(),f(this,pe,null)}removeToolbarCommentButton(){var t;(t=n(this,ks))==null||t.remove(),f(this,ks,null)}setCommentButtonStates({selected:t,hasPopup:e}){n(this,pe)&&(n(this,pe).classList.toggle("selected",t),n(this,pe).ariaExpanded=e)}edit(t){const e=this.commentPopupPositionInLayer;let s,i;if(e)[s,i]=e;else{[s,i]=n(this,Tt).commentButtonPosition;const{width:c,height:u,x:p,y:m}=n(this,Tt);s=p+s*c,i=m+i*u}const r=n(this,Tt).parent.boundingClientRect,{x:a,y:o,width:l,height:h}=r;n(this,Tt)._uiManager.editComment(n(this,Tt),a+s*l,o+i*h,{...t,parentDimensions:r})}finish(){n(this,ks)&&(n(this,ks).focus({focusVisible:n(this,Nr)}),f(this,Nr,!1))}isDeleted(){return n(this,Hr)||n(this,Us)===""}isEmpty(){return n(this,Us)===null}hasBeenEdited(){return this.isDeleted()||n(this,Us)!==n(this,$h)}serialize(){return this.data}get data(){return{text:n(this,Us),richText:n(this,Or),date:n(this,Br),deleted:this.isDeleted()}}set data(t){if(t!==n(this,Us)&&f(this,Or,null),t===null){f(this,Us,""),f(this,Hr,!0);return}f(this,Us,t),f(this,Br,new Date),f(this,Hr,!1)}setInitialText(t,e=null){f(this,$h,t),this.data=t,f(this,Br,null),f(this,Or,e)}shown(){}destroy(){var t,e;(t=n(this,ks))==null||t.remove(),f(this,ks,null),(e=n(this,pe))==null||e.remove(),f(this,pe,null),f(this,Us,""),f(this,Or,null),f(this,Br,null),f(this,Tt,null),f(this,Nr,!1),f(this,Hr,!1)}}pe=new WeakMap,ks=new WeakMap,Nr=new WeakMap,Tt=new WeakMap,$h=new WeakMap,Or=new WeakMap,Us=new WeakMap,Br=new WeakMap,Hr=new WeakMap,Ur=new WeakMap,jh=new WeakSet,mf=function(t,e){if(!n(this,Tt)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[n(this,Tt)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button"));const s=n(this,Tt)._uiManager._signal;if(!(s instanceof AbortSignal)||s.aborted)return t;t.addEventListener("contextmenu",vs,{signal:s}),e&&(t.addEventListener("focusin",r=>{n(this,Tt)._focusEventsAllowed=!1,Ft(r)},{capture:!0,signal:s}),t.addEventListener("focusout",r=>{n(this,Tt)._focusEventsAllowed=!0,Ft(r)},{capture:!0,signal:s})),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:s});const i=r=>{r.preventDefault(),t===n(this,ks)?this.edit():n(this,Tt).toggleComment(!0)};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(f(this,Nr,!0),i(r))},{signal:s}),t.addEventListener("pointerenter",()=>{n(this,Tt).toggleComment(!1,!0)},{signal:s}),t.addEventListener("pointerleave",()=>{n(this,Tt).toggleComment(!1,!1)},{signal:s}),t};var ko,$r,Gh,zh,Vh,Wh,Xh,Ui,jr,$i,Gr,ji,Sr,dm,um,fm;const Wp=class Wp{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:s=null,onPinchStart:i=null,onPinching:r=null,onPinchEnd:a=null,signal:o}){g(this,Sr);g(this,ko);g(this,$r,!1);g(this,Gh,null);g(this,zh);g(this,Vh);g(this,Wh);g(this,Xh);g(this,Ui,null);g(this,jr);g(this,$i,null);g(this,Gr);g(this,ji,null);f(this,ko,t),f(this,Gh,s),f(this,zh,e),f(this,Vh,i),f(this,Wh,r),f(this,Xh,a),f(this,Gr,new AbortController),f(this,jr,AbortSignal.any([o,n(this,Gr).signal])),t.addEventListener("touchstart",b(this,Sr,dm).bind(this),{passive:!1,signal:n(this,jr)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Zs.pixelRatio}destroy(){var t,e;(t=n(this,Gr))==null||t.abort(),f(this,Gr,null),(e=n(this,Ui))==null||e.abort(),f(this,Ui,null)}};ko=new WeakMap,$r=new WeakMap,Gh=new WeakMap,zh=new WeakMap,Vh=new WeakMap,Wh=new WeakMap,Xh=new WeakMap,Ui=new WeakMap,jr=new WeakMap,$i=new WeakMap,Gr=new WeakMap,ji=new WeakMap,Sr=new WeakSet,dm=function(t){var i,r,a;if((i=n(this,zh))!=null&&i.call(this))return;if(t.touches.length===1){if(n(this,Ui))return;const o=f(this,Ui,new AbortController),l=AbortSignal.any([n(this,jr),o.signal]),h=n(this,ko),c={capture:!0,signal:l,passive:!1},u=p=>{var m;p.pointerType==="touch"&&((m=n(this,Ui))==null||m.abort(),f(this,Ui,null))};h.addEventListener("pointerdown",p=>{p.pointerType==="touch"&&(Ft(p),u(p))},c),h.addEventListener("pointerup",u,c),h.addEventListener("pointercancel",u,c);return}if(!n(this,ji)){f(this,ji,new AbortController);const o=AbortSignal.any([n(this,jr),n(this,ji).signal]),l=n(this,ko),h={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",b(this,Sr,um).bind(this),h);const c=b(this,Sr,fm).bind(this);l.addEventListener("touchend",c,h),l.addEventListener("touchcancel",c,h),h.capture=!0,l.addEventListener("pointerdown",Ft,h),l.addEventListener("pointermove",Ft,h),l.addEventListener("pointercancel",Ft,h),l.addEventListener("pointerup",Ft,h),(r=n(this,Vh))==null||r.call(this)}if(Ft(t),t.touches.length!==2||(a=n(this,Gh))!=null&&a.call(this)){f(this,$i,null);return}let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]),f(this,$i,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:s.screenX,touch1Y:s.screenY})},um=function(t){var _;if(!n(this,$i)||t.touches.length!==2)return;Ft(t);let[e,s]=t.touches;e.identifier>s.identifier&&([e,s]=[s,e]);const{screenX:i,screenY:r}=e,{screenX:a,screenY:o}=s,l=n(this,$i),{touch0X:h,touch0Y:c,touch1X:u,touch1Y:p}=l,m=u-h,A=p-c,y=a-i,v=o-r,w=Math.hypot(y,v)||1,E=Math.hypot(m,A)||1;if(!n(this,$r)&&Math.abs(E-w)<=Wp.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=i,l.touch0Y=r,l.touch1X=a,l.touch1Y=o,!n(this,$r)){f(this,$r,!0);return}const S=[(i+a)/2,(r+o)/2];(_=n(this,Wh))==null||_.call(this,S,E,w)},fm=function(t){var e;t.touches.length>=2||(n(this,ji)&&(n(this,ji).abort(),f(this,ji,null),(e=n(this,Xh))==null||e.call(this)),n(this,$i)&&(Ft(t),f(this,$i,null),f(this,$r,!1))
10)};let Eh=Wp;var zr,$s,Mt,wt,Gi,Mo,Gn,qh,ge,Vr,zi,ui,zn,Yh,Wr,ss,Kh,Xr,Vi,fi,Do,Lo,Ms,qr,Jh,wu,V,bf,Qh,yf,Rd,pm,gm,Af,kd,wf,mm,bm,ym,vf,Am,Ef,wm,vm,Em,Sf,eh;const Y=class Y{constructor(t){g(this,V);g(this,zr,null);g(this,$s,null);g(this,Mt,null);g(this,wt,null);g(this,Gi,null);g(this,Mo,!1);g(this,Gn,null);g(this,qh,"");g(this,ge,null);g(this,Vr,null);g(this,zi,null);g(this,ui,null);g(this,zn,null);g(this,Yh,"");g(this,Wr,!1);g(this,ss,null);g(this,Kh,!1);g(this,Xr,!1);g(this,Vi,!1);g(this,fi,null);g(this,Do,0);g(this,Lo,0);g(this,Ms,null);g(this,qr,null);k(this,"isSelected",!1);k(this,"_isCopy",!1);k(this,"_editToolbar",null);k(this,"_initialOptions",Object.create(null));k(this,"_initialData",null);k(this,"_isVisible",!0);k(this,"_uiManager",null);k(this,"_focusEventsAllowed",!0);g(this,Jh,!1);g(this,wu,Y._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,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:r,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[r,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=Y.prototype._resizeWithKeyboard,e=Er.TRANSLATE_SMALL,s=Er.TRANSLATE_BIG;return J(this,"_resizerKeyboardManager",new cd([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],Y.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return J(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new By({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(Y._l10n??(Y._l10n=t),Y._l10nResizer||(Y._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"})),Y._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);Y._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){_t("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return n(this,Jh)}set _isDraggable(t){var e;f(this,Jh,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
10setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=n(this,wu)}setParent(t){var e;t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,V,eh).call(this),(e=n(this,ui))==null||e.remove(),f(this,ui,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(n(this,Wr)?f(this,Wr,!1):this.parent.setSelected(this))}focusout(t){var s;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(s=this.parent)!=null&&s.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[r,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/r,this.y=(e+i)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i),this._onTranslated()}translate(t,e){b(this,V,bf).call(this,this.parentDimensions,t,e)}translateInPage(t,e){n(this,ss)||f(this,ss,[this.x,this.y,this.width,this.height]),b(this,V,bf).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){n(this,ss)||f(this,ss,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[i,r]}=this;if(this.x+=t/i,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:p}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,p)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:c}=s;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!n(this,ss)&&(n(this,ss)[0]!==this.x||n(this,ss)[1]!==this.y)}get _hasBeenResized(){return!!n(this,ss)&&(n(this,ss)[2]!==this.width||n(this,ss)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=Y,i=s/t,r=s/e;switch(this.rotation){case 90:return[-i,r];case 180:return[i,r];case 270:return[i,-r];default:return[-i,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,i]}=this;let{x:r,y:a,width:o,height:l}=this;if(o*=s,l*=i,r*=s,a*=i,this._mustFixPosition)switch(t){case 0:r=ke(r,0,s-o),a=ke(a,0,i-l);break;case 90:r=ke(r,0,s-l),a=ke(a,o,i);break;case 180:r=ke(r,o,s),a=ke(a,l,i);break;case 270:r=ke(r,l,s),a=ke(a,0,i-o);break}this.x=r/=s,this.y=a/=i;const[h,c]=this.getBaseTranslation();r+=h,a+=c,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return b(s=Y,Qh,yf).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return b(s=Y,Qh,yf).call(s,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,s]}=this;return[e*t,s*t]}setDims(){const{div:{style:t},width:e,height:s}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=n(this,Mt))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||n(this,Xr))return this._editToolbar;this._editToolbar=new af(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,s]of t)await this._editToolbar.addButton(e,s);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;(t=this._editToolbar)==null||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}
10removeCommentButtonFromToolbar(){var t;(t=this._editToolbar)==null||t.removeButton("comment")}removeEditToolbar(){var t,e;(t=this._editToolbar)==null||t.remove(),this._editToolbar=null,(e=n(this,Mt))==null||e.destroy()}addContainer(t){var s;const e=(s=this._editToolbar)==null?void 0:s.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return n(this,Mt)||(ru.initialize(Y._l10n),f(this,Mt,new ru(this)),n(this,zr)&&(n(this,Mt).data=n(this,zr),f(this,zr,null))),n(this,Mt)}get altTextData(){var t;return(t=n(this,Mt))==null?void 0:t.data}set altTextData(t){n(this,Mt)&&(n(this,Mt).data=t)}get guessedAltText(){var t;return(t=n(this,Mt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=n(this,Mt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=n(this,Mt))==null?void 0:e.serialize(t)}hasAltText(){return!!n(this,Mt)&&!n(this,Mt).isEmpty()}hasAltTextData(){var t;return((t=n(this,Mt))==null?void 0:t.hasData())??!1}focusCommentButton(){var t;(t=n(this,wt))==null||t.focusButton()}addCommentButton(){return n(this,wt)||f(this,wt,new md(this))}addStandaloneCommentButton(){if(n(this,Gi)){this._uiManager.isEditingMode()&&n(this,Gi).classList.remove("hidden");return}this.hasComment&&(f(this,Gi,n(this,wt).renderForStandalone()),this.div.append(n(this,Gi)))}removeStandaloneCommentButton(){n(this,wt).removeStandaloneCommentButton(),f(this,Gi,null)}hideStandaloneCommentButton(){var t;(t=n(this,Gi))==null||t.classList.add("hidden")}get comment(){const{data:{richText:t,text:e,date:s,deleted:i}}=n(this,wt);return{text:e,richText:t,date:s,deleted:i,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){n(this,wt)||f(this,wt,new md(this)),n(this,wt).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:s}){if(!e||(n(this,wt)||f(this,wt,new md(this)),n(this,wt).setInitialText(t,s),!this.annotationElementId))return;const i=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);i&&this.updateFromAnnotationLayer(i)}get hasEditedComment(){var t;return(t=n(this,wt))==null?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return(t=n(this,wt))==null?void 0:t.isDeleted()}get hasComment(){return!!n(this,wt)&&!n(this,wt).isEmpty()&&!n(this,wt).isDeleted()}async editComment(t){n(this,wt)||f(this,wt,new md(this)),n(this,wt).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){n(this,wt).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const[,,,i]=t.rect,[r]=this.pageDimensions,[a]=this.pageTranslation,o=a+r+1,l=i-100,h=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,h,i]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){n(this,wt).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=n(this,Mo)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),b(this,V,Ef).call(this);const[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*s/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/s).toFixed(2)}%`);const[i,r]=this.getInitialTranslation();return this.translate(i,r),Zg(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(n(this,qr)||f(this,qr,new Eh({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,V,mm).bind(this),onPinching:b(this,V,bm).bind(this),onPinchEnd:b(this,V,ym).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=de.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(f(this,Wr,!0),this._isDraggable){b(this,V,Am).call(this,t);return}b(this,V,vf).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){n(this,fi)&&clearTimeout(n(this,fi)),f(this,fi,setTimeout(()=>{var t;f(this,fi,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const i=this.parentScale,[r,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/i,c=e/i,u=this.x*r,p=this.y*a,m=this.width*r,A=this.height*a;switch(s){case 0:return[u+h+o,a-p-c-A+l,u+h+m+o,a-p-c+l];case 90:return[u+c+o,a-p+h+l,u+c+A+o,a-p+h+m+l];case 180:return[u-h-m+o,a-p+c+l,u-h+o,a-p+c+A+l];case 270:return[u-c-A+o,a-p-h-m+l,u-c+o,a-p-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,r,a]=t,o=r-s,l=a-i;switch(this.rotation){case 0:return[s,e-a,o,l];case 90:return[s,e-i,l,o];case 180:return[r,e-i,o,l];case 270:return[r,e-a,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Y._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;(t=n(this,wt))==null||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:s,opacity:i,deleted:r,richText:a},uid:o,pageIndex:l,creationDate:h,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:h,modificationDate:s||c,popupRef:!r,color:e,opacity:i}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),f(this,Xr,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),f(this,Xr,!1),!0):!1}isInEditMode(){return n(this,Xr)}shouldGetKeyboardEvents(){return n(this,Vi)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:s,right:i}=this.getClientDimensions(),{innerHeight:r,innerWidth:a}=window;return e<a&&i>0&&t<r&&s>0}rebuild(){b(this,V,Ef).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){var s;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}static async deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});i.rotation=t.rotation,f(i,zr,t.accessibilityData),i._isCopy=t.isCopy||!1;const[r,a]=i.pageDimensions,[o,l,h,c]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/r,i.y=l/a,i.width=h/r,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e;if((t=n(this,zn))==null||t.abort(),f(this,zn,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),n(this,fi)&&(clearTimeout(n(this,fi)),f(this,fi,null)),b(this,V,eh).call(this),this.removeEditToolbar(),n(this,Ms)){for(const s of n(this,Ms).values())clearTimeout(s);f(this,Ms,null)}this.parent=null,(e=n(this,qr))==null||e.destroy(),f(this,qr,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,V,pm).call(this),n(this,ge).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[s,i,r,a]=this.getPDFRect();return[Y._round(s+(r-s)*t),Y._round(i+(a-i)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return n(this,wt).commentPopupPositionInLayer}set commentPopupPosition(t){n(this,wt).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return n(this,wt).hasDefaultPopupPosition()}get commentButtonWidth(){return n(this,wt).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){n(this,wt).setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),f(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=n(this,ge).children;if(!n(this,$s)){f(this,$s,Array.from(e));const a=b(this,V,wm).bind(this),o=b(this,V,vm).bind(this),l=this._uiManager._signal;for(const h of n(this,$s)){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",b(this,V,Em).bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",Y._l10nResizer[c])}}const s=n(this,$s)[0];let i=0;for(const a of e){if(a===s)break;i++}const r=(360-this.rotation+this.parentRotation)%360/90*(n(this,$s).length/4);if(r!==i){if(r<i)for(let o=0;o<i-r;o++)n(this,ge).append(n(this,ge).firstChild);else if(r>i)for(let o=0;o<r-i;o++)n(this,ge).firstChild.before(n(this,ge).lastChild);let a=0;for(const o of e){const h=n(this,$s)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",Y._l10nResizer[h])}}b(this,V,Sf).call(this,0),f(this,Vi,!0),n(this,ge).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){n(this,Vi)&&b(this,V,wf).call(this,n(this,Yh),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,V,eh).call(this),this.div.focus()}select(){var t,e,s;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var i,r;
10(i=this.div)!=null&&i.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())});return}(e=this._editToolbar)==null||e.show(),(s=n(this,Mt))==null||s.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return(t=this.div)==null?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,s,i,r;this.isSelected&&(this.isSelected=!1,(t=n(this,ge))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(i=this._editToolbar)==null||i.hide(),(r=n(this,Mt))==null||r.toggleAltTextBadge(!0),this.hasComment&&this._uiManager.toggleComment(this,!1,!1))}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return n(this,Kh)}set isEditing(t){f(this,Kh,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){n(this,Ms)||f(this,Ms,new Map);const{action:s}=t;let i=n(this,Ms).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),n(this,Ms).delete(s),n(this,Ms).size===0&&f(this,Ms,null)},Y._telemetryTimeout),n(this,Ms).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),f(this,Mo,!1)}disable(){this.div&&(this.div.tabIndex=-1),f(this,Mo,!0)}updateFakeAnnotationElement(t){if(!n(this,ui)&&!this.deleted){f(this,ui,t.addFakeAnnotation(this));return}if(this.deleted){n(this,ui).remove(),f(this,ui,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&n(this,ui).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};zr=new WeakMap,$s=new WeakMap,Mt=new WeakMap,wt=new WeakMap,Gi=new WeakMap,Mo=new WeakMap,Gn=new WeakMap,qh=new WeakMap,ge=new WeakMap,Vr=new WeakMap,zi=new WeakMap,ui=new WeakMap,zn=new WeakMap,Yh=new WeakMap,Wr=new WeakMap,ss=new WeakMap,Kh=new WeakMap,Xr=new WeakMap,Vi=new WeakMap,fi=new WeakMap,Do=new WeakMap,Lo=new WeakMap,Ms=new WeakMap,qr=new WeakMap,Jh=new WeakMap,wu=new WeakMap,V=new WeakSet,bf=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Qh=new WeakSet,yf=function(t,e,s){switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Rd=function(t){switch(t){case 90:{const[e,s]=this.pageDimensions;return[0,-e/s,s/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,s]=this.pageDimensions;return[0,e/s,-s/e,0]}default:return[1,0,0,1]}},pm=function(){if(n(this,ge))return;f(this,ge,document.createElement("div")),n(this,ge).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const s of t){const i=document.createElement("div");n(this,ge).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",b(this,V,gm).bind(this,s),{signal:e}),i.addEventListener("contextmenu",vs,{signal:e}),i.tabIndex=-1}this.div.prepend(n(this,ge))},gm=function(t,e){var c;e.preventDefault();const{isMac:s}=de.platform;if(e.button!==0||e.ctrlKey&&s)return;(c=n(this,Mt))==null||c.toggle(!1);const i=this._isDraggable;this._isDraggable=!1,f(this,Vr,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,V,wf).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",Ft,{passive:!1,signal:a}),window.addEventListener("contextmenu",vs,{signal:a}),f(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var u;r.abort(),this.parent.togglePointerEvents(!0),(u=n(this,Mt))==null||u.toggle(!0),this._isDraggable=i,this.parent.div.style.cursor=o,this.div.style.cursor=l,b(this,V,kd).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},Af=function(t,e,s,i){this.width=s,this.height=i,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},kd=function(){if(!n(this,zi))return;const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=n(this,zi);f(this,zi,null);const r=this.x,a=this.y,o=this.width,l=this.height;r===t&&a===e&&o===s&&l===i||this.addCommands({cmd:b(this,V,Af).bind(this,r,a,o,l),undo:b(this,V,Af).bind(this,t,e,s,i),mustExec:!0})},wf=function(t,e){const[s,i]=this.parentDimensions,r=this.x,a=this.y,o=this.width,l=this.height,h=Y.MIN_SIZE/s,c=Y.MIN_SIZE/i,u=b(this,V,Rd).call(this,this.rotation),p=(F,I)=>[u[0]*F+u[2]*I,u[1]*F+u[3]*I],m=b(this,V,Rd).call(this,360-this.rotation),A=(F,I)=>[m[0]*F+m[2]*I,m[1]*F+m[3]*I];let y,v,w=!1,E=!1;switch(t){case"topLeft":w=!0,y=(F,I)=>[0,0],v=(F,I)=>[F,I];break;case"topMiddle":y=(F,I)=>[F/2,0],v=(F,I)=>[F/2,I];break;case"topRight":w=!0,y=(F,I)=>[F,0],v=(F,I)=>[0,I];break;case"middleRight":E=!0,y=(F,I)=>[F,I/2],v=(F,I)=>[0,I/2];break;case"bottomRight":w=!0,y=(F,I)=>[F,I],v=(F,I)=>[0,0];break;case"bottomMiddle":y=(F,I)=>[F/2,I],v=(F,I)=>[F/2,0];break;case"bottomLeft":w=!0,y=(F,I)=>[0,I],v=(F,I)=>[F,0];break;case"middleLeft":E=!0,y=(F,I)=>[0,I/2],v=(F,I)=>[F,I/2];break}const S=y(o,l),_=v(o,l);let C=p(..._);const T=Y._round(r+C[0]),x=Y._round(a+C[1]);let P=1,R=1,D,M;if(e.fromKeyboard)({deltaX:D,deltaY:M}=e);else{const{screenX:F,screenY:I}=e,[et,ft]=n(this,Vr);[D,M]=this.screenToPageTranslation(F-et,I-ft),n(this,Vr)[0]=F,n(this,Vr)[1]=I}if([D,M]=A(D/s,M/i),w){const F=Math.hypot(o,l);
10P=R=Math.max(Math.min(Math.hypot(_[0]-S[0]-D,_[1]-S[1]-M)/F,1/o,1/l),h/o,c/l)}else E?P=ke(Math.abs(_[0]-S[0]-D),h,1)/o:R=ke(Math.abs(_[1]-S[1]-M),c,1)/l;const U=Y._round(o*P),z=Y._round(l*R);C=p(...v(U,z));const O=T-C[0],W=x-C[1];n(this,ss)||f(this,ss,[this.x,this.y,this.width,this.height]),this.width=U,this.height=z,this.x=O,this.y=W,this.setDims(),this.fixAndSetPosition(),this._onResizing()},mm=function(){var t;f(this,zi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=n(this,Mt))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)},bm=function(t,e,s){let r=.7*(s/e)+1-.7;if(r===1)return;const a=b(this,V,Rd).call(this,this.rotation),o=(T,x)=>[a[0]*T+a[2]*x,a[1]*T+a[3]*x],[l,h]=this.parentDimensions,c=this.x,u=this.y,p=this.width,m=this.height,A=Y.MIN_SIZE/l,y=Y.MIN_SIZE/h;r=Math.max(Math.min(r,1/p,1/m),A/p,y/m);const v=Y._round(p*r),w=Y._round(m*r);if(v===p&&w===m)return;n(this,ss)||f(this,ss,[c,u,p,m]);const E=o(p/2,m/2),S=Y._round(c+E[0]),_=Y._round(u+E[1]),C=o(v/2,w/2);this.x=S-C[0],this.y=_-C[1],this.width=v,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},ym=function(){var t;(t=n(this,Mt))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),b(this,V,kd).call(this)},vf=function(t){const{isMac:e}=de.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Am=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let s=!1;const i=new AbortController,r=this._uiManager.combinedSignal(i),a={capture:!0,passive:!1,signal:r},o=h=>{i.abort(),f(this,Gn,null),f(this,Wr,!1),this._uiManager.endDragSession()||b(this,V,vf).call(this,h),s&&this._onStopDragging()};e&&(f(this,Do,t.clientX),f(this,Lo,t.clientY),f(this,Gn,t.pointerId),f(this,qh,t.pointerType),window.addEventListener("pointermove",h=>{s||(s=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:u,pointerId:p}=h;if(p!==n(this,Gn)){Ft(h);return}const[m,A]=this.screenToPageTranslation(c-n(this,Do),u-n(this,Lo));f(this,Do,c),f(this,Lo,u),this._uiManager.dragSelectedEditors(m,A)},a),window.addEventListener("touchmove",Ft,a),window.addEventListener("pointerdown",h=>{h.pointerType===n(this,qh)&&(n(this,qr)||h.isPrimary)&&o(h),Ft(h)},a));const l=h=>{if(!n(this,Gn)||n(this,Gn)===h.pointerId){o(h);return}Ft(h)};window.addEventListener("pointerup",l,{signal:r}),window.addEventListener("blur",l,{signal:r})},Ef=function(){if(n(this,zn)||!this.div)return;f(this,zn,new AbortController);const t=this._uiManager.combinedSignal(n(this,zn));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},wm=function(t){Y._resizerKeyboardManager.exec(this,t)},vm=function(t){var e;n(this,Vi)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==n(this,ge)&&b(this,V,eh).call(this)},Em=function(t){f(this,Yh,n(this,Vi)?t:"")},Sf=function(t){if(n(this,$s))for(const e of n(this,$s))e.tabIndex=t},eh=function(){f(this,Vi,!1),b(this,V,Sf).call(this,-1),b(this,V,kd).call(this)},g(Y,Qh),k(Y,"_l10n",null),k(Y,"_l10nResizer",null),k(Y,"_borderLineWidth",-1),k(Y,"_colorManager",new hf),k(Y,"_zIndex",1),k(Y,"_telemetryTimeout",1e3);let xt=Y;class By extends xt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const ng=3285377520,Es=4294901760,si=65535;class Sm{constructor(t){this.h1=t?t&4294967295:ng,this.h2=t?t&4294967295:ng}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let y=0,v=t.length;y<v;y++){const w=t.charCodeAt(y);w<=255?e[s++]=w:(e[s++]=w>>>8,e[s++]=w&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const i=s>>2,r=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,l=0,h=this.h1,c=this.h2;const u=3432918353,p=461845907,m=u&si,A=p&si;for(let y=0;y<i;y++)y&1?(o=a[y],o=o*u&Es|o*m&si,o=o<<15|o>>>17,o=o*p&Es|o*A&si,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[y],l=l*u&Es|l*m&si,l=l<<15|l>>>17,l=l*p&Es|l*A&si,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,r){case 3:o^=e[i*4+2]<<16;case 2:o^=e[i*4+1]<<8;case 1:o^=e[i*4],o=o*u&Es|o*m&si,o=o<<15|o>>>17,o=o*p&Es|o*A&si,i&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Es|t*36045&si,e=e*4283543511&Es|((e<<16|t>>>16)*2950163797&Es)>>>16,t^=e>>>1,t=t*444984403&Es|t*60499&si,e=e*3301882366&Es|((e<<16|t>>>16)*3120437893&Es)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const _f=Object.freeze({map:null,hash:"",transfer:void 0});var Yr,Kr,Wi,me,vu,_m;class Fp{constructor(){g(this,vu);g(this,Yr,!1);g(this,Kr,null);g(this,Wi,null);g(this,me,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=n(this,me).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return n(this,me).get(t)}remove(t){const e=n(this,me).get(t);if(e!==void 0&&(e instanceof xt&&n(this,Wi).delete(e.annotationElementId),n(this,me).delete(t),n(this,me).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function")){for(const s of n(this,me).values())if(s instanceof xt)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=n(this,me).get(t);let i=!1;if(s!==void 0)for(const[r,a]of Object.entries(e))s[r]!==a&&(i=!0,s[r]=a);else i=!0,n(this,me).set(t,e);i&&b(this,vu,_m).call(this),e instanceof xt&&((n(this,Wi)||f(this,Wi,new Map)).set(e.annotationElementId,e),typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type))}has(t){return n(this,me).has(t)}get size(){return n(this,me).size}resetModified(){n(this,Yr)&&(f(this,Yr,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Cm(this)}get serializable(){if(n(this,me).size===0)return _f;const t=new Map,e=new Sm,s=[],i=Object.create(null);let r=!1;
10for(const[a,o]of n(this,me)){const l=o instanceof xt?o.serialize(!1,i):o;l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),r||(r=!!l.bitmap))}if(r)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:_f}get editorStats(){let t=null;const e=new Map;let s=0,i=0;for(const r of n(this,me).values()){if(!(r instanceof xt)){r.popup&&(r.popup.deleted?i+=1:s+=1);continue}r.isCommentDeleted?i+=1:r.hasEditedComment&&(s+=1);const a=r.telemetryFinalData;if(!a)continue;const{type:o}=a;e.has(o)||e.set(o,Object.getPrototypeOf(r).constructor),t||(t=Object.create(null));const l=t[o]||(t[o]=new Map);for(const[h,c]of Object.entries(a)){if(h==="type")continue;let u=l.get(h);u||(u=new Map,l.set(h,u));const p=u.get(c)??0;u.set(c,p+1)}}if((i>0||s>0)&&(t||(t=Object.create(null)),t.comments={deleted:i,edited:s}),!t)return null;for(const[r,a]of e)t[r]=a.computeTelemetryFinalData(t[r]);return t}resetModifiedIds(){f(this,Kr,null)}updateEditor(t,e){var i;const s=(i=n(this,Wi))==null?void 0:i.get(t);return s?(s.updateFromAnnotationLayer(e),!0):!1}getEditor(t){var e;return((e=n(this,Wi))==null?void 0:e.get(t))||null}get modifiedIds(){if(n(this,Kr))return n(this,Kr);const t=[];if(n(this,Wi))for(const e of n(this,Wi).values())e.serialize()&&t.push(e.annotationElementId);return f(this,Kr,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return n(this,me).entries()}}Yr=new WeakMap,Kr=new WeakMap,Wi=new WeakMap,me=new WeakMap,vu=new WeakSet,_m=function(){n(this,Yr)||(f(this,Yr,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Zh;class Cm extends Fp{constructor(e){super();g(this,Zh);const{map:s,hash:i,transfer:r}=e.serializable,a=structuredClone(s,r?{transfer:r}:null);f(this,Zh,{map:a,hash:i,transfer:r})}get print(){_t("Should not call PrintAnnotationStorage.print")}get serializable(){return n(this,Zh)}get modifiedIds(){return J(this,"modifiedIds",{ids:new Set,hash:""})}}Zh=new WeakMap;var Io;class Hy{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){g(this,Io,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),n(this,Io).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||n(this,Io).has(t.loadedName))){if(it(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:r,style:a}=t,o=new FontFace(i,r,a);this.addNativeFontFace(o);try{await o.load(),n(this,Io).add(i),s==null||s(t)}catch{q(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}_t("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){const s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(i){throw q(`Failed to load font '${s.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return J(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return J(this,"isSyncFontLoadingSupported",Oe||de.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(it(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const r=s.shift();setTimeout(r.callback,0)}}const{loadingRequests:s}=this,i={done:!1,complete:e,callback:t};return s.push(i),i}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return J(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(_,C){return _.charCodeAt(C)<<24|_.charCodeAt(C+1)<<16|_.charCodeAt(C+2)<<8|_.charCodeAt(C+3)&255}function i(_,C,T,x){const P=_.substring(0,C),R=_.substring(C+T);return P+x+R}let r,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;function c(_,C){if(++h>30){q("Load test font never loaded."),C();return}if(l.font="30px "+_,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(c.bind(null,_,C))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=i(p,976,u.length,u);const A=16,y=1482184792;let v=s(p,A);for(r=0,a=u.length-3;r<a;r+=4)v=v-y+s(u,r)|0;r<u.length&&(v=v-y+s(u+"XXX",r)|0),p=i(p,A,4,Ty(v));const w=`url(data:font/opentype;base64,${btoa(p)});`,E=`@font-face {font-family:"${u}";src:${w}}`;this.insertRule(E);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",
10S.style.top=S.style.left="0px";for(const _ of[t.loadedName,u]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=_,S.append(C)}this._document.body.append(S),c(u,()=>{S.remove(),e.complete()})}}Io=new WeakMap;var pt;class Uy{constructor(t,e=null,s,i){g(this,pt);this.compiledGlyphs=Object.create(null),f(this,pt,t),this._inspectFont=e,s&&Object.assign(this,s),i&&(this.charProcOperatorList=i)}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var s;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${$g(this.data)});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return(s=this._inspectFont)==null||s.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const s=this.loadedName+"_path_"+e;let i;try{i=t.get(s)}catch(a){q(`getPathGenerator - ignoring character: "${a}".`)}const r=new Path2D(i||"");return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=r}get black(){return n(this,pt).black}get bold(){return n(this,pt).bold}get disableFontFace(){return n(this,pt).disableFontFace??!1}get fontExtraProperties(){return n(this,pt).fontExtraProperties??!1}get isInvalidPDFjsFont(){return n(this,pt).isInvalidPDFjsFont}get isType3Font(){return n(this,pt).isType3Font}get italic(){return n(this,pt).italic}get missingFile(){return n(this,pt).missingFile}get remeasure(){return n(this,pt).remeasure}get vertical(){return n(this,pt).vertical}get ascent(){return n(this,pt).ascent}get defaultWidth(){return n(this,pt).defaultWidth}get descent(){return n(this,pt).descent}get bbox(){return n(this,pt).bbox}get fontMatrix(){return n(this,pt).fontMatrix}get fallbackName(){return n(this,pt).fallbackName}get loadedName(){return n(this,pt).loadedName}get mimetype(){return n(this,pt).mimetype}get name(){return n(this,pt).name}get data(){return n(this,pt).data}clearData(){n(this,pt).clearData()}get cssFontInfo(){return n(this,pt).cssFontInfo}get systemFontInfo(){return n(this,pt).systemFontInfo}get defaultVMetrics(){return n(this,pt).defaultVMetrics}}pt=new WeakMap;function $y(d){if(d instanceof URL)return d.href;if(typeof d=="string"){if(Oe)return d;const t=URL.parse(d,window.location);if(t)return t.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function jy(d){if(Oe&&typeof Buffer<"u"&&d instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength)return d;if(typeof d=="string")return od(d);if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||typeof d=="object"&&!isNaN(d==null?void 0:d.length))return new Uint8Array(d);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function bd(d){if(typeof d!="string")return null;if(d.endsWith("/"))return d;throw new Error(`Invalid factory url: "${d}" must include trailing slash.`)}const Cf=d=>typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0,Gy=d=>typeof d=="object"&&typeof(d==null?void 0:d.name)=="string",Tm=ky.bind(null,Cf,Gy);var Xi,Eu;class zy{constructor(){g(this,Xi,new Map);g(this,Eu,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};n(this,Eu).then(()=>{for(const[i]of n(this,Xi))i.call(this,s)})}addEventListener(t,e,s=null){let i=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:r}=s;if(r.aborted){q("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);i=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}n(this,Xi).set(e,i)}removeEventListener(t,e){const s=n(this,Xi).get(e);s==null||s(),n(this,Xi).delete(e)}terminate(){for(const[,t]of n(this,Xi))t==null||t();n(this,Xi).clear()}}Xi=new WeakMap,Eu=new WeakMap;const yd={DATA:1,ERROR:2},Wt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function rg(){}function Ue(d){if(d instanceof An||d instanceof iu||d instanceof Jp||d instanceof Ah||d instanceof Yu)return d;switch(d instanceof Error||typeof d=="object"&&d!==null||_t('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new An(d.message);case"InvalidPDFException":return new iu(d.message);case"PasswordException":return new Jp(d.message,d.code);case"ResponseException":return new Ah(d.message,d.status,d.missing);case"UnknownErrorException":return new Yu(d.message,d.details)}return new Yu(d.message,d.toString())}var Fo,Ns,xm,Pm,Rm,Md;class sh{constructor(t,e,s){g(this,Ns);g(this,Fo,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=s,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),s.addEventListener("message",b(this,Ns,xm).bind(this),{signal:n(this,Fo).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}
10sendWithPromise(t,e,s){const i=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[i]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){r.reject(a)}return r.promise}sendWithStream(t,e,s,i){const r=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[r]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:r,data:e,desiredSize:h.desiredSize},i),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[r].pullCall=c,l.postMessage({sourceName:a,targetName:o,stream:Wt.PULL,streamId:r,desiredSize:h.desiredSize}),c.promise},cancel:h=>{it(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[r].cancelCall=c,this.streamControllers[r].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:Wt.CANCEL,streamId:r,reason:Ue(h)}),c.promise}},s)}destroy(){var t;(t=n(this,Fo))==null||t.abort(),f(this,Fo,null)}}Fo=new WeakMap,Ns=new WeakSet,xm=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,Ns,Rm).call(this,t);return}if(t.callback){const s=t.callbackId,i=this.callbackCapabilities[s];if(!i)throw new Error(`Cannot resolve callback ${s}`);if(delete this.callbackCapabilities[s],t.callback===yd.DATA)i.resolve(t.data);else if(t.callback===yd.ERROR)i.reject(Ue(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const s=this.sourceName,i=t.sourceName,r=this.comObj;Promise.try(e,t.data).then(function(a){r.postMessage({sourceName:s,targetName:i,callback:yd.DATA,callbackId:t.callbackId,data:a})},function(a){r.postMessage({sourceName:s,targetName:i,callback:yd.ERROR,callbackId:t.callbackId,reason:Ue(a)})});return}if(t.streamId){b(this,Ns,Pm).call(this,t);return}e(t.data)},Pm=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,r=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,c=1,u){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=c,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:s,targetName:i,stream:Wt.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:i,stream:Wt.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){it(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:i,stream:Wt.ERROR,streamId:e,reason:Ue(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){r.postMessage({sourceName:s,targetName:i,stream:Wt.START_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:s,targetName:i,stream:Wt.START_COMPLETE,streamId:e,reason:Ue(h)})})},Rm=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,r=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case Wt.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(Ue(t.reason));break;case Wt.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(Ue(t.reason));break;case Wt.PULL:if(!o){r.postMessage({sourceName:s,targetName:i,stream:Wt.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||rg).then(function(){r.postMessage({sourceName:s,targetName:i,stream:Wt.PULL_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:s,targetName:i,stream:Wt.PULL_COMPLETE,streamId:e,reason:Ue(h)})});break;case Wt.ENQUEUE:if(it(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case Wt.CLOSE:if(it(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),b(this,Ns,Md).call(this,a,e);break;case Wt.ERROR:it(a,"error should have stream controller"),a.controller.error(Ue(t.reason)),b(this,Ns,Md).call(this,a,e);break;case Wt.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(Ue(t.reason)),b(this,Ns,Md).call(this,a,e);break;case Wt.CANCEL:if(!o)break;const l=Ue(t.reason);Promise.try(o.onCancel||rg,l).then(function(){r.postMessage({sourceName:s,targetName:i,stream:Wt.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:s,targetName:i,stream:Wt.CANCEL_COMPLETE,streamId:e,reason:Ue(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Md=async function(t,e){var s,i,r;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(r=t.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var tc;class km{constructor({enableHWA:t=!1}){g(this,tc,!1);f(this,tc,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!n(this,tc)})}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){_t("Abstract method `_createCanvas` called.")}}tc=new WeakMap;class Vy extends km{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class Mm{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(e).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}async _fetch(t){_t("Abstract method `_fetch` called.")}}class ag extends Mm{async _fetch(t){const e=await Gl(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):od(e)}}class Dm{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,r){return"none"}destroy(t=!1){}}var Jr,No,qi,Yi,Te,Qr,Zr,N,Se,ih,Za,Dd,to,Lm,Tf,eo,nh,rh,xf,ah;class Wy extends Dm{constructor({docId:e,ownerDocument:s=globalThis.document}){super();g(this,N);g(this,Jr);g(this,No);g(this,qi);g(this,Yi);g(this,Te);g(this,Qr);g(this,Zr,0);f(this,Yi,e),f(this,Te,s)}addFilter(e){if(!e)return"none";let s=n(this,N,Se).get(e);if(s)return s;const[i,r,a]=b(this,N,Dd).call(this,e),o=e.length===1?i:`${i}${r}${a}`;if(s=n(this,N,Se).get(o),s)return n(this,N,Se).set(e,s),s;const l=`g_${n(this,Yi)}_transfer_map_${Jt(this,Zr)._++}`,h=b(this,N,to).call(this,l);n(this,N,Se).set(e,h),n(this,N,Se).set(o,h);const c=b(this,N,eo).call(this,l);return b(this,N,rh).call(this,i,r,a,c),h}addHCMFilter(e,s){var A;const i=`${e}-${s}`,r="base";let a=n(this,N,ih).get(r);if((a==null?void 0:a.key)===i||(a?((A=a.filter)==null||A.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},n(this,N,ih).set(r,a)),!e||!s))return a.url;const o=b(this,N,ah).call(this,e);e=H.makeHexColor(...o);const l=b(this,N,ah).call(this,s);if(s=H.makeHexColor(...l),n(this,N,Za).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const h=new Array(256);for(let y=0;y<=255;y++){const v=y/255;h[y]=v<=.03928?v/12.92:((v+.055)/1.055)**2.4}const c=h.join(","),u=`g_${n(this,Yi)}_hcm_filter`,p=a.filter=b(this,N,eo).call(this,u);
vendor: 4,467 bytes, line 10
10b(this,N,rh).call(this,c,c,c,p),b(this,N,Tf).call(this,p);const m=(y,v)=>{const w=o[y]/255,E=l[y]/255,S=new Array(v+1);for(let _=0;_<=v;_++)S[_]=w+_/v*(E-w);return S.join(",")};return b(this,N,rh).call(this,m(0,5),m(1,5),m(2,5),p),a.url=b(this,N,to).call(this,u),a.url}addAlphaFilter(e){let s=n(this,N,Se).get(e);if(s)return s;const[i]=b(this,N,Dd).call(this,[e]),r=`alpha_${i}`;if(s=n(this,N,Se).get(r),s)return n(this,N,Se).set(e,s),s;const a=`g_${n(this,Yi)}_alpha_map_${Jt(this,Zr)._++}`,o=b(this,N,to).call(this,a);n(this,N,Se).set(e,o),n(this,N,Se).set(r,o);const l=b(this,N,eo).call(this,a);return b(this,N,xf).call(this,i,l),o}addLuminosityFilter(e){let s=n(this,N,Se).get(e||"luminosity");if(s)return s;let i,r;if(e?([i]=b(this,N,Dd).call(this,[e]),r=`luminosity_${i}`):r="luminosity",s=n(this,N,Se).get(r),s)return n(this,N,Se).set(e,s),s;const a=`g_${n(this,Yi)}_luminosity_map_${Jt(this,Zr)._++}`,o=b(this,N,to).call(this,a);n(this,N,Se).set(e,o),n(this,N,Se).set(r,o);const l=b(this,N,eo).call(this,a);return b(this,N,Lm).call(this,l),e&&b(this,N,xf).call(this,i,l),o}addHighlightHCMFilter(e,s,i,r,a){var E;const o=`${s}-${i}-${r}-${a}`;let l=n(this,N,ih).get(e);if((l==null?void 0:l.key)===o||(l?((E=l.filter)==null||E.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},n(this,N,ih).set(e,l)),!s||!i))return l.url;const[h,c]=[s,i].map(b(this,N,ah).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[m,A]=[r,a].map(b(this,N,ah).bind(this));p<u&&([u,p,m,A]=[p,u,A,m]),n(this,N,Za).style.color="";const y=(S,_,C)=>{const T=new Array(256),x=(p-u)/C,P=S/255,R=(_-S)/(255*C);let D=0;for(let M=0;M<=C;M++){const U=Math.round(u+M*x),z=P+M*R;for(let O=D;O<=U;O++)T[O]=z;D=U+1}for(let M=D;M<256;M++)T[M]=T[D-1];return T.join(",")},v=`g_${n(this,Yi)}_hcm_${e}_filter`,w=l.filter=b(this,N,eo).call(this,v);return b(this,N,Tf).call(this,w),b(this,N,rh).call(this,y(m[0],A[0],5),y(m[1],A[1],5),y(m[2],A[2],5),w),l.url=b(this,N,to).call(this,v),l.url}destroy(e=!1){var s,i,r,a;e&&((s=n(this,Qr))!=null&&s.size)||((i=n(this,qi))==null||i.parentNode.parentNode.remove(),f(this,qi,null),(r=n(this,No))==null||r.clear(),f(this,No,null),(a=n(this,Qr))==null||a.clear(),f(this,Qr,null),f(this,Zr,0))}}Jr=new WeakMap,No=new WeakMap,qi=new WeakMap,Yi=new WeakMap,Te=new WeakMap,Qr=new WeakMap,Zr=new WeakMap,N=new WeakSet,Se=function(){return n(this,No)||f(this,No,new Map)},ih=function(){return n(this,Qr)||f(this,Qr,new Map)},Za=function(){if(!n(this,qi)){const e=n(this,Te).createElement("div"),{style:s}=e;s.visibility="hidden",s.contain="strict",s.width=s.height=0,s.position="absolute",s.top=s.left=0,s.zIndex=-1;const i=n(this,Te).createElementNS(Mi,"svg");i.setAttribute("width",0),i.setAttribute("height",0),f(this,qi,n(this,Te).createElementNS(Mi,"defs")),e.append(i),i.append(n(this,qi)),n(this,Te).body.append(e)}return n(this,qi)},Dd=function(e){if(e.length===1){const h=e[0],c=new Array(256);for(let p=0;p<256;p++)c[p]=h[p]/255;const u=c.join(",");return[u,u,u]}const[s,i,r]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=s[h]/255,o[h]=i[h]/255,l[h]=r[h]/255;return[a.join(","),o.join(","),l.join(",")]},to=function(e){if(n(this,Jr)===void 0){f(this,Jr,"");const s=n(this,Te).URL;s!==n(this,Te).baseURI&&(hd(s)?q('#createUrl: ignore "data:"-URL for performance reasons.'):f(this,Jr,kp(s,"")))}return`url(${n(this,Jr)}#${e})`},Lm=function(e){const s=n(this,Te).createElementNS(Mi,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),e.append(s)},Tf=function(e){const s=n(this,Te).createElementNS(Mi,"feColorMatrix");s.setAttribute("type","matrix"),s.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"),e.append(s)},eo=function(e){const s=n(this,Te).createElementNS(Mi,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),n(this,N,Za).append(s),s},nh=function(e,s,i){const r=n(this,Te).createElementNS(Mi,s);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),e.append(r)},rh=function(e,s,i,r){const a=n(this,Te).createElementNS(Mi,"feComponentTransfer");r.append(a),b(this,N,nh).call(this,a,"feFuncR",e),b(this,N,nh).call(this,a,"feFuncG",s),b(this,N,nh).call(this,a,"feFuncB",i)},xf=function(e,s){const i=n(this,Te).createElementNS(Mi,"feComponentTransfer");
10s.append(i),b(this,N,nh).call(this,i,"feFuncA",e)},ah=function(e){return n(this,N,Za).style.color=e,zl(getComputedStyle(n(this,N,Za)).getPropertyValue("color"))};class Im{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}async _fetch(t){_t("Abstract method `_fetch` called.")}}class og extends Im{async _fetch(t){const e=await Gl(t,"arraybuffer");return new Uint8Array(e)}}class Fm{constructor({baseUrl:t=null}){this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!t)throw new Error("Wasm filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetch(e).catch(s=>{throw new Error(`Unable to load wasm data at: ${e}`)})}async _fetch(t){_t("Abstract method `_fetch` called.")}}class lg extends Fm{async _fetch(t){const e=await Gl(t,"arraybuffer");return new Uint8Array(e)}}Oe&&q("Please use the `legacy` build in Node.js environments.");async function Np(d){const e=await process.getBuiltinModule("fs").promises.readFile(d);return new Uint8Array(e)}class Xy extends Dm{}class qy extends km{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class Yy extends Mm{async _fetch(t){return Np(t)}}class Ky extends Im{async _fetch(t){return Np(t)}}class Jy extends Fm{async _fetch(t){return Np(t)}}const Ka="__forcedDependency",{floor:hg,ceil:cg}=Math;function Ad(d,t,e,s,i,r){d[t*4+0]=Math.min(d[t*4+0],e),d[t*4+1]=Math.min(d[t*4+1],s),d[t*4+2]=Math.max(d[t*4+2],i),d[t*4+3]=Math.max(d[t*4+3],r)}const Pf=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Oo,Vn;class Qy{constructor(t,e){g(this,Oo);g(this,Vn);f(this,Oo,t),f(this,Vn,e)}get length(){return n(this,Oo).length}isEmpty(t){return n(this,Oo)[t]===Pf}minX(t){return n(this,Vn)[t*4+0]/256}minY(t){return n(this,Vn)[t*4+1]/256}maxX(t){return(n(this,Vn)[t*4+2]+1)/256}maxY(t){return(n(this,Vn)[t*4+3]+1)/256}}Oo=new WeakMap,Vn=new WeakMap;const wd=(d,t)=>{if(!d)return;let e=d.get(t);return e||(e={dependencies:new Set,isRenderingOperation:!1},d.set(t,e)),e};var Ge,ze,ta,js,ea,Ki,ut,gt,Ji,Ve,ec,Bo,sa,ia,Qi,xe,pi,sc,Rf;class Zy{constructor(t,e,s=!1){g(this,sc);g(this,Ge,{__proto__:null});g(this,ze,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Ka]:[]});g(this,ta,new Map);g(this,js,[]);g(this,ea,[]);g(this,Ki,[[1,0,0,1,0,0]]);g(this,ut,[-1/0,-1/0,1/0,1/0]);g(this,gt,new Float64Array([1/0,1/0,-1/0,-1/0]));g(this,Ji,-1);g(this,Ve,new Set);g(this,ec,new Map);g(this,Bo,new Map);g(this,sa);g(this,ia);g(this,Qi);g(this,xe);g(this,pi);f(this,sa,t.width),f(this,ia,t.height),b(this,sc,Rf).call(this,e),s&&f(this,pi,new Map)}growOperationsCount(t){t>=n(this,xe).length&&b(this,sc,Rf).call(this,t,n(this,xe))}save(t){return f(this,Ge,{__proto__:n(this,Ge)}),f(this,ze,{__proto__:n(this,ze),transform:{__proto__:n(this,ze).transform},moveText:{__proto__:n(this,ze).moveText},sameLineText:{__proto__:n(this,ze).sameLineText},[Ka]:{__proto__:n(this,ze)[Ka]}}),f(this,ut,{__proto__:n(this,ut)}),n(this,js).push(t),this}restore(t){var i;const e=Object.getPrototypeOf(n(this,Ge));if(e===null)return this;f(this,Ge,e),f(this,ze,Object.getPrototypeOf(n(this,ze))),f(this,ut,Object.getPrototypeOf(n(this,ut)));const s=n(this,js).pop();return s!==void 0&&((i=wd(n(this,pi),t))==null||i.dependencies.add(s),n(this,xe)[t]=n(this,xe)[s]),this}recordOpenMarker(t){return n(this,js).push(t),this}getOpenMarker(){return n(this,js).length===0?null:n(this,js).at(-1)}recordCloseMarker(t){var s;const e=n(this,js).pop();return e!==void 0&&((s=wd(n(this,pi),t))==null||s.dependencies.add(e),n(this,xe)[t]=n(this,xe)[e]),this}beginMarkedContent(t){return n(this,ea).push(t),this}endMarkedContent(t){var s;const e=n(this,ea).pop();return e!==void 0&&((s=wd(n(this,pi),t))==null||s.dependencies.add(e),n(this,xe)[t]=n(this,xe)[e]),this}pushBaseTransform(t){return n(this,Ki).push(H.multiplyByDOMMatrix(n(this,Ki).at(-1),t.getTransform())),this}popBaseTransform(){return n(this,Ki).length>1&&n(this,Ki).pop(),this}recordSimpleData(t,e){return n(this,Ge)[t]=e,this}recordIncrementalData(t,e){return n(this,ze)[t].push(e),this}resetIncrementalData(t,e){return n(this,ze)[t].length=0,this}recordNamedData(t,e){return n(this,ta).set(t,e),this}recordSimpleDataFromNamed(t,e,s){n(this,Ge)[t]=n(this,ta).get(e)??s}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Ka,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in n(this,Ge)&&this.recordFutureForcedDependency(e,n(this,Ge)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of n(this,Ve))this.recordFutureForcedDependency(Ka,t);return this}resetBBox(t){return n(this,Ji)!==t&&(f(this,Ji,t),n(this,gt)[0]=1/0,n(this,gt)[1]=1/0,n(this,gt)[2]=-1/0,n(this,gt)[3]=-1/0),this}recordClipBox(t,e,s,i,r,a){const o=H.multiplyByDOMMatrix(n(this,Ki).at(-1),e.getTransform()),l=[1/0,1/0,-1/0,-1/0];H.axialAlignedBoundingBox([s,r,i,a],o,l);const h=H.intersect(n(this,ut),l);return h?(n(this,ut)[0]=h[0],n(this,ut)[1]=h[1],n(this,ut)[2]=h[2],n(this,ut)[3]=h[3]):(n(this,ut)[0]=n(this,ut)[1]=1/0,n(this,ut)[2]=n(this,ut)[3]=-1/0),this}recordBBox(t,e,s,i,r,a){const o=n(this,ut);
10if(o[0]===1/0)return this;const l=H.multiplyByDOMMatrix(n(this,Ki).at(-1),e.getTransform());if(o[0]===-1/0)return H.axialAlignedBoundingBox([s,r,i,a],l,n(this,gt)),this;const h=[1/0,1/0,-1/0,-1/0];return H.axialAlignedBoundingBox([s,r,i,a],l,h),n(this,gt)[0]=Math.min(n(this,gt)[0],Math.max(h[0],o[0])),n(this,gt)[1]=Math.min(n(this,gt)[1],Math.max(h[1],o[1])),n(this,gt)[2]=Math.max(n(this,gt)[2],Math.min(h[2],o[2])),n(this,gt)[3]=Math.max(n(this,gt)[3],Math.min(h[3],o[3])),this}recordCharacterBBox(t,e,s,i=1,r=0,a=0,o){const l=s.bbox;let h,c;if(l&&(h=l[2]!==l[0]&&l[3]!==l[1]&&n(this,Bo).get(s),h!==!1&&(c=[0,0,0,0],H.axialAlignedBoundingBox(l,s.fontMatrix,c),(i!==1||r!==0||a!==0)&&H.scaleMinMax([i,0,0,-i,r,a],c),h)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(t);const u=o();return l&&c&&h===void 0&&(h=c[0]<=r-u.actualBoundingBoxLeft&&c[2]>=r+u.actualBoundingBoxRight&&c[1]<=a-u.actualBoundingBoxAscent&&c[3]>=a+u.actualBoundingBoxDescent,n(this,Bo).set(s,h),h)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,r-u.actualBoundingBoxLeft,r+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(t){return n(this,gt)[0]=Math.max(0,n(this,ut)[0]),n(this,gt)[1]=Math.max(0,n(this,ut)[1]),n(this,gt)[2]=Math.min(n(this,sa),n(this,ut)[2]),n(this,gt)[3]=Math.min(n(this,ia),n(this,ut)[3]),this}getSimpleIndex(t){return n(this,Ge)[t]}recordDependencies(t,e){const s=n(this,Ve),i=n(this,Ge),r=n(this,ze);for(const a of e)a in n(this,Ge)?s.add(i[a]):a in r&&r[a].forEach(s.add,s);return this}recordNamedDependency(t,e){return n(this,ta).has(e)&&n(this,Ve).add(n(this,ta).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Ka]),n(this,pi)){const s=wd(n(this,pi),t),{dependencies:i}=s;n(this,Ve).forEach(i.add,i),n(this,js).forEach(i.add,i),n(this,ea).forEach(i.add,i),i.delete(t),s.isRenderingOperation=!0}if(n(this,Ji)===t){const s=hg(n(this,gt)[0]*256/n(this,sa)),i=hg(n(this,gt)[1]*256/n(this,ia)),r=cg(n(this,gt)[2]*256/n(this,sa)),a=cg(n(this,gt)[3]*256/n(this,ia));Ad(n(this,Qi),t,s,i,r,a);for(const o of n(this,Ve))o!==t&&Ad(n(this,Qi),o,s,i,r,a);for(const o of n(this,js))o!==t&&Ad(n(this,Qi),o,s,i,r,a);for(const o of n(this,ea))o!==t&&Ad(n(this,Qi),o,s,i,r,a);e||(n(this,Ve).clear(),f(this,Ji,-1))}return this}recordShowTextOperation(t,e=!1){const s=Array.from(n(this,Ve));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const i of s)this.recordIncrementalData("sameLineText",i);return this}bboxToClipBoxDropOperation(t,e=!1){return n(this,Ji)===t&&(f(this,Ji,-1),n(this,ut)[0]=Math.max(n(this,ut)[0],n(this,gt)[0]),n(this,ut)[1]=Math.max(n(this,ut)[1],n(this,gt)[1]),n(this,ut)[2]=Math.min(n(this,ut)[2],n(this,gt)[2]),n(this,ut)[3]=Math.min(n(this,ut)[3],n(this,gt)[3]),e||n(this,Ve).clear()),this}_takePendingDependencies(){const t=n(this,Ve);return f(this,Ve,new Set),t}_extractOperation(t){const e=n(this,ec).get(t);return n(this,ec).delete(t),e}_pushPendingDependencies(t){for(const e of t)n(this,Ve).add(e)}take(){return n(this,Bo).clear(),new Qy(n(this,xe),n(this,Qi))}takeDebugMetadata(){return n(this,pi)}}Ge=new WeakMap,ze=new WeakMap,ta=new WeakMap,js=new WeakMap,ea=new WeakMap,Ki=new WeakMap,ut=new WeakMap,gt=new WeakMap,Ji=new WeakMap,Ve=new WeakMap,ec=new WeakMap,Bo=new WeakMap,sa=new WeakMap,ia=new WeakMap,Qi=new WeakMap,xe=new WeakMap,pi=new WeakMap,sc=new WeakSet,Rf=function(t,e){const s=new ArrayBuffer(t*4);f(this,Qi,new Uint8ClampedArray(s)),f(this,xe,new Uint32Array(s)),e&&e.length>0?(n(this,xe).set(e),n(this,xe).fill(Pf,e.length)):n(this,xe).fill(Pf)};var vt,Bt,Gs,Ho,Uo;const Xp=class Xp{constructor(t,e,s){g(this,vt);g(this,Bt);g(this,Gs);g(this,Ho,0);g(this,Uo,0);if(t instanceof Xp&&n(t,Gs)===!!s)return t;f(this,vt,t),f(this,Bt,e),f(this,Gs,!!s)}growOperationsCount(){throw new Error("Unreachable")}save(t){return Jt(this,Uo)._++,n(this,vt).save(n(this,Bt)),this}restore(t){return n(this,Uo)>0&&(n(this,vt).restore(n(this,Bt)),Jt(this,Uo)._--),this}recordOpenMarker(t){return Jt(this,Ho)._++,this}getOpenMarker(){return n(this,Ho)>0?n(this,Bt):n(this,vt).getOpenMarker()}recordCloseMarker(t){return Jt(this,Ho)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return n(this,vt).pushBaseTransform(t),this}popBaseTransform(){return n(this,vt).popBaseTransform(),this}recordSimpleData(t,e){return n(this,vt).recordSimpleData(t,n(this,Bt)),this}recordIncrementalData(t,e){return n(this,vt).recordIncrementalData(t,n(this,Bt)),this}resetIncrementalData(t,e){return n(this,vt).resetIncrementalData(t,n(this,Bt)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,s){return n(this,vt).recordSimpleDataFromNamed(t,e,n(this,Bt)),this}recordFutureForcedDependency(t,e){return n(this,vt).recordFutureForcedDependency(t,n(this,Bt)),this}inheritSimpleDataAsFutureForcedDependencies(t){return n(this,vt).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return n(this,vt).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return n(this,Gs)||n(this,vt).resetBBox(n(this,Bt)),this}recordClipBox(t,e,s,i,r,a){return n(this,Gs)||n(this,vt).recordClipBox(n(this,Bt),e,s,i,r,a),this}recordBBox(t,e,s,i,r,a){return n(this,Gs)||n(this,vt).recordBBox(n(this,Bt),e,s,i,r,a),this}recordCharacterBBox(t,e,s,i,r,a,o){return n(this,Gs)||n(this,vt).recordCharacterBBox(n(this,Bt),e,s,i,r,a,o),this}recordFullPageBBox(t){return n(this,Gs)||n(this,vt).recordFullPageBBox(n(this,Bt)),this}getSimpleIndex(t){return n(this,vt).getSimpleIndex(t)}recordDependencies(t,e){return n(this,vt).recordDependencies(n(this,Bt),e),this}recordNamedDependency(t,e){return n(this,vt).recordNamedDependency(n(this,Bt),e),this}recordOperation(t){return n(this,vt).recordOperation(n(this,Bt),!0),this}recordShowTextOperation(t){return n(this,vt).recordShowTextOperation(n(this,Bt),!0),this}bboxToClipBoxDropOperation(t){return n(this,Gs)||n(this,vt).bboxToClipBoxDropOperation(n(this,Bt),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};vt=new WeakMap,Bt=new WeakMap,Gs=new WeakMap,Ho=new WeakMap,Uo=new WeakMap;let au=Xp;const Ss={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["f
10ilter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Ae={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function kf(d,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],e,s),d.clip(i)}class Op{isModifyingCurrentTransform(){return!1}getPattern(){_t("Abstract method `getPattern` called.")}}class tA extends Op{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,i){let r;if(i===Ae.STROKE||i===Ae.FILL){const a=e.current.getClippedPathBoundingBox(i,It(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.cachedCanvases.getCanvas("pattern",o,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),s=H.transform(s,[1,0,0,1,a[0],a[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),kf(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),r=t.createPattern(h.canvas,"no-repeat");const u=new DOMMatrix(s);r.setTransform(u)}else kf(t,this._bbox),r=this._createGradient(t);return r}}function Qu(d,t,e,s,i,r,a,o){const l=t.coords,h=t.colors,c=d.data,u=d.width*4;let p;l[e+1]>l[s+1]&&(p=e,e=s,s=p,p=r,r=a,a=p),l[s+1]>l[i+1]&&(p=s,s=i,i=p,p=a,a=o,o=p),l[e+1]>l[s+1]&&(p=e,e=s,s=p,p=r,r=a,a=p);const m=(l[e]+t.offsetX)*t.scaleX,A=(l[e+1]+t.offsetY)*t.scaleY,y=(l[s]+t.offsetX)*t.scaleX,v=(l[s+1]+t.offsetY)*t.scaleY,w=(l[i]+t.offsetX)*t.scaleX,E=(l[i+1]+t.offsetY)*t.scaleY;if(A>=E)return;const S=h[r],_=h[r+1],C=h[r+2],T=h[a],x=h[a+1],P=h[a+2],R=h[o],D=h[o+1],M=h[o+2],U=Math.round(A),z=Math.round(E);let O,W,F,I,et,ft,se,Ke;for(let nt=U;nt<=z;nt++){if(nt<v){const Ct=nt<A?0:(A-nt)/(A-v);O=m-(m-y)*Ct,W=S-(S-T)*Ct,F=_-(_-x)*Ct,I=C-(C-P)*Ct}else{let Ct;nt>E?Ct=1:v===E?Ct=0:Ct=(v-nt)/(v-E),O=y-(y-w)*Ct,W=T-(T-R)*Ct,F=x-(x-D)*Ct,I=P-(P-M)*Ct}let rt;nt<A?rt=0:nt>E?rt=1:rt=(A-nt)/(A-E),et=m-(m-w)*rt,ft=S-(S-R)*rt,se=_-(_-D)*rt,Ke=C-(C-M)*rt;const Yt=Math.round(Math.min(O,et)),ue=Math.round(Math.max(O,et));let Ee=u*nt+Yt*4;for(let Ct=Yt;Ct<=ue;Ct++)rt=(O-Ct)/(O-et),rt<0?rt=0:rt>1&&(rt=1),c[Ee++]=W-(W-ft)*rt|0,c[Ee++]=F-(F-se)*rt|0,c[Ee++]=I-(I-Ke)*rt|0,c[Ee++]=255}}function eA(d,t,e){const s=t.coords,i=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(s.length/o)-1,h=o-1;for(r=0;r<l;r++){let c=r*o;for(let u=0;u<h;u++,c++)Qu(d,e,s[c],s[c+1],s[c+o],i[c],i[c+1],i[c+o]),Qu(d,e,s[c+o+1],s[c+1],s[c+o],i[c+o+1],i[c+1],i[c+o])}break;case"triangles":for(r=0,a=s.length;r<a;r+=3)Qu(d,e,s[r],s[r+1],s[r+2],i[r],i[r+1],i[r+2]);break;default:throw new Error("illegal figure")}}class sA extends Op{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),p=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),m=h/u,A=c/p,y={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-l,scaleX:1/m,scaleY:1/A},v=u+2*2,w=p+2*2,E=s.getCanvas("mesh",v,w),S=E.context,_=S.createImageData(u,p);if(e){const T=_.data;for(let x=0,P=T.length;x<P;x+=4)T[x]=e[0],T[x+1]=e[1],T[x+2]=e[2],T[x+3]=255}for(const T of this._figures)eA(_,T,y);return S.putImageData(_,2,2),{canvas:E.canvas,offsetX:o-2*m,offsetY:l-2*A,scaleX:m,scaleY:A}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,i){kf(t,this._bbox);const r=new Float32Array(2);if(i===Ae.SHADING)H.singularValueDecompose2dScale(It(t),r);
10else if(this.matrix){H.singularValueDecompose2dScale(this.matrix,r);const[o,l]=r;H.singularValueDecompose2dScale(e.baseTransform,r),r[0]*=o,r[1]*=l}else H.singularValueDecompose2dScale(e.baseTransform,r);const a=this._createMeshCanvas(r,i===Ae.SHADING?null:this._background,e.cachedCanvases);return i!==Ae.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY),t.createPattern(a.canvas,"no-repeat")}}class iA extends Op{getPattern(){return"hotpink"}}function nA(d){switch(d[0]){case"RadialAxial":return new tA(d);case"Mesh":return new sA(d);case"Dummy":return new iA}throw new Error(`Unknown IR type: ${d[0]}`)}const dg={COLORED:1,UNCOLORED:2},Su=class Su{constructor(t,e,s,i){this.color=t[1],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.ctx=e,this.canvasGraphicsFactory=s,this.baseTransform=i}createPatternCanvas(t,e){var ft,se;const{bbox:s,operatorList:i,paintType:r,tilingType:a,color:o,canvasGraphicsFactory:l}=this;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),Ou("TilingType: "+a);const u=s[0],p=s[1],m=s[2],A=s[3],y=m-u,v=A-p,w=new Float32Array(2);H.singularValueDecompose2dScale(this.matrix,w);const[E,S]=w;H.singularValueDecompose2dScale(this.baseTransform,w);const _=E*w[0],C=S*w[1];let T=y,x=v,P=!1,R=!1;const D=Math.ceil(h*_),M=Math.ceil(c*C),U=Math.ceil(y*_),z=Math.ceil(v*C);D>=U?T=h:P=!0,M>=z?x=c:R=!0;const O=this.getSizeAndScale(T,this.ctx.canvas.width,_),W=this.getSizeAndScale(x,this.ctx.canvas.height,C),F=t.cachedCanvases.getCanvas("pattern",O.size,W.size),I=F.context,et=l.createCanvasGraphics(I,e);if(et.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(et,r,o),I.translate(-O.scale*u,-W.scale*p),et.transform(0,O.scale,0,0,W.scale,0,0),I.save(),(ft=et.dependencyTracker)==null||ft.save(),this.clipBbox(et,u,p,m,A),et.baseTransform=It(et.ctx),et.executeOperatorList(i),et.endDrawing(),(se=et.dependencyTracker)==null||se.restore(),I.restore(),P||R){const Ke=F.canvas;P&&(T=h),R&&(x=c);const nt=this.getSizeAndScale(T,this.ctx.canvas.width,_),rt=this.getSizeAndScale(x,this.ctx.canvas.height,C),Yt=nt.size,ue=rt.size,Ee=t.cachedCanvases.getCanvas("pattern-workaround",Yt,ue),Ct=Ee.context,Sn=P?Math.floor(y/h):0,Je=R?Math.floor(v/c):0;for(let At=0;At<=Sn;At++)for(let Qe=0;Qe<=Je;Qe++)Ct.drawImage(Ke,Yt*At,ue*Qe,Yt,ue,0,0,Yt,ue);return{canvas:Ee.canvas,scaleX:nt.scale,scaleY:rt.scale,offsetX:u,offsetY:p}}return{canvas:F.canvas,scaleX:O.scale,scaleY:W.scale,offsetX:u,offsetY:p}}getSizeAndScale(t,e,s){const i=Math.max(Su.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*s);return r>=i?r=i:s=r/t,{scale:s,size:r}}clipBbox(t,e,s,i,r){const a=i-e,o=r-s;t.ctx.rect(e,s,a,o),H.axialAlignedBoundingBox([e,s,i,r],It(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,r=t.current;switch(e){case dg.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;i.fillStyle=r.fillColor=a,i.strokeStyle=r.strokeColor=o;break;case dg.UNCOLORED:i.fillStyle=i.strokeStyle=s,r.fillColor=r.strokeColor=s;break;default:throw new Cy(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,i,r){let a=s;i!==Ae.SHADING&&(a=H.transform(a,e.baseTransform),this.matrix&&(a=H.transform(a,this.matrix)));const o=this.createPatternCanvas(e,r);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=t.createPattern(o.canvas,"repeat");return h.setTransform(l),h}};k(Su,"MAX_PATTERN_SIZE",3e3);let Mf=Su;function rA({src:d,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:r=4294967295,inverseDecode:a=!1}){const o=de.isLittleEndian?4278190080:255,[l,h]=a?[r,o]:[o,r],c=s>>3,u=s&7,p=d.length;e=new Uint32Array(e.buffer);let m=0;for(let A=0;A<i;A++){for(const v=t+c;t<v;t++){const w=t<p?d[t]:255;e[m++]=w&128?h:l,e[m++]=w&64?h:l,e[m++]=w&32?h:l,e[m++]=w&16?h:l,e[m++]=w&8?h:l,e[m++]=w&4?h:l,e[m++]=w&2?h:l,e[m++]=w&1?h:l}if(u===0)continue;const y=t<p?d[t++]:255;for(let v=0;v<u;v++)e[m++]=y&1<<7-v?h:l}return{srcPos:t,destPos:m}}const ug=16,fg=100,aA=15,pg=10,Ye=16,Zu=new DOMMatrix,ys=new Float32Array(2),ro=new Float32Array([1/0,1/0,-1/0,-1/0]);function oA(d,t){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");d.__originalSave=d.save,d.__originalRestore=d.restore,d.__originalRotate=d.rotate,d.__originalScale=d.scale,d.__originalTranslate=d.translate,d.__originalTransform=d.transform,d.__originalSetTransform=d.setTransform,d.__originalResetTransform=d.resetTransform,d.__originalClip=d.clip,d.__originalMoveTo=d.moveTo,d.__originalLineTo=d.lineTo,d.__originalBezierCurveTo=d.bezierCurveTo,d.__originalRect=d.rect,d.__originalClosePath=d.closePath,d.__originalBeginPath=d.beginPath,d._removeMirroring=()=>{d.save=d.__originalSave,d.restore=d.__originalRestore,d.rotate=d.__originalRotate,d.scale=d.__originalScale,d.translate=d.__originalTranslate,d.transform=d.__originalTransform,d.setTransform=d.__originalSetTransform,d.resetTransform=d.__originalResetTransform,d.clip=d.__originalClip,d.moveTo=d.__originalMoveTo,d.lineTo=d.__originalLineTo,d.bezierCurveTo=d.__originalBezierCurveTo,d.rect=d.__originalRect,d.closePath=d.__originalClosePath,d.beginPath=d.__originalBeginPath,delete d._removeMirroring},d.save=function(){t.save(),this.__originalSave()}
10,d.restore=function(){t.restore(),this.__originalRestore()},d.translate=function(e,s){t.translate(e,s),this.__originalTranslate(e,s)},d.scale=function(e,s){t.scale(e,s),this.__originalScale(e,s)},d.transform=function(e,s,i,r,a,o){t.transform(e,s,i,r,a,o),this.__originalTransform(e,s,i,r,a,o)},d.setTransform=function(e,s,i,r,a,o){t.setTransform(e,s,i,r,a,o),this.__originalSetTransform(e,s,i,r,a,o)},d.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},d.rotate=function(e){t.rotate(e),this.__originalRotate(e)},d.clip=function(e){t.clip(e),this.__originalClip(e)},d.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},d.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},d.bezierCurveTo=function(e,s,i,r,a,o){t.bezierCurveTo(e,s,i,r,a,o),this.__originalBezierCurveTo(e,s,i,r,a,o)},d.rect=function(e,s,i,r){t.rect(e,s,i,r),this.__originalRect(e,s,i,r)},d.closePath=function(){t.closePath(),this.__originalClosePath()},d.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class lA{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return this.cache[t]!==void 0?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function vd(d,t,e,s,i,r,a,o,l,h){const[c,u,p,m,A,y]=It(d);if(u===0&&p===0){const E=a*c+A,S=Math.round(E),_=o*m+y,C=Math.round(_),T=(a+l)*c+A,x=Math.abs(Math.round(T)-S)||1,P=(o+h)*m+y,R=Math.abs(Math.round(P)-C)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(m),S,C),d.drawImage(t,e,s,i,r,0,0,x,R),d.setTransform(c,u,p,m,A,y),[x,R]}if(c===0&&m===0){const E=o*p+A,S=Math.round(E),_=a*u+y,C=Math.round(_),T=(o+h)*p+A,x=Math.abs(Math.round(T)-S)||1,P=(a+l)*u+y,R=Math.abs(Math.round(P)-C)||1;return d.setTransform(0,Math.sign(u),Math.sign(p),0,S,C),d.drawImage(t,e,s,i,r,0,0,R,x),d.setTransform(c,u,p,m,A,y),[R,x]}d.drawImage(t,e,s,i,r,a,o,l,h);const v=Math.hypot(c,u),w=Math.hypot(p,m);return[v*l,w*h]}class gg{constructor(t,e,s){k(this,"alphaIsShape",!1);k(this,"fontSize",0);k(this,"fontSizeScale",1);k(this,"textMatrix",null);k(this,"textMatrixScale",1);k(this,"fontMatrix",sf);k(this,"leading",0);k(this,"x",0);k(this,"y",0);k(this,"lineX",0);k(this,"lineY",0);k(this,"charSpacing",0);k(this,"wordSpacing",0);k(this,"textHScale",1);k(this,"textRenderingMode",fe.FILL);k(this,"textRise",0);k(this,"fillColor","#000000");k(this,"strokeColor","#000000");k(this,"patternFill",!1);k(this,"patternStroke",!1);k(this,"fillAlpha",1);k(this,"strokeAlpha",1);k(this,"lineWidth",1);k(this,"activeSMask",null);k(this,"transferMaps","none");s==null||s(this),this.clipBox=new Float32Array([0,0,t,e]),this.minMax=ro.slice()}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Ae.FILL,e=null){const s=this.minMax.slice();if(t===Ae.STROKE){e||_t("Stroke bounding box must include transform."),H.singularValueDecompose2dScale(e,ys);const i=ys[0]*this.lineWidth/2,r=ys[1]*this.lineWidth/2;s[0]-=i,s[1]-=r,s[2]+=i,s[3]+=r}return s}updateClipFromPath(){const t=H.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(ro,0)}getClippedPathBoundingBox(t=Ae.FILL,e=null){return H.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function mg(d,t){if(t instanceof ImageData){d.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Ye,r=(e-i)/Ye,a=i===0?r:r+1,o=d.createImageData(s,Ye);let l=0,h;const c=t.data,u=o.data;let p,m,A,y;if(t.kind===bh.GRAYSCALE_1BPP){const v=c.byteLength,w=new Uint32Array(u.buffer,0,u.byteLength>>2),E=w.length,S=s+7>>3,_=4294967295,C=de.isLittleEndian?4278190080:255;for(p=0;p<a;p++){for(A=p<r?Ye:i,h=0,m=0;m<A;m++){const T=v-l;let x=0;const P=T>S?s:T*8-7,R=P&-8;let D=0,M=0;for(;x<R;x+=8)M=c[l++],w[h++]=M&128?_:C,w[h++]=M&64?_:C,w[h++]=M&32?_:C,w[h++]=M&16?_:C,w[h++]=M&8?_:C,w[h++]=M&4?_:C,w[h++]=M&2?_:C,w[h++]=M&1?_:C;for(;x<P;x++)D===0&&(M=c[l++],D=128),w[h++]=M&D?_:C,D>>=1}for(;h<E;)w[h++]=0;d.putImageData(o,0,p*Ye)}}else if(t.kind===bh.RGBA_32BPP){for(m=0,y=s*Ye*4,p=0;p<r;p++)u.set(c.subarray(l,l+y)),l+=y,d.putImageData(o,0,m),m+=Ye;p<a&&(y=s*i*4,u.set(c.subarray(l,l+y)),d.putImageData(o,0,m))}else if(t.kind===bh.RGB_24BPP)for(A=Ye,y=s*A,p=0;p<a;p++){for(p>=r&&(A=i,y=s*A),h=0,m=y;m--;)u[h++]=c[l++],u[h++]=c[l++],u[h++]=c[l++],u[h++]=255;d.putImageData(o,0,p*Ye)}else throw new Error(`bad image kind: ${t.kind}`)}function bg(d,t){if(t.bitmap){d.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Ye,r=(e-i)/Ye,a=i===0?r:r+1,o=d.createImageData(s,Ye);let l=0;const h=t.data,c=o.data;for(let u=0;u<a;u++){const p=u<r?Ye:i;({srcPos:l}=rA({src:h,srcPos:l,dest:c,width:s,height:p,nonBlackColor:0})),d.putImageData(o,0,u*Ye)}}function Wl(d,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)d[s]!==void 0&&(t[s]=d[s]);d.setLineDash!==void 0&&(t.setLineDash(d.getLineDash()),t.lineDashOffset=d.lineDashOffset)}function Ed(d){d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0);const{filter:t}=d;t!=="none"&&t!==""&&(d.filter="none")}function yg(d,t){if(t)return!0;H.singularValueDecompose2dScale(d,ys);const e=Math.fround(Zs.pixelRatio*wn.PDF_TO_CSS_UNITS);return ys[0]<=e&&ys[1]<=e}const hA=["butt","round","square"],cA=["miter","round","bevel"],dA={},Ag={};var ti,Df,Lf,If;const qp=class qp{constructor(t,e,s,i,r,{optionalContentConfig:a,markedContentStack:o=null},l,h,c){g(this,ti);
10this.ctx=t,this.current=new gg(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=s,this.canvasFactory=i,this.filterFactory=r,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new lA(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,this.dependencyTracker=c??null}getObject(t,e,s=null){var i;return typeof e=="string"?((i=this.dependencyTracker)==null||i.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):s}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,s){const l=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...It(this.compositeCtx))}this.ctx.save(),Ed(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=It(this.ctx)}executeOperatorList(t,e,s,i,r){var w;const a=t.argsArray,o=t.fnArray;let l=e||0;const h=a.length;if(h===l)return l;const c=h-l>pg&&typeof s=="function",u=c?Date.now()+aA:0;let p=0;const m=this.commonObjs,A=this.objs;let y,v;for(;;){if(i!==void 0&&l===i.nextBreakPoint)return i.breakIt(l,s),l;if(!r||r(l))if(y=o[l],v=a[l]??null,y!==Ul.dependency)v===null?this[y](l):this[y](l,...v);else for(const E of v){(w=this.dependencyTracker)==null||w.recordNamedData(E,l);const S=E.startsWith("g_")?m:A;if(!S.has(E))return S.get(E,s),l}if(l++,l===h)return l;if(c&&++p>pg){if(Date.now()>u)return s(),l;p=0}}}endDrawing(){b(this,ti,Df).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,ti,Lf).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,i=t.height??t.displayHeight;let r=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,l=i,h="prescale1",c,u;for(;r>2&&o>1||a>2&&l>1;){let p=o,m=l;r>2&&o>1&&(p=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),r/=o/p),a>2&&l>1&&(m=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,a/=l/m),c=this.cachedCanvases.getCanvas(h,p,m),u=c.context,u.clearRect(0,0,p,m),u.drawImage(t,0,0,o,l,0,0,p,m),t=c.canvas,o=p,l=m,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:l}}_createMaskCanvas(t,e){var D,M;const s=this.ctx,{width:i,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,l=It(s);let h,c,u,p;if((e.bitmap||e.data)&&e.count>1){const U=e.bitmap||e.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),a]),h=this._cachedBitmapsMap.get(U),h||(h=new Map,this._cachedBitmapsMap.set(U,h));const z=h.get(c);if(z&&!o){const O=Math.round(Math.min(l[0],l[2])+l[4]),W=Math.round(Math.min(l[1],l[3])+l[5]);return(D=this.dependencyTracker)==null||D.recordDependencies(t,Ss.transformAndFill),{canvas:z,offsetX:O,offsetY:W}}u=z}u||(p=this.cachedCanvases.getCanvas("maskCanvas",i,r),bg(p.context,e));let m=H.transform(l,[1/i,0,0,-1/r,0,0]);m=H.transform(m,[1,0,0,1,0,-r]);const A=ro.slice();H.axialAlignedBoundingBox([0,0,i,r],m,A);const[y,v,w,E]=A,S=Math.round(w-y)||1,_=Math.round(E-v)||1,C=this.cachedCanvases.getCanvas("fillCanvas",S,_),T=C.context,x=y,P=v;T.translate(-x,-P),T.transform(...m),u||(u=this._scaleImage(p.canvas,ei(T)),u=u.img,h&&o&&h.set(c,u)),T.imageSmoothingEnabled=yg(It(T),e.interpolate),vd(T,u,0,0,u.width,u.height,0,0,i,r),T.globalCompositeOperation="source-in";const R=H.transform(ei(T),[1,0,0,1,-x,-P]);return T.fillStyle=o?a.getPattern(s,this,R,Ae.FILL,t):a,T.fillRect(0,0,i,r),h&&!o&&
10(this.cachedCanvases.delete("fillCanvas"),h.set(c,C.canvas)),(M=this.dependencyTracker)==null||M.recordDependencies(t,Ss.transformAndFill),{canvas:C.canvas,offsetX:Math.round(x),offsetY:Math.round(P)}}setLineWidth(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineCap",t),this.ctx.lineCap=hA[e]}setLineJoin(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineJoin",t),this.ctx.lineJoin=cA[e]}setMiterLimit(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,s){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("dash",t);const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(e),i.lineDashOffset=s)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var s,i,r,a,o;for(const[l,h]of e)switch(l){case"LW":this.setLineWidth(t,h);break;case"LC":this.setLineCap(t,h);break;case"LJ":this.setLineJoin(t,h);break;case"ML":this.setMiterLimit(t,h);break;case"D":this.setDash(t,h[0],h[1]);break;case"RI":this.setRenderingIntent(t,h);break;case"FL":this.setFlatness(t,h);break;case"Font":this.setFont(t,h[0],h[1]);break;case"CA":(s=this.dependencyTracker)==null||s.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=h;break;case"ca":(i=this.dependencyTracker)==null||i.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=h;break;case"BM":(r=this.dependencyTracker)==null||r.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=h;break;case"SMask":(a=this.dependencyTracker)==null||a.recordSimpleData("SMask",t),this.current.activeSMask=h?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":(o=this.dependencyTracker)==null||o.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(h);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,s=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(i,e,s);this.suspendedCtx=this.ctx;const a=this.ctx=r.context;a.setTransform(this.suspendedCtx.getTransform()),Wl(this.suspendedCtx,a),oA(a,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Wl(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];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,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()}composeSMask(t,e,s,i){const r=i[0],a=i[1],o=i[2]-r,l=i[3]-a;o===0||l===0||(this.genericComposeSMask(e.context,s,o,l,e.subtype,e.backdrop,e.transferMap,r,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}genericComposeSMask(t,e,s,i,r,a,o,l,h,c,u){let p=t.canvas,m=l-c,A=h-u;if(a)if(m<0||A<0||m+s>p.width||A+i>p.height){const v=this.cachedCanvases.getCanvas("maskExtension",s,i),w=v.context;w.drawImage(p,-m,-A),w.globalCompositeOperation="destination-atop",w.fillStyle=a,w.fillRect(0,0,s,i),w.globalCompositeOperation="source-over",p=v.canvas,m=A=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const v=new Path2D;v.rect(m,A,s,i),t.clip(v),t.globalCompositeOperation="destination-atop",t.fillStyle=a,t.fillRect(m,A,s,i),t.restore(
10)}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),r==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):r==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const y=new Path2D;y.rect(l,h,s,i),e.clip(y),e.globalCompositeOperation="destination-in",e.drawImage(p,m,A,s,i,l,h,s,i),e.restore()}save(t){var s;this.inSMaskMode&&Wl(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone(),(s=this.dependencyTracker)==null||s.save(t)}restore(t){var e;if((e=this.dependencyTracker)==null||e.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&Wl(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,s,i,r,a,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",t),this.ctx.transform(e,s,i,r,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s,i){let[r]=s;if(!i){r||(r=s[0]=new Path2D),this[e](t,r);return}if(this.dependencyTracker!==null){const a=e===Ul.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,i[0]-a,i[2]+a,i[1]-a,i[3]+a).recordDependencies(t,["transform"])}if(!(r instanceof Path2D)){const a=s[0]=new Path2D;for(let o=0,l=r.length;o<l;)switch(r[o++]){case gd.moveTo:a.moveTo(r[o++],r[o++]);break;case gd.lineTo:a.lineTo(r[o++],r[o++]);break;case gd.curveTo:a.bezierCurveTo(r[o++],r[o++],r[o++],r[o++],r[o++],r[o++]);break;case gd.closePath:a.closePath();break;default:q(`Unrecognized drawing path operator: ${r[o-1]}`);break}r=a}H.axialAlignedBoundingBox(i,It(this.ctx),this.current.minMax),this[e](t,r),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,s=!0){var a;const i=this.ctx,r=this.current.strokeColor;if(i.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof r=="object"&&(r!=null&&r.getPattern)){const o=r.isModifyingCurrentTransform()?i.getTransform():null;if(i.save(),i.strokeStyle=r.getPattern(i,this,ei(i),Ae.STROKE,t),o){const l=new Path2D;l.addPath(e,i.getTransform().invertSelf().multiplySelf(o)),e=l}this.rescaleAndStroke(e,!1),i.restore()}else this.rescaleAndStroke(e,!0);(a=this.dependencyTracker)==null||a.recordDependencies(t,Ss.stroke),s&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Ae.STROKE,It(this.ctx))),i.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,s=!0){var h,c,u;const i=this.ctx,r=this.current.fillColor,a=this.current.patternFill;let o=!1;if(a){const p=r.isModifyingCurrentTransform()?i.getTransform():null;if((h=this.dependencyTracker)==null||h.save(t),i.save(),i.fillStyle=r.getPattern(i,this,ei(i),Ae.FILL,t),p){const m=new Path2D;m.addPath(e,i.getTransform().invertSelf().multiplySelf(p)),e=m}o=!0}const l=this.current.getClippedPathBoundingBox();this.contentVisible&&l!==null&&(this.pendingEOFill?(i.fill(e,"evenodd"),this.pendingEOFill=!1):i.fill(e)),(c=this.dependencyTracker)==null||c.recordDependencies(t,Ss.fill),o&&(i.restore(),(u=this.dependencyTracker)==null||u.restore(t)),s&&this.consumePath(t,e,l)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var s;this.ctx.fill(e),(s=this.dependencyTracker)==null||s.recordDependencies(t,Ss.rawFillPath).recordOperation(t)}clip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=dA}eoClip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=Ag}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(e=this.dependencyTracker)==null||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){const{dependencyTracker:i}=this;e!==void 0&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(e!==void 0){const i=new Path2D,r=s.getTransform().invertSelf();for(const{transform:a,x:o,y:l,fontSize:h,path:c}of e)c&&i.addPath(c,new DOMMatrix(a).preMultiplySelf(r).translate(o,l).scale(h,-h));s.clip(i)}delete this.pendingTextPaths}setCharSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,s){var u,p;(u=this.dependencyTracker)==null||u.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const i=this.commonObjs.get(e),r=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=i.fontMatrix||sf,(r.fontMatrix[0]===0||r.fontMatrix[3]===0)&&q("Invalid font matrix for font "+e),s<0?(s=-s,r.fontDirection=-1):r.fontDirection=1,this.current.font=i,this.current.fontSize=s,i.isType3Font)return;const a=i.loadedName||"sans-serif",o=((p=i.systemFontInfo)==null?void 0:p.css)||`"${a}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const h=i.italic?"italic":"normal";let c=s;s<ug?c=ug:s>fg&&(c=fg),this.current.fontSizeScale=s/c,this.ctx.font=`${h} ${l} ${c}px ${o}`}setTextRenderingMode(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,s){var i;(i=this.dependencyTracker)==null||i.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=s}setLeadingMoveText(t,e,s){this.setLeading(t,-s),this.moveText(t,e,s)}setTextMatrix(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("textMatrix",t);const{current:s}=this;s.textMatrix=e,s.textMatrixScale=Math.hypot(e[0],e[1]),s.x=s.lineX=0,s.y=s.lineY=0}nextLine(t){var e;this.moveText(t,0,this.current.leading),(e=this.dependencyTracker)==null||e.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}
10paintChar(t,e,s,i,r,a){var w,E,S,_;const o=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,u=l.fontSize/l.fontSizeScale,p=c&fe.FILL_STROKE_MASK,m=!!(c&fe.ADD_TO_PATH_FLAG),A=l.patternFill&&!h.missingFile,y=l.patternStroke&&!h.missingFile;let v;if((h.disableFontFace||m||A||y)&&!h.missingFile&&(v=h.getPathGenerator(this.commonObjs,e)),v&&(h.disableFontFace||A||y)){o.save(),o.translate(s,i),o.scale(u,-u),(w=this.dependencyTracker)==null||w.recordCharacterBBox(t,o,h);let C;if(p===fe.FILL||p===fe.FILL_STROKE)if(r){C=o.getTransform(),o.setTransform(...r);const T=b(this,ti,If).call(this,v,C,r);o.fill(T)}else o.fill(v);if(p===fe.STROKE||p===fe.FILL_STROKE)if(a){C||(C=o.getTransform()),o.setTransform(...a);const{a:T,b:x,c:P,d:R}=C,D=H.inverseTransform(a),M=H.transform([T,x,P,R,0,0],D);H.singularValueDecompose2dScale(M,ys),o.lineWidth*=Math.max(ys[0],ys[1])/u,o.stroke(b(this,ti,If).call(this,v,C,a))}else o.lineWidth/=u,o.stroke(v);o.restore()}else(p===fe.FILL||p===fe.FILL_STROKE)&&(o.fillText(e,s,i),(E=this.dependencyTracker)==null||E.recordCharacterBBox(t,o,h,u,s,i,()=>o.measureText(e))),(p===fe.STROKE||p===fe.FILL_STROKE)&&(this.dependencyTracker&&((S=this.dependencyTracker)==null||S.recordCharacterBBox(t,o,h,u,s,i,()=>o.measureText(e)).recordDependencies(t,Ss.stroke)),o.strokeText(e,s,i));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:It(o),x:s,y:i,fontSize:u,path:v}),(_=this.dependencyTracker)==null||_.recordCharacterBBox(t,o,h,u,s,i))}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return J(this,"isFontSubpixelAAEnabled",s)}showText(t,e){var P,R,D,M;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Ss.showText).resetBBox(t),this.current.textRenderingMode&fe.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const s=this.current,i=s.font;if(i.isType3Font){this.showType3Text(t,e),(P=this.dependencyTracker)==null||P.recordShowTextOperation(t);return}const r=s.fontSize;if(r===0){(R=this.dependencyTracker)==null||R.recordOperation(t);return}const a=this.ctx,o=s.fontSizeScale,l=s.charSpacing,h=s.wordSpacing,c=s.fontDirection,u=s.textHScale*c,p=e.length,m=i.vertical,A=m?1:-1,y=i.defaultVMetrics,v=r*s.fontMatrix[0],w=s.textRenderingMode===fe.FILL&&!i.disableFontFace&&!s.patternFill;a.save(),s.textMatrix&&a.transform(...s.textMatrix),a.translate(s.x,s.y+s.textRise),c>0?a.scale(u,-1):a.scale(u,1);let E,S;if(s.patternFill){a.save();const U=s.fillColor.getPattern(a,this,ei(a),Ae.FILL,t);E=It(a),a.restore(),a.fillStyle=U}if(s.patternStroke){a.save();const U=s.strokeColor.getPattern(a,this,ei(a),Ae.STROKE,t);S=It(a),a.restore(),a.strokeStyle=U}let _=s.lineWidth;const C=s.textMatrixScale;if(C===0||_===0){const U=s.textRenderingMode&fe.FILL_STROKE_MASK;(U===fe.STROKE||U===fe.FILL_STROKE)&&(_=this.getSinglePixelWidth())}else _/=C;if(o!==1&&(a.scale(o,o),_/=o),a.lineWidth=_,i.isInvalidPDFjsFont){const U=[];let z=0;for(const W of e)U.push(W.unicode),z+=W.width;const O=U.join("");if(a.fillText(O,0,0),this.dependencyTracker!==null){const W=a.measureText(O);this.dependencyTracker.recordBBox(t,this.ctx,-W.actualBoundingBoxLeft,W.actualBoundingBoxRight,-W.actualBoundingBoxAscent,W.actualBoundingBoxDescent).recordShowTextOperation(t)}
10s.x+=z*v*u,a.restore(),this.compose();return}let T=0,x;for(x=0;x<p;++x){const U=e[x];if(typeof U=="number"){T+=A*U*r/1e3;continue}let z=!1;const O=(U.isSpace?h:0)+l,W=U.fontChar,F=U.accent;let I,et,ft=U.width;if(m){const nt=U.vmetric||y,rt=-(U.vmetric?nt[1]:ft*.5)*v,Yt=nt[2]*v;ft=nt?-nt[0]:ft,I=rt/o,et=(T+Yt)/o}else I=T/o,et=0;let se;if(i.remeasure&&ft>0){se=a.measureText(W);const nt=se.width*1e3/r*o;if(ft<nt&&this.isFontSubpixelAAEnabled){const rt=ft/nt;z=!0,a.save(),a.scale(rt,1),I/=rt}else ft!==nt&&(I+=(ft-nt)/2e3*r/o)}if(this.contentVisible&&(U.isInFont||i.missingFile)){if(w&&!F)a.fillText(W,I,et),(D=this.dependencyTracker)==null||D.recordCharacterBBox(t,a,se?{bbox:null}:i,r/o,I,et,()=>se??a.measureText(W));else if(this.paintChar(t,W,I,et,E,S),F){const nt=I+r*F.offset.x/o,rt=et-r*F.offset.y/o;this.paintChar(t,F.fontChar,nt,rt,E,S)}}const Ke=m?ft*v-O*c:ft*v+O*c;T+=Ke,z&&a.restore()}m?s.y-=T:s.x+=T*u,a.restore(),this.compose(),(M=this.dependencyTracker)==null||M.recordShowTextOperation(t)}showType3Text(t,e){const s=this.ctx,i=this.current,r=i.font,a=i.fontSize,o=i.fontDirection,l=r.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,u=i.textHScale*o,p=i.fontMatrix||sf,m=e.length,A=i.textRenderingMode===fe.INVISIBLE;let y,v,w,E;if(A||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),i.textMatrix&&s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),s.scale(u,o);const S=this.dependencyTracker;for(this.dependencyTracker=S?new au(S,t):null,y=0;y<m;++y){if(v=e[y],typeof v=="number"){E=l*v*a/1e3,this.ctx.translate(E,0),i.x+=E*u;continue}const _=(v.isSpace?c:0)+h,C=r.charProcOperatorList[v.operatorListId];C?this.contentVisible&&(this.save(),s.scale(a,a),s.transform(...p),this.executeOperatorList(C),this.restore()):q(`Type3 character "${v.operatorListId}" is not available.`);const T=[v.width,0];H.applyTransform(T,p),w=T[0]*a+_,s.translate(w,0),i.x+=w*u}
10s.restore(),S&&(this.dependencyTracker=S)}setCharWidth(t,e,s){}setCharWidthAndBounds(t,e,s,i,r,a,o){var h;const l=new Path2D;l.rect(i,r,a-i,o-r),this.ctx.clip(l),(h=this.dependencyTracker)==null||h.recordBBox(t,this.ctx,i,a,r,o).recordClipBox(t,this.ctx,i,a,r,o),this.endPath(t)}getColorN_Pattern(t,e){let s;if(e[0]==="TilingPattern"){const i=this.baseTransform||It(this.ctx),r={createCanvasGraphics:(a,o)=>new qp(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new au(this.dependencyTracker,o,!0):null)};s=new Mf(e,this.ctx,r,i)}else s=this._getPattern(t,e[1],e[2]);return s}setStrokeColorN(t,...e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}
10setStrokeTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,s=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=nA(this.getObject(t,e)),this.cachedPatterns.set(e,i)),s&&(i.matrix=s),i}shadingFill(t,e){var a;if(!this.contentVisible)return;const s=this.ctx;this.save(t);const i=this._getPattern(t,e);s.fillStyle=i.getPattern(s,this,ei(s),Ae.SHADING,t);const r=ei(s);if(r){const{width:o,height:l}=s.canvas,h=ro.slice();H.axialAlignedBoundingBox([0,0,o,l],r,h);const[c,u,p,m]=h;this.ctx.fillRect(c,u,p-c,m-u)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(a=this.dependencyTracker)==null||a.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Ss.transform).recordDependencies(t,Ss.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){_t("Should not call beginInlineImage")}beginImageData(){_t("Should not call beginImageData")}paintFormXObjectBegin(t,e,s){var i;if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=It(this.ctx),s)){H.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);const[r,a,o,l]=s,h=new Path2D;h.rect(r,a,o-r,l-a),this.ctx.clip(h),(i=this.dependencyTracker)==null||i.recordClipBox(t,this.ctx,r,o,a,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var S;if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;
10e.isolated||Ou("TODO: Support non-isolated groups."),e.knockout&&q("Knockout groups not supported.");const i=It(s);if(e.matrix&&s.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=ro.slice();H.axialAlignedBoundingBox(e.bbox,It(s),r);const a=[0,0,s.canvas.width,s.canvas.height];r=H.intersect(r,a)||[0,0,0,0];const o=Math.floor(r[0]),l=Math.floor(r[1]),h=Math.max(Math.ceil(r[2])-o,1),c=Math.max(Math.ceil(r[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,c]);let u="groupAt"+this.groupLevel;e.smask&&(u+="_smask_"+this.smaskCounter++%2);const p=this.cachedCanvases.getCanvas(u,h,c),m=p.context;m.translate(-o,-l),m.transform(...i);let A=new Path2D;const[y,v,w,E]=e.bbox;if(A.rect(y,v,w-y,E-v),e.matrix){const _=new Path2D;_.addPath(A,new DOMMatrix(e.matrix)),A=_}m.clip(A),e.smask&&this.smaskStack.push({canvas:p.canvas,context:m,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(s.setTransform(1,0,0,1,0,0),s.translate(o,l),s.save()),Wl(s,m),this.ctx=m,(S=this.dependencyTracker)==null||S.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(t,e){var r;if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,(r=this.dependencyTracker)==null||r.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();const a=It(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...a);const o=ro.slice();H.axialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],a,o),this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(o)}}beginAnnotation(t,e,s,i,r,a){if(b(this,ti,Df).call(this),Ed(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){const o=s[2]-s[0],l=s[3]-s[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=s[0],i[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=o,s[3]=l,H.singularValueDecompose2dScale(It(this.ctx),ys);const{viewportScale:h}=this,c=Math.ceil(o*this.outputScaleX*h),u=Math.ceil(l*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,u);const{canvas:p,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(e,p),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(ys[0],0,0,-ys[1],0,l*ys[1]),Ed(this.ctx)}else{Ed(this.ctx),this.endPath(t);const h=new Path2D;h.rect(s[0],s[1],o,l),this.ctx.clip(h)}}this.current=new gg(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...i),this.transform(t,...r)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),b(this,ti,Lf).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){var o;if(!this.contentVisible)return;const s=e.count;e=this.getObject(t,e.data,e),e.count=s;const i=this.ctx,r=this._createMaskCanvas(t,e),a=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,r.offsetX,r.offsetY),(o=this.dependencyTracker)==null||o.resetBBox(t).recordBBox(t,this.ctx,r.offsetX,r.offsetX+a.width,r.offsetY,r.offsetY+a.height).recordOperation(t),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s,i=0,r=0,a,o){var u,p,m;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const l=this.ctx;l.save();const h=It(l);l.transform(s,i,r,a,0,0);const c=this._createMaskCanvas(t,e);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]),(u=this.dependencyTracker)==null||u.resetBBox(t);for(let A=0,y=o.length;A<y;A+=2){const v=H.transform(h,[s,i,r,a,o[A],o[A+1]]);l.drawImage(c.canvas,v[4],v[5]),(p=this.dependencyTracker)==null||p.recordBBox(t,this.ctx,v[4],v[4]+c.canvas.width,v[5],v[5]+c.canvas.height)}l.restore(),this.compose(),(m=this.dependencyTracker)==null||m.recordOperation(t)}paintImageMaskXObjectGroup(t,e){var a,o,l;if(!this.contentVisible)return;const s=this.ctx,i=this.current.fillColor,r=this.current.patternFill;(a=this.dependencyTracker)==null||a.resetBBox(t).recordDependencies(t,Ss.transformAndFill);for(const h of e){const{data:c,width:u,height:p,transform:m}=h,A=this.cachedCanvases.getCanvas("maskCanvas",u,p),y=A.context;y.save();const v=this.getObject(t,c,h);bg(y,v),y.globalCompositeOperation="source-in",y.fillStyle=r?i.getPattern(y,this,ei(s),Ae.FILL,t):i,y.fillRect(0,0,u,p),y.restore(
10),s.save(),s.transform(...m),s.scale(1,-1),vd(s,A.canvas,0,0,u,p,0,-1,1,1),(o=this.dependencyTracker)==null||o.recordBBox(t,s,0,u,0,p),s.restore()}this.compose(),(l=this.dependencyTracker)==null||l.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;const s=this.getObject(t,e);if(!s){q("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,s)}paintImageXObjectRepeat(t,e,s,i,r){if(!this.contentVisible)return;const a=this.getObject(t,e);if(!a){q("Dependent image isn't ready yet");return}const o=a.width,l=a.height,h=[];for(let c=0,u=r.length;c<u;c+=2)h.push({transform:[s,0,0,i,r[c],r[c+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,a,h)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:e,width:s,height:i}=t,r=this.cachedCanvases.getCanvas("inlineImage",s,i),a=r.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",r.canvas}paintInlineImageXObject(t,e){var h;if(!this.contentVisible)return;const s=e.width,i=e.height,r=this.ctx;this.save(t);const{filter:a}=r;a!=="none"&&a!==""&&(r.filter="none"),r.scale(1/s,-1/i);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)o=e;else{const u=this.cachedCanvases.getCanvas("inlineImage",s,i).context;mg(u,e),o=this.applyTransferMapsToCanvas(u)}const l=this._scaleImage(o,ei(r));r.imageSmoothingEnabled=yg(It(r),e.interpolate),(h=this.dependencyTracker)==null||h.resetBBox(t).recordBBox(t,r,0,s,-i,0).recordDependencies(t,Ss.imageXObject).recordOperation(t),vd(r,l.img,0,0,l.paintWidth,l.paintHeight,0,-i,s,i),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,s){var a,o,l;if(!this.contentVisible)return;const i=this.ctx;let r;if(e.bitmap)r=e.bitmap;else{const h=e.width,c=e.height,p=this.cachedCanvases.getCanvas("inlineImage",h,c).context;mg(p,e),r=this.applyTransferMapsToCanvas(p)}(a=this.dependencyTracker)==null||a.resetBBox(t);for(const h of s)i.save(),i.transform(...h.transform),i.scale(1,-1),vd(i,r,h.x,h.y,h.w,h.h,0,-1,1,1),(o=this.dependencyTracker)==null||o.recordBBox(t,i,0,1,-1,0),i.restore();(l=this.dependencyTracker)==null||l.recordOperation(t),this.compose()}paintSolidColorImageMask(t){var e;this.contentVisible&&((e=this.dependencyTracker)==null||e.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Ss.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,s){}beginMarkedContent(t,e){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,s){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;(e=this.dependencyTracker)==null||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,s){var a,o;const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const r=this.ctx;this.pendingClip?(i||(this.pendingClip===Ag?r.clip(e,"evenodd"):r.clip(e)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):(o=this.dependencyTracker)==null||o.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=It(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:i,d:r}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const l=Math.abs(e),h=Math.abs(r);if(l===h)if(t===0)a=o=1/l;else{const c=l*t;a=o=c<1?1/c:1}else if(t===0)a=1/l,o=1/h;else{const c=l*t,u=h*t;a=c<1?1/c:1,o=u<1?1/u:1}}else{const l=Math.abs(e*r-s*i),h=Math.hypot(e,s),c=Math.hypot(i,r);if(t===0)a=c/l,o=h/l;else{const u=t*l;a=c>u?c/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:s,current:{lineWidth:i}}=this,[r,a]=this.getScaleForStroking();if(r===a){s.lineWidth=(i||1)*r,s.stroke(t);return}const o=s.getLineDash();e&&s.save(),s.scale(r,a),Zu.a=1/r,Zu.d=1/a;const l=new Path2D;if(l.addPath(t,Zu),o.length>0){const h=Math.max(r,a);
10s.setLineDash(o.map(c=>c/h)),s.lineDashOffset/=h}s.lineWidth=i||1,s.stroke(l),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};ti=new WeakSet,Df=function(){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)},Lf=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},If=function(t,e,s){const i=new Path2D;return i.addPath(t,new DOMMatrix(s).invertSelf().multiplySelf(e)),i};let co=qp;for(const d in Ul)co.prototype[d]!==void 0&&(co.prototype[Ul[d]]=co.prototype[d]);var $o,jo,ic,Go,Ld;const oo=class oo{constructor(t){g(this,Go);g(this,$o);g(this,jo);g(this,ic);f(this,$o,t),f(this,jo,new DataView(n(this,$o))),f(this,ic,new TextDecoder)}static write(t){const e=new TextEncoder,s={};let i=0;for(const h of oo.strings){const c=e.encode(t[h]);s[h]=c,i+=4+c.length}const r=new ArrayBuffer(i),a=new Uint8Array(r),o=new DataView(r);let l=0;for(const h of oo.strings){const c=s[h],u=c.length;o.setUint32(l,u),a.set(c,l+4),l+=4+u}return it(l===r.byteLength,"CssFontInfo.write: Buffer overflow"),r}get fontFamily(){return b(this,Go,Ld).call(this,0)}get fontWeight(){return b(this,Go,Ld).call(this,1)}get italicAngle(){return b(this,Go,Ld).call(this,2)}};$o=new WeakMap,jo=new WeakMap,ic=new WeakMap,Go=new WeakSet,Ld=function(t){it(t<oo.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=n(this,jo).getUint32(e)+4;const s=n(this,jo).getUint32(e);return n(this,ic).decode(new Uint8Array(n(this,$o),e+4,s))},k(oo,"strings",["fontFamily","fontWeight","italicAngle"]);let ou=oo;var Wn,gi,na,ra,oh;const lo=class lo{constructor(t){g(this,ra);g(this,Wn);g(this,gi);g(this,na);f(this,Wn,t),f(this,gi,new DataView(n(this,Wn))),f(this,na,new TextDecoder)}static write(t){const e=new TextEncoder,s={};let i=0;for(const p of lo.strings){const m=e.encode(t[p]);s[p]=m,i+=4+m.length}i+=4;let r,a,o=1+i;t.style&&(r=e.encode(t.style.style),a=e.encode(t.style.weight),o+=4+r.length+4+a.length);const l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l);let u=0;c.setUint8(u++,t.guessFallback?1:0),c.setUint32(u,0),u+=4,i=0;for(const p of lo.strings){const m=s[p],A=m.length;i+=4+A,c.setUint32(u,A),h.set(m,u+4),u+=4+A}return c.setUint32(u-i-4,i),t.style&&(c.setUint32(u,r.length),h.set(r,u+4),u+=4+r.length,c.setUint32(u,a.length),h.set(a,u+4),u+=4+a.length),it(u<=l.byteLength,"SubstitionInfo.write: Buffer overflow"),l.transferToFixedLength(u)}get guessFallback(){return n(this,gi).getUint8(0)!==0}get css(){return b(this,ra,oh).call(this,0)}get loadedName(){return b(this,ra,oh).call(this,1)}get baseFontName(){return b(this,ra,oh).call(this,2)}get src(){return b(this,ra,oh).call(this,3)}get style(){let t=1;t+=4+n(this,gi).getUint32(t);const e=n(this,gi).getUint32(t),s=n(this,na).decode(new Uint8Array(n(this,Wn),t+4,e));t+=4+e;const i=n(this,gi).getUint32(t),r=n(this,na).decode(new Uint8Array(n(this,Wn),t+4,i));return{style:s,weight:r}}};Wn=new WeakMap,gi=new WeakMap,na=new WeakMap,ra=new WeakSet,oh=function(t){it(t<lo.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=n(this,gi).getUint32(e)+4;const s=n(this,gi).getUint32(e);return n(this,na).decode(new Uint8Array(n(this,Wn),e+4,s))},k(lo,"strings",["css","loadedName","baseFontName","src"]);let lu=lo;var zo,Vo,Wo,Xo,is,mi,nc,mt,$t,Os,Id,lh;const K=class K{constructor({data:t,extra:e}){g(this,$t);g(this,mi);g(this,nc);g(this,mt);f(this,mi,t),f(this,nc,new TextDecoder),f(this,mt,new DataView(n(this,mi))),e&&Object.assign(this,e)}get black(){return b(this,$t,Os).call(this,0)}get bold(){return b(this,$t,Os).call(this,1)}get disableFontFace(){return b(this,$t,Os).call(this,2)}get fontExtraProperties(){return b(this,$t,Os).call(this,3)}get isInvalidPDFjsFont(){return b(this,$t,Os).call(this,4)}get isType3Font(){return b(this,$t,Os).call(this,5)}get italic(){return b(this,$t,Os).call(this,6)}get missingFile(){return b(this,$t,Os).call(this,7)}get remeasure(){return b(this,$t,Os).call(this,8)}get vertical(){return b(this,$t,Os).call(this,9)}get ascent(){return b(this,$t,Id).call(this,0)}get defaultWidth(){return b(this,$t,Id).call(this,1)}get descent(){return b(this,$t,Id).call(this,2)}get bbox(){let t=n(K,Vo);if(n(this,mt).getUint8(t)===0)return;t+=1;const s=[];for(let i=0;i<4;i++)s.push(n(this,mt).getInt16(t,!0)),t+=2;return s}get fontMatrix(){let t=n(K,Wo);if(n(this,mt).getUint8(t)===0)return;t+=1;const s=[];for(let i=0;i<6;i++)s.push(n(this,mt).getFloat64(t,!0)),t+=8;return s}get defaultVMetrics(){let t=n(K,Xo);if(n(this,mt).getUint8(t)===0)return;t+=1;const s=[];for(let i=0;i<3;i++)s.push(n(this,mt).getInt16(t,!0)),t+=2;return s}get fallbackName(){return b(this,$t,lh).call(this,0)}get loadedName(){return b(this,$t,lh).call(this,1)}get mimetype(){return b(this,$t,lh).call(this,2)}get name(){return b(this,$t,lh).call(this,3)}get data(){let t=n(K,is);const e=n(this,mt).getUint32(t);t+=4+e;const s=n(this,mt).getUint32(t);t+=4+s;const i=n(this,mt).getUint32(t);t+=4+i;const r=n(this,mt).getUint32(t);if(r!==0)return new Uint8Array(n(this,mi),t+4,r)}clearData(){let t=n(K,is);const e=n(this,mt).getUint32(t);t+=4+e;const s=n(this,mt).getUint32(t);t+=4+s;const i=n(this,mt).getUint32(t);t+=4+i;const r=n(this,mt).getUint32(t);new Uint8Array(n(this,mi),t+4,r).fill(0),n(this,mt).setUint32(t,0)}get cssFontInfo(){let t=n(K,is);const e=n(this,mt).getUint32(t);t+=4+e;const s=n(this,mt).getUint32(t);t+=4+s;const i=n(this,mt).getUint32(t);if(i===0)return null;
10const r=new Uint8Array(i);return r.set(new Uint8Array(n(this,mi),t+4,i)),new ou(r.buffer)}get systemFontInfo(){let t=n(K,is);const e=n(this,mt).getUint32(t);t+=4+e;const s=n(this,mt).getUint32(t);if(s===0)return null;const i=new Uint8Array(s);return i.set(new Uint8Array(n(this,mi),t+4,s)),new lu(i.buffer)}static write(t){const e=t.systemFontInfo?lu.write(t.systemFontInfo):null,s=t.cssFontInfo?ou.write(t.cssFontInfo):null,i=new TextEncoder,r={};let a=0;for(const y of K.strings)r[y]=i.encode(t[y]),a+=4+r[y].length;const o=n(K,is)+4+a+4+(e?e.byteLength:0)+4+(s?s.byteLength:0)+4+(t.data?t.data.length:0),l=new ArrayBuffer(o),h=new Uint8Array(l),c=new DataView(l);let u=0;const p=K.bools.length;let m=0,A=0;for(let y=0;y<p;y++){const v=t[K.bools[y]];m|=(v===void 0?0:v?2:1)<<A,A+=2,(A===8||y===p-1)&&(c.setUint8(u++,m),m=0,A=0)}it(u===n(K,zo),"FontInfo.write: Boolean properties offset mismatch");for(const y of K.numbers)c.setFloat64(u,t[y]),u+=8;if(it(u===n(K,Vo),"FontInfo.write: Number properties offset mismatch"),t.bbox){c.setUint8(u++,4);for(const y of t.bbox)c.setInt16(u,y,!0),u+=2}else c.setUint8(u++,0),u+=2*4;if(it(u===n(K,Wo),"FontInfo.write: BBox properties offset mismatch"),t.fontMatrix){c.setUint8(u++,6);for(const y of t.fontMatrix)c.setFloat64(u,y,!0),u+=8}else c.setUint8(u++,0),u+=8*6;if(it(u===n(K,Xo),"FontInfo.write: FontMatrix properties offset mismatch"),t.defaultVMetrics){c.setUint8(u++,1);for(const y of t.defaultVMetrics)c.setInt16(u,y,!0),u+=2}else c.setUint8(u++,0),u+=3*2;it(u===n(K,is),"FontInfo.write: DefaultVMetrics properties offset mismatch"),c.setUint32(n(K,is),0),u+=4;for(const y of K.strings){const v=r[y],w=v.length;c.setUint32(u,w),h.set(v,u+4),u+=4+w}if(c.setUint32(n(K,is),u-n(K,is)-4),!e)c.setUint32(u,0),u+=4;else{const y=e.byteLength;c.setUint32(u,y),it(u+4+y<=l.byteLength,"FontInfo.write: Buffer overflow at systemFontInfo"),h.set(new Uint8Array(e),u+4),u+=4+y}if(!s)c.setUint32(u,0),u+=4;else{const y=s.byteLength;c.setUint32(u,y),it(u+4+y<=l.byteLength,"FontInfo.write: Buffer overflow at cssFontInfo"),h.set(new Uint8Array(s),u+4),u+=4+y}return t.data===void 0?(c.setUint32(u,0),u+=4):(c.setUint32(u,t.data.length),h.set(t.data,u+4),u+=4+t.data.length),it(u<=l.byteLength,"FontInfo.write: Buffer overflow"),l.transferToFixedLength(u)}};zo=new WeakMap,Vo=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,is=new WeakMap,mi=new WeakMap,nc=new WeakMap,mt=new WeakMap,$t=new WeakSet,Os=function(t){it(t<K.bools.length,"Invalid boolean index");const e=Math.floor(t/4),s=t*2%8,i=n(this,mt).getUint8(e)>>s&3;return i===0?void 0:i===2},Id=function(t){return it(t<K.numbers.length,"Invalid number index"),n(this,mt).getFloat64(n(K,zo)+t*8)},lh=function(t){it(t<K.strings.length,"Invalid string index");let e=n(K,is)+4;for(let r=0;r<t;r++)e+=n(this,mt).getUint32(e)+4;const s=n(this,mt).getUint32(e),i=new Uint8Array(s);return i.set(new Uint8Array(n(this,mi),e+4,s)),n(this,nc).decode(i)},k(K,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),k(K,"numbers",["ascent","defaultWidth","descent"]),k(K,"strings",["fallbackName","loadedName","mimetype","name"]),g(K,zo,Math.ceil(K.bools.length*2/8)),g(K,Vo,n(K,zo)+K.numbers.length*8),g(K,Wo,n(K,Vo)+1+2*4),g(K,Xo,n(K,Wo)+1+8*6),g(K,is,n(K,Xo)+1+2*3);let Ff=K;var rc,ac;class Js{static get workerPort(){return n(this,rc)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");f(this,rc,t)}static get workerSrc(){return n(this,ac)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");f(this,ac,t)}}rc=new WeakMap,ac=new WeakMap,g(Js,rc,null),g(Js,ac,"");var qo,oc;class uA{constructor({parsedData:t,rawData:e}){g(this,qo);g(this,oc);f(this,qo,t),f(this,oc,e)}getRaw(){return n(this,oc)}get(t){return n(this,qo).get(t)??null}[Symbol.iterator](){return n(this,qo).entries()}}qo=new WeakMap,oc=new WeakMap;const so=Symbol("INTERNAL");var lc,hc,cc,Yo;class fA{constructor(t,{name:e,intent:s,usage:i,rbGroups:r}){g(this,lc,!1);g(this,hc,!1);g(this,cc,!1);g(this,Yo,!0);f(this,lc,!!(t&bs.DISPLAY)),f(this,hc,!!(t&bs.PRINT)),this.name=e,this.intent=s,this.usage=i,this.rbGroups=r}get visible(){if(n(this,cc))return n(this,Yo);if(!n(this,Yo))return!1;const{print:t,view:e}=this.usage;return n(this,lc)?(e==null?void 0:e.viewState)!=="OFF":n(this,hc)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==so&&_t("Internal method `_setVisible` called."),f(this,cc,s),f(this,Yo,e)}}lc=new WeakMap,hc=new WeakMap,cc=new WeakMap,Yo=new WeakMap;var Xn,bt,Ko,Jo,dc,Nf;class pA{constructor(t,e=bs.DISPLAY){g(this,dc);g(this,Xn,null);g(this,bt,new Map);g(this,Ko,null);g(this,Jo,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,f(this,Jo,t.order);for(const s of t.groups)n(this,bt).set(s.id,new fA(e,s));if(t.baseState==="OFF")for(const s of n(this,bt).values())s._setVisible(so,!1);for(const s of t.on)n(this,bt).get(s)._setVisible(so,!0);for(const s of t.off)n(this,bt).get(s)._setVisible(so,!1);f(this,Ko,this.getHash())}}isVisible(t){if(n(this,bt).size===0)return!0;
10if(!t)return Ou("Optional content group not defined."),!0;if(t.type==="OCG")return n(this,bt).has(t.id)?n(this,bt).get(t.id).visible:(q(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,dc,Nf).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!n(this,bt).has(e))return q(`Optional content group not found: ${e}`),!0;if(n(this,bt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!n(this,bt).has(e))return q(`Optional content group not found: ${e}`),!0;if(!n(this,bt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!n(this,bt).has(e))return q(`Optional content group not found: ${e}`),!0;if(!n(this,bt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!n(this,bt).has(e))return q(`Optional content group not found: ${e}`),!0;if(n(this,bt).get(e).visible)return!1}return!0}return q(`Unknown optional content policy ${t.policy}.`),!0}return q(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var r;const i=n(this,bt).get(t);if(!i){q(`Optional content group not found: ${t}`);return}if(s&&e&&i.rbGroups.length)for(const a of i.rbGroups)for(const o of a)o!==t&&((r=n(this,bt).get(o))==null||r._setVisible(so,!1,!0));i._setVisible(so,!!e,!0),f(this,Xn,null)}setOCGState({state:t,preserveRB:e}){let s;for(const i of t){switch(i){case"ON":case"OFF":case"Toggle":s=i;continue}const r=n(this,bt).get(i);if(r)switch(s){case"ON":this.setVisibility(i,!0,e);break;case"OFF":this.setVisibility(i,!1,e);break;case"Toggle":this.setVisibility(i,!r.visible,e);break}}f(this,Xn,null)}get hasInitialVisibility(){return n(this,Ko)===null||this.getHash()===n(this,Ko)}getOrder(){return n(this,bt).size?n(this,Jo)?n(this,Jo).slice():[...n(this,bt).keys()]:null}getGroup(t){return n(this,bt).get(t)||null}getHash(){if(n(this,Xn)!==null)return n(this,Xn);const t=new Sm;for(const[e,s]of n(this,bt))t.update(`${e}:${s.visible}`);return f(this,Xn,t.hexdigest())}[Symbol.iterator](){return n(this,bt).entries()}}Xn=new WeakMap,bt=new WeakMap,Ko=new WeakMap,Jo=new WeakMap,dc=new WeakSet,Nf=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const r=t[i];let a;if(Array.isArray(r))a=b(this,dc,Nf).call(this,r);else if(n(this,bt).has(r))a=n(this,bt).get(r).visible;else return q(`Optional content group not found: ${r}`),!0;switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return s==="And"};class gA{constructor(t,{disableRange:e=!1,disableStream:s=!1}){it(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:r,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(r==null?void 0:r.length)>0){const l=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const s=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s);else{const i=this._rangeReaders.some(function(r){return r._begin!==t?!1:(r._enqueue(s),!0)});it(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}_onProgress(t){var e,s,i,r;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(r=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||r.call(i,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;(t=this._fullRequestReader)==null||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){it(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new mA(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new bA(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeReaders.slice(0))s.cancel(t);this._pdfDataRangeTransport.abort()}}class mA{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Hu(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const r of this._queuedChunks)this._loaded+=r.byteLength;
10this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class bA{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const s of this._requests)s.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){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function yA(d){let t=!0,e=s("filename\\*","i").exec(d);if(e){e=e[1];let c=o(e);return c=unescape(c),c=l(c),c=h(c),r(c)}if(e=a(d),e){const c=h(e);return r(c)}if(e=s("filename","i").exec(d),e){e=e[1];let c=o(e);return c=h(c),r(c)}function s(c,u){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function i(c,u){if(c){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const p=new TextDecoder(c,{fatal:!0}),m=od(u);u=p.decode(m),t=!1}catch{}}return u}function r(c){return t&&/[\x80-\xff]/.test(c)&&(c=i("utf-8",c),t&&(c=i("iso-8859-1",c))),c}function a(c){const u=[];let p;const m=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=m.exec(c))!==null;){let[,y,v,w]=p;if(y=parseInt(y,10),y in u){if(y===0)break;continue}u[y]=[v,w]}const A=[];for(let y=0;y<u.length&&y in u;++y){let[v,w]=u[y];w=o(w),v&&(w=unescape(w),y===0&&(w=l(w))),A.push(w)}return A.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let p=0;p<u.length;++p){const m=u[p].indexOf('"');m!==-1&&(u[p]=u[p].slice(0,m),u.length=p+1),u[p]=u[p].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function l(c){const u=c.indexOf("'");if(u===-1)return c;const p=c.slice(0,u),A=c.slice(u+1).replace(/^[^']*'/,"");return i(p,A)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,p,m,A){if(m==="q"||m==="Q")return A=A.replaceAll("_"," "),A=A.replaceAll(/=([0-9a-fA-F]{2})/g,function(y,v){return String.fromCharCode(parseInt(v,16))}),i(p,A);try{A=atob(A)}catch{}return i(p,A)})}return""}function Nm(d,t){const e=new Headers;if(!d||!t||typeof t!="object")return e;for(const s in t){const i=t[s];i!==void 0&&e.append(s,i)}return e}function Uu(d){var t;return((t=URL.parse(d))==null?void 0:t.origin)??null}function Om({responseHeaders:d,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(d.get("Content-Length"),10);return!Number.isInteger(r)||(i.suggestedLength=r,r<=2*e)||s||!t||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Bm(d){const t=d.get("Content-Disposition");if(t){let e=yA(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Hu(e))return e}return null}function dd(d,t){return new Ah(`Unexpected server response (${d}) while retrieving PDF "${t}".`,d,d===404||d===0&&t.startsWith("file:"))}function Hm(d){return d===200||d===206}function Um(d,t,e){return{method:"GET",headers:d,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function $m(d){return d instanceof Uint8Array?d.buffer:d instanceof ArrayBuffer?d:(q(`getArrayBuffer - unexpected data format: ${d}`),new Uint8Array(d).buffer)}class AA{constructor(t){k(this,"_responseOrigin",null);this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Nm(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return it(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new wA(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new vA(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class wA{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const s=new Headers(t.headers),i=e.url;fetch(i,Um(s,this._withCredentials,this._abortController)).then(r=>{if(t._responseOrigin=Uu(r.url),!Hm(r.status))throw dd(r.status,i);this._reader=r.body.getReader(),this._headersCapability.resolve();const a=r.headers,{allowRangeRequests:o,suggestedLength:l}=Om({responseHeaders:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=o,this._contentLength=l||this._contentLength,this._filename=Bm(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new An("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:$m(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class vA{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const i=t.source;this._withCredentials=i.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!i.disableStream,this._abortController=new AbortController;const r=new Headers(t.headers);r.append("Range",`bytes=${e}-${s-1}`);const a=i.url;fetch(a,Um(r,this._withCredentials,this._abortController)).then(o=>{const l=Uu(o.url);if(l!==t._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${t._responseOrigin}".`);if(!Hm(o.status))throw dd(o.status,a);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:$m(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const tf=200,ef=206;function EA(d){const t=d.response;return typeof t!="string"?t:od(t).buffer}class SA{constructor({url:t,httpHeaders:e,withCredentials:s}){k(this,"_responseOrigin",null);this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Nm(this.isHttp,e),this.withCredentials=s||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(t){const e=new XMLHttpRequest,s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[r,a]of this.headers)e.setRequestHeader(r,a);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=ef):i.expectedStatus=tf,e.responseType="arraybuffer",it(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{t.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var i;const s=this.pendingRequests[t];s&&((i=s.onProgress)==null||i.call(s,e))}onStateChange(t,e){const s=this.pendingRequests[t];if(!s)return;const i=s.xhr;if(i.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),i.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],i.status===0&&this.isHttp){s.onError(i.status);return}const r=i.status||tf;if(!(r===tf&&s.expectedStatus===ef)&&r!==s.expectedStatus){s.onError(i.status);return}const o=EA(i);if(r===ef){const l=i.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);h?s.onDone({begin:parseInt(h[1],10),chunk:o}):(q('Missing or invalid "Content-Range" header.'),s.onError(0))}else o?s.onDone({begin:0,chunk:o}):s.onError(i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
10abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class _A{constructor(t){this._source=t,this._manager=new SA(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return it(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new CA(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new TA(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class CA{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}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t);this._manager._responseOrigin=Uu(e.responseURL);const s=e.getAllResponseHeaders(),i=new Headers(s?s.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(o=>{const[l,...h]=o.split(": ");return[l,h.join(": ")]}):[]),{allowRangeRequests:r,suggestedLength:a}=Om({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=Bm(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=dd(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;(e=this.onProgress)==null||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};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class TA{constructor(t,e,s){this._manager=t,this._url=t.url,this._requestId=t.request({begin:e,end:s,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}_onHeadersReceived(){var e;const t=Uu((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);
10t!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${t}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var t;(t=this.onClosed)==null||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError??(this._storedError=dd(t,this._url));for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||(e=this.onProgress)==null||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const xA=/^[a-z][a-z0-9\-+.]+:/i;function PA(d){if(xA.test(d))return new URL(d);const t=process.getBuiltinModule("url");return new URL(t.pathToFileURL(d))}class RA{constructor(t){this.source=t,this.url=PA(t.url),it(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return((t=this._fullRequestReader)==null?void 0:t._loaded)??0}getFullReader(){return it(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new kA(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new MA(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;(e=this._fullRequestReader)==null||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}}class kA{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers();const s=process.getBuiltinModule("fs");s.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=dd(0,this._url.href)),this._storedError=i,this._headersCapability.reject(i)})}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 s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new An("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class MA{constructor(t,e,s){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=t.source;this._isStreamingSupported=!i.disableStream;const r=process.getBuiltinModule("fs");this._setReadableStream(r.createReadStream(this._url,{start:e,end:s-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var s;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,(s=this.onProgress)==null||s.call(this,{loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}const Xl=Symbol("INITIAL_DATA");var ns,uc,Of;class jm{constructor(){g(this,uc);g(this,ns,Object.create(null))}get(t,e=null){if(e){const i=b(this,uc,Of).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=n(this,ns)[t];if(!s||s.data===Xl)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=n(this,ns)[t];return!!e&&e.data!==Xl}delete(t){const e=n(this,ns)[t];return!e||e.data===Xl?!1:(delete n(this,ns)[t],!0)}resolve(t,e=null){const s=b(this,uc,Of).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in n(this,ns)){const{data:s}=n(this,ns)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}f(this,ns,Object.create(null))}*[Symbol.iterator](){for(const t in n(this,ns)){const{data:e}=n(this,ns)[t];e!==Xl&&(yield[t,e])}}}ns=new WeakMap,uc=new WeakSet,Of=function(t){var e;return(e=n(this,ns))[t]||(e[t]={...Promise.withResolvers(),data:Xl})};const DA=1e5,wg=30;var Dg,qn,We,fc,pc,aa,Zi,gc,mc,oa,Qo,Zo,Yn,tl,bc,el,la,yc,Ac,Ut,sl,ha,wc,Kn,il,En,Gm,zm,Bf,ws,Fd,Hf,Vm,Wm;let Sh=(Ut=class{constructor({textContentSource:t,container:e,viewport:s}){g(this,En);g(this,qn,Promise.withResolvers());g(this,We,null);g(this,fc,!1);g(this,pc,!!((Dg=globalThis.FontInspector)!=null&&Dg.enabled));g(this,aa,null);g(this,Zi,null);g(this,gc,0);g(this,mc,0);g(this,oa,null);g(this,Qo,null);g(this,Zo,0);g(this,Yn,0);g(this,tl,Object.create(null));g(this,bc,[]);g(this,el,null);g(this,la,[]);g(this,yc,new WeakMap);g(this,Ac,null);var l;if(t instanceof ReadableStream)f(this,el,t);else if(typeof t=="object")f(this,el,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');f(this,We,f(this,Qo,e)),f(this,Yn,s.scale*Zs.pixelRatio),f(this,Zo,s.rotation),f(this,Zi,{div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:r,pageX:a,pageY:o}=s.rawDims;f(this,Ac,[1,0,0,-1,-a,o+r]),f(this,mc,i),f(this,gc,r),b(l=Ut,ws,Vm).call(l),vr(e,s),n(this,qn).promise.finally(()=>{n(Ut,il).delete(this),f(this,Zi,null),f(this,tl,null)}
10).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=de.platform;return J(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){const t=()=>{n(this,oa).read().then(({value:e,done:s})=>{if(s){n(this,qn).resolve();return}n(this,aa)??f(this,aa,e.lang),Object.assign(n(this,tl),e.styles),b(this,En,Gm).call(this,e.items),t()},n(this,qn).reject)};return f(this,oa,n(this,el).getReader()),n(Ut,il).add(this),t(),n(this,qn).promise}update({viewport:t,onBefore:e=null}){var r;const s=t.scale*Zs.pixelRatio,i=t.rotation;if(i!==n(this,Zo)&&(e==null||e(),f(this,Zo,i),vr(n(this,Qo),{rotation:i})),s!==n(this,Yn)){e==null||e(),f(this,Yn,s);const a={div:null,properties:null,ctx:b(r=Ut,ws,Fd).call(r,n(this,aa))};for(const o of n(this,la))a.properties=n(this,yc).get(o),a.div=o,b(this,En,Bf).call(this,a)}}cancel(){var e;const t=new An("TextLayer task cancelled.");(e=n(this,oa))==null||e.cancel(t).catch(()=>{}),f(this,oa,null),n(this,qn).reject(t)}get textDivs(){return n(this,la)}get textContentItemsStr(){return n(this,bc)}static cleanup(){if(!(n(this,il).size>0)){n(this,sl).clear();for(const{canvas:t}of n(this,ha).values())t.remove();n(this,ha).clear()}}},qn=new WeakMap,We=new WeakMap,fc=new WeakMap,pc=new WeakMap,aa=new WeakMap,Zi=new WeakMap,gc=new WeakMap,mc=new WeakMap,oa=new WeakMap,Qo=new WeakMap,Zo=new WeakMap,Yn=new WeakMap,tl=new WeakMap,bc=new WeakMap,el=new WeakMap,la=new WeakMap,yc=new WeakMap,Ac=new WeakMap,sl=new WeakMap,ha=new WeakMap,wc=new WeakMap,Kn=new WeakMap,il=new WeakMap,En=new WeakSet,Gm=function(t){var i,r;if(n(this,fc))return;(r=n(this,Zi)).ctx??(r.ctx=b(i=Ut,ws,Fd).call(i,n(this,aa)));const e=n(this,la),s=n(this,bc);for(const a of t){if(e.length>DA){q("Ignoring additional textDivs for performance reasons."),f(this,fc,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=n(this,We);f(this,We,document.createElement("span")),n(this,We).classList.add("markedContent"),a.id&&n(this,We).setAttribute("id",`${a.id}`),o.append(n(this,We))}else a.type==="endMarkedContent"&&f(this,We,n(this,We).parentNode);continue}s.push(a.str),b(this,En,zm).call(this,a)}},zm=function(t){var y;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};n(this,la).push(e);const i=H.transform(n(this,Ac),t.transform);let r=Math.atan2(i[1],i[0]);const a=n(this,tl)[t.fontName];a.vertical&&(r+=Math.PI/2);let o=n(this,pc)&&a.fontSubstitution||a.fontFamily;o=Ut.fontFamilyMap.get(o)||o;const l=Math.hypot(i[2],i[3]),h=l*b(y=Ut,ws,Wm).call(y,o,a,n(this,aa));let c,u;r===0?(c=i[4],u=i[5]-h):(c=i[4]+h*Math.sin(r),u=i[5]-h*Math.cos(r));const p="calc(var(--total-scale-factor) *",m=e.style;n(this,We)===n(this,Qo)?(m.left=`${(100*c/n(this,mc)).toFixed(2)}%`,m.top=`${(100*u/n(this,gc)).toFixed(2)}%`):(m.left=`${p}${c.toFixed(2)}px)`,m.top=`${p}${u.toFixed(2)}px)`),m.fontSize=`${p}${(n(Ut,Kn)*l).toFixed(2)}px)`,m.fontFamily=o,s.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,n(this,pc)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),r!==0&&(s.angle=r*(180/Math.PI));let A=!1;if(t.str.length>1)A=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const v=Math.abs(t.transform[0]),w=Math.abs(t.transform[3]);v!==w&&Math.max(v,w)/Math.min(v,w)>1.5&&(A=!0)}if(A&&(s.canvasWidth=a.vertical?t.height:t.width),n(this,yc).set(e,s),n(this,Zi).div=e,n(this,Zi).properties=s,b(this,En,Bf).call(this,n(this,Zi)),s.hasText&&n(this,We).append(e),s.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),n(this,We).append(v)}},Bf=function(t){var o;const{div:e,properties:s,ctx:i}=t,{style:r}=e;let a="";if(n(Ut,Kn)>1&&(a=`scale(${1/n(Ut,Kn)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=r,{canvasWidth:h,fontSize:c}=s;b(o=Ut,ws,Hf).call(o,i,c*n(this,Yn),l);const{width:u}=i.measureText(e.textContent);u>0&&(a=`scaleX(${h*n(this,Yn)/u}) ${a}`)}s.angle!==0&&(a=`rotate(${s.angle}deg) ${a}`),a.length>0&&(r.transform=a)},ws=new WeakSet,Fd=function(t=null){let e=n(this,ha).get(t||(t=""));if(!e){const s=document.createElement("canvas");s.className="hiddenCanvasElement",s.lang=t,document.body.append(s),e=s.getContext("2d",{alpha:!1,willReadFrequently:!0}),n(this,ha).set(t,e),n(this,wc).set(e,{size:0,family:""})}return e},Hf=function(t,e,s){const i=n(this,wc).get(t);e===i.size&&s===i.family||(t.font=`${e}px ${s}`,i.size=e,i.family=s)},Vm=function(){if(n(this,Kn)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),f(this,Kn,t.getBoundingClientRect().height),t.remove()},Wm=function(t,e,s){const i=n(this,sl).get(t);if(i)return i;const r=b(this,ws,Fd).call(this,s);r.canvas.width=r.canvas.height=wg,b(this,ws,Hf).call(this,r,wg,t);const a=r.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);r.canvas.width=r.canvas.height=0;let h=.8;return o?h=o/(o+l):(de.platform.isFirefox&&q("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?h=e.ascent:e.descent&&(h=1+e.desce
10nt)),n(this,sl).set(t,h),h},g(Ut,ws),g(Ut,sl,new Map),g(Ut,ha,new Map),g(Ut,wc,new WeakMap),g(Ut,Kn,null),g(Ut,il,new Set),Ut);const LA=100;function Bp(d={}){typeof d=="string"||d instanceof URL?d={url:d}:(d instanceof ArrayBuffer||ArrayBuffer.isView(d))&&(d={data:d});const t=new Uf,{docId:e}=t,s=d.url?$y(d.url):null,i=d.data?jy(d.data):null,r=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,l=d.range instanceof Hp?d.range:null,h=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:2**16;let c=d.worker instanceof $l?d.worker:null;const u=d.verbosity,p=typeof d.docBaseUrl=="string"&&!hd(d.docBaseUrl)?d.docBaseUrl:null,m=bd(d.cMapUrl),A=d.cMapPacked!==!1,y=d.CMapReaderFactory||(Oe?Yy:ag),v=bd(d.iccUrl),w=bd(d.standardFontDataUrl),E=d.StandardFontDataFactory||(Oe?Ky:og),S=bd(d.wasmUrl),_=d.WasmFactory||(Oe?Jy:lg),C=d.stopAtErrors!==!0,T=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,x=d.isEvalSupported!==!1,P=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!Oe,R=typeof d.isImageDecoderSupported=="boolean"?d.isImageDecoderSupported:!Oe&&(de.platform.isFirefox||!globalThis.chrome),D=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,M=typeof d.disableFontFace=="boolean"?d.disableFontFace:Oe,U=d.fontExtraProperties===!0,z=d.enableXfa===!0,O=d.ownerDocument||globalThis.document,W=d.disableRange===!0,F=d.disableStream===!0,I=d.disableAutoFetch===!0,et=d.pdfBug===!0,ft=d.CanvasFactory||(Oe?qy:Vy),se=d.FilterFactory||(Oe?Xy:Wy),Ke=d.enableHWA===!0,nt=d.useWasm!==!1,rt=l?l.length:d.length??NaN,Yt=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!Oe&&!M,ue=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:!!(y===ag&&E===og&&_===lg&&m&&w&&S&&Kl(m,document.baseURI)&&Kl(w,document.baseURI)&&Kl(S,document.baseURI)),Ee=null;Ey(u);const Ct={canvasFactory:new ft({ownerDocument:O,enableHWA:Ke}),filterFactory:new se({docId:e,ownerDocument:O}),cMapReaderFactory:ue?null:new y({baseUrl:m,isCompressed:A}),standardFontDataFactory:ue?null:new E({baseUrl:w}),wasmFactory:ue?null:new _({baseUrl:S})};c||(c=$l.create({verbosity:u,port:Js.workerPort}),t._worker=c);const Sn={docId:e,apiVersion:"5.4.296",data:i,password:o,disableAutoFetch:I,rangeChunkSize:h,length:rt,docBaseUrl:p,enableXfa:z,evaluatorOptions:{maxImageSize:T,disableFontFace:M,ignoreErrors:C,isEvalSupported:x,isOffscreenCanvasSupported:P,isImageDecoderSupported:R,canvasMaxAreaInBytes:D,fontExtraProperties:U,useSystemFonts:Yt,useWasm:nt,useWorkerFetch:ue,cMapUrl:m,iccUrl:v,standardFontDataUrl:w,wasmUrl:S}},Je={ownerDocument:O,pdfBug:et,styleElement:Ee,loadingParams:{disableAutoFetch:I,enableXfa:z}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const At=c.messageHandler.sendWithPromise("GetDocRequest",Sn,i?[i.buffer]:null);let Qe;if(l)Qe=new gA(l,{disableRange:W,disableStream:F});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");const ki=Kl(s)?AA:Oe?RA:_A;Qe=new ki({url:s,length:rt,httpHeaders:r,withCredentials:a,rangeChunkSize:h,disableRange:W,disableStream:F})}return At.then(ki=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const lt=new sh(e,ki,c.port),Rt=new NA(lt,t,Qe,Je,Ct,Ke);t._transport=Rt,lt.send("Ready",null)})}).catch(t._capability.reject),t}var _u;const Cu=class Cu{constructor(){k(this,"_capability",Promise.withResolvers());k(this,"_transport",null);k(this,"_worker",null);k(this,"docId",`d${Jt(Cu,_u)._++}`);k(this,"destroyed",!1);k(this,"onPassword",null);k(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,s,i;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(r){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,r}this._transport=null,(i=this._worker)==null||i.destroy(),this._worker=null}async getData(){return this._transport.getData()}};_u=new WeakMap,g(Cu,_u,0);let Uf=Cu;var ca,vc,Ec,Sc,_c,Lg;let Hp=(Lg=class{constructor(t,e,s=!1,i=null){g(this,ca,Promise.withResolvers());g(this,vc,[]);g(this,Ec,[]);g(this,Sc,[]);g(this,_c,[]);this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i}addRangeListener(t){n(this,_c).push(t)}addProgressListener(t){n(this,Sc).push(t)}addProgressiveReadListener(t){n(this,Ec).push(t)}addProgressiveDoneListener(t){n(this,vc).push(t)}onDataRange(t,e){for(const s of n(this,_c))s(t,e)}onDataProgress(t,e){n(this,ca).promise.then(()=>{for(const s of n(this,Sc))s(t,e)})}onDataProgressiveRead(t){n(this,ca).promise.then(()=>{for(const e of n(this,Ec))e(t)})}onDataProgressiveDone(){n(this,ca).promise.then(()=>{for(const t of n(this,vc))t()})}transportReady(){n(this,ca).resolve()}requestDataRange(t,e){_t("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ca=new WeakMap,vc=new WeakMap,Ec=new WeakMap,Sc=new WeakMap,_c=new WeakMap,Lg);class IA{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return J(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()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}
10=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var tn,da,hh;class FA{constructor(t,e,s,i=!1){g(this,da);g(this,tn,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Zp:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new jm,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:r=!1}={}){return new ld({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:r})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return J(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}
10render({canvasContext:t,canvas:e=t.canvas,viewport:s,intent:i="display",annotationMode:r=xi.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:u=null,isEditing:p=!1,recordOperations:m=!1,operationsFilter:A=null}){var R,D,M;(R=this._stats)==null||R.time("Overall");const y=this._transport.getRenderingIntent(i,r,u,p),{renderingIntent:v,cacheKey:w}=y;f(this,tn,!1),l||(l=this._transport.getOptionalContentConfig(v));let E=this._intentStates.get(w);E||(E=Object.create(null),this._intentStates.set(w,E)),E.streamReaderCancelTimeout&&(clearTimeout(E.streamReaderCancelTimeout),E.streamReaderCancelTimeout=null);const S=!!(v&bs.PRINT);E.displayReadyCapability||(E.displayReadyCapability=Promise.withResolvers(),E.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(D=this._stats)==null||D.time("Page Request"),this._pumpOperatorList(y));const _=!!(this._pdfBug&&((M=globalThis.StepperManager)!=null&&M.enabled)),C=!this.recordedBBoxes&&(m||_),T=U=>{var z,O;if(E.renderTasks.delete(x),C){const W=(z=x.gfx)==null?void 0:z.dependencyTracker.take();W&&(x.stepper&&x.stepper.setOperatorBBoxes(W,x.gfx.dependencyTracker.takeDebugMetadata()),m&&(this.recordedBBoxes=W))}S&&f(this,tn,!0),b(this,da,hh).call(this),U?(x.capability.reject(U),this._abortOperatorList({intentState:E,reason:U instanceof Error?U:new Error(U)})):x.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(O=globalThis.Stats)!=null&&O.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},x=new $f({callback:T,params:{canvas:e,canvasContext:t,dependencyTracker:C?new Zy(e,E.operatorList.length,_):null,viewport:s,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:E.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:A});(E.renderTasks||(E.renderTasks=new Set)).add(x);const P=x.task;return Promise.all([E.displayReadyCapability.promise,l]).then(([U,z])=>{var O;if(this.destroyed){T();return}if((O=this._stats)==null||O.time("Rendering"),!(z.renderingIntent&v))throw new Error("Mu
10st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:U,optionalContentConfig:z}),x.operatorListChanged()}).catch(T),P}getOperatorList({intent:t="display",annotationMode:e=xi.ENABLE,printAnnotationStorage:s=null,isEditing:i=!1}={}){var h;function r(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,s,i,!0);let o=this._intentStates.get(a.cacheKey);o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o));let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=r,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>wh.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function r(){a.read().then(function({value:l,done:h}){if(h){s(o);return}o.lang??(o.lang=l.lang),Object.assign(o.styles,l.styles),o.items.push(...l.items),r()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};r()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),f(this,tn,!1),Promise.all(t)}cleanup(t=!1){f(this,tn,!0);const e=b(this,da,hh).call(this);return t&&e&&this._stats&&(this._stats=new Zp),e}_startRenderPage(t,e){var i,r;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(r=s.displayReadyCapability)==null||r.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&b(this,da,hh).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:i}){const{map:r,transfer:a}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:r,modifiedIds:i},a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then(({value:u,done:p})=>{if(p){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),c())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();b(this,da,hh).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};c()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Bu){let i=LA;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new An(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,r]of this._intentStates)if(r===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}tn=new WeakMap,da=new WeakSet,hh=function(){if(!n(this,tn)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),f(this,tn,!1),!0};var Jn,zs,en,ua,Tu,fa,pa,Be,Nd,Xm,qm,ch,nl,Od;const kt=class kt{constructor({name:t=null,port:e=null,verbosity:s=Sy()}={}){g(this,Be);g(this,Jn,Promise.withResolvers());g(this,zs,null);g(this,en,null);g(this,ua,null);if(this.name=t,this.destroyed=!1,this.verbosity=s,e){if(n(kt,pa).has(e))throw new Error("Cannot use more than one PDFWorker per port.");n(kt,pa).set(e,this),b(this,Be,Xm).call(this,e)}else b(this,Be,qm).call(this)}get promise(){return n(this,Jn).promise}get port(){return n(this,en)}get messageHandler(){return n(this,zs)}destroy(){var t,e;this.destroyed=!0,(t=n(this,ua))==null||t.terminate(),f(this,ua,null),n(kt,pa).delete(n(this,en)),f(this,en,null),(e=n(this,zs))==null||e.destroy(),f(this,zs,null)}static create(t){const e=n(this,pa).get(t==null?void 0:t.port);
10if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new kt(t)}static get workerSrc(){if(Js.workerSrc)return Js.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return J(this,"_setupFakeWorkerGlobal",(async()=>n(this,nl,Od)?n(this,nl,Od):(await import(this.workerSrc)).WorkerMessageHandler)())}};Jn=new WeakMap,zs=new WeakMap,en=new WeakMap,ua=new WeakMap,Tu=new WeakMap,fa=new WeakMap,pa=new WeakMap,Be=new WeakSet,Nd=function(){n(this,Jn).resolve(),n(this,zs).send("configure",{verbosity:this.verbosity})},Xm=function(t){f(this,en,t),f(this,zs,new sh("main","worker",t)),n(this,zs).on("ready",()=>{}),b(this,Be,Nd).call(this)},qm=function(){if(n(kt,fa)||n(kt,nl,Od)){b(this,Be,ch).call(this);return}let{workerSrc:t}=kt;try{kt._isSameOrigin(window.location,t)||(t=kt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new sh("main","worker",e),i=()=>{r.abort(),s.destroy(),e.terminate(),this.destroyed?n(this,Jn).reject(new Error("Worker was destroyed")):b(this,Be,ch).call(this)},r=new AbortController;e.addEventListener("error",()=>{n(this,ua)||i()},{signal:r.signal}),s.on("test",o=>{if(r.abort(),this.destroyed||!o){i();return}f(this,zs,s),f(this,en,e),f(this,ua,e),b(this,Be,Nd).call(this)}),s.on("ready",o=>{if(r.abort(),this.destroyed){i();return}try{a()}catch{b(this,Be,ch).call(this)}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Ou("The worker has been disabled.")}b(this,Be,ch).call(this)},ch=function(){n(kt,fa)||(q("Setting up fake worker."),f(kt,fa,!0)),kt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){n(this,Jn).reject(new Error("Worker was destroyed"));return}const e=new zy;f(this,en,e);const s=`fake${Jt(kt,Tu)._++}`,i=new sh(s+"_worker",s,e);t.setup(i,e),f(this,zs,new sh(s,s+"_worker",e)),b(this,Be,Nd).call(this)}).catch(t=>{n(this,Jn).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},nl=new WeakSet,Od=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},g(kt,nl),g(kt,Tu,0),g(kt,fa,!1),g(kt,pa,new WeakMap),Oe&&(f(kt,fa,!0),Js.workerSrc||(Js.workerSrc="./pdf.worker.mjs")),kt._isSameOrigin=(t,e)=>{const s=URL.parse(t);if(!(s!=null&&s.origin)||s.origin==="null")return!1;const i=new URL(e,s);return s.origin===i.origin},kt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},kt.fromPort=t=>{if(Dy("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return kt.create(t)};let $l=kt;var sn,bi,rl,al,nn,ga,dh;class NA{constructor(t,e,s,i,r,a){g(this,ga);g(this,sn,new Map);g(this,bi,new Map);g(this,rl,new Map);g(this,al,new Map);g(this,nn,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new jm,this.fontLoader=new Hy({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.wasmFactory=r.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=a,this.setupMessageHandler()}get annotationStorage(){return J(this,"annotationStorage",new Fp)}getRenderingIntent(t,e=xi.ENABLE,s=null,i=!1,r=!1){let a=bs.DISPLAY,o=_f;switch(t){case"any":a=bs.ANY;break;case"display":break;case"print":a=bs.PRINT;break;default:q(`getRenderingIntent - invalid intent: ${t}`)}const l=a&bs.PRINT&&s instanceof Cm?s:this.annotationStorage;switch(e){case xi.DISABLE:a+=bs.ANNOTATIONS_DISABLE;break;case xi.ENABLE:break;case xi.ENABLE_FORMS:a+=bs.ANNOTATIONS_FORMS;break;case xi.ENABLE_STORAGE:a+=bs.ANNOTATIONS_STORAGE,o=l.serializable;break;default:q(`getRenderingIntent - invalid annotationMode: ${e}`)}i&&(a+=bs.IS_EDITING),r&&(a+=bs.OPLIST);const{ids:h,hash:c}=l.modifiedIds,u=[a,o.hash,c];
10return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=n(this,nn))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of n(this,bi).values())t.push(i._destroy());n(this,bi).clear(),n(this,rl).clear(),n(this,al).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i,r;this.commonObjs.clear(),this.fontLoader.clear(),n(this,sn).clear(),this.filterFactory.destroy(),Sh.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new An("Worker was terminated.")),(r=this.messageHandler)==null||r.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(s,i)=>{it(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},i.onPull=()=>{this._fullReader.read().then(function({value:r,done:a}){if(a){i.close();return}it(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{i.error(r)})},i.onCancel=r=>{this._fullReader.cancel(r),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async s=>{var o;await this._fullReader.headersReady;const{isStreamingSupported:i,isRangeSupported:r,contentLength:a}=this._fullReader;return(!i||!r)&&(this._lastProgress&&((o=e.onProgress)==null||o.call(e,this._lastProgress)),this._fullReader.onProgress=l=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:l.loaded,total:l.total})}),{isStreamingSupported:i,isRangeSupported:r,contentLength:a}}),t.on("GetRangeReader",(s,i)=>{it(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(s.begin,s.end);if(!r){i.close();return}i.onPull=()=>{r.read().then(function({value:a,done:o}){if(o){i.close();return}it(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{r.cancel(a),i.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:s})=>{this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new IA(s,this))}),t.on("DocException",s=>{e._capability.reject(Ue(s))}),t.on("PasswordRequest",s=>{f(this,nn,Promise.withResolvers());try{if(!e.onPassword)throw Ue(s);const i=r=>{r instanceof Error?n(this,nn).reject(r):n(this,nn).resolve({password:r})};e.onPassword(i,s.code)}catch(i){n(this,nn).reject(i)}return n(this,nn).promise}),t.on("DataLoaded",s=>{var i;(i=e.onProgress)==null||i.call(e,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{if(this.destroyed)return;n(this,bi).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,r])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":if("error"in r){const u=r.error;q(`Error during font loading: ${u}`),this.commonObjs.resolve(s,u);break}const o=new Ff(r),l=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(u,p)=>globalThis.FontInspector.fontAdded(u,p):null,h=new Uy(o,l,r.extra,r.charProcOperatorList);this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!h.fontExtraProperties&&h.data&&h.clearData(),this.commonObjs.resolve(s,h)});break;case"CopyLocalImage":const{imageRef:c}=r;it(c,"The imageRef must be defined.");for(const u of n(this,bi).values())for(const[,p]of u.objs)if((p==null?void 0:p.ref)===c)return p.dataLen?(this.commonObjs.resolve(s,structuredClone(p)),p.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,r);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,r,a])=>{var l;if(this.destroyed)return;const o=n(this,bi).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(r){case"Image":case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBinaryData",async s=>{if(this.destroyed)throw new Error("Worker was destroyed.");const i=this[s.type];if(!i)throw new Error(`${s.type} not initialized, see the \`useWorkerFetch\` parameter.`);return i.fetch(s)})}
10getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&q("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((s=this._fullReader)==null?void 0:s.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=n(this,rl).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&n(this,al).set(r.refStr,t);const a=new FA(e,r,this,this._params.pdfBug);return n(this,bi).set(e,a),a});return n(this,rl).set(e,i),i}getPageIndex(t){return Cf(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return b(this,ga,dh).call(this,"GetFieldObjects")}hasJSActions(){return b(this,ga,dh).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.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)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return b(this,ga,dh).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 b(this,ga,dh).call(this,"GetOptionalContentConfig").then(e=>new pA(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=n(this,sn).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var r,a;return{info:i[0],metadata:i[1]?new uA(i[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return n(this,sn).set(t,s),s}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of n(this,bi).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),n(this,sn).clear(),this.filterFactory.destroy(!0),Sh.cleanup()}}cachedPageNumber(t){if(!Cf(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return n(this,al).get(e)??null}}sn=new WeakMap,bi=new WeakMap,rl=new WeakMap,al=new WeakMap,nn=new WeakMap,ga=new WeakSet,dh=function(t,e=null){const s=n(this,sn).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return n(this,sn).set(t,i),i};var Qn;class OA{constructor(t){g(this,Qn,null);k(this,"onContinue",null);k(this,"onError",null);f(this,Qn,t)}get promise(){return n(this,Qn).capability.promise}cancel(t=0){n(this,Qn).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=n(this,Qn).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=n(this,Qn);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}Qn=new WeakMap;var Zn,ma;const kr=class kr{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:r,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:p=null,enableHWA:m=!1,operationsFilter:A=null}){g(this,Zn,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new OA
10(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.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=m,this._dependencyTracker=e.dependencyTracker,this._operationsFilter=A}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var l,h;if(this.cancelled)return;if(this._canvas){if(n(kr,ma).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");n(kr,ma).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:s,transform:i,background:r,dependencyTracker:a}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new co(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,a),this.gfx.beginDrawing({transform:i,viewport:s,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,(h=this.graphicsReadyCallback)==null||h.call(this)}cancel(t=null,e=0){var s,i,r;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),n(this,Zn)&&(window.cancelAnimationFrame(n(this,Zn)),f(this,Zn,null)),n(kr,ma).delete(this._canvas),t||(t=new Bu(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(r=(i=this.task).onError)==null||r.call(i,t)}operatorListChanged(){var t,e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.gfx.dependencyTracker)==null||t.growOperationsCount(this.operatorList.fnArray.length),(e=this.stepper)==null||e.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?f(this,Zn,window.requestAnimationFrame(()=>{f(this,Zn,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._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),n(kr,ma).delete(this._canvas),this.callback())))}};Zn=new WeakMap,ma=new WeakMap,g(kr,ma,new WeakSet);let $f=kr;const Ym="5.4.296",Km="f56dc8601";var rs,ba,ol,te,Cc,ll,rn,Tc,tr,Vs,xc,yt,jf,Gf,zf,Tr,Jm,Tn;const $e=class $e{constructor({editor:t=null,uiManager:e=null}){g(this,yt);g(this,rs,null);g(this,ba,null);g(this,ol);g(this,te,null);g(this,Cc,!1);g(this,ll,!1);g(this,rn,null);g(this,Tc);g(this,tr,null);g(this,Vs,null);var s,i;t?(f(this,ll,!1),f(this,rn,t)):f(this,ll,!0),f(this,Vs,(t==null?void 0:t._uiManager)||e),f(this,Tc,n(this,Vs)._eventBus),f(this,ol,((s=t==null?void 0:t.color)==null?void 0:s.toUpperCase())||((i=n(this,Vs))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),n($e,xc)||f($e,xc,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"}))}static get _keyboardManager(){return J(this,"_keyboardManager",new cd([[["Escape","mac+Escape"],$e.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],$e.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],$e.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],$e.prototype._moveToPrevious],[["Home","mac+Home"],$e.prototype._moveToBeginning],[["End","mac+End"],$e.prototype._moveToEnd]]))}renderButton(){const t=f(this,rs,document.createElement("button"));
10t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",n(this,rn)&&(t.ariaControls=`${n(this,rn).id}_colorpicker_dropdown`);const e=n(this,Vs)._signal;t.addEventListener("click",b(this,yt,Tr).bind(this),{signal:e}),t.addEventListener("keydown",b(this,yt,zf).bind(this),{signal:e});const s=f(this,ba,document.createElement("span"));return s.className="swatch",s.ariaHidden="true",s.style.backgroundColor=n(this,ol),t.append(s),t}renderMainDropdown(){const t=f(this,te,b(this,yt,jf).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===n(this,rs)){b(this,yt,Tr).call(this,t);return}const e=t.target.getAttribute("data-color");e&&b(this,yt,Gf).call(this,e,t)}_moveToNext(t){var e,s;if(!n(this,yt,Tn)){b(this,yt,Tr).call(this,t);return}if(t.target===n(this,rs)){(e=n(this,te).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=n(this,te))==null?void 0:e.firstChild)||t.target===n(this,rs)){n(this,yt,Tn)&&this._hideDropdownFromKeyboard();return}n(this,yt,Tn)||b(this,yt,Tr).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!n(this,yt,Tn)){b(this,yt,Tr).call(this,t);return}(e=n(this,te).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!n(this,yt,Tn)){b(this,yt,Tr).call(this,t);return}(e=n(this,te).lastChild)==null||e.focus()}hideDropdown(){var t,e;(t=n(this,te))==null||t.classList.add("hidden"),n(this,rs).ariaExpanded="false",(e=n(this,tr))==null||e.abort(),f(this,tr,null)}_hideDropdownFromKeyboard(){var t;if(!n(this,ll)){if(!n(this,yt,Tn)){(t=n(this,rn))==null||t.unselect();return}this.hideDropdown(),n(this,rs).focus({preventScroll:!0,focusVisible:n(this,Cc)})}}updateColor(t){if(n(this,ba)&&(n(this,ba).style.backgroundColor=t),!n(this,te))return;const e=n(this,Vs).highlightColors.values();for(const s of n(this,te).children)s.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=n(this,rs))==null||t.remove(),f(this,rs,null),f(this,ba,null),(e=n(this,te))==null||e.remove(),f(this,te,null)}};rs=new WeakMap,ba=new WeakMap,ol=new WeakMap,te=new WeakMap,Cc=new WeakMap,ll=new WeakMap,rn=new WeakMap,Tc=new WeakMap,tr=new WeakMap,Vs=new WeakMap,xc=new WeakMap,yt=new WeakSet,jf=function(){const t=document.createElement("div"),e=n(this,Vs)._signal;t.addEventListener("contextmenu",vs,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),n(this,rn)&&(t.id=`${n(this,rn).id}_colorpicker_dropdown`);for(const[s,i]of n(this,Vs).highlightColors){const r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",i),r.title=s,r.setAttribute("data-l10n-id",n($e,xc)[s]);const a=document.createElement("span");r.append(a),a.className="swatch",a.style.backgroundColor=i,r.ariaSelected=i===n(this,ol),r.addEventListener("click",b(this,yt,Gf).bind(this,i),{signal:e}),t.append(r)}return t.addEventListener("keydown",b(this,yt,zf).bind(this),{signal:e}),t},Gf=function(t,e){e.stopPropagation(),n(this,Tc).dispatch("switchannotationeditorparams",{source:this,type:st.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},zf=function(t){$e._keyboardManager.exec(this,t)},Tr=function(t){if(n(this,yt,Tn)){this.hideDropdown();return}if(f(this,Cc,t.detail===0),n(this,tr)||(f(this,tr,new AbortController),window.addEventListener("pointerdown",b(this,yt,Jm).bind(this),{signal:n(this,Vs).combinedSignal(n(this,tr))})),n(this,rs).ariaExpanded="true",n(this,te)){n(this,te).classList.remove("hidden");return}const e=f(this,te,b(this,yt,jf).call(this));n(this,rs).append(e)},Jm=function(t){var e;(e=n(this,te))!=null&&e.contains(t.target)||this.hideDropdown()},Tn=function(){return n(this,te)&&!n(this,te).classList.contains("hidden")},g($e,xc,null);let _h=$e;var yi,Pc,hl,Rc;const Mr=class Mr{constructor(t){g(this,yi,null);g(this,Pc,null);g(this,hl,null);f(this,Pc,t),f(this,hl,t._uiManager),n(Mr,Rc)||f(Mr,Rc,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(n(this,yi))return n(this,yi);const{editorType:t,colorType:e,colorValue:s}=n(this,Pc),i=f(this,yi,document.createElement("input"));return i.type="color",i.value=s||"#000000",i.className="basicColorPicker",i.tabIndex=0,i.setAttribute("data-l10n-id",n(Mr,Rc)[t]),i.addEventListener("input",()=>{n(this,hl).updateParams(e,i.value)},{signal:n(this,hl)._signal}),i}update(t){n(this,yi)&&(n(this,yi).value=t)}destroy(){var t;(t=n(this,yi))==null||t.remove(),f(this,yi,null)}hideDropdown(){}};yi=new WeakMap,Pc=new WeakMap,hl=new WeakMap,Rc=new WeakMap,g(Mr,Rc,null);let hu=Mr;
10function vg(d){return Math.floor(Math.max(0,Math.min(1,d))*255).toString(16).padStart(2,"0")}function ql(d){return Math.max(0,Math.min(255,255*d))}class Eg{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=ql(t),[t,t,t]}static G_HTML([t]){const e=vg(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(ql)}static RGB_HTML(t){return`#${t.map(vg).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_rgb([t,e,s,i]){return[ql(1-Math.min(1,t+i)),ql(1-Math.min(1,s+i)),ql(1-Math.min(1,e+i))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,r=1-e,a=1-s,o=Math.min(i,r,a);return["CMYK",i,r,a,o]}}class BA{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){_t("Abstract method `_createSVG` called.")}}class Ch extends BA{_createSVG(t){return document.createElementNS(Mi,t)}}const HA=9,za=new WeakSet,UA=new Date().getTimezoneOffset()*60*1e3;class Sg{static create(t){switch(t.data.annotationType){case Gt.LINK:return new Up(t);case Gt.TEXT:return new jA(t);case Gt.WIDGET:switch(t.data.fieldType){case"Tx":return new GA(t);case"Btn":return t.data.radioButton?new tb(t):t.data.checkBox?new VA(t):new WA(t);case"Ch":return new XA(t);case"Sig":return new zA(t)}return new Xa(t);case Gt.POPUP:return new Wf(t);case Gt.FREETEXT:return new rb(t);case Gt.LINE:return new YA(t);case Gt.SQUARE:return new KA(t);case Gt.CIRCLE:return new JA(t);case Gt.POLYLINE:return new ab(t);case Gt.CARET:return new ZA(t);case Gt.INK:return new $p(t);case Gt.POLYGON:return new QA(t);case Gt.HIGHLIGHT:return new ob(t);case Gt.UNDERLINE:return new tw(t);case Gt.SQUIGGLY:return new ew(t);case Gt.STRIKEOUT:return new sw(t);case Gt.STAMP:return new lb(t);case Gt.FILEATTACHMENT:return new iw(t);default:return new Nt(t)}}}var ya,cl,Ds,kc,Vf;const Yp=class Yp{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){g(this,kc);g(this,ya,null);g(this,cl,!1);g(this,Ds,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.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Yp._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var s;const{data:t}=this,e=(s=this.annotationStorage)==null?void 0:s.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
10get commentButtonPosition(){var o;const t=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;const{quadPoints:e,inkLists:s,rect:i}=this.data;let r=-1/0,a=-1/0;if((e==null?void 0:e.length)>=8){for(let l=0;l<e.length;l+=8)e[l+1]>a?(a=e[l+1],r=e[l+2]):e[l+1]===a&&(r=Math.max(r,e[l+2]));return[r,a]}if((s==null?void 0:s.length)>=1){for(const l of s)for(let h=0,c=l.length;h<c;h+=2)l[h+1]>a?(a=l[h+1],r=l[h]):l[h+1]===a&&(r=Math.max(r,l[h]));if(r!==1/0)return[r,a]}return i?[i[2],i[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:s,pageHeight:i,pageX:r,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-r)/s,t[1]=100*(t[1]-a)/i,t}get commentText(){var e,s,i;const{data:t}=this;return((s=(e=this.annotationStorage.getRawValue(`${yh}${t.id}`))==null?void 0:e.popup)==null?void 0:s.contents)||((i=t.contentsObj)==null?void 0:i.str)||""}set commentText(t){const{data:e}=this,s={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:s})||this.annotationStorage.setValue(`${yh}${e.id}`,{id:e.id,annotationType:e.annotationType,pageIndex:this.parent.page._pageIndex,popup:s,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;(e=((t=n(this,Ds))==null?void 0:t.popup)||this.popup)==null||e.remove(),f(this,Ds,this.popup=null)}updateEdited(t){var r;if(!this.container)return;t.rect&&(n(this,ya)||f(this,ya,{rect:this.data.rect.slice(0)}));const{rect:e,popup:s}=t;e&&b(this,kc,Vf).call(this,e);let i=((r=n(this,Ds))==null?void 0:r.popup)||this.popup;!i&&(s!=null&&s.text)&&(this._createPopup(s),i=n(this,Ds).popup),i&&(i.updateEdited(t),s!=null&&s.deleted&&(i.remove(),f(this,Ds,null),this.popup=null))}resetEdited(){var t;n(this,ya)&&(b(this,kc,Vf).call(this,n(this,ya).rect),(t=n(this,Ds))==null||t.popup.resetEdited(),f(this,ya,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),!(this instanceof Xa)&&!(this instanceof Up)&&(r.tabIndex=0);const{style:a}=r;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof Wf){const{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,r),r}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const y=e.borderStyle.horizontalCornerRadius,v=e.borderStyle.verticalCornerRadius;if(y>0||v>0){const E=`calc(${y}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;a.borderRadius=E}else if(this instanceof tb){const E=`calc(${o}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;a.borderRadius=E}switch(e.borderStyle.style){case Ja.SOLID:a.borderStyle="solid";break;case Ja.DASHED:a.borderStyle="dashed";break;case Ja.BEVELED:q("Unimplemented border style: beveled");break;case Ja.INSET:q("Unimplemented border style: inset");break;case Ja.UNDERLINE:a.borderBottomStyle="solid";break}const w=e.borderColor||null;w?(f(this,cl,!0),a.borderColor=H.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):a.borderWidth=0}const h=H.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:c,pageHeight:u,pageX:p,pageY:m}=i.rawDims;a.left=`${100*(h[0]-p)/c}%`,a.top=`${100*(h[1]-m)/u}%`;const{rotation:A}=e;return e.hasOwnCanvas||A===0?(a.width=`${100*o/c}%`,a.height=`${100*l/u}%`):this.setRotation(A,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims;let{width:r,height:a}=this;t%180!==0&&([r,a]=[a,r]),e.style.width=`${100*r/s}%`,e.style.height=`${100*a/i}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const r=i.detail[e],a=r[0],o=r.slice(1);i.target.style[s]=Eg[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:Eg[`${a}_rgb`](o)})};return J(this,"_commonActions",{display:e=>{const{display:s}=e.detail,i=s%2===1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:e=>{setTimeout(()=>
10e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const r=t[i]||s[i];r==null||r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,r]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:r},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,r]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){const[y,v,w,E]=t.subarray(2,6);if(i===y&&r===v&&e===w&&s===E)return}const{style:a}=this.container;let o;if(n(this,cl)){const{borderColor:y,borderWidth:v}=a;a.borderWidth=0,o=["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="${y}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const l=i-e,h=r-s,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const p=c.createElement("defs");u.append(p);const m=c.createElement("clipPath"),A=`clippath_${this.data.id}`;m.setAttribute("id",A),m.setAttribute("clipPathUnits","objectBoundingBox"),p.append(m);for(let y=2,v=t.length;y<v;y+=8){const w=t[y],E=t[y+1],S=t[y+2],_=t[y+3],C=c.createElement("rect"),T=(S-e)/l,x=(r-E)/h,P=(w-S)/l,R=(E-_)/h;C.setAttribute("x",T),C.setAttribute("y",x),C.setAttribute("width",P),C.setAttribute("height",R),m.append(C),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${x}" width="${P}" height="${R}"/>`)}n(this,cl)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${A})`}_createPopup(t=null){const{data:e}=this;let s,i;t?(s={str:t.text},i=t.date):(s=e.contentsObj,i=e.modificationDate);const r=f(this,Ds,new Wf({data:{color:e.color,titleObj:e.titleObj,modificationDate:i,contentsObj:s,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}));this.parent._commentManager||this.parent.div.append(r.render())}get hasPopupElement(){return!!(n(this,Ds)||this.popup||this.data.popupRef)}get extraPopupElement(){return n(this,Ds)}render(){_t("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:r,id:a,exportValues:o}of i){if(r===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!za.has(h)){q(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:l,domElement:h})}return s}for(const i of document.getElementsByName(t)){const{exportValue:r}=i,a=i.getAttribute("data-element-id");a!==e&&za.has(i)&&s.push({id:a,exportValue:r,domElement:i})}return s}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};ya=new WeakMap,cl=new WeakMap,Ds=new WeakMap,kc=new WeakSet,Vf=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:l}}}}=this;s==null||s.splice(0,4,...t),e.left=`${100*(t[0]-o)/r}%`,e.top=`${100*(a-t[3]+l)/a}%`,i===0?(e.width=`${100*(t[2]-t[0])/r}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(i)};let Nt=Yp;class $A extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&(this._createPopup(t.comment),this.extraPopupElement.popup.renderCommentButton())}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
10get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.container.remove(),this.container=null,this.removePopup()}}var As,xr,Qm,Zm;class Up extends Nt{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});g(this,As);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let r=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(i,e.action,e.overlaidText),r=!0):e.attachment?(b(this,As,Qm).call(this,i,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(b(this,As,Zm).call(this,i,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(i,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),r=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&this.container.append(i),this.container}_bindLink(e,s,i=""){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&b(this,As,xr).call(this),i&&(e.title=i)}_bindNamedAction(e,s,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),i&&(e.title=i),b(this,As,xr).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(s.actions)){const a=i.get(r);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:r}}),!1})}s.overlaidText&&(e.title=s.overlaidText),e.onclick||(e.onclick=()=>!1),b(this,As,xr).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),b(this,As,xr).call(this),!this._fieldObjects){q('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(e.onclick=()=>!1);return}e.onclick=()=>{var u;i==null||i();const{fields:r,refs:a,include:o}=s,l=[];if(r.length!==0||a.length!==0){const p=new Set(a);for(const m of r){const A=this._fieldObjects[m]||[];for(const{id:y}of A)p.add(y)}for(const m of Object.values(this._fieldObjects))for(const A of m)p.has(A.id)===o&&l.push(A)}else for(const p of Object.values(this._fieldObjects))l.push(...p);const h=this.annotationStorage,c=[];for(const p of l){const{id:m}=p;switch(c.push(m),p.type){case"text":{const y=p.defaultValue||"";h.setValue(m,{value:y});break}case"checkbox":case"radiobutton":{const y=p.defaultValue===p.exportValues;h.setValue(m,{value:y});break}case"combobox":case"listbox":{const y=p.defaultValue||"";h.setValue(m,{value:y});break}default:continue}const A=document.querySelector(`[data-element-id="${m}"]`);if(A){if(!za.has(A)){q(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;A.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}As=new WeakSet,xr=function(){this.container.setAttribute("data-internal-link","")},Qm=function(e,s,i="",r=null){e.href=this.linkService.getAnchorUrl(""),s.description?e.title=s.description:i&&(e.title=i),e.onclick=()=>{var a;return(a=this.downloadManager)==null||a.openOrDownloadData(s.content,s.filename,r),!1},b(this,As,xr).call(this)},Zm=function(e,s,i=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),i&&(e.title=i),b(this,As,xr).call(this)};class jA extends Nt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}
10class Xa extends Nt{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return de.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,r){s.includes("mouse")?t.addEventListener(s,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(s,a=>{var o;if(s==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}r&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:r(a)}}))})}_setEventListeners(t,e,s,i){var r,a,o;for(const[l,h]of s)(h==="Action"||(r=this.data.actions)!=null&&r[h])&&((h==="Focus"||h==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,l,h,i),h==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):h==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":H.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||HA,r=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(qu*i))||1,u=h/c;a=Math.min(i,l(u/qu))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,l(h/qu))}r.fontSize=`calc(${a}px * var(--total-scale-factor))`,r.color=H.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class GA extends Xa{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,i){const r=this.annotationStorage;
10for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),r.setValue(a.id,{[i]:s})}render(){var i,r;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(` 11`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type=this.data.password?"password":"text",s.setAttribute("value",h??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),za.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=0;const{datetimeFormat:u,datetimeType:p,timeStep:m}=this.data,A=!!p&&this.enableScripting;u&&(s.title=u),this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",v=>{t.setValue(e,{value:v.target.value}),this.setPropertyOnSiblings(s,"value",v.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",v=>{const w=this.data.defaultFieldValue??"";s.value=c.userValue=w,c.formattedValue=null});let y=v=>{const{formattedValue:w}=c;w!=null&&(v.target.value=w),v.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",w=>{var S;if(c.focused)return;const{target:E}=w;if(A&&(E.type=p,m&&(E.step=m)),c.userValue){const _=c.userValue;if(A)if(p==="time"){const C=new Date(_),T=[C.getHours(),C.getMinutes(),C.getSeconds()];E.value=T.map(x=>x.toString().padStart(2,"0")).join(":")}else E.value=new Date(_-UA).toISOString().split(p==="date"?"T":".",1)[0];else E.value=_}c.lastCommittedValue=E.value,c.commitKey=1,(S=this.data.actions)!=null&&S.Focus||(c.focused=!0)}),s.addEventListener("updatefromsandbox",w=>{this.showElementAndHideCanvas(w.target);const E={value(S){c.userValue=S.detail.value??"",A||t.setValue(e,{value:c.userValue.toString()}),S.target.value=c.userValue},formattedValue(S){const{formattedValue:_}=S.detail;c.formattedValue=_,_!=null&&S.target!==document.activeElement&&(S.target.value=_);const C={formattedValue:_};A&&(C.value=_),t.setValue(e,C)},selRange(S){S.target.setSelectionRange(...S.detail.selRange)},charLimit:S=>{var x;const{charLimit:_}=S.detail,{target:C}=S;if(_===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",_);let T=c.userValue;!T||T.length<=_||(T=T.slice(0,_),C.value=c.userValue=T,t.setValue(e,{value:T}),(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:T,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(E,w)}),s.addEventListener("keydown",w=>{var _;c.commitKey=1;let E=-1;if(w.key==="Escape"?E=0:w.key==="Enter"&&!this.data.multiLine?E=2:w.key==="Tab"&&(c.commitKey=3),E===-1)return;const{value:S}=w.target;c.lastCommittedValue!==S&&(c.lastCommittedValue=S,c.userValue=S,(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,willCommit:!0,commitKey:E,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}}))});const v=y;
11y=null,s.addEventListener("blur",w=>{var _,C;if(!c.focused||!w.relatedTarget)return;(_=this.data.actions)!=null&&_.Blur||(c.focused=!1);const{target:E}=w;let{value:S}=E;if(A){if(S&&p==="time"){const T=S.split(":").map(x=>parseInt(x,10));S=new Date(2e3,0,1,T[0],T[1],T[2]||0).valueOf(),E.step=""}else S.includes("T")||(S=`${S}T00:00`),S=new Date(S).valueOf();E.type="text"}c.userValue=S,c.lastCommittedValue!==S&&((C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,willCommit:!0,commitKey:c.commitKey,selStart:w.target.selectionStart,selEnd:w.target.selectionEnd}})),v(w)}),(r=this.data.actions)!=null&&r.Keystroke&&s.addEventListener("beforeinput",w=>{var R;c.lastCommittedValue=null;const{data:E,target:S}=w,{value:_,selectionStart:C,selectionEnd:T}=S;let x=C,P=T;switch(w.inputType){case"deleteWordBackward":{const D=_.substring(0,C).match(/\w*[^\w]*$/);D&&(x-=D[0].length);break}case"deleteWordForward":{const D=_.substring(C).match(/^[^\w]*\w*/);D&&(P+=D[0].length);break}case"deleteContentBackward":C===T&&(x-=1);break;case"deleteContentForward":C===T&&(P+=1);break}w.preventDefault(),(R=this.linkService.eventBus)==null||R.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,change:E||"",willCommit:!1,selStart:x,selEnd:P}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],w=>w.target.value)}if(y&&s.addEventListener("blur",y),this.data.comb){const w=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${w}px * var(--total-scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class zA extends Xa{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class VA extends Xa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof i=="string"&&(i=i!=="Off",t.setValue(s,{value:i})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return za.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,i&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=0,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s)){const c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(s,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(s,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class tb extends Xa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof i=="string"&&(i=i!==e.buttonValue,t.setValue(s,{value:i})),i)for(const a of this._getElementsByName(e.fieldName,s))t.setValue(a.id,{value:!1});const r=document.createElement("input");if(za.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,i&&r.setAttribute("checked",!0),r.tabIndex=0,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,s))t.setValue(h.id,{value:!1});t.setValue(s,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;r.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const c=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const p=c&&u.id===s;u.domElement&&(u.domElement.checked=p),t.setValue(u.id,{value:p})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}
11return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class WA extends Up{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),t}}class XA extends Xa{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");za.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",c=>{const u=this.data.defaultFieldValue;for(const p of i.options)p.selected=p.value===u});for(const c of this.data.options){const u=document.createElement("option");u.textContent=c.displayValue,u.value=c.exportValue,s.value.includes(c.exportValue)&&(u.setAttribute("selected",!0),r=!1),i.append(u)}let a=null;if(r){const c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),i.prepend(c),a=()=>{c.remove(),i.removeEventListener("input",a),a=null},i.addEventListener("input",a)}const o=c=>{const u=c?"value":"textContent",{options:p,multiple:m}=i;return m?Array.prototype.filter.call(p,A=>A.selected).map(A=>A[u]):p.selectedIndex===-1?null:p[p.selectedIndex][u]};let l=o(!1);const h=c=>{const u=c.target.options;return Array.prototype.map.call(u,p=>({displayValue:p.textContent,exportValue:p.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{const u={value(p){a==null||a();const m=p.detail.value,A=new Set(Array.isArray(m)?m:[m]);for(const y of i.options)y.selected=A.has(y.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(p){i.multiple=!0},remove(p){const m=i.options,A=p.detail.remove;m[A].selected=!1,i.remove(A),m.length>0&&Array.prototype.findIndex.call(m,v=>v.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},clear(p){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(p){const{index:m,displayValue:A,exportValue:y}=p.detail.insert,v=i.children[m],w=document.createElement("option");w.textContent=A,w.value=y,v?v.before(w):i.append(w),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},items(p){const{items:m}=p.detail;for(;i.length!==0;)i.remove(0);for(const A of m){const{displayValue:y,exportValue:v}=A,w=document.createElement("option");w.textContent=y,w.value=v,i.append(w)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(p)}),l=o(!1)},indices(p){const m=new Set(p.detail.indices);for(const A of p.target.options)A.selected=m.has(A.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(p){p.target.disabled=!p.detail.editable}};this._dispatchEventFromSandbox(u,c)}),i.addEventListener("input",c=>{var m;const u=o(!0),p=o(!1);t.setValue(e,{value:u}),c.preventDefault(),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:p,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],c=>c.target.value)):i.addEventListener("input",function(c){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}var Mc,Xf;class Wf extends Nt{constructor(e){const{data:s,elements:i,parent:r}=e,a=!!r._commentManager;super(e,{isRenderable:!a&&Nt._hasPopupData(s)});g(this,Mc);if(this.elements=i,a&&Nt._hasPopupData(s)){const o=this.popup=b(this,Mc,Xf).call(this);for(const l of i)l.popup=o}else this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";
11const s=this.popup=b(this,Mc,Xf).call(this),i=[];for(const r of this.elements)r.popup=s,r.container.ariaHasPopup="dialog",i.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(r=>`${Dp}${r}`).join(",")),this.container}}Mc=new WeakSet,Xf=function(){return new qA({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,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,commentManager:this.parent._commentManager})};var as,er,xu,Pu,dl,ul,Ht,Ai,sr,Aa,fl,pl,wi,os,an,on,re,ln,ir,Dc,hn,gl,wa,nr,Pe,rr,Z,Bd,qf,Yf,Kf,Hd,Jf,eb,sb,ib,nb,Ud,$d,Qf;class qA{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:u,commentManager:p=null}){g(this,Z);g(this,as,null);g(this,er,b(this,Z,ib).bind(this));g(this,xu,b(this,Z,Qf).bind(this));g(this,Pu,b(this,Z,$d).bind(this));g(this,dl,b(this,Z,Ud).bind(this));g(this,ul,null);g(this,Ht,null);g(this,Ai,null);g(this,sr,null);g(this,Aa,null);g(this,fl,null);g(this,pl,null);g(this,wi,!1);g(this,os,null);g(this,an,null);g(this,on,null);g(this,re,null);g(this,ln,null);g(this,ir,null);g(this,Dc,null);g(this,hn,null);g(this,gl,null);g(this,wa,null);g(this,nr,!1);g(this,Pe,null);g(this,rr,null);f(this,Ht,t),f(this,gl,i),f(this,Ai,a),f(this,hn,o),f(this,fl,l),f(this,ul,e),f(this,Dc,h),f(this,pl,c),f(this,Aa,s),f(this,as,p),f(this,Pe,s[0]),f(this,sr,vh.toDateObject(r)),this.trigger=s.flatMap(m=>m.getElementsToTriggerPopup()),p?this.renderCommentButton():(b(this,Z,Bd).call(this),n(this,Ht).hidden=!0,u&&b(this,Z,Ud).call(this))}renderCommentButton(){if(n(this,re)||(n(this,ln)||b(this,Z,qf).call(this),!n(this,ln)))return;const{signal:t}=f(this,an,new AbortController),e=!!n(this,Pe).extraPopupElement,s=()=>{n(this,as).toggleCommentPopup(this,!0,void 0,!e)},i=()=>{n(this,as).toggleCommentPopup(this,!1,!0,!e)},r=()=>{n(this,as).toggleCommentPopup(this,!1,!1)};if(e){f(this,re,n(this,Pe).container);for(const a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",n(this,er),{signal:t}),a.addEventListener("click",s,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",r,{signal:t}),a.classList.add("popupTriggerArea")}else{const a=f(this,re,document.createElement("button"));a.className="annotationCommentButton";const o=n(this,Pe).container;a.style.zIndex=o.style.zIndex+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),b(this,Z,Kf).call(this),b(this,Z,Yf).call(this),a.addEventListener("keydown",n(this,er),{signal:t}),a.addEventListener("click",s,{signal:t}),a.addEventListener("pointerenter",i,{signal:t}),a.addEventListener("pointerleave",r,{signal:t}),o.after(a)}}get commentButtonColor(){const{color:t,opacity:e}=n(this,Pe).commentData;return t?n(this,fl)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;(t=n(this,re))==null||t.focus()},0)}getData(){const{richText:t,color:e,opacity:s,creationDate:i,modificationDate:r}=n(this,Pe).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:s,creationDate:i,modificationDate:r}}get elementBeforePopup(){return n(this,re)}get comment(){return n(this,rr)||f(this,rr,n(this,Pe).commentText),n(this,rr)}set comment(t){t!==this.comment&&(n(this,Pe).commentText=f(this,rr,t))}get parentBoundingClientRect(){return n(this,Pe).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){n(this,re)&&(n(this,re).classList.toggle("selected",t),n(this,re).ariaExpanded=e)}setSelectedCommentButton(t){n(this,re).classList.toggle("selected",t)}get commentPopupPosition(){if(n(this,ir))return n(this,ir);const{x:t,y:e,height:s}=n(this,re).getBoundingClientRect(),{x:i,y:r,width:a,height:o}=n(this,Pe).layer.getBoundingClientRect();return[(t-i)/a,(e+s-r)/o]}set commentPopupPosition(t){f(this,ir,t)}hasDefaultPopupPosition(){return n(this,ir)===null}get commentButtonPosition(){return n(this,ln)}get commentButtonWidth(){return n(this,re).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,s]=n(this,ir)||this.commentButtonPosition.map(h=>h/100),i=this.parentBoundingClientRect,{x:r,y:a,width:o,height:l}=i;
11n(this,as).showDialog(null,this,r+e*o,a+s*l,{...t,parentDimensions:i})}render(){var s,i;if(n(this,os))return;const t=f(this,os,document.createElement("div"));if(t.className="popup",n(this,ul)){const r=t.style.outlineColor=H.makeHexColor(...n(this,ul));t.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`}const e=document.createElement("span");if(e.className="header",(s=n(this,gl))!=null&&s.str){const r=document.createElement("span");r.className="title",e.append(r),{dir:r.dir,str:r.textContent}=n(this,gl)}if(t.append(e),n(this,sr)){const r=document.createElement("time");r.className="popupDate",r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:n(this,sr).valueOf()})),r.dateTime=n(this,sr).toISOString(),e.append(r)}Ip({html:n(this,Z,Hd)||n(this,Ai).str,dir:(i=n(this,Ai))==null?void 0:i.dir,className:"popupContent"},t),n(this,Ht).append(t)}updateEdited({rect:t,popup:e,deleted:s}){var i;if(n(this,as)){s?(this.remove(),f(this,rr,null)):e&&(e.deleted?this.remove():(b(this,Z,Kf).call(this),f(this,rr,e.text))),t&&(f(this,ln,null),b(this,Z,qf).call(this),b(this,Z,Yf).call(this));return}if(s||e!=null&&e.deleted){this.remove();return}b(this,Z,Bd).call(this),n(this,wa)||f(this,wa,{contentsObj:n(this,Ai),richText:n(this,hn)}),t&&f(this,on,null),e&&e.text&&(f(this,hn,b(this,Z,sb).call(this,e.text)),f(this,sr,vh.toDateObject(e.date)),f(this,Ai,null)),(i=n(this,os))==null||i.remove(),f(this,os,null)}resetEdited(){var t;n(this,wa)&&({contentsObj:Jt(this,Ai)._,richText:Jt(this,hn)._}=n(this,wa),f(this,wa,null),(t=n(this,os))==null||t.remove(),f(this,os,null),f(this,on,null))}remove(){var t,e,s;if((t=n(this,an))==null||t.abort(),f(this,an,null),(e=n(this,os))==null||e.remove(),f(this,os,null),f(this,nr,!1),f(this,wi,!1),(s=n(this,re))==null||s.remove(),f(this,re,null),this.trigger)for(const i of this.trigger)i.classList.remove("popupTriggerArea")}forceHide(){f(this,nr,this.isVisible),n(this,nr)&&(n(this,Ht).hidden=!0)}maybeShow(){n(this,as)||(b(this,Z,Bd).call(this),n(this,nr)&&(n(this,os)||b(this,Z,$d).call(this),f(this,nr,!1),n(this,Ht).hidden=!1))}get isVisible(){return n(this,as)?!1:n(this,Ht).hidden===!1}}as=new WeakMap,er=new WeakMap,xu=new WeakMap,Pu=new WeakMap,dl=new WeakMap,ul=new WeakMap,Ht=new WeakMap,Ai=new WeakMap,sr=new WeakMap,Aa=new WeakMap,fl=new WeakMap,pl=new WeakMap,wi=new WeakMap,os=new WeakMap,an=new WeakMap,on=new WeakMap,re=new WeakMap,ln=new WeakMap,ir=new WeakMap,Dc=new WeakMap,hn=new WeakMap,gl=new WeakMap,wa=new WeakMap,nr=new WeakMap,Pe=new WeakMap,rr=new WeakMap,Z=new WeakSet,Bd=function(){var e;if(n(this,an))return;f(this,an,new AbortController);const{signal:t}=n(this,an);for(const s of this.trigger)s.addEventListener("click",n(this,dl),{signal:t}),s.addEventListener("pointerenter",n(this,Pu),{signal:t}),s.addEventListener("pointerleave",n(this,xu),{signal:t}),s.classList.add("popupTriggerArea");for(const s of n(this,Aa))(e=s.container)==null||e.addEventListener("keydown",n(this,er),{signal:t})},qf=function(){const t=n(this,Aa).find(e=>e.hasCommentButton);t&&f(this,ln,t._normalizePoint(t.commentButtonPosition))},Yf=function(){if(n(this,Pe).extraPopupElement&&!n(this,Pe).editor)return;this.renderCommentButton();const[t,e]=n(this,ln),{style:s}=n(this,re);s.left=`calc(${t}%)`,s.top=`calc(${e}% - var(--comment-button-dim))`},Kf=function(){n(this,Pe).extraPopupElement||(this.renderCommentButton(),n(this,re).style.backgroundColor=this.commentButtonColor||"")},Hd=function(){const t=n(this,hn),e=n(this,Ai);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&n(this,hn).html||null},Jf=function(){var t,e,s;return((s=(e=(t=n(this,Z,Hd))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},eb=function(){var t,e,s;return((s=(e=(t=n(this,Z,Hd))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},sb=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:n(this,Z,eb),fontSize:n(this,Z,Jf)?`calc(${n(this,Z,Jf)}px * var(--total-scale-factor))`:""}};for(const r of t.split(` 12`))e.push({name:"span",value:r,attributes:i});return s},ib=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&n(this,wi))&&b(this,Z,Ud).call(this)},nb=function(){if(n(this,on)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:r}}}=n(this,fl);let a=!!n(this,pl),o=a?n(this,pl):n(this,Dc);for(const A of n(this,Aa))if(!o||H.intersect(A.data.rect,o)!==null){o=A.data.rect,a=!0;break}const l=H.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),c=a?o[2]-o[0]+5:0,u=l[0]+c,p=l[1];f(this,on,[100*(u-i)/e,100*(p-r)/s]);const{style:m}=n(this,Ht);m.left=`${n(this,on)[0]}%`,m.top=`${n(this,on)[1]}%`},Ud=function(){if(n(this,as)){n(this,as).toggleCommentPopup(this,!1);return}f(this,wi,!n(this,wi)),n(this,wi)?(b(this,Z,$d).call(this),n(this,Ht).addEventListener("click",n(this,dl)),n(this,Ht).addEventListener("keydown",n(this,er))):(b(this,Z,Qf).call(this),n(this,Ht).removeEventListener("click",n(this,dl)),n(this,Ht).removeEventListener("keydown",n(this,er)))},$d=function(){n(this,os)||this.render(),this.isVisible?n(this,wi)&&n(this,Ht).classList.add("focused"):(b(this,Z,nb).call(this),n(this,Ht).hidden=!1,n(this,Ht).style.zIndex=parseInt(n(this,Ht).style.zIndex)+1e3)},Qf=function(){n(this,Ht).classList.remove("focused"),!(n(this,wi)||!this.isVisible)&&(n(this,Ht).hidden=!0,n(this,Ht).style.zIndex=parseInt(n(this,Ht).style.zIndex)-1e3)};class rb extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=X.FREETEXT}
12render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Lc;class YA extends Nt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,Lc,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=f(this,Lc,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,Lc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Lc=new WeakMap;var Ic;class KA extends Nt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,Ic,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=f(this,Ic,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,Ic)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ic=new WeakMap;var Fc;class JA extends Nt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,Fc,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:s,height:i}=this,r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=f(this,Fc,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttribute("rx",s/2-a/2),o.setAttribute("ry",i/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,Fc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Fc=new WeakMap;var Nc;class ab extends Nt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,Nc,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:r},width:a,height:o}=this;if(!s)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,p=s.length;u<p;u+=2){const m=s[u]-e[0],A=e[3]-s[u+1];h.push(`${m},${A}`)}h=h.join(" ");const c=f(this,Nc,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,Nc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Nc=new WeakMap;class QA extends ab{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ZA extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Oc,va,Bc,Zf;class $p extends Nt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,Bc);g(this,Oc,null);g(this,va,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?X.HIGHLIGHT:X.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:s,inkLists:i,borderStyle:r,popupRef:a}}=this,{transform:o,width:l,height:h}=b(this,Bc,Zf).call(this,s,e),c=this.svgFactory.create(l,h,!0),u=f(this,Oc,this.svgFactory.createElement("svg:g"));c.append(u),u.setAttribute("stroke-width",r.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 p=0,m=i.length;p<m;p++){const A=this.svgFactory.createElement(this.svgElementName);n(this,va).push(A),A.setAttribute("points",i[p].join(",")),u.append(A)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:s,points:i,rect:r}=e,a=n(this,Oc);if(s>=0&&a.setAttribute("stroke-width",s||1),i)for(let o=0,l=n(this,va).length;o<l;o++)n(this,va)[o].setAttribute("points",i[o].join(","));if(r){const{transform:o,width:l,height:h}=b(this,Bc,Zf).call(this,this.data.rotation,r);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return n(this,va)}addHighlightArea(){this.container.classList.add("highlightArea")}}Oc=new WeakMap,va=new WeakMap,Bc=new WeakSet,Zf=function(e,s){switch(e){case 90:return{transform:`rotate(90) translate(${-s[0]},${s[1]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};case 180:return{transform:`rotate(180) translate(${-s[2]},${s[1]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]};case 270:return{transform:`rotate(270) translate(${-s[2]},${s[3]}) scale(1,-1)`,width:s[3]-s[1],height:s[2]-s[0]};default:return{transform:`translate(${-s[0]},${s[3]}) scale(1,-1)`,width:s[2]-s[0],height:s[3]-s[1]}}};class ob extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=X.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}
12class tw extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class ew extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),t){const s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class sw extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),t){const s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class lb extends Nt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=X.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var Hc,Uc,tp;class iw extends Nt{constructor(e){var i;super(e,{isRenderable:!0});g(this,Uc);g(this,Hc,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(i=this.linkService.eventBus)==null||i.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:s}=this;let i;s.hasAppearance||s.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(s.name)?"paperclip":"pushpin"}.svg`,s.fillAlpha&&s.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(s.fillAlpha*100)}%);`)),i.addEventListener("dblclick",b(this,Uc,tp).bind(this)),f(this,Hc,i);const{isMac:r}=de.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(r?a.metaKey:a.ctrlKey)&&b(this,Uc,tp).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return n(this,Hc)}addHighlightArea(){this.container.classList.add("highlightArea")}}Hc=new WeakMap,Uc=new WeakSet,tp=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var ml,Ea,bl,ar,$c,Sa,_r,ep,sp,yl;let jp=(yl=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:r,viewport:
12a,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){g(this,_r);g(this,ml,null);g(this,Ea,null);g(this,bl,null);g(this,ar,new Map);g(this,$c,null);g(this,Sa,null);this.div=t,f(this,ml,e),f(this,Ea,s),f(this,$c,o||null),f(this,Sa,h||null),f(this,bl,c||new Fp),this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i,this._commentManager=l||null}hasEditableAnnotations(){return n(this,ar).size>0}async render(t){var a,o,l;const{annotations:e}=t,s=this.div;vr(s,this.viewport);const i=new Map,r={data:null,layer:s,linkService:n(this,Sa),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Ch,annotationStorage:n(this,bl),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const h of e){if(h.noHTML)continue;const c=h.annotationType===Gt.POPUP;if(c){const m=i.get(h.id);if(!m)continue;r.elements=m}else if(h.rect[2]===h.rect[0]||h.rect[3]===h.rect[1])continue;r.data=h;const u=Sg.create(r);if(!u.isRenderable)continue;if(!c&&h.popupRef){const m=i.get(h.popupRef);m?m.push(u):i.set(h.popupRef,[u])}const p=u.render();h.hidden&&(p.style.visibility="hidden"),await b(this,_r,ep).call(this,p,h.id,r.elements),(o=(a=u.extraPopupElement)==null?void 0:a.popup)==null||o.renderCommentButton(),u._isEditable&&(n(this,ar).set(u.data.id,u),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(u))}b(this,_r,sp).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:n(this,Sa),svgFactory:new Ch,parent:this};for(const s of t){s.borderStyle||(s.borderStyle=yl._defaultBorderStyle),e.data=s;const i=Sg.create(e);if(!i.isRenderable)continue;const r=i.render();await b(this,_r,ep).call(this,r,s.id,null)}}update({viewport:t}){const e=this.div;this.viewport=t,vr(e,{rotation:t.rotation}),b(this,_r,sp).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(n(this,ar).values())}getEditableAnnotation(t){return n(this,ar).get(t)}addFakeAnnotation(t){var o;const{div:e}=this,{id:s,rotation:i}=t,r=new $A({data:{id:s,rect:t.getPDFRect(),rotation:i},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:n(this,Sa),annotationStorage:n(this,bl)}),a=r.render();return e.append(a),(o=n(this,ml))==null||o.moveElementInDOM(e,a,a,!1),r.createOrUpdatePopup(),r}static get _defaultBorderStyle(){return J(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Ja.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},ml=new WeakMap,Ea=new WeakMap,bl=new WeakMap,ar=new WeakMap,$c=new WeakMap,Sa=new WeakMap,_r=new WeakSet,ep=async function(t,e,s){var o,l;const i=t.firstChild||t,r=i.id=`${Dp}${e}`,a=await((o=n(this,$c))==null?void 0:o.getAriaAttributes(r));if(a)for(const[h,c]of a)i.setAttribute(h,c);s?s.at(-1).container.after(t):(this.div.append(t),(l=n(this,ml))==null||l.moveElementInDOM(this.div,t,i,!1))},sp=function(){var e;if(!n(this,Ea))return;const t=this.div;for(const[s,i]of n(this,Ea)){const r=t.querySelector(`[data-annotation-id="${s}"]`);if(!r)continue;i.className="annotationContent";const{firstChild:a}=r;a?a.nodeName==="CANVAS"?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):r.append(i);const o=n(this,ar).get(s);o&&(o._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(s,r.id,i),o._hasNoCanvas=!1):o.canvas=i)}n(this,Ea).clear()},yl);const Sd=/\r\n?|\n/g;var ls,jc,_a,hs,qt,hb,cb,db,jd,yn,Gd,zd,ub,np,fb;const Pt=class Pt extends xt{constructor(e){super({...e,name:"freeTextEditor"});g(this,qt);g(this,ls,"");g(this,jc,`${this.id}-editor`);g(this,_a,null);g(this,hs);k(this,"_colorPicker",null);this.color=e.color||Pt._defaultColor||xt._defaultLineColor,f(this,hs,e.fontSize||Pt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert")}static get _keyboardManager(){const e=Pt.prototype,s=a=>a.isEmpty(),i=Er.TRANSLATE_SMALL,r=Er.TRANSLATE_BIG;return J(this,"_keyboardManager",new cd([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:s}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:s}]]))}static initialize(e,s){xt.initialize(e,s);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
12static updateDefaultParams(e,s){switch(e){case st.FREETEXT_SIZE:Pt._defaultFontSize=s;break;case st.FREETEXT_COLOR:Pt._defaultColor=s;break}}updateParams(e,s){switch(e){case st.FREETEXT_SIZE:b(this,qt,hb).call(this,s);break;case st.FREETEXT_COLOR:b(this,qt,cb).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[st.FREETEXT_SIZE,Pt._defaultFontSize],[st.FREETEXT_COLOR,Pt._defaultColor||xt._defaultLineColor]]}get propertiesToUpdate(){return[[st.FREETEXT_SIZE,n(this,hs)],[st.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new hu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return st.FREETEXT_COLOR}onUpdatedColor(){var e;this.editorDiv.style.color=this.color,(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-Pt._internalPadding*e,-(Pt._internalPadding+n(this,hs))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),f(this,_a,new AbortController);const e=this._uiManager.combinedSignal(n(this,_a));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",n(this,jc)),this._isDraggable=!0,(e=n(this,_a))==null||e.abort(),f(this,_a,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var s;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(s=this._initialOptions)!=null&&s.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();const e=n(this,ls),s=f(this,ls,b(this,qt,db).call(this).trimEnd());if(e===s)return;const i=r=>{if(f(this,ls,r),!r){this.remove();return}b(this,qt,zd).call(this),this._uiManager.rebuild(this),b(this,qt,jd).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),b(this,qt,jd).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Pt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){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)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,s;(this._isCopy||this.annotationElementId)&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",n(this,jc)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${n(this,hs)}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[r,a]=this.parentDimensions;
12if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,u]=this.pageDimensions,[p,m]=this.pageTranslation;let A,y;switch(this.rotation){case 0:A=e+(o[0]-p)/c,y=s+this.height-(o[1]-m)/u;break;case 90:A=e+(o[0]-p)/c,y=s-(o[1]-m)/u,[l,h]=[h,-l];break;case 180:A=e-this.width+(o[0]-p)/c,y=s-(o[1]-m)/u,[l,h]=[-l,-h];break;case 270:A=e+(o[0]-p-this.height*u)/c,y=s+(o[1]-m-this.width*c)/u,[l,h]=[-h,l];break}this.setAt(A*r,y*a,l,h)}else this._moveAfterPaste(e,s);b(this,qt,zd).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var A,y,v;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const r=b(A=Pt,yn,np).call(A,s.getData("text")||"").replaceAll(Sd,` 13`);if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes(` 14`)){o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,c=[],u=[];if(l.nodeType===Node.TEXT_NODE){const w=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Sd,"")),w!==this.editorDiv){let E=c;for(const S of this.editorDiv.childNodes){if(S===w){E=u;continue}E.push(b(y=Pt,yn,Gd).call(y,S))}}c.push(l.nodeValue.slice(0,h).replaceAll(Sd,""))}else if(l===this.editorDiv){let w=c,E=0;for(const S of this.editorDiv.childNodes)E++===h&&(w=u),w.push(b(v=Pt,yn,Gd).call(v,S))}f(this,ls,`${c.join(` 15`)}${r}${u.join(` 16`)}`),b(this,qt,zd).call(this);const p=new Range;let m=Math.sumPrecise(c.map(w=>w.length));for(const{firstChild:w}of this.editorDiv.childNodes)if(w.nodeType===Node.TEXT_NODE){const E=w.nodeValue.length;if(m<=E){p.setStart(w,m),p.setEnd(w,m);break}m-=E}a.removeAllRanges(),a.addRange(p)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=Pt._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,s,i){var o;let r=null;if(e instanceof rb){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:u,id:p,popupRef:m,richText:A,contentsObj:y,creationDate:v,modificationDate:w},textContent:E,textPosition:S,parent:{page:{pageNumber:_}}}=e;if(!E||E.length===0)return null;r=e={annotationType:X.FREETEXT,color:Array.from(h),fontSize:l,value:E.join(` 17`),position:S,pageIndex:_-1,rect:c.slice(0),rotation:u,annotationElementId:p,id:p,deleted:!1,popupRef:m,comment:(y==null?void 0:y.str)||null,richText:A,creationDate:v,modificationDate:w}}const a=await super.deserialize(e,s,i);return f(a,hs,e.fontSize),a.color=H.makeHexColor(...e.color),f(a,ls,b(o=Pt,yn,np).call(o,e.value)),a._initialData=r,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=xt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(e),{color:s,fontSize:n(this,hs),value:b(this,qt,ub).call(this)});return this.addComment(i),e?(i.isCopy=!0,i):this.annotationElementId&&!b(this,qt,fb).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(!s)return null;const{style:i}=s;i.fontSize=`calc(${n(this,hs)}px * var(--total-scale-factor))`,i.color=this.color,s.replaceChildren();for(const r of n(this,ls).split(` 18`)){const a=document.createElement("div");a.append(r?document.createTextNode(r):document.createElement("br")),s.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:n(this,ls)}}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};ls=new WeakMap,jc=new WeakMap,_a=new WeakMap,hs=new WeakMap,qt=new WeakSet,hb=function(e){const s=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--total-scale-factor))`,this.translate(0,-(r-n(this,hs))*this.parentScale),f(this,hs,r),b(this,qt,jd).call(this)},i=n(this,hs);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:st.FREETEXT_S
18IZE,overwriteIfSameType:!0,keepUndo:!0})},cb=function(e){const s=r=>{this.color=r,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:st.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},db=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const r of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&r.nodeName==="BR"||(e.push(b(i=Pt,yn,Gd).call(i,r)),s=r);return e.join(` 19`)},jd=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:r,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",r.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},yn=new WeakSet,Gd=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Sd,"")},zd=function(){if(this.editorDiv.replaceChildren(),!!n(this,ls))for(const e of n(this,ls).split(` 20`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},ub=function(){return n(this,ls).replaceAll("Â "," ")},np=function(e){return e.replaceAll(" ","Â ")},fb=function(e){const{value:s,fontSize:i,color:r,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==r[l])||e.pageIndex!==a},g(Pt,yn),k(Pt,"_freeTextDefaultContent",""),k(Pt,"_internalPadding",0),k(Pt,"_defaultColor",null),k(Pt,"_defaultFontSize",10),k(Pt,"_type","freetext"),k(Pt,"_editorType",X.FREETEXT);let ip=Pt;class B{toSVGPath(){_t("Abstract method `toSVGPath` must be implemented.")}get box(){_t("Abstract getter `box` must be implemented.")}serialize(t,e){_t("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*r;return a}static _rescaleAndSwap(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*r;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let r=0,a=t.length;r<a;r+=2)i[r]=e+t[r],i[r+1]=s+t[r+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,r){switch(r){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static _normalizePagePoint(t,e,s){switch(s){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,s,i,r,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+r)/6,(5*i+a)/6,(s+r)/2,(i+a)/2]}}k(B,"PRECISION",1e-4);var cs,Ws,Al,wl,vi,tt,Ca,Ta,Gc,zc,vl,El,or,Vc,Ru,ku,ee,uh,pb,gb,mb,bb,yb,Ab;const Fi=class Fi{constructor({x:t,y:e},s,i,r,a,o=0){g(this,ee);g(this,cs);g(this,Ws,[]);g(this,Al);g(this,wl);g(this,vi,[]);g(this,tt,new Float32Array(18));g(this,Ca);g(this,Ta);g(this,Gc);g(this,zc);g(this,vl);g(this,El);g(this,or,[]);f(this,cs,s),f(this,El,r*i),f(this,wl,a),n(this,tt).set([NaN,NaN,NaN,NaN,t,e],6),f(this,Al,o),f(this,zc,n(Fi,Vc)*i),f(this,Gc,n(Fi,ku)*i),f(this,vl,i),n(this,or).push(t,e)}isEmpty(){return isNaN(n(this,tt)[8])}add({x:t,y:e}){var R;f(this,Ca,t),f(this,Ta,e);const[s,i,r,a]=n(this,cs);let[o,l,h,c]=n(this,tt).subarray(8,12);const u=t-h,p=e-c,m=Math.hypot(u,p);if(m<n(this,Gc))return!1;const A=m-n(this,zc),y=A/m,v=y*u,w=y*p;let E=o,S=l;o=h,l=c,h+=v,c+=w,(R=n(this,or))==null||R.push(t,e);const _=-w/A,C=v/A,T=_*n(this,El),x=C*n(this,El);return n(this,tt).set(n(this,tt).subarray(2,8),0),n(this,tt).set([h+T,c+x],4),n(this,tt).set(n(this,tt).subarray(14,18),12),n(this,tt).set([h-T,c-x],16),isNaN(n(this,tt)[6])?(n(this,vi).length===0&&(n(this,tt).set([o+T,l+x],2),n(this,vi).push(NaN,NaN,NaN,NaN,(o+T-s)/r,(l+
vendor: 5,284 bytes, line 20
20x-i)/a),n(this,tt).set([o-T,l-x],14),n(this,Ws).push(NaN,NaN,NaN,NaN,(o-T-s)/r,(l-x-i)/a)),n(this,tt).set([E,S,o,l,h,c],6),!this.isEmpty()):(n(this,tt).set([E,S,o,l,h,c],6),Math.abs(Math.atan2(S-l,E-o)-Math.atan2(w,v))<Math.PI/2?([o,l,h,c]=n(this,tt).subarray(2,6),n(this,vi).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/r,((l+c)/2-i)/a),[o,l,E,S]=n(this,tt).subarray(14,18),n(this,Ws).push(NaN,NaN,NaN,NaN,((E+o)/2-s)/r,((S+l)/2-i)/a),!0):([E,S,o,l,h,c]=n(this,tt).subarray(0,6),n(this,vi).push(((E+5*o)/6-s)/r,((S+5*l)/6-i)/a,((5*o+h)/6-s)/r,((5*l+c)/6-i)/a,((o+h)/2-s)/r,((l+c)/2-i)/a),[h,c,o,l,E,S]=n(this,tt).subarray(12,18),n(this,Ws).push(((E+5*o)/6-s)/r,((S+5*l)/6-i)/a,((5*o+h)/6-s)/r,((5*l+c)/6-i)/a,((o+h)/2-s)/r,((l+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=n(this,vi),e=n(this,Ws);if(isNaN(n(this,tt)[6])&&!this.isEmpty())return b(this,ee,pb).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,ee,mb).call(this,s);for(let i=e.length-6;i>=6;i-=6)isNaN(e[i])?s.push(`L${e[i+4]} ${e[i+5]}`):s.push(`C${e[i]} ${e[i+1]} ${e[i+2]} ${e[i+3]} ${e[i+4]} ${e[i+5]}`);return b(this,ee,gb).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,i,r,a){return new wb(t,e,s,i,r,a)}getOutlines(){var u;const t=n(this,vi),e=n(this,Ws),s=n(this,tt),[i,r,a,o]=n(this,cs),l=new Float32Array((((u=n(this,or))==null?void 0:u.length)??0)+2);for(let p=0,m=l.length-2;p<m;p+=2)l[p]=(n(this,or)[p]-i)/a,l[p+1]=(n(this,or)[p+1]-r)/o;if(l[l.length-2]=(n(this,Ca)-i)/a,l[l.length-1]=(n(this,Ta)-r)/o,isNaN(s[6])&&!this.isEmpty())return b(this,ee,bb).call(this,l);const h=new Float32Array(n(this,vi).length+24+n(this,Ws).length);let c=t.length;for(let p=0;p<c;p+=2){if(isNaN(t[p])){h[p]=h[p+1]=NaN;continue}h[p]=t[p],h[p+1]=t[p+1]}c=b(this,ee,Ab).call(this,h,c);for(let p=e.length-6;p>=6;p-=6)for(let m=0;m<6;m+=2){if(isNaN(e[p+m])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=e[p+m],h[c+1]=e[p+m+1],c+=2}return b(this,ee,yb).call(this,h,c),this.newFreeDrawOutline(h,l,n(this,cs),n(this,vl),n(this,Al),n(this,wl))}};cs=new WeakMap,Ws=new WeakMap,Al=new WeakMap,wl=new WeakMap,vi=new WeakMap,tt=new WeakMap,Ca=new WeakMap,Ta=new WeakMap,Gc=new WeakMap,zc=new WeakMap,vl=new WeakMap,El=new WeakMap,or=new WeakMap,Vc=new WeakMap,Ru=new WeakMap,ku=new WeakMap,ee=new WeakSet,uh=function(){const t=n(this,tt).subarray(4,6),e=n(this,tt).subarray(16,18),[s,i,r,a]=n(this,cs);return[(n(this,Ca)+(t[0]-e[0])/2-s)/r,(n(this,Ta)+(t[1]-e[1])/2-i)/a,(n(this,Ca)+(e[0]-t[0])/2-s)/r,(n(this,Ta)+(e[1]-t[1])/2-i)/a]},pb=function(){const[t,e,s,i]=n(this,cs),[r,a,o,l]=b(this,ee,uh).call(this);return`M${(n(this,tt)[2]-t)/s} ${(n(this,tt)[3]-e)/i} L${(n(this,tt)[4]-t)/s} ${(n(this,tt)[5]-e)/i} L${r} ${a} L${o} ${l} L${(n(this,tt)[16]-t)/s} ${(n(this,tt)[17]-e)/i} L${(n(this,tt)[14]-t)/s} ${(n(this,tt)[15]-e)/i} Z`},gb=function(t){const e=n(this,Ws);t.push(`L${e[4]} ${e[5]} Z`)},mb=function(t){const[e,s,i,r]=n(this,cs),a=n(this,tt).subarray(4,6),o=n(this,tt).subarray(16,18),[l,h,c,u]=b(this,ee,uh).call(this);t.push(`L${(a[0]-e)/i} ${(a[1]-s)/r} L${l} ${h} L${c} ${u} L${(o[0]-e)/i} ${(o[1]-s)/r}`)},bb=function(t){const e=n(this,tt),[s,i,r,a]=n(this,cs),[o,l,h,c]=b(this,ee,uh).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-s)/r,(e[3]-i)/a,NaN,NaN,NaN,NaN,(e[4]-s)/r,(e[5]-i)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(e[16]-s)/r,(e[17]-i)/a,NaN,NaN,NaN,NaN,(e[14]-s)/r,(e[15]-i)/a],0),this.newFreeDrawOutline(u,t,n(this,cs),n(this,vl),n(this,Al),n(this,wl))},yb=function(t,e){const s=n(this,Ws);return t.set([NaN,NaN,NaN,NaN,s[4],s[5]],e),e+=6},Ab=function(t,e){const s=n(this,tt).subarray(4,6),i=n(this,tt).subarray(16,18),[r,a,o,l]=n(this,cs),[h,c,u,p]=b(this,ee,uh).call(this);return t.set([NaN,NaN,NaN,NaN,(s[0]-r)/o,(s[1]-a)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,(i[0]-r)/o,(i[1]-a)/l],e),e+=24},g(Fi,Vc,8),g(Fi,Ru,2),g(Fi,ku,n(Fi,Vc)+n(Fi,Ru));let cu=Fi;var Sl,xa,cn,Wc,ds,Xc,Vt,Mu,vb;class wb extends B{constructor(e,s,i,r,a,o){super();g(this,Mu);g(this,Sl);g(this,xa,new Float32Array(4));g(this,cn);g(this,Wc);g(this,ds);g(this,Xc);g(this,Vt);f(this,Vt,e),f(this,ds,s),f(this,Sl,i),f(this,Xc,r),f(this,cn,a),f(this,Wc,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Mu,vb).call(this,o);const[l,h,c,u]=n(this,xa);for(let p=0,m=e.length;p<m;p+=2)e[p]=(e[p]-l)/c,e[p+1]=(e[p+1]-h)/u;for(let p=0,m=s.length;p<m;p+=2)s[p]=(s[p]-l)/c,s[p+1]=(s[p+1]-h)/u}toSVGPath(){const e=[`M${n(this,Vt)[4]} ${n(this,Vt)[5]}`];for(let s=6,i=n(this,Vt).length;s<i;s+=6){if(isNaN(n(this,Vt)[s])){e.push(`L${n(this,Vt)[s+4]} ${n(this,Vt)[s+5]}`);continue}e.push(`C${n(this,Vt)[s]} ${n(this,Vt)[s+1]} ${n(this,Vt)[s+2]} ${n(this,Vt)[s+3]} ${n(this,Vt)[s+4]} ${n(this,Vt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,r],a){const o=i-e,l=r-s;let h,c;switch(a){case 0:h=B._rescale(n(this,Vt),e,r,o,-l),c=B._rescale(n(this,ds),e,r,o,-l);break;case 90:h=B._rescaleAndSwap(n(this,Vt),e,s,o,l),c=B._rescaleAndSwap(n(this,ds),e,s,o,l);break;case 180:h=B._rescale(n(this,Vt),i,s,-o,l),c=B._rescale(n(this,ds),i,s,-o,l);break;case 270:h=B._rescaleAndSwap(n(this,Vt),i,r,-o,-l),c=B._rescaleAndSwap(n(this,ds),i,r,
20-o,-l);break}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return n(this,xa)}newOutliner(e,s,i,r,a,o=0){return new cu(e,s,i,r,a,o)}getNewOutline(e,s){const[i,r,a,o]=n(this,xa),[l,h,c,u]=n(this,Sl),p=a*c,m=o*u,A=i*c+l,y=r*u+h,v=this.newOutliner({x:n(this,ds)[0]*p+A,y:n(this,ds)[1]*m+y},n(this,Sl),n(this,Xc),e,n(this,Wc),s??n(this,cn));for(let w=2;w<n(this,ds).length;w+=2)v.add({x:n(this,ds)[w]*p+A,y:n(this,ds)[w+1]*m+y});return v.getOutlines()}}Sl=new WeakMap,xa=new WeakMap,cn=new WeakMap,Wc=new WeakMap,ds=new WeakMap,Xc=new WeakMap,Vt=new WeakMap,Mu=new WeakSet,vb=function(e){const s=n(this,Vt);let i=s[4],r=s[5];const a=[i,r,i,r];let o=i,l=r,h=i,c=r;const u=e?Math.max:Math.min,p=new Float32Array(4);for(let A=6,y=s.length;A<y;A+=6){const v=s[A+4],w=s[A+5];isNaN(s[A])?(H.pointBoundingBox(v,w,a),l>w?(o=v,l=w):l===w&&(o=u(o,v)),c<w?(h=v,c=w):c===w&&(h=u(h,v))):(p[0]=p[1]=1/0,p[2]=p[3]=-1/0,H.bezierBoundingBox(i,r,...s.slice(A,A+6),p),H.rectBoundingBox(p[0],p[1],p[2],p[3],a),l>p[1]?(o=p[0],l=p[1]):l===p[1]&&(o=u(o,p[0])),c<p[3]?(h=p[2],c=p[3]):c===p[3]&&(h=u(h,p[2]))),i=v,r=w}const m=n(this,xa);m[0]=a[0]-n(this,cn),m[1]=a[1]-n(this,cn),m[2]=a[2]-a[0]+2*n(this,cn),m[3]=a[3]-a[1]+2*n(this,cn),this.firstPoint=[o,l],this.lastPoint=[h,c]};var qc,Yc,Kc,lr,Xs,He,Eb,Vd,Sb,_b,ap;class rp{constructor(t,e=0,s=0,i=!0){g(this,He);g(this,qc);g(this,Yc);g(this,Kc);g(this,lr,[]);g(this,Xs,[]);const r=[1/0,1/0,-1/0,-1/0],o=10**-4;for(const{x:v,y:w,width:E,height:S}of t){const _=Math.floor((v-e)/o)*o,C=Math.ceil((v+E+e)/o)*o,T=Math.floor((w-e)/o)*o,x=Math.ceil((w+S+e)/o)*o,P=[_,T,x,!0],R=[C,T,x,!1];n(this,lr).push(P,R),H.rectBoundingBox(_,T,C,x,r)}const l=r[2]-r[0]+2*s,h=r[3]-r[1]+2*s,c=r[0]-s,u=r[1]-s;let p=i?-1/0:1/0,m=1/0;const A=n(this,lr).at(i?-1:-2),y=[A[0],A[2]];for(const v of n(this,lr)){const[w,E,S,_]=v;!_&&i?E<m?(m=E,p=w):E===m&&(p=Math.max(p,w)):_&&!i&&(E<m?(m=E,p=w):E===m&&(p=Math.min(p,w))),v[0]=(w-c)/l,v[1]=(E-u)/h,v[2]=(S-u)/h}f(this,qc,new Float32Array([c,u,l,h])),f(this,Yc,[p,m]),f(this,Kc,y)}getOutlines(){n(this,lr).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of n(this,lr))e[3]?(t.push(...b(this,He,ap).call(this,e)),b(this,He,Sb).call(this,e)):(b(this,He,_b).call(this,e),t.push(...b(this,He,ap).call(this,e)));return b(this,He,Eb).call(this,t)}}qc=new WeakMap,Yc=new WeakMap,Kc=new WeakMap,lr=new WeakMap,Xs=new WeakMap,He=new WeakSet,Eb=function(t){const e=[],s=new Set;for(const a of t){const[o,l,h]=a;e.push([o,l,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a<o;a+=2){const l=e[a][2],h=e[a+1][2];l.push(h),h.push(l),s.add(l),s.add(h)}const i=[];let r;for(;s.size>0;){const a=s.values().next().value;let[o,l,h,c,u]=a;s.delete(a);let p=o,m=l;for(r=[o,h],i.push(r);;){let A;if(s.has(c))A=c;else if(s.has(u))A=u;else break;s.delete(A),[o,l,h,c,u]=A,p!==o&&(r.push(p,m,o,m===l?l:h),p=o),m=m===l?h:l}r.push(p,m)}return new nw(i,n(this,qc),n(this,Yc),n(this,Kc))},Vd=function(t){const e=n(this,Xs);let s=0,i=e.length-1;for(;s<=i;){const r=s+i>>1,a=e[r][0];if(a===t)return r;a<t?s=r+1:i=r-1}return i+1},Sb=function([,t,e]){const s=b(this,He,Vd).call(this,t);n(this,Xs).splice(s,0,[t,e])},_b=function([,t,e]){const s=b(this,He,Vd).call(this,t);for(let i=s;i<n(this,Xs).length;i++){const[r,a]=n(this,Xs)[i];if(r!==t)break;if(r===t&&a===e){n(this,Xs).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[r,a]=n(this,Xs)[i];if(r!==t)break;if(r===t&&a===e){n(this,Xs).splice(i,1);return}}},ap=function(t){const[e,s,i]=t,r=[[e,s,i]],a=b(this,He,Vd).call(this,i);for(let o=0;o<a;o++){const[l,h]=n(this,Xs)[o];for(let c=0,u=r.length;c<u;c++){const[,p,m]=r[c];if(!(h<=p||m<=l)){if(p>=l){if(m>h)r[c][1]=h;else{if(u===1)return[];r.splice(c,1),c--,u--}continue}r[c][2]=l,m>h&&r.push([e,h,m])}}}return r};var Jc,_l;class nw extends B{constructor(e,s,i,r){super();g(this,Jc);g(this,_l);f(this,_l,e),f(this,Jc,s),this.firstPoint=i,this.lastPoint=r}toSVGPath(){const e=[];for(const s of n(this,_l)){let[i,r]=s;e.push(`M${i} ${r}`);for(let a=2;a<s.length;a+=2){const o=s[a],l=s[a+1];o===i?(e.push(`V${l}`),r=l):l===r&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,r],a){const o=[],l=i-e,h=r-s;for(const c of n(this,_l)){const u=new Array(c.length);for(let p=0;p<c.length;p+=2)u[p]=e+c[p]*l,u[p+1]=r-c[p+1]*h;o.push(u)}return o}get box(){return n(this,Jc)}get classNamesForOutlining(){return["highlightOutline"]}}Jc=new WeakMap,_l=new WeakMap;class op extends cu{newFreeDrawOutline(t,e,s,i,r,a){return new rw(t,e,s,i,r,a)}}class rw extends wb{newOutliner(t,e,s,i,r,a=0){return new op(t,e,s,i,r,a)}}var Cl,Qc,dn,Pa,Zc,Xe,td,ed,Ra,us,fs,be,Tl,xl,Re,Pl,Ls,sd,Q,lp,Wd,Cb,Tb,xb,hp,Pr,Fs,io,Pb,Xd,qd,Rb,kb,Mb,Db,Lb;const ht=class ht extends xt{constructor(e){super({...e,name:"highlightEditor"});g(this,Q);g(this,Cl,null);g(this,Qc,0);g(this,dn);g(this,Pa,null);g(this,Zc,null);g(this,Xe,null);g(this,td,null);g(this,ed,0);g(this,Ra,null);g(this,us,null);g(this,fs,null);g(this,be,!1);g(this,Tl,null);g(this,xl,null);g(this,Re,null);g(this,Pl,"");g(this,Ls);g(this,sd,"");this.color=e.color||ht._defaultColor,f(this,Ls,e.thickness||ht._defaultThickness),this.opacity=e.opacity||ht._defaultOpacity,f(this,dn,e.boxes||null),f(this,sd,e.methodOfCreation||""),f(this,Pl,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(f(this,be,!0),b(this,Q,Wd).call(this,e),b(this,Q,Pr).call(this)):n(this,dn)&&(f(this,Cl,e.anchorNode),f(this,Qc,e.anchorOffset),f(this,td,e.focusNode),f(this,ed,e.focusOffset),b(this,Q,lp).call(this),b(this,Q,Pr).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const e=ht.prototype;return J(this,"_keyboardManager",new cd([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:n(this,be)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:n(this,Ls),methodOfCreation:n(this,sd)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("
20color").size}}static initialize(e,s){var i;xt.initialize(e,s),ht._defaultColor||(ht._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case st.HIGHLIGHT_COLOR:ht._defaultColor=s;break;case st.HIGHLIGHT_THICKNESS:ht._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return n(this,xl)}get commentButtonPosition(){return n(this,Tl)}updateParams(e,s){switch(e){case st.HIGHLIGHT_COLOR:b(this,Q,Cb).call(this,s);break;case st.HIGHLIGHT_THICKNESS:b(this,Q,Tb).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[st.HIGHLIGHT_COLOR,ht._defaultColor],[st.HIGHLIGHT_THICKNESS,ht._defaultThickness]]}get propertiesToUpdate(){return[[st.HIGHLIGHT_COLOR,this.color||ht._defaultColor],[st.HIGHLIGHT_THICKNESS,n(this,Ls)||ht._defaultThickness],[st.HIGHLIGHT_FREE,n(this,be)]]}onUpdatedColor(){var e,s;(e=this.parent)==null||e.drawLayer.updateProperties(n(this,fs),{root:{fill:this.color,"fill-opacity":this.opacity}}),(s=n(this,Zc))==null||s.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",f(this,Zc,new _h({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,Q,qd).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,b(this,Q,qd).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Q,hp).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Q,Pr).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?b(this,Q,hp).call(this):e&&(b(this,Q,Pr).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),s&&this.select()}rotate(e){var r,a,o;const{drawLayer:s}=this.parent;let i;n(this,be)?(e=(e-this.rotation+360)%360,i=b(r=ht,Fs,io).call(r,n(this,us).box,e)):i=b(a=ht,Fs,io).call(a,[this.x,this.y,this.width,this.height],e),s.updateProperties(n(this,fs),{bbox:i,root:{"data-main-rotation":e}}),s.updateProperties(n(this,Re),{bbox:b(o=ht,Fs,io).call(o,n(this,Xe).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();n(this,Pl)&&(e.setAttribute("aria-label",n(this,Pl)),e.setAttribute("role","mark")),n(this,be)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Q,Pb).bind(this),{signal:this._uiManager._signal});const s=f(this,Ra,document.createElement("div"));return e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=n(this,Pa),this.setDims(this.width,this.height),Zg(this,n(this,Ra),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(n(this,Re),{rootClass:{hovered:!0}})}pointerleave(){var e;this.isSelected||(e=this.parent)==null||e.drawLayer.updateProperties(n(this,Re),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Q,Xd).call(this,!0);break;case 1:case 3:b(this,Q,Xd).call(this,!1);break}}select(){var e;super.select(),n(this,Re)&&((e=this.parent)==null||e.drawLayer.updateProperties(n(this,Re),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),n(this,Re)&&((e=this.parent)==null||e.drawLayer.updateProperties(n(this,Re),{rootClass:{selected:!1}}),n(this,be)||b(this,Q,Xd).call(this,!1))}get _mustFixPosition(){return!n(this,be)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(n(this,fs),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(n(this,Re),{rootClass:{hidden:!e}}))}static startHighlighting(e,s,{target:i,x:r,y:a}){const{x:o,y:l,width:h,height:c}=i.getBoundingClientRect(),u=new AbortController,p=e.combinedSignal(u),m=A=>{u.abort(),b(this,Fs,Db).call(this,e,A)};window.addEventListener("blur",m,{signal:p}),window.addEventListener("pointerup",m,{signal:p}),window.addEventListener("pointerdown",Ft,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",vs,{signal:p}),i.addEventListener("pointermove",b(this,Fs,Mb).bind(this,e),{signal:p}),this._freeHighlight=new op({x:r,y:a},[o,l,h,c],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.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(e,s,i){var y,v,w,E;let r=null;if(e instanceof ob){const{data:{quadPoints:S,rect:_,rotation:C,id:T,color:x,opacity:P,popupRef:R,richText:D,contentsObj:M,creationDate:U,modificationDate:z},parent:{page:{pageNumber:O}}}=e;r=e={annotationType:X.HIGHLIGHT,color:Array.from(x),opacity:P,quadPoints:S,boxes:null,pageIndex:O-1,rect:_.slice(0),rotation:C,annotationElementId:T,id:T,deleted:!1,popupRef:R,richText:D,comment:(M==null?void 0:M.str)||null,creationDate:U,modificationDate:z}}else if(e instanceof $p){const{data:{inkLists:S,rect:_,rotation:C,id:T,color:x,borderStyle:{rawWidth:P},popupRef:R,richText:D,contentsObj:M,creationDate:U,modificationDate:z},parent:{page:{pageNumber:O}}}=e;r=e={annotationType:X.HIGHLIGHT,color:Array.from(x),thickness:P,inkLists:S,boxes:null,pageIndex:O-1,rect:_.slice(0),rotation:C,annotationElementId:T,id:T,deleted:!1,popupRef:R,richText:D,comment:(M==null?void 0:M.str)||null,creationDate:U,modificationDate:z}}const{color:a,quadPoints:o,inkLists:l,opacity:h}=e,c=await super.deserialize(e,s,i);c.color=H.makeHexColor(...a),c.opacity=h||1,l&&f(c,Ls,e.thickness),c._initialData=r,e.comment&&c.setCommentData(e);const[u,p]=c.pageDimensions,[m,A]=c.pageTranslation;if(o){const S=f(c,dn,[]);for(let _=0;_<o.length;_+=8)S.push({x:(o[_]-m)/u,y:1-(o[_+1]-A)/p,width:(o[_+2]-o[_])/u,height:(o[_+1]-o[_+5])/p});b(y=c,Q,lp).call(y),b(v=c,Q,Pr).call(v),c.rotate(c.rotation)}else if(l){f(c,be,!0);const S=l[0],_={x:S[0]-m,y:p-(S[1]-A)},C=new op(_,[0,0,u,p],1,n(c,Ls)/2,!0,.001);for(let P=0,R=S.length;P<R;P+=2)_.x=S[P]-m,_.y=p-(S[P+1]-A),C.add(_);const{id:T,clipPathId:x}=s.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:C.toSVGPath()}},!0,!0);b(w=c,Q,Wd).call(w,{highlightOutlines:C.getOutlines(),highlightId:T,clipPathId:x}),b(E=c,Q,Pr).call(E),c.rotate(c.parentRotation)}return c}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const s=xt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(e);return Object.assign(i,{color:s,opacity:this.opacity,thickness:n(this,Ls),quadPoints:b(this,Q,Rb).call(this),outlines:b(this,Q,kb).call(this,i.rect)}),this.addComment(i),this.annotationElementId&&!b(this,Q,Lb).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};Cl=new WeakMap,Qc=new WeakMap,dn=new WeakMap,Pa=new WeakMap,Zc=new WeakMap,Xe=new WeakMap,td=new WeakMap,ed=new WeakMap,Ra=new WeakMap,us=new WeakMap,fs=new WeakMap,be=new WeakMap,Tl=new WeakMap,xl=new WeakMap,Re=new WeakMap,Pl=new WeakMap,Ls=new WeakMap,sd=new WeakMap,Q=new WeakSet,lp=function(){const e=new rp(n(this,dn),.001);f(this,us,e.getOutlines()),[this.x,this.y,this.width,this.height]=n(this,us).box;const s=new rp(n(this,dn),.0025,.001,this._uiManager.direction==="ltr");f(this,Xe,s.getOutlines());const{firstPoint:i}=n(this,us);f(this,Tl,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]);const{lastPoint:r}=n(this,Xe);f(this,xl,[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height])},Wd=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var p,m;if(f(this,us,e),f(this,Xe,e.getNewOutline(n(this,Ls)/2+1.5,.0025)),s>=0)f(this,fs,s),f(this,Pa,i),this.parent.drawLayer.finalizeDraw(s,{bbox:e.box,path:{d:e.toSVGPath()}}),f(this,Re,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:n(this,Xe).box,path:{d:n(this,Xe).toSVGPath()}},!0));else if(this.parent){const A=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(n(this,fs),{bbox:b(p=ht,Fs,io).call(p,n(this,us).box,(A-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(n(this,Re),{bbox:b(m=ht,Fs,io).call(m,n(this,Xe).box,A),path:{d:n(this,Xe).toSVGPath()}})}const[a,o,l,h]=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=h;break;case 90:{const[A,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/A,this.height=h*A/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=h;break;case 270:{const[A,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/A,this.height=h*A/y;break}}const{firstPoint:c}=e;f(this,Tl,[(c[0]-a)/l,(c[1]-o)/h]);const{lastPoint:u}=n(this,Xe);f(this,xl,[(u[0]-a)/l,(u[1]-o)/h])},Cb=function(e){const s=(a,o)=>{this.color=a,this.opacity=o,this.onUpdatedColor()},i=this.color,r=this.opacity;this.addCommands({cmd:s.bind(this,e,ht._defaultOpacity),undo:s.bind(this,i,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:st.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},Tb=function(e){const s=n(this,Ls),i=r=>{f(this,Ls,r),b(this,Q,xb).call(this,r)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:st.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)}
20,xb=function(e){n(this,be)&&(b(this,Q,Wd).call(this,{highlightOutlines:n(this,us).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims(this.width,this.height))},hp=function(){n(this,fs)===null||!this.parent||(this.parent.drawLayer.remove(n(this,fs)),f(this,fs,null),this.parent.drawLayer.remove(n(this,Re)),f(this,Re,null))},Pr=function(e=this.parent){n(this,fs)===null&&({id:Jt(this,fs)._,clipPathId:Jt(this,Pa)._}=e.drawLayer.draw({bbox:n(this,us).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:n(this,be)},path:{d:n(this,us).toSVGPath()}},!1,!0),f(this,Re,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:n(this,be)},bbox:n(this,Xe).box,path:{d:n(this,Xe).toSVGPath()}},n(this,be))),n(this,Ra)&&(n(this,Ra).style.clipPath=n(this,Pa)))},Fs=new WeakSet,io=function([e,s,i,r],a){switch(a){case 90:return[1-s-r,e,r,i];case 180:return[1-e-i,1-s-r,i,r];case 270:return[s,1-e-i,r,i]}return[e,s,i,r]},Pb=function(e){ht._keyboardManager.exec(this,e)},Xd=function(e){if(!n(this,Cl))return;const s=window.getSelection();e?s.setPosition(n(this,Cl),n(this,Qc)):s.setPosition(n(this,td),n(this,ed))},qd=function(){return n(this,be)?this.rotation:0},Rb=function(){if(n(this,be))return null;const[e,s]=this.pageDimensions,[i,r]=this.pageTranslation,a=n(this,dn),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:c,width:u,height:p}of a){const m=h*e+i,A=(1-c)*s+r;o[l]=o[l+4]=m,o[l+1]=o[l+3]=A,o[l+2]=o[l+6]=m+u*e,o[l+5]=o[l+7]=A-p*s,l+=8}return o},kb=function(e){return n(this,us).serialize(e,b(this,Q,qd).call(this))},Mb=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},Db=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(s,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Lb=function(e){const{color:s}=this._initialData;return this.hasEditedComment||e.color.some((i,r)=>i!==s[r])},g(ht,Fs),k(ht,"_defaultColor",null),k(ht,"_defaultOpacity",1),k(ht,"_defaultThickness",12),k(ht,"_type","highlight"),k(ht,"_editorType",X.HIGHLIGHT),k(ht,"_freeHighlightId",-1),k(ht,"_freeHighlight",null),k(ht,"_freeHighlightClipId","");let du=ht;var ka;class Ib{constructor(){g(this,ka,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){n(this,ka)[t]=e}toSVGProperties(){const t=n(this,ka);return f(this,ka,Object.create(null)),{root:t}}reset(){f(this,ka,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){_t("Not implemented")}}ka=new WeakMap;var ps,Rl,ae,Ma,Da,hr,cr,dr,La,at,cp,dp,up,fh,Fb,Yd,ph,no;const $=class $ extends xt{constructor(e){super(e);g(this,at);g(this,ps,null);g(this,Rl);k(this,"_colorPicker",null);k(this,"_drawId",null);f(this,Rl,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){var e;(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,at,cp).call(this,e),b(this,at,fh).call(this))}static _mergeSVGProperties(e,s){const i=new Set(Object.keys(e));for(const[r,a]of Object.entries(s))i.has(r)?Object.assign(e[r],a):e[r]=a;return e}static getDefaultDrawingOptions(e){_t("Not implemented")}static get typesMap(){_t("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,s){const i=this.typesMap.get(e);i&&this._defaultDrawingOptions.updateProperty(i,s),this._currentParent&&(n($,ae).updateProperty(i,s),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,s){const i=this.constructor.typesMap.get(e);i&&this._updateProperty(e,i,s)}static get defaultPropertiesToUpdate(){const e=[],s=this._defaultDrawingOptions;for(const[i,r]of this.typesMap)e.push([i,s[r]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:s}=this;for(const[i,r]of this.constructor.typesMap)e.push([i,s[r]]);return e}_updateProperty(e,s,i){const r=this._drawingOptions,a=r[s],o=l=>{var c;r.updateProperty(s,l);const h=n(this,ps).updateProperty(s,l);h&&b(this,at,ph).call(this,h),(c=this.parent)==null||c.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:o.bind(this,i),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,$._mergeSVGProperties(n(this,ps).getPathResizingSVGProperties(b(this,at,Yd).call(this)),{bbox:b(this,at,no).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,$._mergeSVGProperties(n(this,ps).getPathResizedSVGProperties(b(this,at,Yd).call(this)),{bbox:b(this,at,no).call(this)}))}_onTranslating(e,s){var i;(i=this.parent)==null||i.drawLayer.updateProperties(this._drawId,{bbox:b(this,at,no).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,$._mergeSVGProperties(n(this,ps).getPathTranslatedSVGProperties(b(this,at,Yd).call(this),this.parentDimensions),{bbox:b(this,at,no).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.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(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,n(this,Rl)&&(f(this,Rl,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,at,up).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,at,fh).call(this),b(this,at,ph).call(this,n(this,ps).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,at,up).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,at,fh).call(this,e),s=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(e),s&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,$._mergeSVGProperties({bbox:b(this,at,no).call(this)},n(this,ps).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,at,ph).call(this,n(this,ps).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}
20render(){if(this.div)return this.div;let e,s;this._isCopy&&(e=this.x,s=this.y);const i=super.render();i.classList.add("draw");const r=document.createElement("div");return i.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,s),i}static createDrawerInstance(e,s,i,r,a){_t("Not implemented")}static startDrawing(e,s,i,r){var v;const{target:a,offsetX:o,offsetY:l,pointerId:h,pointerType:c}=r;if(n($,cr)&&n($,cr)!==c)return;const{viewport:{rotation:u}}=e,{width:p,height:m}=a.getBoundingClientRect(),A=f($,Ma,new AbortController),y=e.combinedSignal(A);if(n($,hr)||f($,hr,h),n($,cr)??f($,cr,c),window.addEventListener("pointerup",w=>{var E;n($,hr)===w.pointerId?this._endDraw(w):(E=n($,dr))==null||E.delete(w.pointerId)},{signal:y}),window.addEventListener("pointercancel",w=>{var E;n($,hr)===w.pointerId?this._currentParent.endDrawingSession():(E=n($,dr))==null||E.delete(w.pointerId)},{signal:y}),window.addEventListener("pointerdown",w=>{n($,cr)===w.pointerType&&((n($,dr)||f($,dr,new Set)).add(w.pointerId),n($,ae).isCancellable()&&(n($,ae).removeLastElement(),n($,ae).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:y}),window.addEventListener("contextmenu",vs,{signal:y}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:y}),a.addEventListener("touchmove",w=>{w.timeStamp===n($,La)&&Ft(w)},{signal:y}),e.toggleDrawing(),(v=s._editorUndoBar)==null||v.hide(),n($,ae)){e.drawLayer.updateProperties(this._currentDrawId,n($,ae).startNew(o,l,p,m,u));return}s.updateUIForDefaultProperties(this),f($,ae,this.createDrawerInstance(o,l,p,m,u)),f($,Da,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(n($,Da).toSVGProperties(),n($,ae).defaultSVGProperties),!0,!1)}static _drawMove(e){var a;if(f($,La,-1),!n($,ae))return;const{offsetX:s,offsetY:i,pointerId:r}=e;if(n($,hr)===r){if(((a=n($,dr))==null?void 0:a.size)>=1){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,n($,ae).add(s,i)),f($,La,e.timeStamp),Ft(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,f($,ae,null),f($,Da,null),f($,cr,null),f($,La,NaN)),n($,Ma)&&(n($,Ma).abort(),f($,Ma,null),f($,hr,NaN),f($,dr,null))}static _endDraw(e){const s=this._currentParent;if(s){if(s.toggleDrawing(!0),this._cleanup(!1),(e==null?void 0:e.target)===s.div&&s.drawLayer.updateProperties(this._currentDrawId,n($,ae).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const i=n($,ae),r=this._currentDrawId,a=i.getLastElement();s.addCommands({cmd:()=>{s.drawLayer.updateProperties(r,i.setLastElement(a))},undo:()=>{s.drawLayer.updateProperties(r,i.removeLastElement())},mustExec:!1,type:st.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const s=this._currentParent;if(!s)return null;if(s.toggleDrawing(!0),s.cleanUndoStack(st.DRAW_STEP),!n($,ae).isEmpty()){const{pageDimensions:[i,r],scale:a}=s,o=s.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:n($,ae).getOutlines(i*a,r*a,a,this._INNER_MARGIN),drawingOptions:n($,Da),mustBeCommitted:!e});return this._cleanup(!0),o}return s.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,s,i,r,a,o){_t("Not implemented")}static async deserialize(e,s,i){var u,p;const{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:l}}=s.viewport,h=this.deserializeDraw(o,l,r,a,this._INNER_MARGIN,e),c=await super.deserialize(e,s,i);return c.createDrawingOptions(e),b(u=c,at,cp).call(u,{drawOutlines:h}),b(p=c,at,fh).call(p),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){const[s,i]=this.pageTranslation,[r,a]=this.pageDimensions;return n(this,ps).serialize([s,i,r,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};ps=new WeakMap,Rl=new WeakMap,ae=new WeakMap,Ma=new WeakMap,Da=new WeakMap,hr=ne
20w WeakMap,cr=new WeakMap,dr=new WeakMap,La=new WeakMap,at=new WeakSet,cp=function({drawOutlines:e,drawId:s,drawingOptions:i}){f(this,ps,e),this._drawingOptions||(this._drawingOptions=i),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),s>=0?(this._drawId=s,this.parent.drawLayer.finalizeDraw(s,e.defaultProperties)):this._drawId=b(this,at,dp).call(this,e,this.parent),b(this,at,ph).call(this,e.box)},dp=function(e,s){const{id:i}=s.drawLayer.draw($._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return i},up=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},fh=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,at,dp).call(this,n(this,ps),e)}},Fb=function([e,s,i,r]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[s,1-e,i*(o/a),r*(a/o)];case 180:return[1-e,1-s,i,r];case 270:return[1-s,e,i*(o/a),r*(a/o)];default:return[e,s,i,r]}},Yd=function(){const{x:e,y:s,width:i,height:r,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-s,e,i*(a/o),r*(o/a)];case 180:return[1-e,1-s,i,r];case 270:return[s,1-e,i*(a/o),r*(o/a)];default:return[e,s,i,r]}},ph=function(e){[this.x,this.y,this.width,this.height]=b(this,at,Fb).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},no=function(){const{x:e,y:s,width:i,height:r,rotation:a,parentRotation:o,parentDimensions:[l,h]}=this;switch((a*4+o)/90){case 1:return[1-s-r,e,r,i];case 2:return[1-e-i,1-s-r,i,r];case 3:return[s,1-e-i,r,i];case 4:return[e,s-i*(l/h),r*(h/l),i*(l/h)];case 5:return[1-s,e,i*(l/h),r*(h/l)];case 6:return[1-e-r*(h/l),1-s,r*(h/l),i*(l/h)];case 7:return[s-i*(l/h),1-e-r*(h/l),i*(l/h),r*(h/l)];case 8:return[e-i,s-r,i,r];case 9:return[1-s,e-i,r,i];case 10:return[1-e,1-s,i,r];case 11:return[s-r,1-e,r,i];case 12:return[e-r*(h/l),s,r*(h/l),i*(l/h)];case 13:return[1-s-i*(l/h),e-r*(h/l),i*(l/h),r*(h/l)];case 14:return[1-e,1-s-i*(l/h),r*(h/l),i*(l/h)];case 15:return[s,1-e,i*(l/h),r*(h/l)];default:return[e,s,i,r]}},k($,"_currentDrawId",-1),k($,"_currentParent",null),g($,ae,null),g($,Ma,null),g($,Da,null),g($,hr,NaN),g($,cr,null),g($,dr,null),g($,La,NaN),k($,"_INNER_MARGIN",3);let uu=$;var Ei,oe,le,Ia,kl,Ie,ye,Is,Fa,Na,Oa,Ml,Kd;class aw{constructor(t,e,s,i,r,a){g(this,Ml);g(this,Ei,new Float64Array(6));g(this,oe);g(this,le);g(this,Ia);g(this,kl);g(this,Ie);g(this,ye,"");g(this,Is,0);g(this,Fa,new ud);g(this,Na);g(this,Oa);f(this,Na,s),f(this,Oa,i),f(this,Ia,r),f(this,kl,a),[t,e]=b(this,Ml,Kd).call(this,t,e);const o=f(this,oe,[NaN,NaN,NaN,NaN,t,e]);f(this,Ie,[t,e]),f(this,le,[{line:o,points:n(this,Ie)}]),n(this,Ei).set(o,0)}updateProperty(t,e){t==="stroke-width"&&f(this,kl,e)}isEmpty(){return!n(this,le)||n(this,le).length===0}isCancellable(){return n(this,Ie).length<=10}add(t,e){[t,e]=b(this,Ml,Kd).call(this,t,e);const[s,i,r,a]=n(this,Ei).subarray(2,6),o=t-r,l=e-a;return Math.hypot(n(this,Na)*o,n(this,Oa)*l)<=2?null:(n(this,Ie).push(t,e),isNaN(s)?(n(this,Ei).set([r,a,t,e],2),n(this,oe).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(n(this,Ei)[0])&&n(this,oe).splice(6,6),n(this,Ei).set([s,i,r,a,t,e],0),n(this,oe).push(...B.createBezierPoints(s,i,r,a,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){const s=this.add(t,e);return s||(n(this,Ie).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,s,i,r){f(this,Na,s),f(this,Oa,i),f(this,Ia,r),[t,e]=b(this,Ml,Kd).call(this,t,e);const a=f(this,oe,[NaN,NaN,NaN,NaN,t,e]);f(this,Ie,[t,e]);const o=n(this,le).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),n(this,le).push({line:a,points:n(this,Ie)}),n(this,Ei).set(a,0),f(this,Is,0),this.toSVGPath(),null}getLastElement(){return n(this,le).at(-1)}setLastElement(t){return n(this,le)?(n(this,le).push(t),f(this,oe,t.line),f(this,Ie,t.points),f(this,Is,0),{path:{d:this.toSVGPath()}}):n(this,Fa).setLastElement(t)}removeLastElement(){if(!n(this,le))return n(this,Fa).removeLastElement();n(this,le).pop(),f(this,ye,"");for(let t=0,e=n(this,le).length;t<e;t++){const{line:s,points:i}=n(this,le)[t];f(this,oe,s),f(this,Ie,i),f(this,Is,0),this.toSVGPath()}return{path:{d:n(this,ye)}}}toSVGPath(){const t=B.svgRound(n(this,oe)[4]),e=B.svgRound(n(this,oe)[5]);if(n(this,Ie).length===2)return f(this,ye,`${n(this,ye)} M ${t} ${e} Z`),n(this,ye);if(n(this,Ie).length<=6){const i=n(this,ye).lastIndexOf("M");f(this,ye,`${n(this,ye).slice(0,i)} M ${t} ${e}`),f(this,Is,6)}if(n(this,Ie).length===4){const i=B.svgRound(n(this,oe)[10]),r=B.svgRound(n(this,oe)[11]);return f(this,ye,`${n(this,ye)} L ${i} ${r}`),f(this,Is,12),n(this,ye)}const s=[];n(this,Is)===0&&(s.push(`M ${t} ${e}`),f(this,Is,6));for(let i=n(this,Is),r=n(this,oe).length;i<r;i+=6){const[a,o,l,h,c,u]=n(this,oe).slice(i,i+6).map(B.svgRound);s.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}return f(this,ye,n(this,ye)+s.join(" ")),f(this,Is,n(this,oe).length),n(this,ye)}getOutlines(t,e,s,i){const r=n(this,le).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),n(this,Fa).build(n(this,le),t,e,s,n(this,Ia),n(this,kl),i),f(this,Ei,null),f(this,oe,null),f(this,le,null),f(this,ye,null),n(this,Fa)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Ei=new WeakMap,oe=new WeakMap,le=new WeakMap,Ia=new WeakMap,kl=new WeakMap,Ie=new WeakMap,ye=new WeakMap,Is=new WeakMap,Fa=new WeakMap,Na=new WeakMap,Oa=new WeakMap,Ml=new WeakSet,Kd=function(t,e){return B._normalizePoint(t,e,n(this,Na),n(this,Oa),n(this,Ia))};var Fe,id,nd,gs,Si,_i,Dl,Ll,Ba,we,Li,Nb,Ob,Bb;class ud extends B{constructor(){super(...arguments);g(this,we);g(this,Fe);g(this,id,0);g(this,nd);g(this,gs);g(this,Si);g(this,_i);g(this,Dl);g(this,Ll);g(this,Ba)}build(e,s,i,r,a,o,l){f(this,Si,s),f(this,_i,i),f(this,Dl,r),f(this,Ll,a),f(this,Ba,o),f(this,nd,l??0),f(this,gs,e),b(this,we,Ob).call(this)}get thickness(){return n(this,Ba)}setLastElement(e){return n(this,gs).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return n(this,gs).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:s}of n(this,gs)){if(e.push(`M${B.svgRound(s[4])} ${B.svgRound(s[5])}`),s.length===6){e.push("Z");continue}if(s.length===12&&isNaN(s[6])){e.push(`L${B.svgRound(s[10])} ${B.svgRound(s[11])}`);continue}for(let i=6,r=s.length;i<r;i+=6){const[a,o,l,h,c,u]=s.subarray(i,i+6).map(B.svgRound);e.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}}return e.join("")}serialize([e,s,i,r],a){const o=[],l=[],[h,c,u,p]=b(this,we,Nb).call(this);let m,A,y,v,w,E,S,_,C;switch(n(this,Ll)){case 0:C=B._rescale,m=e,A=s+r,y=i,v=-r,w=e+h*i,E=s+(1-c-p)*r,S=e+(h+u)*i,_=s+(1-c)*r;break;case 90:C=B._rescaleAndSwap,m=e,A=s,y=i,v=r,w=e+c*i,E=s+h*r,S=e+(c+p)*i,_=s+(h+u)*r;break;case 180:C=B._rescale,m=e+i,A=s,y=-i,v=r,w=e+(1-h-u)*i,E=s+c*r,S=e+(1-h)*i,_=s+(c+p)*r;break;case 270:C=B._rescaleAndSwap,m=e+i,A=s+r,y=-i,v=-r,w=e+(1-c-p)*i,E=s+(1-h-u)*r,S=e+(1-c)*i,_=s+(1-h)*r;break}for(const{line:T,points:x}
20of n(this,gs))o.push(C(T,m,A,y,v,a?new Array(T.length):null)),l.push(C(x,m,A,y,v,a?new Array(x.length):null));return{lines:o,points:l,rect:[w,E,S,_]}}static deserialize(e,s,i,r,a,{paths:{lines:o,points:l},rotation:h,thickness:c}){const u=[];let p,m,A,y,v;switch(h){case 0:v=B._rescale,p=-e/i,m=s/r+1,A=1/i,y=-1/r;break;case 90:v=B._rescaleAndSwap,p=-s/r,m=-e/i,A=1/r,y=1/i;break;case 180:v=B._rescale,p=e/i+1,m=-s/r,A=-1/i,y=1/r;break;case 270:v=B._rescaleAndSwap,p=s/r+1,m=e/i+1,A=-1/r,y=-1/i;break}if(!o){o=[];for(const E of l){const S=E.length;if(S===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1]]));continue}if(S===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1],NaN,NaN,NaN,NaN,E[2],E[3]]));continue}const _=new Float32Array(3*(S-2));o.push(_);let[C,T,x,P]=E.subarray(0,4);_.set([NaN,NaN,NaN,NaN,C,T],0);for(let R=4;R<S;R+=2){const D=E[R],M=E[R+1];_.set(B.createBezierPoints(C,T,x,P,D,M),(R-2)*3),[C,T,x,P]=[x,P,D,M]}}}for(let E=0,S=o.length;E<S;E++)u.push({line:v(o[E].map(_=>_??NaN),p,m,A,y),points:v(l[E].map(_=>_??NaN),p,m,A,y)});const w=new this.prototype.constructor;return w.build(u,i,r,1,h,c,a),w}get box(){return n(this,Fe)}updateProperty(e,s){return e==="stroke-width"?b(this,we,Bb).call(this,s):null}updateParentDimensions([e,s],i){const[r,a]=b(this,we,Li).call(this);f(this,Si,e),f(this,_i,s),f(this,Dl,i);const[o,l]=b(this,we,Li).call(this),h=o-r,c=l-a,u=n(this,Fe);return u[0]-=h,u[1]-=c,u[2]+=2*h,u[3]+=2*c,u}updateRotation(e){return f(this,id,e),{path:{transform:this.rotationTransform}}}get viewBox(){return n(this,Fe).map(B.svgRound).join(" ")}get defaultProperties(){const[e,s]=n(this,Fe);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(e)} ${B.svgRound(s)}`}}}get rotationTransform(){const[,,e,s]=n(this,Fe);let i=0,r=0,a=0,o=0,l=0,h=0;switch(n(this,id)){case 90:r=s/e,a=-e/s,l=e;break;case 180:i=-1,o=-1,l=e,h=s;break;case 270:r=-s/e,a=e/s,h=s;break;default:return""}return`matrix(${i} ${r} ${a} ${o} ${B.svgRound(l)} ${B.svgRound(h)})`}getPathResizingSVGProperties([e,s,i,r]){const[a,o]=b(this,we,Li).call(this),[l,h,c,u]=n(this,Fe);if(Math.abs(c-a)<=B.PRECISION||Math.abs(u-o)<=B.PRECISION){const v=e+i/2-(l+c/2),w=s+r/2-(h+u/2);return{path:{"transform-origin":`${B.svgRound(e)} ${B.svgRound(s)}`,transform:`${this.rotationTransform} translate(${v} ${w})`}}}const p=(i-2*a)/(c-2*a),m=(r-2*o)/(u-2*o),A=c/i,y=u/r;return{path:{"transform-origin":`${B.svgRound(l)} ${B.svgRound(h)}`,transform:`${this.rotationTransform} scale(${A} ${y}) translate(${B.svgRound(a)} ${B.svgRound(o)}) scale(${p} ${m}) translate(${B.svgRound(-a)} ${B.svgRound(-o)})`}}}getPathResizedSVGProperties([e,s,i,r]){const[a,o]=b(this,we,Li).call(this),l=n(this,Fe),[h,c,u,p]=l;if(l[0]=e,l[1]=s,l[2]=i,l[3]=r,Math.abs(u-a)<=B.PRECISION||Math.abs(p-o)<=B.PRECISION){const w=e+i/2-(h+u/2),E=s+r/2-(c+p/2);for(const{line:S,points:_}of n(this,gs))B._translate(S,w,E,S),B._translate(_,w,E,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(e)} ${B.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const m=(i-2*a)/(u-2*a),A=(r-2*o)/(p-2*o),y=-m*(h+a)+e+a,v=-A*(c+o)+s+o;if(m!==1||A!==1||y!==0||v!==0)for(const{line:w,points:E}of n(this,gs))B._rescale(w,y,v,m,A,w),B._rescale(E,y,v,m,A,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${B.svgRound(e)} ${B.svgRound(s)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,s],i){const[r,a]=i,o=n(this,Fe),l=e-o[0],h=s-o[1];if(n(this,Si)===r&&n(this,_i)===a)for(const{line:c,points:u}of n(this,gs))B._translate(c,l,h,c),B._translate(u,l,h,u);else{const c=n(this,Si)/r,u=n(this,_i)/a;f(this,Si,r),f(this,_i,a);for(const{line:p,points:m}of n(this,gs))B._rescale(p,l,h,c,u,p),B._rescale(m,l,h,c,u,m);o[2]*=c,o[3]*=u}return o[0]=e,o[1]=s,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${B.svgRound(e)} ${B.svgRound(s)}`}}}get defaultSVGProperties(){const e=n(this,Fe);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${B.svgRound(e[0])} ${B.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}Fe=new WeakMap,id=new WeakMap,nd=new WeakMap,gs=new WeakMap,Si=new WeakMap,_i=new WeakMap,Dl=new WeakMap,Ll=new WeakMap,Ba=new WeakMap,we=new WeakSet,Li=function(e=n(this,Ba)){const s=n(this,nd)+e/2*n(this,Dl);return n(this,Ll)%180===0?[s/n(this,Si),s/n(this,_i)]:[s/n(this,_i),s/n(this,Si)]},Nb=function(){const[e,s,i,r]=n(this,Fe),[a,o]=b(this,we,Li).call(this,0);return[e+a,s+o,i-2*a,r-2*o]},Ob=function(){const e=f(this,Fe,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:r}of n(this,gs)){if(r.length<=12){for(let l=4,h=r.length;l<h;l+=6)H.pointBoundingBox(r[l],r[l+1],e);continue}let a=r[4],o=r[5];for(let l=6,h=r.length;l<h;l+=6){const[c,u,p,m,A,y]=r.subarray(l,l+6);H.bezierBoundingBox(a,o,c,u,p,m,A,y,e),a=A,o=y}}const[s,i]=b(this,we,Li).call(this);e[0]=ke(e[0]-s,0,1),e[1]=ke(e[1]-i,0,1),e[2]=ke(e[2]+s,0,1),e[3]=ke(e[3]+i,0,1),e[2]-=e[0],e[3]-=e[1]},Bb=function(e){const[s,i]=b(this,we,Li).call(this);f(this,Ba,e);const[r,a]=b(this,we,Li).call(this),[o,l]=[r-s,a-i],h=n(this,Fe);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class $u extends Ib{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:xt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new $u(this._viewParameters);return t.updateAll(this),t}}var Du,Hb;const ho=class ho extends uu{constructor(e){super({...e,name:"inkEditor"});g(this,Du);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,s){xt.initialize(e,s),this._defaultDrawingOptions=new $u(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!0}static get typesMap(){return J(this,"typesMap",new Map([[st.INK_THICKNESS,"stroke-width"],[st.INK_COLOR,"stroke"],[st.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,s,i,r,a){return new aw(e,s,i,r,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,s,i,r,a,o){return ud.deserialize(e,s,i,r,a,o)}static async deserialize(e,s,i){let r=null;if(e instanceof $p){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,opacity:p,borderStyle:{rawWidth:m},popupRef:A,richText:y,contentsObj:v,creationDate:w,modificationDate:E},parent:{page:{pageNumber:S}}}=e;r=e={annotationType:X.INK,color:Array.from(u),thickness:m,opacity:p,paths:{points:o},boxes:null,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:A,richText:y,comment:(v==null?void 0:v.str)||null,creationDate:w,modificationDate:E}}const a=await super.deserialize(e,s,i);return a._initialData=r,e.comment&&a.setCommentData(e),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new hu(this)),[["colorPicker",this._colorPicker]]}get colorType(){return st.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:s,parent:i}=this;s.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(e,s.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:s,opacity:i}){this._drawingOptions=ho.getDefaultDrawingOptions({stroke:H.makeHexColor(...e),"stroke-width":s,"stroke-opacity":i})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:s,points:i}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":a,"stroke-width":o}}=this,l=Object.assign(super.serialize(e),{color:xt._colorManager.convert(r),opacity:a,thickness:o,paths:{lines:s,points:i}});return this.addComment(l),e?(l.isCopy=!0,l):this.annotationElementId&&!b(this,Du,Hb).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;const{points:s,rect:i}=this.serializeDraw(!1);return e.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:s,popup:this.comment}),null}};Du=new WeakSet,Hb=function(e){const{color:s,thickness:i,opacity:r,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==s[l])||e.thickness!==i||e.opacity!==r||e.pageIndex!==a},k(ho,"_type","ink"),k(ho,"_editorType",X.INK),k(ho,"_defaultDrawingOptions",null);let fp=ho;class pp extends ud{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const _d=8,Yl=3;var Ha,ct,gp,qs,Ub,$b,mp,Jd,jb,Gb,zb,bp,yp,Vb;class Pi{static extractContoursFromText(t,{fontFamily:e,fontStyle:s,fontWeight:i},r,a,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1});const u=200,p=c.font=`${s} ${i} ${u}px ${e}`,{actualBoundingBoxLeft:m,actualBoundingBoxRight:A,actualBoundingBoxAscent:y,actualBoundingBoxDescent:v,fontBoundingBoxAscent:w,fontBoundingBoxDescent:E,width:S}=c.measureText(t),_=1.5,C=Math.ceil(Math.max(Math.abs(m)+Math.abs(A)||0,S)*_),T=Math.ceil(Math.max(Math.abs(y)+Math.abs(v)||u,Math.abs(w)+Math.abs(E)||u)*_);h=new OffscreenCanvas(C,T),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=p,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,C,T),c.fillStyle="black",c.fillText(t,C*(_-1)/2,T*(3-_)/2);const x=b(this,ct,bp).call(this,c.getImageData(0,0,C,T).data),P=b(this,ct,zb).call(this,x),R=b(this,ct,yp).call(this,P),D=b(this,ct,mp).call(this,x,C,T,R);return this.processDrawnLines({lines:{curves:D,width:C,height:T},pageWidth:r,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(t,e,s,i,r){const[a,o,l]=b(this,ct,Vb).call(this,t),[h,c]=b(this,ct,Gb).call(this,a,o,l,Math.hypot(o,l)*n(this,Ha).sigmaSFactor,n(this,Ha).sigmaR,n(this,Ha).kernelSize),u=b(this,ct,yp).call(this,c),p=b(this,ct,mp).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:e,pageHeight:s,rotation:i,innerMargin:r,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:i,innerMargin:r,mustSmooth:a,areContours:o}){i%180!==0&&([e,s]=[s,e]);const{curves:l,width:h,height:c}=t,u=t.thickness??0,p=[],m=Math.min(e/h,s/c),A=m/e,y=m/s,v=[];for(const{points:E}of l){const S=a?b(this,ct,jb).call(this,E):E;if(!S)continue;v.push(S);const _=S.length,C=new Float32Array(_),T=new Float32Array(3*(_===2?2:_-2));if(p.push({line:T,points:C}),_===2){C[0]=S[0]*A,C[1]=S[1]*y,T.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[x,P,R,D]=S;x*=A,P*=y,R*=A,D*=y,C.set([x,P,R,D],0),T.set([NaN,NaN,NaN,NaN,x,P],0);for(let M=4;M<_;M+=2){const U=C[M]=S[M]*A,z=C[M+1]=S[M+1]*y;T.set(B.createBezierPoints(x,P,R,D,U,z),(M-2)*3),[x,P,R,D]=[R,D,U,z]}}if(p.length===0)return null;const w=o?new pp:new ud;return w.build(p,e,s,1,i,o?0:u,r),{outline:w,newCurves:v,areContours:o,thickness:u,width:h,height:c}}static async compressSignature({outlines:t,areContours:e,thickness:s,width:i,height:r}){let a=1/0,o=-1/0,l=0;for(const S of t){l+=S.length;for(let _=2,C=S.length;_<C;_++){const T=S[_]-S[_-2];a=Math.min(a,T),o=Math.max(o,T)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const c=t.length,u=_d+Yl*c,p=new Uint32Array(u);let m=0;p[m++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,p[m++]=0,p[m++]=i,p[m++]=r,p[m++]=e?0:1,p[m++]=Math.max(0,Math.floor(s??0)),p[m++]=c,p[m++]=h.BYTES_PER_ELEMENT;for(const S of t)p[m++]=S.length-2,p[m++]=S[0],p[m++]=S[1];const A=new CompressionStream("deflate-raw"),y=A.writable.getWriter();await y.ready,y.write(p);const v=h.prototype.constructor;for(const S of t){const _=new v(S.length-2);for(let C=2,T=S.length;C<T;C++)_[C-2]=S[C]-S[C-2];y.write(_)}y.close();const w=await new Response(A.readable).arrayBuffer(),E=new Uint8Array(w);return $g(E)}static async decompressSignature(t){try{const e=My(t),{readable:s,writable:i}=new DecompressionStream("deflate-raw"),r=i.getWriter();await r.ready,r.write(e).then(async()=>{await r.ready,await r.close()}).catch(()=>{});let a=null,o=0;
20for await(const S of s)a||(a=new Uint8Array(new Uint32Array(S.buffer,0,4)[0])),a.set(S,o),o+=S.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const c=l[2],u=l[3],p=l[4]===0,m=l[5],A=l[6],y=l[7],v=[],w=(_d+Yl*A)*Uint32Array.BYTES_PER_ELEMENT;let E;switch(y){case Int8Array.BYTES_PER_ELEMENT:E=new Int8Array(a.buffer,w);break;case Int16Array.BYTES_PER_ELEMENT:E=new Int16Array(a.buffer,w);break;case Int32Array.BYTES_PER_ELEMENT:E=new Int32Array(a.buffer,w);break}o=0;for(let S=0;S<A;S++){const _=l[Yl*S+_d],C=new Float32Array(_+2);v.push(C);for(let T=0;T<Yl-1;T++)C[T]=l[Yl*S+_d+T+1];for(let T=0;T<_;T++)C[T+2]=C[T]+E[o++]}return{areContours:p,thickness:m,outlines:v,width:c,height:u}}catch(e){return q(`decompressSignature: ${e}`),null}}}Ha=new WeakMap,ct=new WeakSet,gp=function(t,e,s,i){return s-=t,i-=e,s===0?i>0?0:4:s===1?i+6:2-i},qs=new WeakMap,Ub=function(t,e,s,i,r,a,o){const l=b(this,ct,gp).call(this,s,i,r,a);for(let h=0;h<8;h++){const c=(-h+l-o+16)%8,u=n(this,qs)[2*c],p=n(this,qs)[2*c+1];if(t[(s+u)*e+(i+p)]!==0)return c}return-1},$b=function(t,e,s,i,r,a,o){const l=b(this,ct,gp).call(this,s,i,r,a);for(let h=0;h<8;h++){const c=(h+l+o+16)%8,u=n(this,qs)[2*c],p=n(this,qs)[2*c+1];if(t[(s+u)*e+(i+p)]!==0)return c}return-1},mp=function(t,e,s,i){const r=t.length,a=new Int32Array(r);for(let c=0;c<r;c++)a[c]=t[c]<=i?1:0;for(let c=1;c<s-1;c++)a[c*e]=a[c*e+e-1]=0;for(let c=0;c<e;c++)a[c]=a[e*s-1-c]=0;let o=1,l;const h=[];for(let c=1;c<s-1;c++){l=1;for(let u=1;u<e-1;u++){const p=c*e+u,m=a[p];if(m===0)continue;let A=c,y=u;if(m===1&&a[p-1]===0)o+=1,y-=1;else if(m>=1&&a[p+1]===0)o+=1,y+=1,m>1&&(l=m);else{m!==1&&(l=Math.abs(m));continue}const v=[u,c],w=y===u+1,E={isHole:w,points:v,id:o,parent:0};h.push(E);let S;for(const M of h)if(M.id===l){S=M;break}S?S.isHole?E.parent=w?S.parent:l:E.parent=w?l:S.parent:E.parent=w?l:0;const _=b(this,ct,Ub).call(this,a,e,c,u,A,y,0);if(_===-1){a[p]=-o,a[p]!==1&&(l=Math.abs(a[p]));continue}let C=n(this,qs)[2*_],T=n(this,qs)[2*_+1];const x=c+C,P=u+T;A=x,y=P;let R=c,D=u;for(;;){const M=b(this,ct,$b).call(this,a,e,R,D,A,y,1);C=n(this,qs)[2*M],T=n(this,qs)[2*M+1];const U=R+C,z=D+T;v.push(z,U);const O=R*e+D;if(a[O+1]===0?a[O]=-o:a[O]===1&&(a[O]=o),U===c&&z===u&&R===x&&D===P){a[p]!==1&&(l=Math.abs(a[p]));break}else A=R,y=D,R=U,D=z}}}return h},Jd=function(t,e,s,i){if(s-e<=4){for(let x=e;x<s-2;x+=2)i.push(t[x],t[x+1]);return}const r=t[e],a=t[e+1],o=t[s-4]-r,l=t[s-3]-a,h=Math.hypot(o,l),c=o/h,u=l/h,p=c*a-u*r,m=l/o,A=1/h,y=Math.atan(m),v=Math.cos(y),w=Math.sin(y),E=A*(Math.abs(v)+Math.abs(w)),S=A*(1-E+E**2),_=Math.max(Math.atan(Math.abs(w+v)*S),Math.atan(Math.abs(w-v)*S));let C=0,T=e;for(let x=e+2;x<s-2;x+=2){const P=Math.abs(p-c*t[x+1]+u*t[x]);P>C&&(T=x,C=P)}C>(h*_)**2?(b(this,ct,Jd).call(this,t,e,T+2,i),b(this,ct,Jd).call(this,t,T,s,i)):i.push(r,a)},jb=function(t){const e=[],s=t.length;return b(this,ct,Jd).call(this,t,0,s,e),e.push(t[s-2],t[s-1]),e.length<=4?null:e},Gb=function(t,e,s,i,r,a){const o=new Float32Array(a**2),l=-2*i**2,h=a>>1;for(let y=0;y<a;y++){const v=(y-h)**2;for(let w=0;w<a;w++)o[y*a+w]=Math.exp((v+(w-h)**2)/l)}const c=new Float32Array(256),u=-2*r**2;for(let y=0;y<256;y++)c[y]=Math.exp(y**2/u);const p=t.length,m=new Uint8Array(p),A=new Uint32Array(256);for(let y=0;y<s;y++)for(let v=0;v<e;v++){const w=y*e+v,E=t[w];let S=0,_=0;for(let T=0;T<a;T++){const x=y+T-h;if(!(x<0||x>=s))for(let P=0;P<a;P++){const R=v+P-h;if(R<0||R>=e)continue;const D=t[x*e+R],M=o[T*a+P]*c[Math.abs(D-E)];S+=D*M,_+=M}}const C=m[w]=Math.round(S/_);A[C]++}return[m,A]},zb=function(t){const e=new Uint32Array(256);for(const s of t)e[s]++;return e},bp=function(t){const e=t.length,s=new Uint8ClampedArray(e>>2);let i=-1/0,r=1/0;for(let o=0,l=s.length;o<l;o++){const h=s[o]=t[o<<2];i=Math.max(i,h),r=Math.min(r,h)}const a=255/(i-r);for(let o=0,l=s.length;o<l;o++)s[o]=(s[o]-r)*a;return s},yp=function(t){let e,s=-1/0,i=-1/0;const r=t.findIndex(l=>l!==0);let a=r,o=r;for(e=r;e<256;e++){const l=t[e];l>s&&(e-a>i&&(i=e-a,o=e-1),s=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},Vb=function(t){const e=t,{width:s,height:i}=t,{maxDim:r}=n(this,Ha);let a=s,o=i;if(s>r||i>r){let p=s,m=i,A=Math.log2(Math.max(s,i)/r);const y=Math.floor(A);A=A===y?y-1:y;for(let w=0;w<A;w++){a=Math.ceil(p/2),o=Math.ceil(m/2);const E=new OffscreenCanvas(a,o);E.getContext("2d").drawImage(t,0,0,p,m,0,0,a,o),p=a,m=o,t!==e&&t.close(),t=E.transferToImageBitmap()}const v=Math.min(r/a,r/o);a=Math.round(a*v),o=Math.round(o*v)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,a,o),h.filter="grayscale(1)",h.drawImage(t,0,0,t.width,t.height,0,0,a,o);const c=h.getImageData(0,0,a,o).data;return[b(this,ct,bp).call(this,c),a,o]},g(Pi,ct),g(Pi,Ha,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),g(Pi,qs,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Gp extends Ib{constructor(){super(),super.updateProperties({fill:xt._defaultLineColor,"stroke-width":0})}clone(){const t=new Gp;return t.updateAll(this),t}}class zp extends $u{constructor(t){super(t),super.updateProperties({stroke:xt._defaultLineColor,"stroke-width":1})}clone(){const t=new zp(this._viewParameters);return t.updateAll(this),t}}var ur,Ci,fr,Ua;const Ze=class Ze extends uu{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});g(this,ur,!1);g(this,Ci,null);g(this,fr,null);g(this,Ua,null);this._willKeepAspectRatio=!0,f(this,fr,e.signatureData||null),f(this,Ci,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,s){xt.initialize(e,s),this._defaultDrawingOptions=new Gp,this._defaultDrawnSignatureOptions=new zp(s.viewParameters)}static getDefaultDrawingOptions(e){const s=this._defaultDrawingOptions.clone();return s.updateProperties(e),s}static get supportMultipleDrawings(){return!1}static get typesMap(){return J(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!n(this,Ci)}}static computeTelemetryFinalData(e){const s=e.get("hasDescription");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}
20render(){if(this.div)return this.div;let e,s;const{_isCopy:i}=this;if(i&&(this._isCopy=!1,e=this.x,s=this.y),super.render(),this._drawId===null)if(n(this,fr)){const{lines:r,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:c}=n(this,fr),{rawDims:{pageWidth:u,pageHeight:p},rotation:m}=this.parent.viewport,A=Pi.processDrawnLines({lines:r,pageWidth:u,pageHeight:p,rotation:m,innerMargin:Ze._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(A,c,l,h)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:n(this,Ci)||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(e,s)),this.div}setUuid(e){f(this,Ua,e),this.addEditToolbar()}getUuid(){return n(this,Ua)}get description(){return n(this,Ci)}set description(e){f(this,Ci,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(s=>{s==null||s.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:s,thickness:i,width:r,height:a}=n(this,fr),o=Math.max(r,a),l=Pi.processDrawnLines({lines:{curves:e.map(h=>({points:h})),thickness:i,width:r,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:s});return{areContours:s,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,s,i,r){const{x:a,y:o}=this,{outline:l}=f(this,fr,e);f(this,ur,l instanceof pp),this.description=i;let h;n(this,ur)?h=Ze.getDefaultDrawingOptions():(h=Ze._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[,c]=this.pageDimensions;let u=s/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(r),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!r,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:r}=this.parent.viewport;return Pi.process(e,s,i,r,Ze._INNER_MARGIN)}getFromText(e,s){const{rawDims:{pageWidth:i,pageHeight:r},rotation:a}=this.parent.viewport;return Pi.extractContoursFromText(e,s,i,r,a,Ze._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:s,pageHeight:i},rotation:r}=this.parent.viewport;return Pi.processDrawnLines({lines:e,pageWidth:s,pageHeight:i,rotation:r,innerMargin:Ze._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:s}){e?this._drawingOptions=Ze.getDefaultDrawingOptions():(this._drawingOptions=Ze._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":s}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:s,points:i}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:n(this,ur),color:[0,0,0],thickness:n(this,ur)?0:r});return this.addComment(a),e?(a.paths={lines:s,points:i},a.uuid=n(this,Ua),a.isCopy=!0):a.lines=s,n(this,Ci)&&(a.accessibilityData={type:"Figure",alt:n(this,Ci)}),a}static deserializeDraw(e,s,i,r,a,o){return o.areContours?pp.deserialize(e,s,i,r,a,o):ud.deserialize(e,s,i,r,a,o)}static async deserialize(e,s,i){var a;const r=await super.deserialize(e,s,i);return f(r,ur,e.areContours),r.description=((a=e.accessibilityData)==null?void 0:a.alt)||"",f(r,Ua,e.uuid),r}};ur=new WeakMap,Ci=new WeakMap,fr=new WeakMap,Ua=new WeakMap,k(Ze,"_type","signature"),k(Ze,"_editorType",X.SIGNATURE),k(Ze,"_defaultDrawingOptions",null);let Ap=Ze;var Dt,he,pr,un,gr,Il,fn,$a,Ti,ms,Fl,ot,gh,mh,Qd,Zd,tu,vp,eu,Wb;class wp extends xt{constructor(e){super({...e,name:"stampEditor"});g(this,ot);g(this,Dt,null);g(this,he,null);g(this,pr,null);g(this,un,null);g(this,gr,null);g(this,Il,"");g(this,fn,null);g(this,$a,!1);g(this,Ti,null);g(this,ms,!1);g(this,Fl,!1);f(this,un,e.bitmapUrl),f(this,gr,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,s){xt.initialize(e,s)}static isHandlingMimeForPasting(e){return nu.includes(e)}static paste(e,s){s.pasteEditor({mode:X.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const s=e.get("hasAltText");return{hasAltText:s.get(!0)??0,hasNoAltText:s.get(!1)??0}}async mlGuessAltText(e=null,s=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await i.guess({name:"altText",request:{data:r,width:a,height:o,channels:r.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),s&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e;n(this,he)&&(f(this,Dt,null),this._uiManager.imageManager.deleteId(n(this,he)),(e=n(this,fn))==null||e.remove(),f(this,fn,null),n(this,Ti)&&(clearTimeout(n(this,Ti)),f(this,Ti,null))),super.remove()}rebuild(){if(!this.parent){n(this,he)&&b(this,ot,Qd).call(this);return}super.rebuild(),this.div!==null&&(n(this,he)&&n(this,fn)===null&&b(this,ot,Qd).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(n(this,pr)||n(this,Dt)||n(this,un)||n(this,gr)||n(this,he)||n(this,$a))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}
20render(){if(this.div)return this.div;let e,s;return this._isCopy&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.createAltText(),n(this,$a)||(n(this,Dt)?b(this,ot,Zd).call(this):b(this,ot,Qd).call(this)),this._isCopy&&this._moveAfterPaste(e,s),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,s){const{id:i,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,s);s.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(f(this,he,i),r&&f(this,Dt,r),f(this,$a,!1),b(this,ot,Zd).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;n(this,Ti)!==null&&clearTimeout(n(this,Ti)),f(this,Ti,setTimeout(()=>{f(this,Ti,null),b(this,ot,vp).call(this)},200))}copyCanvas(e,s,i=!1){e||(e=224);const{width:r,height:a}=n(this,Dt),o=new Zs;let l=n(this,Dt),h=r,c=a,u=null;if(s){if(r>s||a>s){const x=Math.min(s/r,s/a);h=Math.floor(r*x),c=Math.floor(a*x)}u=document.createElement("canvas");const m=u.width=Math.ceil(h*o.sx),A=u.height=Math.ceil(c*o.sy);n(this,ms)||(l=b(this,ot,tu).call(this,m,A));const y=u.getContext("2d");y.filter=this._uiManager.hcmFilter;let v="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":Iy.isDarkMode&&(v="#8f8f9d",w="#42414d");const E=15,S=E*o.sx,_=E*o.sy,C=new OffscreenCanvas(S*2,_*2),T=C.getContext("2d");T.fillStyle=v,T.fillRect(0,0,S*2,_*2),T.fillStyle=w,T.fillRect(0,0,S,_),T.fillRect(S,_,S,_),y.fillStyle=y.createPattern(C,"repeat"),y.fillRect(0,0,m,A),y.drawImage(l,0,0,l.width,l.height,0,0,m,A)}let p=null;if(i){let m,A;if(o.symmetric&&l.width<e&&l.height<e)m=l.width,A=l.height;else if(l=n(this,Dt),r>e||a>e){const w=Math.min(e/r,e/a);m=Math.floor(r*w),A=Math.floor(a*w),n(this,ms)||(l=b(this,ot,tu).call(this,m,A))}const v=new OffscreenCanvas(m,A).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,m,A),p={width:m,height:A,data:v.getImageData(0,0,m,A).data}}return{canvas:u,width:h,height:c,imageData:p}}static async deserialize(e,s,i){var v;let r=null,a=!1;if(e instanceof lb){const{data:{rect:w,rotation:E,id:S,structParent:_,popupRef:C,richText:T,contentsObj:x,creationDate:P,modificationDate:R},container:D,parent:{page:{pageNumber:M}},canvas:U}=e;let z,O;U?(delete e.canvas,{id:z,bitmap:O}=i.imageManager.getFromCanvas(D.id,U),U.remove()):(a=!0,e._hasNoCanvas=!0);const W=((v=await s._structTree.getAriaAttributes(`${Dp}${S}`))==null?void 0:v.get("aria-label"))||"";r=e={annotationType:X.STAMP,bitmapId:z,bitmap:O,pageIndex:M-1,rect:w.slice(0),rotation:E,annotationElementId:S,id:S,deleted:!1,accessibilityData:{decorative:!1,altText:W},isSvg:!1,structParent:_,popupRef:C,richText:T,comment:(x==null?void 0:x.str)||null,creationDate:P,modificationDate:R}}const o=await super.deserialize(e,s,i),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:u,isSvg:p,accessibilityData:m}=e;a?(i.addMissingCanvas(e.id,o),f(o,$a,!0)):u&&i.imageManager.isValidId(u)?(f(o,he,u),h&&f(o,Dt,h)):f(o,un,c),f(o,ms,p);const[A,y]=o.pageDimensions;return o.width=(l[2]-l[0])/A,o.height=(l[3]-l[1])/y,m&&(o.altTextData=m),o._initialData=r,e.comment&&o.setCommentData(e),f(o,Fl,!!r),o}serialize(e=!1,s=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Object.assign(super.serialize(e),{bitmapId:n(this,he),isSvg:n(this,ms)});if(this.addComment(i),e)return i.bitmapUrl=b(this,ot,eu).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;const{decorative:r,altText:a}=this.serializeAltText(!1);if(!r&&a&&(i.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=b(this,ot,Wb).call(this,i);return l.isSame?null:(l.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(s===null)return i;s.stamps||(s.stamps=new Map);const o=n(this,ms)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(n(this,he)))s.stamps.set(n(this,he),{area:o,serialized:i}),i.bitmap=b(this,ot,eu).call(this,!1);else if(n(this,ms)){const l=s.stamps.get(n(this,he));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=b(this,ot,eu).call(this,!1))}return i}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}
20Dt=new WeakMap,he=new WeakMap,pr=new WeakMap,un=new WeakMap,gr=new WeakMap,Il=new WeakMap,fn=new WeakMap,$a=new WeakMap,Ti=new WeakMap,ms=new WeakMap,Fl=new WeakMap,ot=new WeakSet,gh=function(e,s=!1){if(!e){this.remove();return}f(this,Dt,e.bitmap),s||(f(this,he,e.id),f(this,ms,e.isSvg)),e.file&&f(this,Il,e.file.name),b(this,ot,Zd).call(this)},mh=function(){if(f(this,pr,null),this._uiManager.enableWaiting(!1),!!n(this,fn)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Dt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Dt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Qd=function(){if(n(this,he)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(n(this,he)).then(i=>b(this,ot,gh).call(this,i,!0)).finally(()=>b(this,ot,mh).call(this));return}if(n(this,un)){const i=n(this,un);f(this,un,null),this._uiManager.enableWaiting(!0),f(this,pr,this._uiManager.imageManager.getFromUrl(i).then(r=>b(this,ot,gh).call(this,r)).finally(()=>b(this,ot,mh).call(this)));return}if(n(this,gr)){const i=n(this,gr);f(this,gr,null),this._uiManager.enableWaiting(!0),f(this,pr,this._uiManager.imageManager.getFromFile(i).then(r=>b(this,ot,gh).call(this,r)).finally(()=>b(this,ot,mh).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=nu.join(",");const s=this._uiManager._signal;f(this,pr,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const r=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,ot,gh).call(this,r)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>b(this,ot,mh).call(this))),e.click()},Zd=function(){var h;const{div:e}=this;let{width:s,height:i}=n(this,Dt);const[r,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*r,i=this.height*a;else if(s>o*r||i>o*a){const c=Math.min(o*r/s,o*a/i);s*=c,i*=c}this._uiManager.enableWaiting(!1);const l=f(this,fn,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=s/r,this.height=i/a,this.setDims(),(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,ot,vp).call(this),n(this,Fl)||(this.parent.addUndoableEditor(this),f(this,Fl,!0)),this._reportTelemetry({action:"inserted_image"}),n(this,Il)&&this.div.setAttribute("aria-description",n(this,Il)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},tu=function(e,s){const{width:i,height:r}=n(this,Dt);let a=i,o=r,l=n(this,Dt);for(;a>2*e||o>2*s;){const h=a,c=o;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*s&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,c,0,0,a,o),l=u.transferToImageBitmap()}return l},vp=function(){const[e,s]=this.parentDimensions,{width:i,height:r}=this,a=new Zs,o=Math.ceil(i*e*a.sx),l=Math.ceil(r*s*a.sy),h=n(this,fn);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const c=n(this,ms)?n(this,Dt):b(this,ot,tu).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,o,l)},eu=function(e){if(e){if(n(this,ms)){const r=this._uiManager.imageManager.getSvgUrl(n(this,he));if(r)return r}const s=document.createElement("canvas");return{width:s.width,height:s.height}=n(this,Dt),s.getContext("2d").drawImage(n(this,Dt),0,0),s.toDataURL()}if(n(this,ms)){const[s,i]=this.pageDimensions,r=Math.round(this.width*s*wn.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*wn.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(r,a);return o.getContext("2d").drawImage(n(this,Dt),0,0,n(this,Dt).width,n(this,Dt).height,0,0,r,a),o.transferToImageBitmap()}return structuredClone(n(this,Dt))},Wb=function(e){var o;const{pageIndex:s,accessibilityData:{altText:i}}=this._initialData,r=e.pageIndex===s,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&a,isSameAltText:a}}
20,k(wp,"_type","stamp"),k(wp,"_editorType",X.STAMP);var ja,Nl,mr,br,pn,qe,yr,Ol,Bl,Ys,gn,ce,mn,Ar,Hl,j,wr,St,Ep,Xb,ii,Sp,_p,su;const Bs=class Bs{constructor({uiManager:t,pageIndex:e,div:s,structTreeLayer:i,accessibilityManager:r,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:c}){g(this,St);g(this,ja);g(this,Nl,!1);g(this,mr,null);g(this,br,null);g(this,pn,null);g(this,qe,new Map);g(this,yr,!1);g(this,Ol,!1);g(this,Bl,!1);g(this,Ys,null);g(this,gn,null);g(this,ce,null);g(this,mn,null);g(this,Ar,null);g(this,Hl,-1);g(this,j);const u=[...n(Bs,wr).values()];if(!Bs._initialized){Bs._initialized=!0;for(const p of u)p.initialize(c,t)}t.registerEditorTypes(u),f(this,j,t),this.pageIndex=e,this.div=s,f(this,ja,r),f(this,mr,a),this.viewport=h,f(this,ce,l),this.drawLayer=o,this._structTree=i,n(this,j).addLayer(this)}get isEmpty(){return n(this,qe).size===0}get isInvisible(){return this.isEmpty&&n(this,j).getMode()===X.NONE}updateToolbar(t){n(this,j).updateToolbar(t)}updateMode(t=n(this,j).getMode()){switch(b(this,St,su).call(this),t){case X.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case X.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case X.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===X.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const s of n(Bs,wr).values())e.toggle(`${s._type}Editing`,t===s._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=n(this,ce))==null?void 0:e.div)}setEditingState(t){n(this,j).setEditingState(t)}addCommands(t){n(this,j).addCommands(t)}cleanUndoStack(t){n(this,j).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=n(this,mr))==null||e.div.classList.toggle("disabled",!t)}async enable(){var s;f(this,Bl,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(s=n(this,Ar))==null||s.abort(),f(this,Ar,null);const t=new Set;for(const i of n(this,St,Ep))i.enableEditing(),i.show(!0),i.annotationElementId&&(n(this,j).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));const e=n(this,mr);if(e)for(const i of e.getEditableAnnotations()){if(i.hide(),n(this,j).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;const r=await this.deserialize(i);r&&(this.addOrRebuild(r),r.enableEditing())}f(this,Bl,!1),n(this,j)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var s;if(f(this,Ol,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),n(this,ce)&&!n(this,Ar)){f(this,Ar,new AbortController);const i=n(this,j).combinedSignal(n(this,Ar));n(this,ce).div.addEventListener("pointerdown",r=>{const{clientX:o,clientY:l,timeStamp:h}=r,c=n(this,Hl);if(h-c>500){f(this,Hl,h);return}f(this,Hl,-1);const{classList:u}=this.div;u.toggle("getElements",!0);const p=document.elementsFromPoint(o,l);if(u.toggle("getElements",!1),!this.div.contains(p[0]))return;let m;const A=new RegExp(`^${yh}[0-9]+$`);for(const v of p)if(A.test(v.id)){m=v.id;break}if(!m)return;const y=n(this,qe).get(m);(y==null?void 0:y.annotationElementId)===null&&(r.stopPropagation(),r.preventDefault(),y.dblclick(r))},{signal:i,capture:!0})}const t=n(this,mr);if(t){const i=new Map,r=new Map;for(const o of n(this,St,Ep)){if(o.disableEditing(),!o.annotationElementId){o.updateFakeAnnotationElement(t);continue}if(o.serialize()!==null){i.set(o.annotationElementId,o);continue}else r.set(o.annotationElementId,o);(s=this.getEditableAnnotation(o.annotationElementId))==null||s.show(),o.remove()}const a=t.getEditableAnnotations();for(const o of a){const{id:l}=o.data;if(n(this,j).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0}
20);continue}let h=r.get(l);if(h){h.resetAnnotationElement(o),h.show(!1),o.show();continue}h=i.get(l),h&&(n(this,j).addChangedExistingAnnotation(h),h.renderAnnotationElement(o)&&h.show(!1)),o.show()}}b(this,St,su).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const i of n(Bs,wr).values())e.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),f(this,Ol,!1)}getEditableAnnotation(t){var e;return((e=n(this,mr))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){n(this,j).getActive()!==t&&n(this,j).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=n(this,ce))!=null&&t.div&&!n(this,mn)){f(this,mn,new AbortController);const e=n(this,j).combinedSignal(n(this,mn));n(this,ce).div.addEventListener("pointerdown",b(this,St,Xb).bind(this),{signal:e}),n(this,ce).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=n(this,ce))!=null&&t.div&&n(this,mn)&&(n(this,mn).abort(),f(this,mn,null),n(this,ce).div.classList.remove("highlighting"))}enableClick(){if(n(this,br))return;f(this,br,new AbortController);const t=n(this,j).combinedSignal(n(this,br));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=n(this,br))==null||t.abort(),f(this,br,null)}attach(t){n(this,qe).set(t.id,t);const{annotationElementId:e}=t;e&&n(this,j).isDeletedAnnotationElement(e)&&n(this,j).removeDeletedAnnotationElement(t)}detach(t){var e;n(this,qe).delete(t.id),(e=n(this,ja))==null||e.removePointerInTextLayer(t.contentDiv),!n(this,Ol)&&t.annotationElementId&&n(this,j).addDeletedAnnotationElement(t)}remove(t){this.detach(t),n(this,j).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(n(this,j).addDeletedAnnotationElement(t.annotationElementId),xt.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||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),n(this,j).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!n(this,Bl)),n(this,j).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!n(this,pn)&&(t._focusEventsAllowed=!1,f(this,pn,setTimeout(()=>{f(this,pn,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:n(this,j)._signal}),e.focus())},0))),t._structTreeParentId=(s=n(this,ja))==null?void 0:s.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){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getEditorByUID(t){for(const e of n(this,qe).values())if(e.uid===t)return e;return null}getNextId(){return n(this,j).getId()}combinedSignal(t){return n(this,j).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=n(this,St,ii))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await n(this,j).updateMode(t.mode);const{offsetX:s,offsetY:i}=b(this,St,_p).call(this),r=this.getNextId(),a=b(this,St,Sp).call(this,{parent:this,id:r,x:s,y:i,uiManager:n(this,j),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=n(Bs,wr).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,n(this,j)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),r=b(this,St,Sp).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:n(this,j),isCentered:e,...s});return r&&this.add(r),r}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,St,_p).call(this),!0,t)}setSelected(t){n(this,j).setSelected(t)}toggleSelected(t){n(this,j).toggleSelected(t)}unselect(t){n(this,j).unselect(t)}pointerup(t){var i;const{isMac:e}=de.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!n(this,yr)||(f(this,yr,!1),(i=n(this,St,ii))!=null&&i.isDrawer&&n(this,St,ii).supportMultipleDrawings))return;if(!n(this,Nl)){f(this,Nl,!0);return}const s=n(this,j).getMode();if(s===X.STAMP||s===X.SIGNATURE){n(this,j).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var i;if(n(this,j).getMode()===X.HIGHLIGHT&&this.enableTextSelection(),n(this,yr)){f(this,yr,!1);return}const{isMac:e}=de.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(f(this,yr,!0),(i=n(this,St,ii))!=null&&i.isDrawer){this.startDrawingSession(t);return}const s=n(this,j).getActive();f(this,Nl,!s||s.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),n(this,Ys)){n(this,St,ii).startDrawing(this,n(this,j),!1,t);return}n(this,j).setCurrentDrawingSession(this),f(this,Ys,new AbortController);const e=n(this,j).combinedSignal(n(this,Ys));this.div.addEventListener("blur",({relatedTarget:s})=>{s&&!this.div.contains(s)&&(f(this,gn,null),this.commitOrRemove())},{signal:e}),n(this,St,ii).startDrawing(this,n(this,j),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&f(this,gn,e);return}n(this,gn)&&setTimeout(()=>{var e;(e=n(this,gn))==null||e.focus(),f(this,gn,null)},0)}endDrawingSession(t=!1){return n(this,Ys)?(n(this,j).setCurrentDrawingSession(null),n(this,Ys).abort(),f(this,Ys,null),f(this,gn,null),n(this,St,ii).endDrawing(t)):null}findNewParent(t,e,s){const i=n(this,j).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}commitOrRemove(){return n(this,Ys)?(this.endDrawingSession(),!0):!1}onScaleChanging(){n(this,Ys)&&n(this,St,ii).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=n(this,j).getActive())==null?void 0:t.parent)===this&&(n(this,j).commitOrRemove(),n(this,j).setActiveEditor(null)),n(this,pn)&&(clearTimeout(n(this,pn)),f(this,pn,null));for(const s of n(this,qe).values())(e=n(this,ja))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,n(this,qe).clear(),n(this,j).removeLayer(this)}render({viewport:t}){this.viewport=t,vr(this.div,t);for(const e of n(this,j).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){n(this,j).commitOrRemove(),b(this,St,su).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,vr(this.div,{rotation:s}),e!==s)for(const i of n(this,qe).values())i.rotate(s)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return n(this,j).viewParameters.realScale}};ja=new WeakMap,Nl=new WeakMap,mr=new WeakMap,br=new WeakMap,pn=new WeakMap,qe=new WeakMap,yr=new WeakMap,Ol=new WeakMap,Bl=new WeakMap,Ys=new WeakMap,gn=new WeakMap,ce=new WeakMap,mn=new WeakMap,Ar=new WeakMap,Hl
20=new WeakMap,j=new WeakMap,wr=new WeakMap,St=new WeakSet,Ep=function(){return n(this,qe).size!==0?n(this,qe).values():n(this,j).getEditors(this.pageIndex)},Xb=function(t){n(this,j).unselectAll();const{target:e}=t;if(e===n(this,ce).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&n(this,ce).div.contains(e)){const{isMac:s}=de.platform;if(t.button!==0||t.ctrlKey&&s)return;n(this,j).showAllEditors("highlight",!0,!0),n(this,ce).div.classList.add("free"),this.toggleDrawing(),du.startHighlighting(this,n(this,j).direction==="ltr",{target:n(this,ce).div,x:t.x,y:t.y}),n(this,ce).div.addEventListener("pointerup",()=>{n(this,ce).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:n(this,j)._signal}),t.preventDefault()}},ii=function(){return n(Bs,wr).get(n(this,j).getMode())},Sp=function(t){const e=n(this,St,ii);return e?new e.prototype.constructor(t):null},_p=function(){const{x:t,y:e,width:s,height:i}=this.boundingClientRect,r=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),l=Math.min(window.innerHeight,e+i),h=(r+o)/2-t,c=(a+l)/2-e,[u,p]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:u,offsetY:p}},su=function(){for(const t of n(this,qe).values())t.isEmpty()&&t.remove()},k(Bs,"_initialized",!1),g(Bs,wr,new Map([ip,fp,wp,du,Ap].map(t=>[t._editorType,t])));let fu=Bs;var Ks,Ne,Ga,rd,Lu,qb,Ri,Cp,Yb,Tp;const Qt=class Qt{constructor({pageIndex:t}){g(this,Ri);g(this,Ks,null);g(this,Ne,new Map);g(this,Ga,new Map);this.pageIndex=t}setParent(t){if(!n(this,Ks)){f(this,Ks,t);return}if(n(this,Ks)!==t){if(n(this,Ne).size>0)for(const e of n(this,Ne).values())e.remove(),t.append(e);f(this,Ks,t)}}static get _svgFactory(){return J(this,"_svgFactory",new Ch)}draw(t,e=!1,s=!1){const i=Jt(Qt,rd)._++,r=b(this,Ri,Cp).call(this),a=Qt._svgFactory.createElement("defs");r.append(a);const o=Qt._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&n(this,Ga).set(i,o);const h=s?b(this,Ri,Yb).call(this,a,l):null,c=Qt._svgFactory.createElement("use");return r.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(r,t),n(this,Ne).set(i,r),{id:i,clipPathId:`url(#${h})`}}drawOutline(t,e){const s=Jt(Qt,rd)._++,i=b(this,Ri,Cp).call(this),r=Qt._svgFactory.createElement("defs");i.append(r);const a=Qt._svgFactory.createElement("path");r.append(a);const o=`path_p${this.pageIndex}_${s}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const u=Qt._svgFactory.createElement("mask");r.append(u),l=`mask_p${this.pageIndex}_${s}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const p=Qt._svgFactory.createElement("rect");u.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const m=Qt._svgFactory.createElement("use");u.append(m),m.setAttribute("href",`#${o}`),m.setAttribute("stroke","none"),m.setAttribute("fill","black"),m.setAttribute("fill-rule","nonzero"),m.classList.add("mask")}const h=Qt._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const c=h.cloneNode();return i.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(i,t),n(this,Ne).set(s,i),s}finalizeDraw(t,e){n(this,Ga).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:s,bbox:i,rootClass:r,path:a}=e,o=typeof t=="number"?n(this,Ne).get(t):t;if(o){if(s&&b(this,Ri,Tp).call(this,o,s),i&&b(l=Qt,Lu,qb).call(l,o,i),r){const{classList:h}=o;for(const[c,u]of Object.entries(r))h.toggle(c,u)}if(a){const c=o.firstChild.firstChild;b(this,Ri,Tp).call(this,c,a)}}}updateParent(t,e){if(e===this)return;const s=n(this,Ne).get(t);s&&(n(e,Ks).append(s),n(this,Ne).delete(t),n(e,Ne).set(t,s))}remove(t){n(this,Ga).delete(t),n(this,Ks)!==null&&(n(this,Ne).get(t).remove(),n(this,Ne).delete(t))}destroy(){f(this,Ks,null);for(const t of n(this,Ne).values())t.remove();n(this,Ne).clear(),n(this,Ga).clear()}};Ks=new WeakMap,Ne=new WeakMap,Ga=new WeakMap,rd=new WeakMap,Lu=new WeakSet,qb=function(t,[e,s,i,r]){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*r}%`},Ri=new WeakSet,Cp=function(){const t=Qt._svgFactory.create(1,1,!0);return n(this,Ks).append(t),t.setAttribute("aria-hidden",!0),t},Yb=function(t,e){const s=Qt._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const r=Qt._svgFactory.createElement("use");return s.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),i},Tp=function(t,e){for(const[s,i]of Object.entries(e))i===null?t.removeAttribute(s):t.setAttribute(s,i)},g(Qt,Lu),g(Qt,rd,0);let pu=Qt;globalThis._pdfjsTestingUtils={HighlightOutliner:rp};globalThis.pdfjsLib={AbortException:An,AnnotationEditorLayer:fu,AnnotationEditorParamsType:st,AnnotationEditorType:X,AnnotationEditorUIManager:Er,AnnotationLayer:jp,AnnotationMode:xi,AnnotationType:Gt,applyOpacity:Wg,build:Km,ColorPicker:_h,createValidAbsoluteUrl:Rp,CSSConstants:Vg,DOMSVGFactory:Ch,DrawLayer:pu,FeatureTest:de,fetchData:Gl,findContrastColor:Xg,getDocument:Bp,getFilenameFromUrl:jg,getPdfFilenameFromUrl:Gg,getRGB:zl,getUuid:Mp,getXfaPageViewport:zg,GlobalWorkerOptions:Js,ImageKind:bh,InvalidPDFException:iu,isDataScheme:hd,isPdfFile:Hu,isValidExplicitDest:Tm,MathClamp:ke,noContextMenu:vs,normalizeUnicode:Ug,OPS:Ul,OutputScale:Zs,PasswordResponses:Bg,PDFDataRangeTransport:Hp,PDFDateString:vh,PDFWorker:$l,PermissionFlag:Og,PixelsPerInch:wn,RenderingCancelledException:Bu,renderRichText:Ip,ResponseException:Ah,setLayerDimensions:vr,shadow:J,SignatureExtractor:Pi,stopEvent:Ft,SupportedImageMimeTypes:nu,TextLayer:Sh,TouchManager:Eh,updateUrlHash:kp,Util:H,VerbosityLevel:ad,version:Ym,XfaLayer:Lp};const ow=Object.freeze(Object.defineProperty({__proto__:null,AbortException:An,AnnotationEditorLayer:fu,AnnotationEditorParamsType:st,AnnotationEditorType:X,AnnotationEditorUIManager:Er,AnnotationLayer:jp,AnnotationMode:xi,AnnotationType:Gt,CSSConstants:Vg,ColorPicker:_h,DOMSVGFactory:Ch,DrawLayer:pu,FeatureTest:de,GlobalWorkerOptions:Js,ImageKind:bh,InvalidPDFException:iu,MathClamp:ke,OPS:Ul,OutputScale:Zs,PDFDataRangeTransport:Hp,PDFDateString:vh,PDFWorker:$l,PasswordResponses:Bg,PermissionFlag:Og,PixelsPerInch:wn,RenderingCancelledException:Bu,ResponseException:Ah,SignatureExtractor:Pi,SupportedImageMimeTypes:nu,TextLayer:Sh,TouchManager:Eh,Util:H,VerbosityLevel:ad,XfaLayer:Lp,applyOpacity:Wg,build:Km,createValidAbsoluteUrl:Rp,fetchData:Gl,findContrastColor:Xg,getDocument:Bp,getFilenameFromUrl:jg,getPdfFilenameFromUrl:Gg,getRGB:zl,getUuid:Mp,getXfaPageViewport:zg,isDataScheme:hd,isPdfFile:Hu,isValidExplicitDest:Tm,noContextMenu:vs,normalizeUnicode:Ug,renderRichText:Ip,setLayerDimensions:vr,shadow:J,stopEvent:Ft,updateUrlHash:kp,version:Ym},Symbol.toStringTag,{value:"Module"}));var _g=Object.prototype.hasOwnProperty;function Cg(d,t,e){for(e of d.keys())if(uo(e,t))return e}function uo(d,t){var e,s,i;if(d===t)return!0;
20if(d&&t&&(e=d.constructor)===t.constructor){if(e===Date)return d.getTime()===t.getTime();if(e===RegExp)return d.toString()===t.toString();if(e===Array){if((s=d.length)===t.length)for(;s--&&uo(d[s],t[s]););return s===-1}if(e===Set){if(d.size!==t.size)return!1;for(s of d)if(i=s,i&&typeof i=="object"&&(i=Cg(t,i),!i)||!t.has(i))return!1;return!0}if(e===Map){if(d.size!==t.size)return!1;for(s of d)if(i=s[0],i&&typeof i=="object"&&(i=Cg(t,i),!i)||!uo(s[1],t.get(i)))return!1;return!0}if(e===ArrayBuffer)d=new Uint8Array(d),t=new Uint8Array(t);else if(e===DataView){if((s=d.byteLength)===t.byteLength)for(;s--&&d.getInt8(s)===t.getInt8(s););return s===-1}if(ArrayBuffer.isView(d)){if((s=d.byteLength)===t.byteLength)for(;s--&&d[s]===t[s];);return s===-1}if(!e||typeof d=="object"){s=0;for(e in d)if(_g.call(d,e)&&++s&&!_g.call(t,e)||!(e in t)||!uo(d[e],t[e]))return!1;return Object.keys(t).length===s}}return d!==d&&t!==t}function fd(d){let t=!1;return{promise:new Promise((s,i)=>{d.then(r=>!t&&s(r)).catch(r=>!t&&i(r))}),cancel(){t=!0}}}const lw=["onCopy","onCut","onPaste"],hw=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],cw=["onFocus","onBlur"],dw=["onInput","onInvalid","onReset","onSubmit"],uw=["onLoad","onError"],fw=["onKeyDown","onKeyPress","onKeyUp"],pw=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],gw=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],mw=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],bw=["onSelect"],yw=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],Aw=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],ww=["onScroll"],vw=["onWheel"],Ew=["onAnimationStart","onAnimationEnd","onAnimationIteration"],Sw=["onTransitionEnd"],_w=["onToggle"],Cw=["onChange"],Tw=[...lw,...hw,...cw,...dw,...uw,...fw,...pw,...gw,...mw,...bw,...yw,...Aw,...ww,...vw,...Ew,...Sw,...Cw,..._w];function Kb(d,t){const e={};for(const s of Tw){const i=d[s];i&&(t?e[s]=r=>i(r,t(s)):e[s]=i)}return e}var xw="Invariant failed";function Et(d,t){if(!d)throw new Error(xw)}var Pw=function(){},Rw=Pw;const Me=gy(Rw),Jb=G.createContext(null),kw="noopener noreferrer nofollow";class Mw{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHash(){}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Et(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(t){Et(this.pdfViewer),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||kw,t.target=s?"_blank":this.externalLinkTarget||""}goToDestination(t){return new Promise(e=>{Et(this.pdfDocument),Et(t),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{Et(Array.isArray(e));const s=e[0];new Promise(i=>{Et(this.pdfDocument),s instanceof Object?this.pdfDocument.getPageIndex(s).then(r=>{i(r)}).catch(()=>{Et(!1)}):typeof s=="number"?i(s):Et(!1)}).then(i=>{const r=i+1;Et(this.pdfViewer),Et(r>=1&&r<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:r})})})}goToPage(t){const e=t-1;Et(this.pdfViewer),Et(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}goToXY(){}cachePageRef(){}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}executeNamedAction(){}executeSetOCGState(){}isPageVisible(){return!0}isPageCached(){return!0}navigateTo(t){this.goToDestination(t)}}function fo({children:d,type:t}){return jt.jsx("div",{className:`react-pdf__message react-pdf__message--${t}`,children:d})}const Tg={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function Dw(d,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return d}}function jl(){return G.useReducer(Dw,{value:void 0,error:void 0})}const ju=typeof window<"u",Qb=ju&&window.location.protocol==="file:";function Lw(d){return typeof d<"u"}function Cr(d){return Lw(d)&&d!==null}
20function Iw(d){return typeof d=="string"}function Fw(d){return d instanceof ArrayBuffer}function Nw(d){return Et(ju),d instanceof Blob}function xp(d){return Iw(d)&&/^data:/.test(d)}function xg(d){Et(xp(d));const[t="",e=""]=d.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Ow(){return ju&&window.devicePixelRatio||1}const Zb="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function Pg(){Me(!Qb,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Zb}`)}function Bw(){Me(!Qb,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Zb}`)}function Va(d){d!=null&&d.cancel&&d.cancel()}function Pp(d,t){return Object.defineProperty(d,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(d,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(d,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(d,"originalHeight",{get(){return this.view[3]},configurable:!0}),d}function Hw(d){return d.name==="RenderingCancelledException"}function Uw(d){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:r}=i.target;if(!r)return e(new Error("Error while reading a file."));switch(r.code){case r.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case r.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case r.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(d)})}const{PDFDataRangeTransport:$w}=ow,jw=(d,t)=>{switch(t){case Tg.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");d(e);break}case Tg.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");d(e);break}}};function Rg(d){return typeof d=="object"&&d!==null&&("data"in d||"range"in d||"url"in d)}const ev=G.forwardRef(function({children:t,className:e,error:s="Failed to load PDF file.",externalLinkRel:i,externalLinkTarget:r,file:a,inputRef:o,imageResourcesPath:l,loading:h="Loading PDFâ¦",noData:c="No PDF file specified.",onItemClick:u,onLoadError:p,onLoadProgress:m,onLoadSuccess:A,onPassword:y=jw,onSourceError:v,onSourceSuccess:w,options:E,renderMode:S,rotate:_,scale:C,...T},x){const[P,R]=jl(),{value:D,error:M}=P,[U,z]=jl(),{value:O,error:W}=U,F=G.useRef(new Mw),I=G.useRef([]),et=G.useRef(void 0),ft=G.useRef(void 0);a&&a!==et.current&&Rg(a)&&(Me(!uo(a,et.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),et.current=a),E&&E!==ft.current&&(Me(!uo(E,ft.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),ft.current=E);const se=G.useRef({scrollPageIntoView:lt=>{const{dest:Rt,pageNumber:Kt,pageIndex:ie=Kt-1}=lt;if(u){u({dest:Rt,pageIndex:ie,pageNumber:Kt});return}const qa=I.current[ie];if(qa){qa.scrollIntoView();return}Me(!1,`An internal link leading to page ${Kt} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});G.useImperativeHandle(x,()=>({linkService:F,pages:I,viewer:se}),[]);function Ke(){w&&w()}function nt(){M&&(Me(!1,M.toString()),v&&v(M))}function rt(){R({type:"RESET"})}G.useEffect(rt,[a,R]);const Yt=G.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return xp(a)?{data:xg(a)}:(Pg(),{url:a});if(a instanceof $w)return{range:a};if(Fw(a))return{data:a};if(ju&&Nw(a))return{data:await Uw(a)};if(Et(typeof a=="object"),Et(Rg(a)),"url"in a&&typeof a.url=="string"){if(xp(a.url)){const{url:lt,...Rt}=a;return{data:xg(lt),...Rt}}Pg()}return a},[a]);G.useEffect(()=>{const lt=fd(Yt());return lt.promise.then(Rt=>{R({type:"RESOLVE",value:Rt})}).catch(Rt=>{R({type:"REJECT",error:Rt})}),()=>{Va(lt)}},[Yt,R]),G.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){nt();return}Ke()}},[D]);
20function ue(){O&&(A&&A(O),I.current=new Array(O.numPages),F.current.setDocument(O))}function Ee(){W&&(Me(!1,W.toString()),p&&p(W))}G.useEffect(function(){z({type:"RESET"})},[z,D]),G.useEffect(function(){if(!D)return;const Rt=E?{...D,...E}:D,Kt=Bp(Rt);m&&(Kt.onProgress=m),y&&(Kt.onPassword=y);const ie=Kt,qa=ie.promise.then(Vl=>{z({type:"RESOLVE",value:Vl})}).catch(Vl=>{ie.destroyed||z({type:"REJECT",error:Vl})});return()=>{qa.finally(()=>ie.destroy())}},[E,z,D]),G.useEffect(()=>{if(!(typeof O>"u")){if(O===!1){Ee();return}ue()}},[O]),G.useEffect(function(){F.current.setViewer(se.current),F.current.setExternalLinkRel(i),F.current.setExternalLinkTarget(r)},[i,r]);const Ct=G.useCallback((lt,Rt)=>{I.current[lt]=Rt},[]),Sn=G.useCallback(lt=>{delete I.current[lt]},[]),Je=G.useMemo(()=>({imageResourcesPath:l,linkService:F.current,onItemClick:u,pdf:O,registerPage:Ct,renderMode:S,rotate:_,scale:C,unregisterPage:Sn}),[l,u,O,Ct,S,_,C,Sn]),At=G.useMemo(()=>Kb(T,()=>O),[T,O]);function Qe(){function lt(Kt){return!!(Kt!=null&&Kt.pdf)}if(!lt(Je))throw new Error("pdf is undefined");const Rt=typeof t=="function"?t(Je):t;return jt.jsx(Jb.Provider,{value:Je,children:Rt})}function ki(){return a?O==null?jt.jsx(fo,{type:"loading",children:typeof h=="function"?h():h}):O===!1?jt.jsx(fo,{type:"error",children:typeof s=="function"?s():s}):Qe():jt.jsx(fo,{type:"no-data",children:typeof c=="function"?c():c})}return jt.jsx("div",{className:Fu("react-pdf__Document",e),ref:o,...At,children:ki()})});function ty(){return G.useContext(Jb)}function ey(){for(var d=[],t=0;t<arguments.length;t++)d[t]=arguments[t];var e=d.filter(Boolean);if(e.length<=1){var s=e[0];return s||null}return function(r){for(var a=0,o=e;a<o.length;a++){var l=o[a];typeof l=="function"?l(r):l&&(l.current=r)}}}const sy=G.createContext(null);function Gu(){return G.useContext(sy)}function Gw(){const d=ty(),t=Gu();Et(t);const e={...d,...t},{imageResourcesPath:s,linkService:i,onGetAnnotationsError:r,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:h,pdf:c,renderForms:u,rotate:p,scale:m=1}=e;Et(c),Et(h),Et(i);const[A,y]=jl(),{value:v,error:w}=A,E=G.useRef(null);Me(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function S(){v&&a&&a(v)}function _(){w&&(Me(!1,w.toString()),r&&r(w))}G.useEffect(function(){y({type:"RESET"})},[y,h]),G.useEffect(function(){if(!h)return;const R=fd(h.getAnnotations()),D=R;return R.promise.then(M=>{y({type:"RESOLVE",value:M})}).catch(M=>{y({type:"REJECT",error:M})}),()=>{Va(D)}},[y,h]),G.useEffect(()=>{if(v!==void 0){if(v===!1){_();return}S()}},[v]);function C(){l&&l()}function T(P){Me(!1,`${P}`),o&&o(P)}const x=G.useMemo(()=>h.getViewport({scale:m,rotation:p}),[h,p,m]);return G.useEffect(function(){if(!c||!h||!i||!v)return;const{current:R}=E;if(!R)return;const D=x.clone({dontFlip:!0}),M={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,annotationStorage:c.annotationStorage,commentManager:null,div:R,l10n:null,linkService:i,page:h,structTreeLayer:null,viewport:D},U={annotations:v,annotationStorage:c.annotationStorage,div:R,imageResourcesPath:s,linkService:i,page:h,renderForms:u,viewport:D};R.innerHTML="";try{new jp(M).render(U),C()}catch(z){T(z)}return()=>{}},[v,s,i,h,c,u,x]),jt.jsx("div",{className:Fu("react-pdf__Page__annotations","annotationLayer"),ref:E})}const iy={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},zw=/^H(\d+)$/;function Vw(d){return d in iy}function zu(d){return"children"in d}function ny(d){return zu(d)?d.children.length===1&&0 in d.children&&"id"in d.children[0]:!1}function Ww(d){const t={};if(zu(d)){const{role:e}=d,s=e.match(zw);if(s)t.role="heading",t["aria-level"]=Number(s[1]);else if(Vw(e)){const i=iy[e];i&&(t.role=i)}}return t}function ry(d){const t={};if(zu(d)){if(d.alt!==void 0&&(t["aria-label"]=d.alt),d.lang!==void 0&&(t.lang=d.lang),ny(d)){const[e]=d.children;if(e){const s=ry(e);return{...t,...s}}}}else"id"in d&&(t["aria-owns"]=d.id);return t}function Xw(d){return d?{...Ww(d),...ry(d)}:null}function ay({className:d,node:t}){const e=G.useMemo(()=>Xw(t),[t]),s=G.useMemo(()=>!zu(t)||ny(t)?null:t.children.map((i,r)=>jt.jsx(ay,{node:i},r)),[t]);return jt.jsx("span",{className:d,...e,children:s})}function qw(){const d=Gu();Et(d);const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=d,[s,i]=jl(),{value:r,error:a}=s,{customTextRenderer:o,page:l}=d;function h(){r&&e&&e(r)}function c(){a&&(Me(!1,a.toString()),t&&t(a))}return G.useEffect(function(){i({type:"RESET"})},[i,l]),G.useEffect(function(){if(o||!l)return;const p=fd(l.getStructTree()),m=p;return p.promise.then(A=>{i({type:"RESOLVE",value:A})}).catch(A=>{i({type:"REJECT",error:A})}),()=>Va(m)},[o,l,i]),G.useEffect(()=>{if(r!==void 0){if(r===!1){c();return}h()}},[r]),r?jt.jsx(ay,{className:"react-pdf__Page__structTree structTree",node:r}):null}const kg=xi;function Yw(d){const t=Gu();Et(t);const e={...t,...d}
20,{_className:s,canvasBackground:i,devicePixelRatio:r=Ow(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:h,renderTextLayer:c,rotate:u,scale:p}=e,{canvasRef:m}=d;Et(l);const A=G.useRef(null);function y(){l&&o&&o(Pp(l,p))}function v(_){Hw(_)||(Me(!1,_.toString()),a&&a(_))}const w=G.useMemo(()=>l.getViewport({scale:p*r,rotation:u}),[r,l,u,p]),E=G.useMemo(()=>l.getViewport({scale:p,rotation:u}),[l,u,p]);G.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=A;if(!C)return;C.width=w.width,C.height=w.height,C.style.width=`${Math.floor(E.width)}px`,C.style.height=`${Math.floor(E.height)}px`,C.style.visibility="hidden";const T={annotationMode:h?kg.ENABLE_FORMS:kg.ENABLE,canvas:C,canvasContext:C.getContext("2d",{alpha:!1}),viewport:w};i&&(T.background=i);const x=l.render(T),P=x;return x.promise.then(()=>{C.style.visibility="",y()}).catch(v),()=>Va(P)},[i,l,h,w,E]);const S=G.useCallback(()=>{const{current:_}=A;_&&(_.width=0,_.height=0)},[]);return G.useEffect(()=>S,[S]),jt.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:ey(m,A),style:{display:"block",userSelect:"none"},children:c?jt.jsx(qw,{}):null})}function Kw(d){return"str"in d}function Jw(){const d=Gu();Et(d);const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:r,page:a,pageIndex:o,pageNumber:l,rotate:h,scale:c}=d;Et(a);const[u,p]=jl(),{value:m,error:A}=u,y=G.useRef(null);Me(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function v(){m&&s&&s(m)}function w(){A&&(Me(!1,A.toString()),e&&e(A))}G.useEffect(function(){p({type:"RESET"})},[a,p]),G.useEffect(function(){if(!a)return;const P=fd(a.getTextContent()),R=P;return P.promise.then(D=>{p({type:"RESOLVE",value:D})}).catch(D=>{p({type:"REJECT",error:D})}),()=>Va(R)},[a,p]),G.useEffect(()=>{if(m!==void 0){if(m===!1){w();return}v()}},[m]);const E=G.useCallback(()=>{r&&r()},[r]),S=G.useCallback(x=>{Me(!1,x.toString()),i&&i(x)},[i]);function _(){const x=y.current;x&&x.classList.add("selecting")}function C(){const x=y.current;x&&x.classList.remove("selecting")}const T=G.useMemo(()=>a.getViewport({scale:c,rotation:h}),[a,h,c]);return G.useLayoutEffect(function(){if(!a||!m)return;const{current:P}=y;if(!P)return;P.innerHTML="";const R=a.streamTextContent({includeMarkedContent:!0}),D={container:P,textContentSource:R,viewport:T},M=new Sh(D),U=M;return M.render().then(()=>{const z=document.createElement("div");z.className="endOfContent",P.append(z);const O=P.querySelectorAll('[role="presentation"]');if(t){let W=0;m.items.forEach((F,I)=>{if(!Kw(F))return;const et=O[W];if(!et)return;const ft=t({pageIndex:o,pageNumber:l,itemIndex:I,...F});et.innerHTML=ft,W+=F.str&&F.hasEOL?2:1})}E()}).catch(S),()=>Va(U)},[t,S,E,a,o,l,m,T]),jt.jsx("div",{className:Fu("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:_,ref:y})}const Mg=1;function sv(d){const e={...ty(),...d},{_className:s="react-pdf__Page",_enableRegisterUnregisterPage:i=!0,canvasBackground:r,canvasRef:a,children:o,className:l,customRenderer:h,customTextRenderer:c,devicePixelRatio:u,error:p="Failed to load the page.",height:m,inputRef:A,loading:y="Loading pageâ¦",noData:v="No page specified.",onGetAnnotationsError:w,onGetAnnotationsSuccess:E,onGetStructTreeError:S,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:T,onLoadError:x,onLoadSuccess:P,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:D,onRenderError:M,onRenderSuccess:U,onRenderTextLayerError:z,onRenderTextLayerSuccess:O,pageIndex:W,pageNumber:F,pdf:I,registerPage:et,renderAnnotationLayer:ft=!0,renderForms:se=!1,renderMode:Ke="canvas",renderTextLayer:nt=!0,rotate:rt,scale:Yt=Mg,unregisterPage:ue,width:Ee,...Ct}=e,[Sn,Je]=jl(),{value:At,error:Qe}=Sn,ki=G.useRef(null);Et(I);const lt=Cr(F)?F-1:W??null,Rt=F??(Cr(W)?W+1:null),Kt=rt??(At?At.rotate:null),ie=G.useMemo(()=>{if(!At)return null;let _n=1;const Ya=Yt??Mg;if(Ee||m){const Cn=At.getViewport({scale:1,rotation:Kt});Ee?_n=Ee/Cn.width:m&&(_n=m/Cn.height)}return Ya*_n},[m,At,Kt,Yt,Ee]);G.useEffect(function(){return()=>{Cr(lt)&&i&&ue&&ue(lt)}},[i,I,lt,ue]);function qa(){if(P){if(!At||!ie)return;P(Pp(At,ie))}if(i&&et){if(!Cr(lt)||!ki.current)return;et(lt,ki.current)}}function Vl(){Qe&&(Me(!1,Qe.toString()),x&&x(Qe))}G.useEffect(function(){Je({type:"RESET"})},[Je,I,lt]),G.useEffect(function(){if(!I||!Rt)return;const Ya=fd(I.getPage(Rt)),Cn=Ya;return Ya.promise.then(Wu=>{Je({type:"RESOLVE",value:Wu})}).catch(Wu=>{Je({type:"REJECT",error:Wu})}),()=>Va(Cn)},[Je,I,Rt]),G.useEffect(()=>{if(At!==void 0){if(At===!1){Vl();return}qa()}},[At,ie]);const Vu=G.useMemo(()=>
20Cr(lt)&&Rt&&Cr(Kt)&&Cr(ie)?{_className:s,canvasBackground:r,customTextRenderer:c,devicePixelRatio:u,onGetAnnotationsError:w,onGetAnnotationsSuccess:E,onGetStructTreeError:S,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:T,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:D,onRenderError:M,onRenderSuccess:U,onRenderTextLayerError:z,onRenderTextLayerSuccess:O,page:At,pageIndex:lt,pageNumber:Rt,renderForms:se,renderTextLayer:nt,rotate:Kt,scale:ie}:null,[s,r,c,u,w,E,S,_,C,T,R,D,M,U,z,O,At,lt,Rt,se,nt,Kt,ie]),oy=G.useMemo(()=>Kb(Ct,()=>At&&(ie?Pp(At,ie):void 0)),[Ct,At,ie]),pd=`${lt}@${ie}/${Kt}`;function ly(){switch(Ke){case"custom":return Et(h),jt.jsx(h,{},`${pd}_custom`);case"none":return null;case"canvas":default:return jt.jsx(Yw,{canvasRef:a},`${pd}_canvas`)}}function hy(){return nt?jt.jsx(Jw,{},`${pd}_text`):null}function cy(){return ft?jt.jsx(Gw,{},`${pd}_annotations`):null}function dy(){function _n(Cn){return!!(Cn!=null&&Cn.page)}if(!_n(Vu))throw new Error("page is undefined");const Ya=typeof o=="function"?o(Vu):o;return jt.jsxs(sy.Provider,{value:Vu,children:[ly(),hy(),cy(),Ya]})}function uy(){return Rt?I===null||At===void 0||At===null?jt.jsx(fo,{type:"loading",children:typeof y=="function"?y():y}):I===!1||At===!1?jt.jsx(fo,{type:"error",children:typeof p=="function"?p():p}):dy():jt.jsx(fo,{type:"no-data",children:typeof v=="function"?v():v})}return jt.jsx("div",{className:Fu(s,l),"data-page-number":Rt,ref:ey(A,ki),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${ie}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:r||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...oy,children:uy()})}Bw();Js.workerSrc="pdf.worker.mjs";export{ev as D,Js as G,sv as P,Fu as c,jt as j,Ym as v};
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.