PageSourceSearch

https://copees.com/assets/pdf-C9dl9RL1.js

js copees.com collected 2026-10-05 21:41:05 UTC 337,104 bytes, 12 lines download raw bytes

1var Zu=Object.defineProperty;var Nc=d=>{throw TypeError(d)};var tf=(d,t,e)=>t in d?Zu(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var B=(d,t,e)=>tf(d,typeof t!="symbol"?t+"":t,e),Zh=(d,t,e)=>t.has(d)||Nc("Cannot "+e);var r=(d,t,e)=>(Zh(d,t,"read from private field"),e?e.call(d):t.get(d)),b=(d,t,e)=>t.has(d)?Nc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(d):t.set(d,e),p=(d,t,e,s)=>(Zh(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e),g=(d,t,e)=>(Zh(d,t,"access private method"),e);var te=(d,t,e,s)=>({set _(i){p(d,t,i,e)},get _(){return r(d,t,s)}});import{aS as Bo}from"./index-D5YpCUvm.js";var Xr={};Xr.d=(d,t)=>{for(var e in t)Xr.o(t,e)&&!Xr.o(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:t[e]})};Xr.o=(d,t)=>Object.prototype.hasOwnProperty.call(d,t);var F=globalThis.pdfjsLib={};Xr.d(F,{AbortException:()=>En,AnnotationEditorLayer:()=>gc,AnnotationEditorParamsType:()=>O,AnnotationEditorType:()=>G,AnnotationEditorUIManager:()=>An,AnnotationLayer:()=>Zp,AnnotationMode:()=>js,CMapCompressionType:()=>ol,ColorPicker:()=>wh,DOMSVGFactory:()=>Sc,DrawLayer:()=>vc,FeatureTest:()=>Qt,GlobalWorkerOptions:()=>Is,ImageKind:()=>Go,InvalidPDFException:()=>nd,MissingPDFException:()=>wn,OPS:()=>ye,Outliner:()=>Kl,PDFDataRangeTransport:()=>Zd,PDFDateString:()=>dd,PDFWorker:()=>In,PasswordResponses:()=>rf,PermissionFlag:()=>nf,PixelsPerInch:()=>di,RenderingCancelledException:()=>Cc,TextLayer:()=>Rr,UnexpectedResponseException:()=>Vh,Util:()=>P,VerbosityLevel:()=>jh,XfaLayer:()=>eu,build:()=>Ip,createValidAbsoluteUrl:()=>lf,fetchData:()=>Qh,getDocument:()=>Sp,getFilenameFromUrl:()=>vf,getPdfFilenameFromUrl:()=>_f,getXfaPageViewport:()=>yf,isDataScheme:()=>xc,isPdfFile:()=>Tc,noContextMenu:()=>Zt,normalizeUnicode:()=>gf,renderTextLayer:()=>gp,setLayerDimensions:()=>bn,shadow:()=>V,updateTextLayer:()=>mp,version:()=>Mp});const Bt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),id=[1,0,0,1,0,0],al=[.001,0,0,.001,0,0],ef=1e7,tl=1.35,be={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},js={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},sf="pdfjs_internal_editor_",G={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},O={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},nf={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ft={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Go={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},mt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},Lr={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},jh={ERRORS:0,WARNINGS:1,INFOS:5},ol={NONE:0,BINARY:1},ye={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},rf={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Wh=jh.WARNINGS;function af(d){Number.isInteger(d)&&(Wh=d)}function of(){return Wh}function Gh(d){Wh>=jh.INFOS&&console.log(`Info: ${d}`)}function U(d){Wh>=jh.WARNINGS&&console.log(`Warning: ${d}`)}function Z(d){throw new Error(d)}function yt(d,t){d||Z(t)}function hf(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function lf(d,t=null,e=null){if(!d)return null;
1try{if(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=pf(d)}catch{}}const s=t?new URL(d,t):new URL(d);if(hf(s))return s}catch{}return null}function V(d,t,e,s=!1){return Object.defineProperty(d,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const pi=function(){function t(e,s){this.constructor===t&&Z("Cannot initialize BaseException."),this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();class hl extends pi{constructor(t,e){super(t,"PasswordException"),this.code=e}}class ll extends pi{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class nd extends pi{constructor(t){super(t,"InvalidPDFException")}}class wn extends pi{constructor(t){super(t,"MissingPDFException")}}class Vh extends pi{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class cf extends pi{constructor(t){super(t,"FormatError")}}class En extends pi{constructor(t){super(t,"AbortException")}}function rd(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&&Z("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 n=Math.min(i+e,t),a=d.subarray(i,n);s.push(String.fromCharCode.apply(null,a))}return s.join("")}function qh(d){typeof d!="string"&&Z("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 df(d){return String.fromCharCode(d>>24&255,d>>16&255,d>>8&255,d&255)}function wc(d){const t=Object.create(null);for(const[e,s]of d)t[e]=s;return t}function uf(){const d=new Uint8Array(4);return d[0]=1,new Uint32Array(d.buffer,0,1)[0]===1}function ff(){try{return new Function(""),!0}catch{return!1}}class Qt{static get isLittleEndian(){return V(this,"isLittleEndian",uf())}static get isEvalSupported(){return V(this,"isEvalSupported",ff())}static get isOffscreenCanvasSupported(){return V(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?V(this,"platform",{isMac:navigator.platform.includes("Mac")}):V(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var t,e;return V(this,"isCSSRoundSupported",(e=(t=globalThis.CSS)==null?void 0:t.supports)==null?void 0:e.call(t,"width: round(1.5px, 1px)"))}}const el=Array.from(Array(256).keys(),d=>d.toString(16).padStart(2,"0"));var Ds,Vo,cl;class P{static makeHexColor(t,e,s){return`#${el[t]}${el[e]}${el[s]}`}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 applyTransform(t,e){const s=t[0]*e[0]+t[1]*e[2]+e[4],i=t[0]*e[1]+t[1]*e[3]+e[5];return[s,i]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2],i=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s;return[i,n]}static getAxialAlignedBoundingBox(t,e){const s=this.applyTransform(t,e),i=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],n[0],a[0]),Math.min(s[1],i[1],n[1],a[1]),Math.max(s[0],i[0],n[0],a[0]),Math.max(s[1],i[1],n[1],a[1])]}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){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],o=(s+a)/2,h=Math.sqrt((s+a)**2-4*(s*a-n*i))/2,l=o+h||1,c=o-h||1;return[Math.sqrt(l),Math.sqrt(c)]}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 n=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 n>a?null:[s,n,i,a]}static bezierBoundingBox(t,e,s,i,n,a,o,h,l){return l?(l[0]=Math.min(l[0],t,o),l[1]=Math.min(l[1],e,h),l[2]=Math.max(l[2],t,o),l[3]=Math.max(l[3],e,h)):l=[Math.min(t,o),Math.min(e,h),Math.max(t,o),Math.max(e,h)],g(this,Ds,cl).call(this,t,s,n,o,e,i,a,h,3*(-t+3*(s-n)+o),6*(t-2*s+n),3*(s-t),l),g(this,Ds,cl).call(this,t,s,n,o,e,i,a,h,3*(-e+3*(i-a)+h),6*(e-2*i+a),3*(i-e),l),l}}Ds=new WeakSet,Vo=function(t,e,s,i,n,a,o,h,l,c){if(l<=0||l>=1)return;const u=1-l,f=l*l,m=f*l,A=u*(u*(u*t+3*l*e)+3*f*s)+m*i,v=u*(u*(u*n+3*l*a)+3*f*o)+m*h;c[0]=Math.min(c[0],A),c[1]=Math.min(c[1],v),c[2]=Math.max(c[2],A),c[3]=Math.max(c[3],v)}
1,cl=function(t,e,s,i,n,a,o,h,l,c,u,f){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&g(this,Ds,Vo).call(this,t,e,s,i,n,a,o,h,-u/c,f);return}const m=c**2-4*u*l;if(m<0)return;const A=Math.sqrt(m),v=2*l;g(this,Ds,Vo).call(this,t,e,s,i,n,a,o,h,(-c+A)/v,f),g(this,Ds,Vo).call(this,t,e,s,i,n,a,o,h,(-c-A)/v,f)},b(P,Ds);function pf(d){return decodeURIComponent(escape(d))}let sl=null,Hc=null;function gf(d){return sl||(sl=/([\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,Hc=new Map([["ſt","ſt"]])),d.replaceAll(sl,(t,e,s)=>e?e.normalize("NFKC"):Hc.get(s))}function mf(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const d=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(d);else for(let t=0;t<32;t++)d[t]=Math.floor(Math.random()*255);return rd(d)}const ad="pdfjs_internal_id_",ss={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class Xh{constructor(){this.constructor===Xh&&Z("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,i,n){return"none"}destroy(t=!1){}}var Jr;const Mc=class Mc{constructor({enableHWA:t=!1}={}){b(this,Jr,!1);this.constructor===Mc&&Z("Cannot initialize BaseCanvasFactory."),p(this,Jr,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:!r(this,Jr)})}}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){Z("Abstract method `_createCanvas` called.")}};Jr=new WeakMap;let bh=Mc;class Yh{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===Yh&&Z("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, 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":""),s=this.isCompressed?ol.BINARY:ol.NONE;return this._fetchData(e,s).catch(i=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){Z("Abstract method `_fetchData` called.")}}class Kh{constructor({baseUrl:t=null}){this.constructor===Kh&&Z("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, 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._fetchData(e).catch(s=>{throw new Error(`Unable to load font data at: ${e}`)})}_fetchData(t){Z("Abstract method `_fetchData` called.")}}class Ec{constructor(){this.constructor===Ec&&Z("Cannot initialize BaseSVGFactory.")}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){Z("Abstract method `_createSVG` called.")}}const ns="http://www.w3.org/2000/svg",vi=class vi{};B(vi,"CSS",96),B(vi,"PDF",72),B(vi,"PDF_TO_CSS_UNITS",vi.CSS/vi.PDF);let di=vi;var yi,Oe,ls,Xt,Sh,wi,L,Dt,Cn,xn,qo,od,dl,Tn,Ir,Fr,ul,Dr;class bf extends Xh{constructor({docId:e,ownerDocument:s=globalThis.document}={}){super();b(this,L);b(this,yi);b(this,Oe);b(this,ls);b(this,Xt);b(this,Sh);b(this,wi,0);p(this,ls,e),p(this,Xt,s)}addFilter(e){if(!e)return"none";let s=r(this,L,Dt).get(e);if(s)return s;const[i,n,a]=g(this,L,qo).call(this,e),o=e.length===1?i:`${i}${n}${a}`;
1if(s=r(this,L,Dt).get(o),s)return r(this,L,Dt).set(e,s),s;const h=`g_${r(this,ls)}_transfer_map_${te(this,wi)._++}`,l=`url(#${h})`;r(this,L,Dt).set(e,l),r(this,L,Dt).set(o,l);const c=g(this,L,Tn).call(this,h);return g(this,L,Fr).call(this,i,n,a,c),l}addHCMFilter(e,s){var A;const i=`${e}-${s}`,n="base";let a=r(this,L,Cn).get(n);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},r(this,L,Cn).set(n,a)),!e||!s))return a.url;const o=g(this,L,Dr).call(this,e);e=P.makeHexColor(...o);const h=g(this,L,Dr).call(this,s);if(s=P.makeHexColor(...h),r(this,L,xn).style.color="",e==="#000000"&&s==="#ffffff"||e===s)return a.url;const l=new Array(256);for(let v=0;v<=255;v++){const y=v/255;l[v]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const c=l.join(","),u=`g_${r(this,ls)}_hcm_filter`,f=a.filter=g(this,L,Tn).call(this,u);g(this,L,Fr).call(this,c,c,c,f),g(this,L,dl).call(this,f);const m=(v,y)=>{const _=o[v]/255,w=h[v]/255,E=new Array(y+1);for(let S=0;S<=y;S++)E[S]=_+S/y*(w-_);return E.join(",")};return g(this,L,Fr).call(this,m(0,5),m(1,5),m(2,5),f),a.url=`url(#${u})`,a.url}addAlphaFilter(e){let s=r(this,L,Dt).get(e);if(s)return s;const[i]=g(this,L,qo).call(this,[e]),n=`alpha_${i}`;if(s=r(this,L,Dt).get(n),s)return r(this,L,Dt).set(e,s),s;const a=`g_${r(this,ls)}_alpha_map_${te(this,wi)._++}`,o=`url(#${a})`;r(this,L,Dt).set(e,o),r(this,L,Dt).set(n,o);const h=g(this,L,Tn).call(this,a);return g(this,L,ul).call(this,i,h),o}addLuminosityFilter(e){let s=r(this,L,Dt).get(e||"luminosity");if(s)return s;let i,n;if(e?([i]=g(this,L,qo).call(this,[e]),n=`luminosity_${i}`):n="luminosity",s=r(this,L,Dt).get(n),s)return r(this,L,Dt).set(e,s),s;const a=`g_${r(this,ls)}_luminosity_map_${te(this,wi)._++}`,o=`url(#${a})`;r(this,L,Dt).set(e,o),r(this,L,Dt).set(n,o);const h=g(this,L,Tn).call(this,a);return g(this,L,od).call(this,h),e&&g(this,L,ul).call(this,i,h),o}addHighlightHCMFilter(e,s,i,n,a){var w;const o=`${s}-${i}-${n}-${a}`;let h=r(this,L,Cn).get(e);if((h==null?void 0:h.key)===o||(h?((w=h.filter)==null||w.remove(),h.key=o,h.url="none",h.filter=null):(h={key:o,url:"none",filter:null},r(this,L,Cn).set(e,h)),!s||!i))return h.url;const[l,c]=[s,i].map(g(this,L,Dr).bind(this));let u=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),f=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[m,A]=[n,a].map(g(this,L,Dr).bind(this));f<u&&([u,f,m,A]=[f,u,A,m]),r(this,L,xn).style.color="";const v=(E,S,x)=>{const C=new Array(256),R=(f-u)/x,I=E/255,N=(S-E)/(255*x);let q=0;for(let D=0;D<=x;D++){const at=Math.round(u+D*R),it=I+D*N;for(let rt=q;rt<=at;rt++)C[rt]=it;q=at+1}for(let D=q;D<256;D++)C[D]=C[q-1];return C.join(",")},y=`g_${r(this,ls)}_hcm_${e}_filter`,_=h.filter=g(this,L,Tn).call(this,y);return g(this,L,dl).call(this,_),g(this,L,Fr).call(this,v(m[0],A[0],5),v(m[1],A[1],5),v(m[2],A[2],5),_),h.url=`url(#${y})`,h.url}destroy(e=!1){e&&r(this,L,Cn).size!==0||(r(this,Oe)&&(r(this,Oe).parentNode.parentNode.remove(),p(this,Oe,null)),r(this,yi)&&(r(this,yi).clear(),p(this,yi,null)),p(this,wi,0))}}yi=new WeakMap,Oe=new WeakMap,ls=new WeakMap,Xt=new WeakMap,Sh=new WeakMap,wi=new WeakMap,L=new WeakSet,Dt=function(){return r(this,yi)||p(this,yi,new Map)},Cn=function(){return r(this,Sh)||p(this,Sh,new Map)},xn=function(){if(!r(this,Oe)){const e=r(this,Xt).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=r(this,Xt).createElementNS(ns,"svg");i.setAttribute("width",0),i.setAttribute("height",0),p(this,Oe,r(this,Xt).createElementNS(ns,"defs")),e.append(i),i.append(r(this,Oe)),r(this,Xt).body.append(e)}return r(this,Oe)},qo=function(e){if(e.length===1){const l=e[0],c=new Array(256);for(let f=0;f<256;f++)c[f]=l[f]/255;const u=c.join(",");return[u,u,u]}const[s,i,n]=e,a=new Array(256),o=new Array(256),h=new Array(256);for(let l=0;l<256;l++)a[l]=s[l]/255,o[l]=i[l]/255,h[l]=n[l]/255;return[a.join(","),o.join(","),h.join(",")]},od=function(e){const s=r(this,Xt).createElementNS(ns,"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.a
1ppend(s)},dl=function(e){const s=r(this,Xt).createElementNS(ns,"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)},Tn=function(e){const s=r(this,Xt).createElementNS(ns,"filter");return s.setAttribute("color-interpolation-filters","sRGB"),s.setAttribute("id",e),r(this,L,xn).append(s),s},Ir=function(e,s,i){const n=r(this,Xt).createElementNS(ns,s);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)},Fr=function(e,s,i,n){const a=r(this,Xt).createElementNS(ns,"feComponentTransfer");n.append(a),g(this,L,Ir).call(this,a,"feFuncR",e),g(this,L,Ir).call(this,a,"feFuncG",s),g(this,L,Ir).call(this,a,"feFuncB",i)},ul=function(e,s){const i=r(this,Xt).createElementNS(ns,"feComponentTransfer");s.append(i),g(this,L,Ir).call(this,i,"feFuncA",e)},Dr=function(e){return r(this,L,xn).style.color=e,kc(getComputedStyle(r(this,L,xn)).getPropertyValue("color"))};class Af extends bh{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}}async function Qh(d,t="text"){if(Or(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 hd extends Yh{_fetchData(t,e){return Qh(t,this.isCompressed?"arraybuffer":"text").then(s=>({cMapData:s instanceof ArrayBuffer?new Uint8Array(s):qh(s),compressionType:e}))}}class ld extends Kh{_fetchData(t){return Qh(t,"arraybuffer").then(e=>new Uint8Array(e))}}class Sc extends Ec{_createSVG(t){return document.createElementNS(ns,t)}}class Po{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:n=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=n;const o=(t[2]+t[0])/2,h=(t[3]+t[1])/2;let l,c,u,f;switch(s%=360,s<0&&(s+=360),s){case 180:l=-1,c=0,u=0,f=1;break;case 90:l=0,c=1,u=1,f=0;break;case 270:l=0,c=-1,u=-1,f=0;break;case 0:l=1,c=0,u=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(u=-u,f=-f);let m,A,v,y;l===0?(m=Math.abs(h-t[1])*e+i,A=Math.abs(o-t[0])*e+n,v=(t[3]-t[1])*e,y=(t[2]-t[0])*e):(m=Math.abs(o-t[0])*e+i,A=Math.abs(h-t[1])*e+n,v=(t[2]-t[0])*e,y=(t[3]-t[1])*e),this.transform=[l*e,c*e,u*e,f*e,m-l*e*o-u*e*h,A-c*e*o-f*e*h],this.width=v,this.height=y}get rawDims(){const{viewBox:t}=this;return V(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:n=!1}={}){return new Po({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}convertToViewportPoint(t,e){return P.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=P.applyTransform([t[0],t[1]],this.transform),s=P.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return P.applyInverseTransform([t,e],this.transform)}}class Cc extends pi{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function xc(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function Tc(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function vf(d){return[d]=d.split(/[#?]/,1),d.substring(d.lastIndexOf("/")+1)}function _f(d,t="document.pdf"){if(typeof d!="string")return t;if(xc(d))return U('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=e.exec(d);let n=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=s.exec(decodeURIComponent(n))[0]}catch{}return n||t}class Bc{constructor(){B(this,"started",Object.create(null));B(this,"times",[])}time(t){t in this.started&&U(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||U(`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:n}of this.times)t.push(`${s.padEnd(e)} ${n-i}ms
2`);return t.join("")}}function Or(d,t){try{const{protocol:e}=t?new URL(d,t):new URL(d);return e==="http:"||e==="https:"}catch{return!1}}function Zt(d){d.preventDefault()}function cd(d){console.log("Deprecated API usage: "+d)}let zc;class dd{static toDateObject(t){if(!t||typeof t!="string")return null;zc||(zc=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=zc.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 n=parseInt(e[3],10);n=n>=1&&n<=31?n: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 h=parseInt(e[6],10);h=h>=0&&h<=59?h:0;const l=e[7]||"Z";
2let 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,l==="-"?(a+=c,o+=u):l==="+"&&(a-=c,o-=u),new Date(Date.UTC(s,i,n,a,o,h))}}function yf(d,{scale:t=1,rotation:e=0}){const{width:s,height:i}=d.attributes.style,n=[0,0,parseInt(s),parseInt(i)];return new Po({viewBox:n,scale:t,rotation:e})}function kc(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):(U(`Not a valid color format: "${d}"`),[0,0,0])}function wf(d){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of d.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;d.set(e,kc(s))}t.remove()}function lt(d){const{a:t,b:e,c:s,d:i,e:n,f:a}=d.getTransform();return[t,e,s,i,n,a]}function is(d){const{a:t,b:e,c:s,d:i,e:n,f:a}=d.getTransform().invertSelf();return[t,e,s,i,n,a]}function bn(d,t,e=!1,s=!0){if(t instanceof Po){const{pageWidth:i,pageHeight:n}=t.rawDims,{style:a}=d,o=Qt.isCSSRoundSupported,h=`var(--scale-factor) * ${i}px`,l=`var(--scale-factor) * ${n}px`,c=o?`round(${h}, 1px)`:`calc(${h})`,u=o?`round(${l}, 1px)`:`calc(${l})`;!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)}var Ei,Si,ie,Ci,Ch,ud,Gt,fd,pd,Xo,gd,pl;const xh=class xh{constructor(t){b(this,Gt);b(this,Ei,null);b(this,Si,null);b(this,ie);b(this,Ci,null);p(this,ie,t)}render(){const t=p(this,Ei,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");const e=r(this,ie)._uiManager._signal;t.addEventListener("contextmenu",Zt,{signal:e}),t.addEventListener("pointerdown",g(xh,Ch,ud),{signal:e});const s=p(this,Ci,document.createElement("div"));s.className="buttons",t.append(s);const i=r(this,ie).toolbarPosition;if(i){const{style:n}=t,a=r(this,ie)._uiManager.direction==="ltr"?1-i[0]:i[0];n.insetInlineEnd=`${100*a}%`,n.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return g(this,Gt,gd).call(this),t}hide(){var t;r(this,Ei).classList.add("hidden"),(t=r(this,Si))==null||t.hideDropdown()}show(){r(this,Ei).classList.remove("hidden")}addAltTextButton(t){g(this,Gt,Xo).call(this,t),r(this,Ci).prepend(t,r(this,Gt,pl))}addColorPicker(t){p(this,Si,t);const e=t.renderButton();g(this,Gt,Xo).call(this,e),r(this,Ci).prepend(e,r(this,Gt,pl))}remove(){var t;r(this,Ei).remove(),(t=r(this,Si))==null||t.destroy(),p(this,Si,null)}};Ei=new WeakMap,Si=new WeakMap,ie=new WeakMap,Ci=new WeakMap,Ch=new WeakSet,ud=function(t){t.stopPropagation()},Gt=new WeakSet,fd=function(t){r(this,ie)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},pd=function(t){r(this,ie)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},Xo=function(t){const e=r(this,ie)._uiManager._signal;t.addEventListener("focusin",g(this,Gt,fd).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",g(this,Gt,pd).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Zt,{signal:e})},gd=function(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${r(this,ie).editorType}-button`),g(this,Gt,Xo).call(this,t),t.addEventListener("click",e=>{r(this,ie)._uiManager.delete()},{signal:r(this,ie)._uiManager._signal}),r(this,Ci).append(t)},pl=function(){const t=document.createElement("div");return t.className="divider",t},b(xh,Ch);let fl=xh;var Zr,xi,Ti,ui,md,bd,Ad;class Ef{constructor(t){b(this,ui);b(this,Zr,null);b(this,xi,null);b(this,Ti);p(this,Ti,t)}show(t,e,s){const[i,n]=g(this,ui,bd).call(this,e,s),{style:a}=r(this,xi)||p(this,xi,g(this,ui,md).call(this));t.append(r(this,xi)),a.insetInlineEnd=`${100*i}%`,a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){r(this,xi).remove()}}Zr=new WeakMap,xi=new WeakMap,Ti=new WeakMap,ui=new WeakSet,md=function(){const t=p(this,xi,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Zt,{signal:r(this,Ti)._signal});const e=p(this,Zr,document.createElement("div"));return e.className="buttons",t.append(e),g(this,ui,Ad).call(this),t},bd=function(t,e){let s=0,i=0;for(const n of t){const a=n.y+n.height;if(a<s)continue;const o=n.x+(e?n.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]},Ad=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const s=r(this,Ti)._signal;t.addEventListener("contextmenu",Zt,{signal:s}),t.addEventListener("click",()=>{r(this,Ti).highlightSelection("floating_button")},{signal:s}),r(this,Zr).append(t)};function Ah(d,t,e){for(const s of e)t.addEventListener(s,d[s].bind(d))}function Sf(d){return Math.round(Math.min(255,Math.max(1,255*d))).toString(16).padStart(2,"0")}var Th;class Cf{constructor(){b(this,Th,0)}get id(){return`${sf}${te(this,Th)._++}`}}Th=new WeakMap;var ta,kh,fe,ea,ml;const Ic=class Ic{constructor(){b(this,ea);b(this,ta,mf());b(this,kh,0);b(this,fe,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 n=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 V(this,"_isSVGFittingCanvas",n)}async getFromFile(t){const{lastModified:e,name:s,size:i,type:n}=t;return g(this,ea,ml).call(this,`${e}_${s}_${i}_${n}`,t)}async getFromUrl(t){return g(this,ea,ml).call(this,t,t)}async getFromId(t){r(this,fe)||p(this,fe,new Map);const e=r(this,fe).get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=r(this,fe).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){r(this,fe)||p(this,fe,new Map);const e=r(this,fe).get(t);e&&(e.refCounter-=1,e.refCounter===0&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${r(this,ta)}_`)}};ta=new WeakMap,kh=new WeakMap,fe=new WeakMap,ea=new WeakSet,ml=async function(t,e){r(this,fe)||p(this,fe,new Map);let s=r(this,fe).get(t);if(s===null)return null;if(s!=null&&s.bitmap)return s.refCounter+=1,s;try{s||(s={bitmap:null,id:`image_${r(this,ta)}_${te(this,kh)._++}`,refCounter:0,isSvg:!1});let i;if(typeof e=="string"?(s.url=e,i=await Qh(e,"blob")):i=s.file=e,i.type==="image/svg+xml"){const n=Ic._isSVGFittingCanvas,a=new FileReader,o=new Image,h=new Promise((l,c)=>{o.onload=()=>
2{s.bitmap=o,s.isSvg=!0,l()},a.onload=async()=>{const u=s.svgUrl=a.result;o.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(i),await h}else s.bitmap=await createImageBitmap(i);s.refCounter=1}catch(i){console.error(i),s=null}return r(this,fe).set(t,s),s&&r(this,fe).set(s.id,s),s};let gl=Ic;var wt,Ws,sa,Et;class xf{constructor(t=128){b(this,wt,[]);b(this,Ws,!1);b(this,sa);b(this,Et,-1);p(this,sa,t)}add({cmd:t,undo:e,post:s,mustExec:i,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(i&&t(),r(this,Ws))return;const h={cmd:t,undo:e,post:s,type:n};if(r(this,Et)===-1){r(this,wt).length>0&&(r(this,wt).length=0),p(this,Et,0),r(this,wt).push(h);return}if(a&&r(this,wt)[r(this,Et)].type===n){o&&(h.undo=r(this,wt)[r(this,Et)].undo),r(this,wt)[r(this,Et)]=h;return}const l=r(this,Et)+1;l===r(this,sa)?r(this,wt).splice(0,1):(p(this,Et,l),l<r(this,wt).length&&r(this,wt).splice(l)),r(this,wt).push(h)}undo(){if(r(this,Et)===-1)return;p(this,Ws,!0);const{undo:t,post:e}=r(this,wt)[r(this,Et)];t(),e==null||e(),p(this,Ws,!1),p(this,Et,r(this,Et)-1)}redo(){if(r(this,Et)<r(this,wt).length-1){p(this,Et,r(this,Et)+1),p(this,Ws,!0);const{cmd:t,post:e}=r(this,wt)[r(this,Et)];t(),e==null||e(),p(this,Ws,!1)}}hasSomethingToUndo(){return r(this,Et)!==-1}hasSomethingToRedo(){return r(this,Et)<r(this,wt).length-1}destroy(){p(this,wt,null)}}wt=new WeakMap,Ws=new WeakMap,sa=new WeakMap,Et=new WeakMap;var Rh,vd;class Mo{constructor(t){b(this,Rh);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Qt.platform;for(const[s,i,n={}]of t)for(const a of s){const o=a.startsWith("mac+");e&&o?(this.callbacks.set(a.slice(4),{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1))):!e&&!o&&(this.callbacks.set(a,{callback:i,options:n}),this.allKeys.add(a.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(g(this,Rh,vd).call(this,e));if(!s)return;const{callback:i,options:{bubbles:n=!1,args:a=[],checker:o=null}}=s;o&&!o(t,e)||(i.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}Rh=new WeakSet,vd=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 Lh=class Lh{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return wf(t),V(this,"_colors",t)}convert(t){const e=kc(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,i]of this._colors)if(i.every((n,a)=>n===e[a]))return Lh._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?P.makeHexColor(...e):t}};B(Lh,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let bl=Lh;var Fn,ne,bt,xt,Dn,cs,On,we,Nn,ki,Ne,Ee,Ri,ia,na,He,Hn,Gs,Be,Ph,Vs,ra,Li,aa,Bn,Tt,K,ds,Pi,oa,ha,la,ca,da,ua,fa,pa,ga,ma,ba,Aa,va,qs,ze,us,_a,T,Yo,_d,yd,Ko,wd,Ed,Sd,Al,Cd,vl,_l,xd,Ut,zs,Td,kd,yl,Rd,Nr,wl;const Pn=class Pn{constructor(t,e,s,i,n,a,o,h,l){b(this,T);b(this,Fn,new AbortController);b(this,ne,null);b(this,bt,new Map);b(this,xt,new Map);b(this,Dn,null);b(this,cs,null);b(this,On,null);b(this,we,new xf);b(this,Nn,0);b(this,ki,new Set);b(this,Ne,null);b(this,Ee,null);b(this,Ri,new Set);b(this,ia,!1);b(this,na,null);b(this,He,null);b(this,Hn,null);b(this,Gs,!1);b(this,Be,null);b(this,Ph,new Cf);b(this,Vs,!1);b(this,ra,!1);b(this,Li,null);b(this,aa,null);b(this,Bn,null);b(this,Tt,G.NONE);b(this,K,new Set);b(this,ds,null);b(this,Pi,null);b(this,oa,null);b(this,ha,this.blur.bind(this));b(this,la,this.focus.bind(this));b(this,ca,this.copy.bind(this));b(this,da,this.cut.bind(this));b(this,ua,this.paste.bind(this));b(this,fa,this.keydown.bind(this));b(this,pa,this.keyup.bind(this));b(this,ga,this.onEditingAction.bind(this));b(this,ma,this.onPageChanging.bind(this));b(this,ba,this.onScaleChanging.bind(this));b(this,Aa,this.onRotationChanging.bind(this));b(this,va,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});b(this,qs,[0,0]);b(this,ze,null);b(this,us,null);b(this,_a,null);this._signal=r(this,Fn).signal,p(this,us,t),p(this,_a,e),p(this,Dn,s),this._eventBus=i,this._eventBus._on("editingaction",r(this,ga)),this._eventBus._on("pagechanging",r(this,ma)),this._eventBus._on("scalechanging",r(this,ba)),this._eventBus._on("rotationchanging",r(this,Aa)),g(this,T,wd).call(this),g(this,T,xd).call(this),g(this,T,Al).call(this),p(this,cs,n.annotationStorage),p(this,na,n.filterFactory),p(this,Pi,a),p(this,Hn,o||null),p(this,ia,h),p(this,Bn,l||null),this.viewParameters={realScale:di.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const t=Pn.prototype,e=a=>r(a,us).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:h}=o;return h!=="text"&&h!=="number"}return!0},i=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return V(this,"_keyboardManager",new Mo([[["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)&&r(a,us).contains(o)&&!a.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&r(a,us).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:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,s;(t=r(this,Fn))==null||t.abort(),p(this,Fn,null),this._signal=null,this._eventBus._off("editingaction",r(this,ga)),this._eventBus._off("pagechanging",r(this,ma)),this._eventBus._off("scalechanging",r(this,ba)),this._eventBus._off("rotationchanging",r(this,Aa));for(const i of r(this,xt).values())i.destroy();r(this,xt).clear(),r(this,bt).clear(),r(this,Ri).clear(),p(this,ne,null),r(this,K).clear(),r(this,we).destroy(),(e=r(this,Dn))==null||e.destroy(),(s=r(this,Be))==null||s.hide(),p(this,Be,null),r(this,He)&&(clearTimeout(r(this,He)),p(this,He,null)),r(this,ze)&&(clearTimeout(r(this,ze)),p(this,ze,null))}async mlGuess(t){var e;return((e=r(this,Bn))==null?void 0:e.guess(t))||null}get hasMLManager(){return!!r(this,Bn)}get hcmFilter(){return V(this,"hcmFilter",r(this,Pi)?r(this,na).addHCMFilter(r(this,Pi).foreground,r(this,Pi).background):"none")}get direction(){return V(this,"direction",getComputedStyle(r(this,us)).direction)}get highlightColors(){return V(this,"highlightColors",r(this,Hn)?new Map(r(this,Hn).split(",").map(t=>t.split("=").map(e=>e.trim()))):null)}get highlightColorNames(){return V(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){p(this,aa,t)}editAltText(t){var e;(e=r(this,Dn))==null||e.editAltText(this,t)}onPageChanging({pageNumber:t}){p(this,Nn,t-1)}focusMainContainer(){r(this,us).focus()}findParent(t,e){for(const s of r(this,xt).values()){const{x:i,y:n,width:a,height:o}=s.div.getBoundingClientRect();if(t>=i&&t<=i+a&&e>=n&&e<=n+o)return s}return null}disableUserSelect(t=!1){r(this,_a).classList.toggle("noUserSelect",t)}addShouldRescale(t){r(this,Ri).add(t)}removeShouldRescale(t){r(this,Ri).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*di.PDF_TO_CSS_UNITS;for(const e of r(this,Ri))e.onScaleChanging()}
2onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a}=e,o=e.toString(),l=g(this,T,Yo).call(this,e).closest(".textLayer"),c=this.getSelectionBoxes(l);if(c){e.empty(),r(this,Tt)===G.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:G.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const u of r(this,xt).values())if(u.hasTextLayer(l)){u.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:c,anchorNode:s,anchorOffset:i,focusNode:n,focusOffset:a,text:o});break}}}addToAnnotationStorage(t){!t.isEmpty()&&r(this,cs)&&!r(this,cs).has(t.id)&&r(this,cs).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,r(this,Gs)&&(p(this,Gs,!1),g(this,T,Ko).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of r(this,K))if(e.div.contains(t)){p(this,Li,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!r(this,Li))return;const[t,e]=r(this,Li);p(this,Li,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){g(this,T,Al).call(this),g(this,T,vl).call(this)}removeEditListeners(){g(this,T,Cd).call(this),g(this,T,_l).call(this)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const s of r(this,Ee))if(s.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const s of r(this,Ee))if(s.isHandlingMimeForPasting(e.type)){s.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var s;if(t.preventDefault(),(s=r(this,ne))==null||s.commitOrRemove(),!this.hasSelection)return;const e=[];for(const i of r(this,K)){const n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const n of e.items)for(const a of r(this,Ee))if(a.isHandlingMimeForPasting(n.type)){a.paste(n,this.currentLayer);return}let s=e.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(n){U(`paste: "${n.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();const i=this.currentLayer;try{const n=[];for(const h of s){const l=i.deserialize(h);if(!l)return;n.push(l)}const a=()=>{for(const h of n)g(this,T,yl).call(this,h);g(this,T,wl).call(this,n)},o=()=>{for(const h of n)h.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(n){U(`paste: "${n.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),r(this,Tt)!==G.NONE&&!this.isEditorHandlingKeyboard&&Pn._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,r(this,Gs)&&(p(this,Gs,!1),g(this,T,Ko).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}}setEditingState(t){t?(g(this,T,Ed).call(this),g(this,T,vl).call(this),g(this,T,Ut).call(this,{isEditing:r(this,Tt)!==G.NONE,isEmpty:g(this,T,Nr).call(this),hasSomethingToUndo:r(this,we).hasSomethingToUndo(),hasSomethingToRedo:r(this,we).hasSomethingToRedo(),hasSelectedEditor:!1})):(g(this,T,Sd).call(this),g(this,T,_l).call(this),g(this,T,Ut).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!r(this,Ee)){p(this,Ee,t);for(const e of r(this,Ee))g(this,T,zs).call(this,e.defaultPropertiesToUpdate)}}getId(){return r(this,Ph).id}get currentLayer(){return r(this,xt).get(r(this,Nn))}getLayer(t){return r(this,xt).get(t)}get currentPageIndex(){return r(this,Nn)}addLayer(t){r(this,xt).set(t.pageIndex,t),r(this,Vs)?t.enable():t.disable()}removeLayer(t){r(this,xt).delete(t.pageIndex)}updateMode(t,e=null,s=!1){if(r(this,Tt)!==t){if(p(this,Tt,t),t===G.NONE){this.setEditingState(!1),g(this,T,kd).call(this);return}this.setEditingState(!0),g(this,T,Td).call(this),this.unselectAll();for(const i of r(this,xt).values())i.updateMode(t);if(!e&&s){this.addNewEditorFromKeyboard();return}if(e){for(const i of r(this,bt).values())if(i.annotationElementId===e){this.setSelected(i),i.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==r(this,Tt)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){var s;if(r(this,Ee)){switch(t){case O.CREATE:this.currentLayer.addNewEditor();return;case O.HIGHLIGHT_DEFAULT_COLOR:(s=r(this,aa))==null||s.updateColor(e);break;case O.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(r(this,oa)||p(this,oa,new Map)).set(t,e),this.showAllEditors("highlight",e);break}for(const i of r(this,K))i.updateParams(t,e);for(const i of r(this,Ee))i.updateDefaultParams(t,e)}}showAllEditors(t,e,s=!1){var n;for(const a of r(this,bt).values())a.editorType===t&&a.show(e);(((n=r(this,oa))==null?void 0:n.get(O.HIGHLIGHT_SHOW_ALL))??!0)!==e&&g(this,T,zs).call(this,[[O.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(r(this,ra)!==t){p(this,ra,t);for(const e of r(this,xt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}getEditors(t){const e=[];for(const s of r(this,bt).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return r(this,bt).get(t)}addEditor(t){r(this,bt).set(t.id,t)}removeEditor(t){var e;t.div.contains(document.activeElement)&&(r(this,He)&&clearTimeout(r(this,He)),p(this,He,setTimeout(()=>{this.focusMainContainer(),p(this,He,null)},0))),r(this,bt).delete(t.id),this.unselect(t),(!t.annotationElementId||!r(this,ki).has(t.annotationElementId))&&((e
2=r(this,cs))==null||e.remove(t.id))}addDeletedAnnotationElement(t){r(this,ki).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return r(this,ki).has(t)}removeDeletedAnnotationElement(t){r(this,ki).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){r(this,ne)!==t&&(p(this,ne,t),t&&g(this,T,zs).call(this,t.propertiesToUpdate))}updateUI(t){r(this,T,Rd)===t&&g(this,T,zs).call(this,t.propertiesToUpdate)}toggleSelected(t){if(r(this,K).has(t)){r(this,K).delete(t),t.unselect(),g(this,T,Ut).call(this,{hasSelectedEditor:this.hasSelection});return}r(this,K).add(t),t.select(),g(this,T,zs).call(this,t.propertiesToUpdate),g(this,T,Ut).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of r(this,K))e!==t&&e.unselect();r(this,K).clear(),r(this,K).add(t),t.select(),g(this,T,zs).call(this,t.propertiesToUpdate),g(this,T,Ut).call(this,{hasSelectedEditor:!0})}isSelected(t){return r(this,K).has(t)}get firstSelectedEditor(){return r(this,K).values().next().value}unselect(t){t.unselect(),r(this,K).delete(t),g(this,T,Ut).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return r(this,K).size!==0}get isEnterHandled(){return r(this,K).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){r(this,we).undo(),g(this,T,Ut).call(this,{hasSomethingToUndo:r(this,we).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:g(this,T,Nr).call(this)})}redo(){r(this,we).redo(),g(this,T,Ut).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:r(this,we).hasSomethingToRedo(),isEmpty:g(this,T,Nr).call(this)})}addCommands(t){r(this,we).add(t),g(this,T,Ut).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:g(this,T,Nr).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...r(this,K)],e=()=>{for(const i of t)i.remove()},s=()=>{for(const i of t)g(this,T,yl).call(this,i)};this.addCommands({cmd:e,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=r(this,ne))==null||t.commitOrRemove()}hasSomethingToControl(){return r(this,ne)||this.hasSelection}selectAll(){for(const t of r(this,K))t.commit();g(this,T,wl).call(this,r(this,bt).values())}unselectAll(){if(!(r(this,ne)&&(r(this,ne).commitOrRemove(),r(this,Tt)!==G.NONE))&&this.hasSelection){for(const t of r(this,K))t.unselect();r(this,K).clear(),g(this,T,Ut).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;r(this,qs)[0]+=t,r(this,qs)[1]+=e;const[i,n]=r(this,qs),a=[...r(this,K)],o=1e3;r(this,ze)&&clearTimeout(r(this,ze)),p(this,ze,setTimeout(()=>{p(this,ze,null),r(this,qs)[0]=r(this,qs)[1]=0,this.addCommands({cmd:()=>{for(const h of a)r(this,bt).has(h.id)&&h.translateInPage(i,n)},undo:()=>{for(const h of a)r(this,bt).has(h.id)&&h.translateInPage(-i,-n)},mustExec:!1})},o));for(const h of a)h.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,Ne,new Map);for(const t of r(this,K))r(this,Ne).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!r(this,Ne))return!1;this.disableUserSelect(!1);const t=r(this,Ne);p(this,Ne,null);let e=!1;for(const[{x:i,y:n,pageIndex:a},o]of t)o.newX=i,o.newY=n,o.newPageIndex=a,e||(e=i!==o.savedX||n!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const s=(i,n,a,o)=>{if(r(this,bt).has(i.id)){const h=r(this,xt).get(o);h?i._setParentAndPosition(h,n,a):(i.pageIndex=o,i.x=n,i.y=a)}};return this.addCommands({cmd:()=>{for(const[i,{newX:n,newY:a,newPageIndex:o}]of t)s(i,n,a,o)},undo:()=>{for(const[i,{savedX:n,savedY:a,savedPageIndex:o}]of t)s(i,n,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(r(this,Ne))for(const s of r(this,Ne).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())||r(this,K).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return r(this,ne)===t}getActive(){return r(this,ne)}getMode(){return r(this,Tt)}get imageManager(){return V(this,"imageManager",new gl)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let l=0,c=e.rangeCount;l<c;
2l++)if(!t.contains(e.getRangeAt(l).commonAncestorContainer))return null;const{x:s,y:i,width:n,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(l,c,u,f)=>({x:(c-i)/a,y:1-(l+u-s)/n,width:f/a,height:u/n});break;case"180":o=(l,c,u,f)=>({x:1-(l+u-s)/n,y:1-(c+f-i)/a,width:u/n,height:f/a});break;case"270":o=(l,c,u,f)=>({x:1-(c+f-i)/a,y:(l-s)/n,width:f/a,height:u/n});break;default:o=(l,c,u,f)=>({x:(l-s)/n,y:(c-i)/a,width:u/n,height:f/a});break}const h=[];for(let l=0,c=e.rangeCount;l<c;l++){const u=e.getRangeAt(l);if(!u.collapsed)for(const{x:f,y:m,width:A,height:v}of u.getClientRects())A===0||v===0||h.push(o(f,m,A,v))}return h.length===0?null:h}addChangedExistingAnnotation({annotationElementId:t,id:e}){(r(this,On)||p(this,On,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=r(this,On))==null||e.delete(t)}renderAnnotationElement(t){var i;const e=(i=r(this,On))==null?void 0:i.get(t.data.id);if(!e)return;const s=r(this,cs).getRawValue(e);s&&(r(this,Tt)===G.NONE&&!s.hasBeenModified||s.renderAnnotationElement(t))}};Fn=new WeakMap,ne=new WeakMap,bt=new WeakMap,xt=new WeakMap,Dn=new WeakMap,cs=new WeakMap,On=new WeakMap,we=new WeakMap,Nn=new WeakMap,ki=new WeakMap,Ne=new WeakMap,Ee=new WeakMap,Ri=new WeakMap,ia=new WeakMap,na=new WeakMap,He=new WeakMap,Hn=new WeakMap,Gs=new WeakMap,Be=new WeakMap,Ph=new WeakMap,Vs=new WeakMap,ra=new WeakMap,Li=new WeakMap,aa=new WeakMap,Bn=new WeakMap,Tt=new WeakMap,K=new WeakMap,ds=new WeakMap,Pi=new WeakMap,oa=new WeakMap,ha=new WeakMap,la=new WeakMap,ca=new WeakMap,da=new WeakMap,ua=new WeakMap,fa=new WeakMap,pa=new WeakMap,ga=new WeakMap,ma=new WeakMap,ba=new WeakMap,Aa=new WeakMap,va=new WeakMap,qs=new WeakMap,ze=new WeakMap,us=new WeakMap,_a=new WeakMap,T=new WeakSet,Yo=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},_d=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const s=g(this,T,Yo).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(s);i&&(r(this,Be)||p(this,Be,new Ef(this)),r(this,Be).show(s,i,this.direction==="ltr"))},yd=function(){var n,a,o;const t=document.getSelection();if(!t||t.isCollapsed){r(this,ds)&&((n=r(this,Be))==null||n.hide(),p(this,ds,null),g(this,T,Ut).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===r(this,ds))return;if(!g(this,T,Yo).call(this,t).closest(".textLayer")){r(this,ds)&&((a=r(this,Be))==null||a.hide(),p(this,ds,null),g(this,T,Ut).call(this,{hasSelectedText:!1}));return}if((o=r(this,Be))==null||o.hide(),p(this,ds,e),g(this,T,Ut).call(this,{hasSelectedText:!0}),!(r(this,Tt)!==G.HIGHLIGHT&&r(this,Tt)!==G.NONE)&&(r(this,Tt)===G.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),p(this,Gs,this.isShiftKeyDown),!this.isShiftKeyDown)){const h=this._signal,l=c=>{c.type==="pointerup"&&c.button!==0||(window.removeEventListener("pointerup",l),window.removeEventListener("blur",l),c.type==="pointerup"&&g(this,T,Ko).call(this,"main_toolbar"))};window.addEventListener("pointerup",l,{signal:h}),window.addEventListener("blur",l,{signal:h})}},Ko=function(t=""){r(this,Tt)===G.HIGHLIGHT?this.highlightSelection(t):r(this,ia)&&g(this,T,_d).call(this)},wd=function(){document.addEventListener("selectionchange",g(this,T,yd).bind(this),{signal:this._signal})},Ed=function(){const t=this._signal;window.addEventListener("focus",r(this,la),{signal:t}),window.addEventListener("blur",r(this,ha),{signal:t})},Sd=function(){window.removeEventListener("focus",r(this,la)),window.removeEventListener("blur",r(this,ha))},Al=function(){const t=this._signal;window.addEventListener("keydown",r(this,fa),{signal:t}),window.addEventListener("keyup",r(this,pa),{signal:t})},Cd=function(){window.removeEventListener("keydown",r(this,fa)),window.removeEventListener("keyup",r(this,pa))},vl=function(){const t=this._signal;document.addEventListener("copy",r(this,ca),{signal:t}),document.addEventListener("cut",r(this,da),{signal:t}),document.addEventListener("paste",r(this,ua),{signal:t})},_l=function(){document.removeEventListener("copy",r(this,ca)),document.removeEventListener("cut",r(this,da)),document.removeEventListener("paste",r(this,ua))},xd=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Ut=function(t){Object.entries(t).some(([s,i])=>r(this,va)[s]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(r(this,va),t)}),r(this,Tt)===G.HIGHLIGHT&&t.hasSelectedEditor===!1&&g(this,T,zs).call(this,[[O.HIGHLIGHT_FREE,!0]]))},zs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Td=function(){if(!r(this,Vs)){p(this,Vs,!0);for(const t of r(this,xt).values())t.enable();for(const t of r(this,bt).values())t.enable()}},kd=function(){if(this.unselectAll(),r(this,Vs)){p(this,Vs,!1);for(const t of r(this,xt).values())t.disable();for(const t of r(this,bt).values())t.disable()}},yl=function(t){const e=r(this,xt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Rd=function(){let t=null;for(t of r(this,K));return t},Nr=function(){if(r(this,bt).size===0)return!0;
2if(r(this,bt).size===1)for(const t of r(this,bt).values())return t.isEmpty();return!1},wl=function(t){for(const e of r(this,K))e.unselect();r(this,K).clear();for(const e of t)e.isEmpty()||(r(this,K).add(e),e.select());g(this,T,Ut).call(this,{hasSelectedEditor:this.hasSelection})},B(Pn,"TRANSLATE_SMALL",1),B(Pn,"TRANSLATE_BIG",10);let An=Pn;var fs,ps,Se,gs,re,zn,Ce,ya,El;const rs=class rs{constructor(t){b(this,ya);b(this,fs,"");b(this,ps,!1);b(this,Se,null);b(this,gs,null);b(this,re,null);b(this,zn,!1);b(this,Ce,null);p(this,Ce,t)}static initialize(t){rs._l10nPromise||(rs._l10nPromise=t)}async render(){const t=p(this,Se,document.createElement("button"));t.className="altText";const e=await rs._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0";const s=r(this,Ce)._uiManager._signal;t.addEventListener("contextmenu",Zt,{signal:s}),t.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:s});const i=n=>{n.preventDefault(),r(this,Ce)._uiManager.editAltText(r(this,Ce))};return t.addEventListener("click",i,{capture:!0,signal:s}),t.addEventListener("keydown",n=>{n.target===t&&n.key==="Enter"&&(p(this,zn,!0),i(n))},{signal:s}),await g(this,ya,El).call(this),t}finish(){r(this,Se)&&(r(this,Se).focus({focusVisible:r(this,zn)}),p(this,zn,!1))}isEmpty(){return!r(this,fs)&&!r(this,ps)}get data(){return{altText:r(this,fs),decorative:r(this,ps)}}set data({altText:t,decorative:e}){r(this,fs)===t&&r(this,ps)===e||(p(this,fs,t),p(this,ps,e),g(this,ya,El).call(this))}toggle(t=!1){r(this,Se)&&(!t&&r(this,re)&&(clearTimeout(r(this,re)),p(this,re,null)),r(this,Se).disabled=!t)}destroy(){var t;(t=r(this,Se))==null||t.remove(),p(this,Se,null),p(this,gs,null)}};fs=new WeakMap,ps=new WeakMap,Se=new WeakMap,gs=new WeakMap,re=new WeakMap,zn=new WeakMap,Ce=new WeakMap,ya=new WeakSet,El=async function(){var i;const t=r(this,Se);if(!t)return;if(!r(this,fs)&&!r(this,ps)){t.classList.remove("done"),(i=r(this,gs))==null||i.remove();return}t.classList.add("done"),rs._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(n=>{t.setAttribute("aria-label",n)});let e=r(this,gs);if(!e){p(this,gs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip");const n=e.id=`alt-text-tooltip-${r(this,Ce).id}`;t.setAttribute("aria-describedby",n);const a=100,o=r(this,Ce)._uiManager._signal;o.addEventListener("abort",()=>{clearTimeout(r(this,re)),p(this,re,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,re,setTimeout(()=>{p(this,re,null),r(this,gs).classList.add("show"),r(this,Ce)._reportTelemetry({action:"alt_text_tooltip"})},a))},{signal:o}),t.addEventListener("mouseleave",()=>{var h;r(this,re)&&(clearTimeout(r(this,re)),p(this,re,null)),(h=r(this,gs))==null||h.classList.remove("show")},{signal:o})}e.innerText=r(this,ps)?await rs._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):r(this,fs),e.parentNode||t.append(e);const s=r(this,Ce).getImageForAltText();s==null||s.setAttribute("aria-describedby",e.id)},B(rs,"_l10nPromise",null);let vh=rs;var Mi,xe,Nt,Un,Ii,kt,Fi,$n,jn,Ht,wa,Di,Xs,Ea,Oi,ms,Ue,Wn,Gn,pe,Sa,Mh,$,Sl,Ca,Cl,xl,Ld,Pd,Tl,kl,Rl,Md,Id,Fd,Dd,Ll,Hr;const et=class et{constructor(t){b(this,$);b(this,Mi,null);b(this,xe,null);b(this,Nt,null);b(this,Un,!1);b(this,Ii,!1);b(this,kt,null);b(this,Fi,null);b(this,$n,this.focusin.bind(this));b(this,jn,this.focusout.bind(this));b(this,Ht,null);b(this,wa,"");b(this,Di,!1);b(this,Xs,null);b(this,Ea,!1);b(this,Oi,!1);b(this,ms,!1);b(this,Ue,null);b(this,Wn,0);b(this,Gn,0);b(this,pe,null);B(this,"_initialOptions",Object.create(null));B(this,"_isVisible",!0);B(this,"_uiManager",null);B(this,"_focusEventsAllowed",!0);B(this,"_l10nPromise",null);b(this,Sa,!1);b(this,Mh,et._zIndex++);this.constructor===et&&Z("Cannot initialize AnnotationEditor."),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;const{rotation:e,rawDims:{pageWidth:s,pageHeight:i,pageX:n,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,i],this.pageTranslation=[n,a];const[o,h]=this.parentDimensions;this.x=t.x/o,this.y=t.y/h,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=et.prototype._resizeWithKeyboard,e=An.TRANSLATE_SMALL,s=An.TRANSLATE_BIG;return V(this,"_resizerKeyboardManager",new Mo([[["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"],et.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return V(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new Tf({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,s){if(et._l10nPromise||(et._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(n=>[n,t.get(n.replaceAll(/([A-Z])/g,a=>`-${a.toLowerCase()}`))]))),s!=null&&s.strings)for(const n of s.strings)et._l10nPromise.set(n,t.get(n));if(et._borderLineWidth!==-1)return;const i=getComputedStyle(document.documentElement);et._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){Z("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return r(this,Sa)}set _isDraggable(t){var e;p(this,Sa,t),(e=this.div)==null||e.classList.toggle("draggable",t)}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}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=r(this,Mh)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):g(this,$,Hr).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&(r(this,Di)?p(this,Di,!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.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,i){const[n,a]=this.parentDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/n,this.y=(e+i)/a,this.fixAndSetPosition()}translate(t,e){g(this,$,Sl).call(this,this.parentDimensions,t,e)}translateInPage(t,e){r(this,Xs)||p(this,Xs,[this.x,this.y]),g(this,$,Sl).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){r(this,Xs)||p(this,Xs,[this.x,this.y]);const[s,i]=this.parentDimensions;if(this.x+=t/s,this.y+=e/i,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:l,y:c}=this.div.getBoundingClientRect();this.parent.findNewParent(this,l,c)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:a}=this;const[o,h]=this.getBaseTranslation();n+=o,a+=h,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!r(this,Xs)&&(r(this,Xs)[0]!==this.x||r(this,Xs)[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=et,i=s/t,n=s/e;switch(this.rotation){case 90:return[-i,n];case 180:return[i,n];case 270:return[i,-n];default:return[-i,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,s]=this.pageDimensions;let{x:i,y:n,width:a,height:o}=this;if(a*=e,o*=s,i*=e,n*=s,this._mustFixPosition)switch(t){case 0:i=Math.max(0,Math.min(e-a,i)),n=Math.max(0,Math.min(s-o,n));break;case 90:i=Math.max(0,Math.min(e-o,i)),n=Math.min(s,Math.max(a,n));break;case 180:i=Math.min(e,Math.max(a,i)),n=Math.min(s,Math.max(o,n));break;case 270:i=Math.min(e,Math.max(o,i)),n=Math.max(0,Math.min(s-a,n));break}this.x=i/=e,this.y=n/=s;const[h,l]=this.getBaseTranslation();i+=h,n+=l;const{style:c}=this.div;c.left=`${(100*i).toFixed(2)}%`,c.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return g(s=et,Ca,Cl).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return g(s=et,Ca,Cl).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,i=e*t,n=s*t;return Qt.isCSSRoundSupported?[Math.round(i),Math.round(n)]:[i,n]}setDims(t,e){const[s,i]=this.parentDimensions;this.div.style.width=`${(100*t/s).toFixed(2)}%`,r(this,Ii)||(this.div.style.height=`${(100*e/i).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:s}=t,i=s.endsWith("%"),n=!r(this,Ii)&&e.endsWith("%");if(i&&n)return;const[a,o]=this.parentDimensions;i||(t.width=`${(100*parseFloat(s)/a).toFixed(2)}%`),!r(this,Ii)&&!n&&(t.height=`${(100*parseFloat(e)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var t;(t=r(this,Nt))==null||t.finish()}async addEditToolbar(){return r(this,Ht)||r(this,Oi)?r(this,Ht):(p(this,Ht,new fl(this)),this.div.append(r(this,Ht).render()),r(this,Nt)&&r(this,Ht).addAltTextButton(await r(this,Nt).render()),r(this,Ht))}removeEditToolbar(){var t;r(this,Ht)&&(r(this,Ht).remove(),p(this,Ht,null),(t=r(this,Nt))==null||t.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){r(this,Nt)||(vh.initialize(et._l10nPromise),p(this,Nt,new vh(this)),r(this,Mi)&&(r(this,Nt).data=r(this,Mi),p(this,Mi,null)),await this.addEditToolbar())}get altTextData(){var t;return(t=r(this,Nt))==null?void 0:t.data}set altTextData(t){r(this,Nt)&&(r(this,Nt).data=t)}hasAltText(){var t;return!((t=r(this,Nt))!=null&&t.isEmpty())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=r(this,Un)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",r(this,$n),{signal:t}),this.div.addEventListener("focusout",r(this,jn),{signal:t});const[e,s]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*s/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/s).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),Ah(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=Qt.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Di,!0),this._isDraggable){g(this,$,Md).call(this,t);return}g(this,$,Rl).call(this,t)}moveInDOM(){r(this,Ue)&&clearTimeout(r(this,Ue)),p(this,Ue,setTimeout(()=>{var t;p(this,Ue,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition()}getRect(t,e,s=this.rotation){const i=this.parentScale,[n,a]=this.pageDimensions,[o,h]=this.pageTranslation,l=t/i,c=e/i,u=this.x*n,f=this.y*a,m=this.width*n,A=this.height*a;switch(s){case 0:return[u+l+o,a-f-c-A+h,u+l+m+o,a-f-c+h];case 90:return[u+c+o,a-f+l+h,u+c+A+o,a-f+l+m+h];case 180:return[u-l-m+o,a-f+c+h,u-l+o,a-f+c+A+h];case 270:return[u-c-A+o,a-f-l-m+h,u-c+o,a-f-l+h];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,n,a]=t,o=n-s,h=a-i;switch(this.rotation){case 0:return[s,e-a,o,h];case 90:return[s,e-i,h,o];case 180:return[n,e-i,o,h];case 270:return[n,e-a,h,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){p(this,Oi,!0)}disableEditMode(){p(this,Oi,!1)}isInEditMode(){return r(this,Oi)}shouldGetKeyboardEvents(){return r(this,ms)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var e,s;const t=this._uiManager._signal;(e=this.div)==null||e.addEventListener("focusin",r(this,$n),{signal:t}),(s=this.div)==null||s.addEventListener("focusout",r(this,jn),{signal:t})}rotate(t){}serialize(t=!1,e=null){Z("An editor must be serializable")}static deserialize(t,e,s){const i=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:s});i.rotation=t.rotation,p(i,Mi,t.accessibilityData);const[n,a]=i.pageDimensions,[o,h,l,c]=i.getRectInCurrentCoords(t.rect,a);return i.x=o/n,i.y=h/a,i.width=l/n,i.height=c/a,i}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",r(this,$n)),this.div.removeEventListener("focusout",r(this,jn)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),r(this,Ue)&&(clearTimeout(r(this,Ue)),p(this,Ue,null)),g(this,$,Hr).call(this),this.removeEditToolbar(),r(this,pe)){for(const t of r(this,pe).values())clearTimeout(t);p(this,pe,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(g(this,$,Ld).call(this),r(this,kt).classList.remove("hidden"),Ah(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Fi,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=r(this,kt).children;if(!r(this,xe)){p(this,xe,Array.from(e));const a=g(this,$,Id).bind(this),o=g(this,$,Fd).bind(this),h=this._uiManager._signal;for(const l of r(this,xe)){const c=l.getAttribute("data-resizer-name");l.setAttribute("role","spinbutton"),l.addEventListener("keydown",a,{signal:h}),l.addEventListener("blur",o,{signal:h}),l.addEventListener("focus",g(this,$,Dd).bind(this,c),{signal:h}),et._l10nPromise.get(`pdfjs-editor-resizer-label-${c}`).then(u=>l.setAttribute("aria-label",u))}}const s=r(this,xe)[0];let i=0;for(const a of e){if(a===s)break;i++}const n=(360-this.rotation+this.parentRotation)%360/90*(r(this,xe).length/4);if(n!==i){if(n<i)for(let o=0;o<i-n;o++)r(this,kt).append(r(this,kt).firstChild);else if(n>i)for(let o=0;o<n-i;o++)r(this,kt).firstChild.before(r(this,kt).lastChild);let a=0;for(const o of e){const l=r(this,xe)[a++].getAttribute("data-resizer-name");et._l10nPromise.get(`pdfjs-editor-resizer-label-${l}`).then(c=>o.setAttribute("aria-label",c))}}g(this,$,Ll).call(this,0),p(this,ms,!0),r(this,kt).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){r(this,ms)&&g(this,$,kl).call(this,r(this,wa),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){g(this,$,Hr).call(this),this.div.focus()}select(){var t,e;if(this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!r(this,Ht)){this.addEditToolbar().then(()=>{var s,i;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((i=r(this,Ht))==null||i.show())});return}(e=r(this,Ht))==null||e.show()}unselect(){var t,e,s,i;(t=r(this,kt))==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=r(this,Ht))==null||i.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return r(this,Ea)}set isEditing(t){p(this,Ea,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){p(this,Ii,!0);const s=t/e,{style:i}=this.div;i.aspectRatio=s,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){r(this,pe)||p(this,pe,new Map);const{action:s}=t;let i=r(this,pe).get(s);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),r(this,pe).delete(s),r(this,pe).size===0&&p(this,pe,null)},et._telemetryTimeout),r(this,pe).set(s,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,Un,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,Un,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){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.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Mi=new WeakMap,xe=new WeakMap,Nt=new WeakMap,Un=new WeakMap,Ii=new WeakMap,kt=new WeakMap,Fi=new WeakMap,$n=new WeakMap,jn=new WeakMap,Ht=new WeakMap,wa=new WeakMap,Di=new WeakMap,Xs=new WeakMap,Ea=new WeakMap,Oi=new WeakMap,ms=new WeakMap,Ue=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,pe=new WeakMap,Sa=new WeakMap,Mh=new WeakMap,$=new WeakSet,Sl=function([t,e],s,i){[s,i]=this.screenToPageTranslation(s,i),this.x+=s/t,this.y+=i/e,this.fixAndSetPosition()},Ca=new WeakSet,Cl=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]}},xl=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]}},Ld=function(){if(r(this,kt))return;p(this,kt,document.createElement("div")),r(this,kt).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");r(this,kt).append(i),i.classList.add("resizer",s),i.setAttribute("data-resizer-name",s),i.addEventListener("pointerdown",g(this,$,Pd).bind(this,s),{signal:e}),i.addEventListener("contextmenu",Zt,{signal:e}),i.tabIndex=-1}this.div.prepend(r(this,kt))},Pd=function(t,e){var v;e.preventDefault();const{isMac:s}=Qt.platform;if(e.button!==0||e.ctrlKey&&s)return;(v=r(this,Nt))==null||v.toggle(!1);const i=g(this,$,kl).bind(this,t),n=this._isDraggable;this._isDraggable=!1;const a=this._uiManager._signal,o={passive:!0,capture:!0,signal:a};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",i,o),window.addEventListener("contextmenu",Zt,{signal:a});const h=this.x,l=this.y,c=this.width,u=this.height,f=this.parent.div.style.cursor,m=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const A=()=>{var y;this.parent.togglePointerEvents(!0),(y=r(this,Nt))==null||y.toggle(!0),this._isDraggable=n,window.removeEventListener("pointerup",A),window.removeEventListener("blur",A),window.removeEventListener("pointermove",i,o),window.removeEventListener("contextmenu",Zt),this.parent.div.style.cursor=f,this.div.style.cursor=m,g(this,$,Tl).call(this,h,l,c,u)};window.addEventListener("pointerup",A,{signal:a}),window.addEventListener("blur",A,{signal:a})},Tl=function(t,e,s,i){const n=this.x,a=this.y,o=this.width,h=this.height;n===t&&a===e&&o===s&&h===i||this.addCommands({cmd:()=>{this.width=o,this.height=h,this.x=n,this.y=a;const[l,c]=this.parentDimensions;this.setDims(l*o,c*h),this.fixAndSetPosition()},undo:()=>{this.width=s,this.height=i,this.x=t,this.y=e;const[l,c]=this.parentDimensions;this.setDims(l*s,c*i),this.fixAndSetPosition()},mustExec:!0})},kl=function(t,e){const[s,i]=this.parentDimensions,n=this.x,a=this.y,o=this.width,h=this.height,l=et.MIN_SIZE/s,c=et.MIN_SIZE/i,u=H=>Math.round(H*1e4)/1e4,f=g(this,$,xl).call(this,this.rotation),m=(H,z)=>[f[0]*H+f[2]*z,f[1]*H+f[3]*z],A=g(this,$,xl).call(this,360-this.rotation),v=(H,z)=>[A[0]*H+A[2]*z,A[1]*H+A[3]*z];let y,_,w=!1,E=!1;switch(t){case"topLeft":w=!0,y=(H,z)=>[0,0],_=(H,z)=>[H,z];break;case"topMiddle":y=(H,z)=>[H/2,0],_=(H,z)=>[H/2,z];break;case"topRight":w=!0,y=(H,z)=>[H,0],_=(H,z)=>[0,z];break;case"middleRight":E=!0,y=(H,z)=>[H,z/2],_=(H,z)=>[0,z/2];break;case"bottomRight":w=!0,y=(H,z)=>[H,z],_=(H,z)=>[0,0];break;case"bottomMiddle":y=(H,z)=>[H/2,z],_=(H,z)=>[H/2,0];break;case"bottomLeft":w=!0,y=(H,z)=>[0,z],_=(H,z)=>[H,0];break;case"middleLeft":E=!0,y=(H,z)=>[0,z/2],_=(H,z)=>[H,z/2];break}const S=y(o,h),x=_(o,h);let C=m(...x);const R=u(n+C[0]),I=u(a+C[1]);let N=1,q=1,[D,at]=this.screenToPageTranslation(e.movementX,e.movementY);if([D,at]=v(D/s,at/i),w){const H=Math.hypot(o,h);N=q=Math.max(Math.min(Math.hypot(x[0]-S[0]-D,x[1]-S[1]-at)/H,1/o,1/h),l/o,c/h)}else E?N=Math.max(l,Math.min(1,Math.abs(x[0]-S[0]-D)))/o:q=Math.max(c,Math.min(1,Math.abs(x[1]-S[1]-at)))/h;const it=u(o*N),rt=u(h*q);C=m(..._(it,rt));const ot=R-C[0],It=I-C[1];this.width=it,this.height=rt,this.x=ot,this.y=It,this.setDims(s*it,i*rt),this.fixAndSetPosition()},Rl=function(t){const{isMac:e}=Qt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Md=function(t){const e=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let s,i;const n=this._uiManager._signal;e&&(this.div.classList.add("moving"),s={passive:!0,capture:!0,signal:n},p(this,Wn,t.clientX),p(this,Gn,t.clientY),i=o=>{const{clientX:h,clientY:l}=o,[c,u]=this.screenToPageTranslation(h-r(this,Wn),l-r(this,Gn));p(this,Wn,h),p(this,Gn,l),this._uiManager.dragSelectedEditors(c,u)},window.addEventListener("pointermove",i,s));const a=()=>{window.removeEventListener("pointerup",a),window.removeEventListener("blur",a),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,s)),p(this,Di,!1),this._uiManager.endDragSession()||g(this,$,Rl).call(this,t)};window.addEventListener("pointerup",a,{signal:n}),window.addEventListener("blur",a,{signal:n})},Id=function(t){et._resizerKeyboardManager.exec(this,t)},Fd=function(t){var e;r(this,ms)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==r(this,kt)&&g(this,$,Hr).call(this)},Dd=function(t){p(this,wa,r(this,ms)?t:"")},Ll=function(t){if(r(this,xe))for(const e of r(this,xe))e.tabIndex=t},Hr=function(){if(p(this,ms,!1),g(this,$,Ll).call(this,-1),r(this,Fi)){const{savedX:t,savedY:e,savedWidth:s,savedHeight:i}=r(this,Fi);g(this,$,Tl).call(this,t,e,s,i),p(this,Fi,null)}},b(et,Ca),B(et,"_borderLineWidth",-1),B(et,"_colorManager",new bl),B(et,"_zIndex",1),B(et,"_telemetryTimeout",1e3);let Q=et;class Tf extends Q{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}
2serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const Uc=3285377520,ue=4294901760,De=65535;class Od{constructor(t){this.h1=t?t&4294967295:Uc,this.h2=t?t&4294967295:Uc}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let v=0,y=t.length;v<y;v++){const _=t.charCodeAt(v);_<=255?e[s++]=_:(e[s++]=_>>>8,e[s++]=_&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,n=s-i*4,a=new Uint32Array(e.buffer,0,i);let o=0,h=0,l=this.h1,c=this.h2;const u=3432918353,f=461845907,m=u&De,A=f&De;for(let v=0;v<i;v++)v&1?(o=a[v],o=o*u&ue|o*m&De,o=o<<15|o>>>17,o=o*f&ue|o*A&De,l^=o,l=l<<13|l>>>19,l=l*5+3864292196):(h=a[v],h=h*u&ue|h*m&De,h=h<<15|h>>>17,h=h*f&ue|h*A&De,c^=h,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,n){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&ue|o*m&De,o=o<<15|o>>>17,o=o*f&ue|o*A&De,i&1?l^=o:c^=o}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ue|t*36045&De,e=e*4283543511&ue|((e<<16|t>>>16)*2950163797&ue)>>>16,t^=e>>>1,t=t*444984403&ue|t*60499&De,e=e*3301882366&ue|((e<<16|t>>>16)*3120437893&ue)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Pl=Object.freeze({map:null,hash:"",transfer:void 0});var Ni,Rt,Ih,Nd;class Rc{constructor(){b(this,Ih);b(this,Ni,!1);b(this,Rt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=r(this,Rt).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return r(this,Rt).get(t)}remove(t){if(r(this,Rt).delete(t),r(this,Rt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of r(this,Rt).values())if(e instanceof Q)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=r(this,Rt).get(t);let i=!1;if(s!==void 0)for(const[n,a]of Object.entries(e))s[n]!==a&&(i=!0,s[n]=a);else i=!0,r(this,Rt).set(t,e);i&&g(this,Ih,Nd).call(this),e instanceof Q&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return r(this,Rt).has(t)}getAll(){return r(this,Rt).size>0?wc(r(this,Rt)):null}setAll(t){for(const[e,s]of Object.entries(t))this.setValue(e,s)}get size(){return r(this,Rt).size}resetModified(){r(this,Ni)&&(p(this,Ni,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Hd(this)}get serializable(){if(r(this,Rt).size===0)return Pl;const t=new Map,e=new Od,s=[],i=Object.create(null);let n=!1;for(const[a,o]of r(this,Rt)){const h=o instanceof Q?o.serialize(!1,i):o;h&&(t.set(a,h),e.update(`${a}:${JSON.stringify(h)}`),n||(n=!!h.bitmap))}if(n)for(const a of t.values())a.bitmap&&s.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Pl}get editorStats(){let t=null;const e=new Map;for(const s of r(this,Rt).values()){if(!(s instanceof Q))continue;const i=s.telemetryFinalData;if(!i)continue;const{type:n}=i;e.has(n)||e.set(n,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));const a=t[n]||(t[n]=new Map);for(const[o,h]of Object.entries(i)){if(o==="type")continue;let l=a.get(o);l||(l=new Map,a.set(o,l));const c=l.get(h)??0;l.set(h,c+1)}}for(const[s,i]of e)t[s]=i.computeTelemetryFinalData(t[s]);return t}}Ni=new WeakMap,Rt=new WeakMap,Ih=new WeakSet,Nd=function(){r(this,Ni)||(p(this,Ni,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var xa;class Hd extends Rc{constructor(e){super();b(this,xa);const{map:s,hash:i,transfer:n}=e.serializable,a=structuredClone(s,n?{transfer:n}:null);p(this,xa,{map:a,hash:i,transfer:n})}get print(){Z("Should not call PrintAnnotationStorage.print")}get serializable(){return r(this,xa)}}xa=new WeakMap;var Vn;class kf{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){b(this,Vn,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(),r(this,Vn).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}
2){if(!(!t||r(this,Vn).has(t.loadedName))){if(yt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:i,style:n}=t,a=new FontFace(s,i,n);this.addNativeFontFace(a);try{await a.load(),r(this,Vn).add(s),e==null||e(t)}catch{U(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}Z("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 U(`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 V(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(Bt||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),V(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(yt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;s.length>0&&s[0].done;){const n=s.shift();setTimeout(n.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 V(this,"_loadTestFont",t)}
2_prepareFontLoadEvent(t,e){function s(S,x){return S.charCodeAt(x)<<24|S.charCodeAt(x+1)<<16|S.charCodeAt(x+2)<<8|S.charCodeAt(x+3)&255}function i(S,x,C,R){const I=S.substring(0,x),N=S.substring(x+C);return I+R+N}let n,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const h=o.getContext("2d");let l=0;function c(S,x){if(++l>30){U("Load test font never loaded."),x();return}if(h.font="30px "+S,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0){x();return}setTimeout(c.bind(null,S,x))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=i(f,976,u.length,u);const A=16,v=1482184792;let y=s(f,A);for(n=0,a=u.length-3;n<a;n+=4)y=y-v+s(u,n)|0;n<u.length&&(y=y-v+s(u+"XXX",n)|0),f=i(f,A,4,df(y));const _=`url(data:font/opentype;base64,${btoa(f)});`,w=`@font-face {font-family:"${u}";src:${_}}`;this.insertRule(w);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const S of[t.loadedName,u]){const x=this._document.createElement("span");x.textContent="Hi",x.style.fontFamily=S,E.append(x)}this._document.body.append(E),c(u,()=>{E.remove(),e.complete()})}}Vn=new WeakMap;class Rf{constructor(t,{disableFontFace:e=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const i in t)this[i]=t[i];this.disableFontFace=e===!0,this._inspectFont=s}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 i;if(!this.data||this.disableFontFace)return null;const t=rd(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let s;if(!this.cssFontInfo)s=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),s=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${e}}`}return(i=this._inspectFont)==null||i.call(this,this,e),s}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(n){U(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(s)||s.length===0)return this.compiledGlyphs[e]=function(n,a){};const i=[];for(let n=0,a=s.length;n<a;)switch(s[n++]){case ss.BEZIER_CURVE_TO:{const[o,h,l,c,u,f]=s.slice(n,n+6);i.push(m=>m.bezierCurveTo(o,h,l,c,u,f)),n+=6}break;case ss.MOVE_TO:{const[o,h]=s.slice(n,n+2);i.push(l=>l.moveTo(o,h)),n+=2}break;case ss.LINE_TO:{const[o,h]=s.slice(n,n+2);i.push(l=>l.lineTo(o,h)),n+=2}break;case ss.QUADRATIC_CURVE_TO:{const[o,h,l,c]=s.slice(n,n+4);i.push(u=>u.quadraticCurveTo(o,h,l,c)),n+=4}break;case ss.RESTORE:i.push(o=>o.restore());break;case ss.SAVE:i.push(o=>o.save());break;case ss.SCALE:yt(i.length===2,"Scale command is only valid at the third position.");break;case ss.TRANSFORM:{const[o,h,l,c,u,f]=s.slice(n,n+6);i.push(m=>m.transform(o,h,l,c,u,f)),n+=6}break;case ss.TRANSLATE:{const[o,h]=s.slice(n,n+2);i.push(l=>l.translate(o,h)),n+=2}break}return this.compiledGlyphs[e]=function(a,o){i[0](a),i[1](a),a.scale(o,-o);for(let h=2,l=i.length;h<l;h++)i[h](a)}}}if(Bt){var Ml=Promise.withResolvers(),Yr=null;(async()=>{const t=await Bo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),e=await Bo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),s=await Bo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),i=await Bo(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);let n,a;return new Map(Object.entries({fs:t,http:e,https:s,url:i,canvas:n,path2d:a}))})().then(t=>{Yr=t,Ml.resolve()},t=>{U(`loadPackages: ${t}`),Yr=new Map,Ml.resolve()})}class ts{static get promise(){return Ml.promise}static get(t){return Yr==null?void 0:Yr.get(t)}}const Bd=function(d){return ts.get("fs").promises.readFile(d).then(e=>new Uint8Array(e))};class Lf extends Xh{}class Pf extends bh{_createCanvas(t,e){return ts.get("canvas").createCanvas(t,e)}}class Mf extends Yh{_fetchData(t,e){return Bd(t).then(s=>({cMapData:s,compressionType:e}))}}class If extends Kh{_fetchData(t){return Bd(t)}}const Wt={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Il(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 Io{constructor(){this.constructor===Io&&Z("Cannot initialize BaseShadingPattern.")}getPattern(){Z("Abstract method `getPattern` called.")}}class Ff extends Io{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 n;if(i===Wt.STROKE||i===Wt.FILL){const a=e.current.getClippedPathBoundingBox(i,lt(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,h=Math.ceil(a[3]-a[1])||1,l=e.cachedCanvases.getCanvas("pattern",o,h,!0),c=l.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=P.transform(s,[1,0,0,1,a[0],a[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix
2),Il(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),n=t.createPattern(l.canvas,"no-repeat");const u=new DOMMatrix(s);n.setTransform(u)}else Il(t,this._bbox),n=this._createGradient(t);return n}}function il(d,t,e,s,i,n,a,o){const h=t.coords,l=t.colors,c=d.data,u=d.width*4;let f;h[e+1]>h[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f),h[s+1]>h[i+1]&&(f=s,s=i,i=f,f=a,a=o,o=f),h[e+1]>h[s+1]&&(f=e,e=s,s=f,f=n,n=a,a=f);const m=(h[e]+t.offsetX)*t.scaleX,A=(h[e+1]+t.offsetY)*t.scaleY,v=(h[s]+t.offsetX)*t.scaleX,y=(h[s+1]+t.offsetY)*t.scaleY,_=(h[i]+t.offsetX)*t.scaleX,w=(h[i+1]+t.offsetY)*t.scaleY;if(A>=w)return;const E=l[n],S=l[n+1],x=l[n+2],C=l[a],R=l[a+1],I=l[a+2],N=l[o],q=l[o+1],D=l[o+2],at=Math.round(A),it=Math.round(w);let rt,ot,It,H,z,Do,Oo,No;for(let zt=at;zt<=it;zt++){if(zt<y){const gt=zt<A?0:(A-zt)/(A-y);rt=m-(m-v)*gt,ot=E-(E-C)*gt,It=S-(S-R)*gt,H=x-(x-I)*gt}else{let gt;zt>w?gt=1:y===w?gt=0:gt=(y-zt)/(y-w),rt=v-(v-_)*gt,ot=C-(C-N)*gt,It=R-(R-q)*gt,H=I-(I-D)*gt}let St;zt<A?St=0:zt>w?St=1:St=(A-zt)/(A-w),z=m-(m-_)*St,Do=E-(E-N)*St,Oo=S-(S-q)*St,No=x-(x-D)*St;const Ho=Math.round(Math.min(rt,z)),gi=Math.round(Math.max(rt,z));let Bs=u*zt+Ho*4;for(let gt=Ho;gt<=gi;gt++)St=(rt-gt)/(rt-z),St<0?St=0:St>1&&(St=1),c[Bs++]=ot-(ot-Do)*St|0,c[Bs++]=It-(It-Oo)*St|0,c[Bs++]=H-(H-No)*St|0,c[Bs++]=255}}function Df(d,t,e){const s=t.coords,i=t.colors;let n,a;switch(t.type){case"lattice":const o=t.verticesPerRow,h=Math.floor(s.length/o)-1,l=o-1;for(n=0;n<h;n++){let c=n*o;for(let u=0;u<l;u++,c++)il(d,e,s[c],s[c+1],s[c+o],i[c],i[c+1],i[c+o]),il(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(n=0,a=s.length;n<a;n+=3)il(d,e,s[n],s[n+1],s[n+2],i[n],i[n+1],i[n+2]);break;default:throw new Error("illegal figure")}}class Of extends Io{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const o=Math.floor(this._bounds[0]),h=Math.floor(this._bounds[1]),l=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-h,u=Math.min(Math.ceil(Math.abs(l*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),m=l/u,A=c/f,v={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-h,scaleX:1/m,scaleY:1/A},y=u+2*2,_=f+2*2,w=s.getCanvas("mesh",y,_,!1),E=w.context,S=E.createImageData(u,f);if(e){const C=S.data;for(let R=0,I=C.length;R<I;R+=4)C[R]=e[0],C[R+1]=e[1],C[R+2]=e[2],C[R+3]=255}for(const C of this._figures)Df(S,C,v);return E.putImageData(S,2,2),{canvas:w.canvas,offsetX:o-2*m,offsetY:h-2*A,scaleX:m,scaleY:A}}getPattern(t,e,s,i){Il(t,this._bbox);let n;if(i===Wt.SHADING)n=P.singularValueDecompose2dScale(lt(t));else if(n=P.singularValueDecompose2dScale(e.baseTransform),this.matrix){const o=P.singularValueDecompose2dScale(this.matrix);n=[n[0]*o[0],n[1]*o[1]]}const a=this._createMeshCanvas(n,i===Wt.SHADING?null:this._background,e.cachedCanvases);return i!==Wt.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 Nf extends Io{getPattern(){return"hotpink"}}function Hf(d){switch(d[0]){case"RadialAxial":return new Ff(d);case"Mesh":return new Of(d);case"Dummy":return new Nf}throw new Error(`Unknown IR type: ${d[0]}`)}const $c={COLORED:1,UNCOLORED:2},Fh=class Fh{constructor(t,e,s,i,n){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t){const e=this.operatorList,s=this.bbox,i=this.xstep,n=this.ystep,a=this.paintType,o=this.tilingType,h=this.color,l=this.canvasGraphicsFactory;Gh("TilingType: "+o);const c=s[0],u=s[1],f=s[2],m=s[3],A=P.singularValueDecompose2dScale(this.matrix),v=P.singularValueDecompose2dScale(this.baseTransform),y=[A[0]*v[0],A[1]*v[1]],_=this.getSizeAndScale(i,this.ctx.canvas.width,y[0]),w=this.getSizeAndScale(n,this.ctx.canvas.height,y[1]),E=t.cachedCanvases.getCanvas("pattern",_.size,w.size,!0),S=E.context,x=l.createCanvasGraphics(S);x.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(x,a,h);let C=c,R=u,I=f,N=m;return c<0&&(C=0,I+=Math.abs(c)),u<0&&(R=0,N+=Math.abs(u)),S.translate(-(_.scale*C),-(w.scale*R)),x.transform(_.scale,0,0,w.scale,0,0),S.save(),this.clipBbox(x,C,R,I,N),x.baseTransform=lt(x.ctx),x.executeOperatorList(e),x.endDrawing(),{canvas:E.canvas,scaleX:_.scale,scaleY:w.scale,offsetX:C,offsetY:R}}getSizeAndScale(t,e,s){t=Math.abs(t);const i=Math.max(Fh.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*s);return n>=i?n=i:s=n/t,{scale:s,size:n}}clipBbox(t,e,s,i,n){const a=i-e,o=n-s;t.ctx.rect(e,s,a,o),t.current.updateRectMinMax(lt(t.ctx),[e,s,i,n]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const i=t.ctx,n=t.current;switch(e){case $c.COLORED:const a=this.ctx;i.fillStyle=a.fillStyle,i.strokeStyle=a.strokeStyle,n.fillColor=a.fillStyle,n.strokeColor=a.strokeStyle;break;case $c.UNCOLORED:const o=P.makeHexColor(s[0],s[1],s[2]);i.fillStyle=o,i.strokeStyle=o,n.fillColor=o,n.strokeColor=o;break;default:throw new cf(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,i){let n=s;i!==Wt.SHADING&&(n=P.transform(n,e.baseTransform),this.matrix&&(n=P.transform(n,this.matrix
2)));const a=this.createPatternCanvas(e);let o=new DOMMatrix(n);o=o.translate(a.offsetX,a.offsetY),o=o.scale(1/a.scaleX,1/a.scaleY);const h=t.createPattern(a.canvas,"repeat");return h.setTransform(o),h}};B(Fh,"MAX_PATTERN_SIZE",3e3);let Fl=Fh;function Bf({src:d,srcPos:t=0,dest:e,width:s,height:i,nonBlackColor:n=4294967295,inverseDecode:a=!1}){const o=Qt.isLittleEndian?4278190080:255,[h,l]=a?[n,o]:[o,n],c=s>>3,u=s&7,f=d.length;e=new Uint32Array(e.buffer);let m=0;for(let A=0;A<i;A++){for(const y=t+c;t<y;t++){const _=t<f?d[t]:255;e[m++]=_&128?l:h,e[m++]=_&64?l:h,e[m++]=_&32?l:h,e[m++]=_&16?l:h,e[m++]=_&8?l:h,e[m++]=_&4?l:h,e[m++]=_&2?l:h,e[m++]=_&1?l:h}if(u===0)continue;const v=t<f?d[t++]:255;for(let y=0;y<u;y++)e[m++]=v&1<<7-y?l:h}return{srcPos:t,destPos:m}}const jc=16,Wc=100,zf=15,Gc=10,Vc=1e3,Kt=16;function Uf(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()},d.restore=function(){t.restore(),this.__originalRestore()},d.translate=function(s,i){t.translate(s,i),this.__originalTranslate(s,i)},d.scale=function(s,i){t.scale(s,i),this.__originalScale(s,i)},d.transform=function(s,i,n,a,o,h){t.transform(s,i,n,a,o,h),this.__originalTransform(s,i,n,a,o,h)},d.setTransform=function(s,i,n,a,o,h){t.setTransform(s,i,n,a,o,h),this.__originalSetTransform(s,i,n,a,o,h)},d.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},d.rotate=function(s){t.rotate(s),this.__originalRotate(s)},d.clip=function(s){t.clip(s),this.__originalClip(s)},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,n,a,o){t.bezierCurveTo(e,s,i,n,a,o),this.__originalBezierCurveTo(e,s,i,n,a,o)},d.rect=function(e,s,i,n){t.rect(e,s,i,n),this.__originalRect(e,s,i,n)},d.closePath=function(){t.closePath(),this.__originalClosePath()},d.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class $f{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 zo(d,t,e,s,i,n,a,o,h,l){const[c,u,f,m,A,v]=lt(d);if(u===0&&f===0){const w=a*c+A,E=Math.round(w),S=o*m+v,x=Math.round(S),C=(a+h)*c+A,R=Math.abs(Math.round(C)-E)||1,I=(o+l)*m+v,N=Math.abs(Math.round(I)-x)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(m),E,x),d.drawImage(t,e,s,i,n,0,0,R,N),d.setTransform(c,u,f,m,A,v),[R,N]}if(c===0&&m===0){const w=o*f+A,E=Math.round(w),S=a*u+v,x=Math.round(S),C=(o+l)*f+A,R=Math.abs(Math.round(C)-E)||1,I=(a+h)*u+v,N=Math.abs(Math.round(I)-x)||1;return d.setTransform(0,Math.sign(u),Math.sign(f),0,E,x),d.drawImage(t,e,s,i,n,0,0,N,R),d.setTransform(c,u,f,m,A,v),[N,R]}d.drawImage(t,e,s,i,n,a,o,h,l);const y=Math.hypot(c,u),_=Math.hypot(f,m);return[y*h,_*l]}function jf(d){const{width:t,height:e}=d;if(t>Vc||e>Vc)return null;const s=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=t+1;let a=new Uint8Array(n*(e+1)),o,h,l;const c=t+7&-8;let u=new Uint8Array(c*e),f=0;for(const _ of d.data){let w=128;for(;w>0;)u[f++]=_&w?0:255,w>>=1}let m=0;for(f=0,u[f]!==0&&(a[0]=1,++m),h=1;h<t;h++)u[f]!==u[f+1]&&(a[h]=u[f]?2:1,++m),f++;for(u[f]!==0&&(a[h]=2,++m),o=1;o<e;o++){f=o*c,l=o*n,u[f-c]!==u[f]&&(a[l]=u[f]?1:8,++m);let _=(u[f]?4:0)+(u[f-c]?8:0);for(h=1;h<t;h++)_=(_>>
22)+(u[f+1]?4:0)+(u[f-c+1]?8:0),i[_]&&(a[l+h]=i[_],++m),f++;if(u[f-c]!==u[f]&&(a[l+h]=u[f]?2:4,++m),m>s)return null}for(f=c*(e-1),l=o*n,u[f]!==0&&(a[l]=8,++m),h=1;h<t;h++)u[f]!==u[f+1]&&(a[l+h]=u[f]?4:8,++m),f++;if(u[f]!==0&&(a[l+h]=4,++m),m>s)return null;const A=new Int32Array([0,n,-1,0,-n,0,0,0,1]),v=new Path2D;for(o=0;m&&o<=e;o++){let _=o*n;const w=_+t;for(;_<w&&!a[_];)_++;if(_===w)continue;v.moveTo(_%n,o);const E=_;let S=a[_];do{const x=A[S];do _+=x;while(!a[_]);const C=a[_];C!==5&&C!==10?(S=C,a[_]=0):(S=C&51*S>>4,a[_]&=S>>2|S<<2),v.lineTo(_%n,_/n|0),a[_]||--m}while(E!==_);--o}return u=null,a=null,function(_){_.save(),_.scale(1/t,-1/e),_.translate(0,-e),_.fill(v),_.beginPath(),_.restore()}}class qc{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=id,this.textMatrixScale=1,this.fontMatrix=al,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=Ft.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=P.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=P.applyTransform(e,t),i=P.applyTransform(e.slice(2),t),n=P.applyTransform([e[0],e[3]],t),a=P.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,s[0],i[0],n[0],a[0]),this.minY=Math.min(this.minY,s[1],i[1],n[1],a[1]),this.maxX=Math.max(this.maxX,s[0],i[0],n[0],a[0]),this.maxY=Math.max(this.maxY,s[1],i[1],n[1],a[1])}updateScalingPathMinMax(t,e){P.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,n,a,o,h,l,c){const u=P.bezierBoundingBox(e,s,i,n,a,o,h,l,c);c||this.updateRectMinMax(t,u)}getPathBoundingBox(t=Wt.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===Wt.STROKE){e||Z("Stroke bounding box must include transform.");const i=P.singularValueDecompose2dScale(e),n=i[0]*this.lineWidth/2,a=i[1]*this.lineWidth/2;s[0]-=n,s[1]-=a,s[2]+=n,s[3]+=a}return s}updateClipFromPath(){const t=P.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Wt.FILL,e=null){return P.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Xc(d,t){if(typeof ImageData<"u"&&t instanceof ImageData){d.putImageData(t,0,0);return}const e=t.height,s=t.width,i=e%Kt,n=(e-i)/Kt,a=i===0?n:n+1,o=d.createImageData(s,Kt);let h=0,l;const c=t.data,u=o.data;let f,m,A,v;if(t.kind===Go.GRAYSCALE_1BPP){const y=c.byteLength,_=new Uint32Array(u.buffer,0,u.byteLength>>2),w=_.length,E=s+7>>3,S=4294967295,x=Qt.isLittleEndian?4278190080:255;for(f=0;f<a;f++){for(A=f<n?Kt:i,l=0,m=0;m<A;m++){const C=y-h;let R=0;const I=C>E?s:C*8-7,N=I&-8;let q=0,D=0;for(;R<N;R+=8)D=c[h++],_[l++]=D&128?S:x,_[l++]=D&64?S:x,_[l++]=D&32?S:x,_[l++]=D&16?S:x,_[l++]=D&8?S:x,_[l++]=D&4?S:x,_[l++]=D&2?S:x,_[l++]=D&1?S:x;for(;R<I;R++)q===0&&(D=c[h++],q=128),_[l++]=D&q?S:x,q>>=1}for(;l<w;)_[l++]=0;d.putImageData(o,0,f*Kt)}}else if(t.kind===Go.RGBA_32BPP){for(m=0,v=s*Kt*4,f=0;f<n;f++)u.set(c.subarray(h,h+v)),h+=v,d.putImageData(o,0,m),m+=Kt;f<a&&(v=s*i*4,u.set(c.subarray(h,h+v)),d.putImageData(o,0,m))}else if(t.kind===Go.RGB_24BPP)for(A=Kt,v=s*A,f=0;f<a;f++){for(f>=n&&(A=i,v=s*A),l=0,m=v;m--;)u[l++]=c[h++],u[l++]=c[h++],u[l++]=c[h++],u[l++]=255;d.putImageData(o,0,f*Kt)}else throw new Error(`bad image kind: ${t.kind}`)}function Yc(d,t){if(t.bitmap){d.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,i=e%Kt,n=(e-i)/Kt,a=i===0?n:n+1,o=d.createImageData(s,Kt);let h=0;const l=t.data,c=o.data;for(let u=0;u<a;u++){const f=u<n?Kt:i;({srcPos:h}=Bf({src:l,srcPos:h,dest:c,width:s,height:f,nonBlackColor:0})),d.putImageData(o,0,u*Kt)}}function Pr(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 Uo(d){if(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),!Bt){const{filter:t}=d;t!=="none"&&t!==""&&(d.filter="none")}}function Kc(d,t){if(t)return!0;const e=P.singularValueDecompose2dScale(d);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*di.PDF_TO_CSS_UNITS);return e[0]<=s&&e[1]<=s}const Wf=["butt","round","square"],Gf=["miter","round","bevel"],Vf={},Qc={};var fi,Dl,Ol;const Fc=class Fc{constructor(t,e,s,i,n,{optionalContentConfig:a,markedContentStack:o=null},h,l){b(this,fi);
2this.ctx=t,this.current=new qc(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=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedCanvases=new $f(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=h,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const n=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=i||"#ffffff",this.ctx.fillRect(0,0,n,a),this.ctx.fillStyle=o,s){const h=this.cachedCanvases.getCanvas("transparent",n,a);this.compositeCtx=this.ctx,this.transparentCanvas=h.canvas,this.ctx=h.context,this.ctx.save(),this.ctx.transform(...lt(this.compositeCtx))}this.ctx.save(),Uo(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=lt(this.ctx)}executeOperatorList(t,e,s,i){const n=t.argsArray,a=t.fnArray;let o=e||0;const h=n.length;if(h===o)return o;const l=h-o>Gc&&typeof s=="function",c=l?Date.now()+zf:0;let u=0;const f=this.commonObjs,m=this.objs;let A;for(;;){if(i!==void 0&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(A=a[o],A!==ye.dependency)this[A].apply(this,n[o]);else for(const v of n[o]){const y=v.startsWith("g_")?f:m;if(!y.has(v))return y.get(v,s),o}if(o++,o===h)return o;if(l&&++u>Gc){if(Date.now()>c)return s(),o;u=0}}}endDrawing(){g(this,fi,Dl).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(),g(this,fi,Ol).call(this)}_scaleImage(t,e){const s=t.width,i=t.height;let n=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=s,h=i,l="prescale1",c,u;for(;n>2&&o>1||a>2&&h>1;){let f=o,m=h;n>2&&o>1&&(f=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),n/=o/f),a>2&&h>1&&(m=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,a/=h/m),c=this.cachedCanvases.getCanvas(l,f,m),u=c.context,u.clearRect(0,0,f,m),u.drawImage(t,0,0,o,h,0,0,f,m),t=c.canvas,o=f,h=m,l=l==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:o,paintHeight:h}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,n=this.current.fillColor,a=this.current.patternFill,o=lt(e);let h,l,c,u;if((t.bitmap||t.data)&&t.count>1){const I=t.bitmap||t.data.buffer;l=JSON.stringify(a?o:[o.slice(0,4),n]),h=this._cachedBitmapsMap.get(I),h||(h=new Map,this._cachedBitmapsMap.set(I,h));const N=h.get(l);if(N&&!a){const q=Math.round(Math.min(o[0],o[2])+o[4]),D=Math.round(Math.min(o[1],o[3])+o[5]);return{canvas:N,offsetX:q,offsetY:D}}c=N}c||(u=this.cachedCanvases.getCanvas("maskCanvas",s,i),Yc(u.context,t));let f=P.transform(o,[1/s,0,0,-1/i,0,0]);f=P.transform(f,[1,0,0,1,0,-i]);const[m,A,v,y]=P.getAxialAlignedBoundingBox([0,0,s,i],f),_=Math.round(v-m)||1,w=Math.round(y-A)||1,E=this.cachedCanvases.getCanvas("fillCanvas",_,w),S=E.context,x=m,C=A;S.translate(-x,-C),S.transform(...f),c||(c=this._scaleImage(u.canvas,is(S)),c=c.img,h&&a&&h.set(l,c)),S.imageSmoothingEnabled=Kc(lt(S),t.interpolate),zo(S,c,0,0,c.width,c.height,0,0,s,i),S.globalCompositeOperation="source-in";const R=P.transform(is(S),[1,0,0,1,-x,-C]);return S.fillStyle=a?n.getPattern(e,this,R,Wt.FILL):n,S.fillRect(0,0,s,i),h&&!a&&(this.cachedCanvases.delete("fillCanvas"),h.set(l,E.canvas)),{canvas:E.canvas,offsetX:Math.round(x),offsetY:Math.round(C)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Wf[t]}setLineJoin(t){this.ctx.lineJoin=Gf[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(t),s.lineDashOffset=e)}
2setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=s;break;case"ca":this.current.fillAlpha=s,this.ctx.globalAlpha=s;break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask=s?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(s);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const n=this.ctx;n.setTransform(...lt(this.suspendedCtx)),Pr(this.suspendedCtx,n),Uf(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Pr(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 n=i[0],a=i[1],o=i[2]-n,h=i[3]-a;o===0||h===0||(this.genericComposeSMask(e.context,s,o,h,e.subtype,e.backdrop,e.transferMap,n,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,n,a,o,h,l,c,u){let f=t.canvas,m=h-c,A=l-u;if(a){if(m<0||A<0||m+s>f.width||A+i>f.height){const y=this.cachedCanvases.getCanvas("maskExtension",s,i),_=y.context;_.drawImage(f,-m,-A),a.some(w=>w!==0)&&(_.globalCompositeOperation="destination-atop",_.fillStyle=P.makeHexColor(...a),_.fillRect(0,0,s,i),_.globalCompositeOperation="source-over"),f=y.canvas,m=A=0}else if(a.some(y=>y!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const y=new Path2D;y.rect(m,A,s,i),t.clip(y),t.globalCompositeOperation="destination-atop",t.fillStyle=P.makeHexColor(...a),t.fillRect(m,A,s,i),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&o?e.filter=this.filterFactory.addAlphaFilter(o):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(o));const v=new Path2D;v.rect(h,l,s,i),e.clip(v),e.globalCompositeOperation="destination-in",e.drawImage(f,m,A,s,i,h,l,s,i),e.restore()}save(){this.inSMaskMode?(Pr(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Pr(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,n,a){this.ctx.transform(t,e,s,i,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,n=this.current;let a=n.x,o=n.y,h,l;const c=lt(i),u=c[0]===0&&c[3]===0||c[1]===0&&c[2]===0,f=u?s.slice(0):null;for(let m=0,A=0,v=t.length;m<v;
2m++)switch(t[m]|0){case ye.rectangle:a=e[A++],o=e[A++];const y=e[A++],_=e[A++],w=a+y,E=o+_;i.moveTo(a,o),y===0||_===0?i.lineTo(w,E):(i.lineTo(w,o),i.lineTo(w,E),i.lineTo(a,E)),u||n.updateRectMinMax(c,[a,o,w,E]),i.closePath();break;case ye.moveTo:a=e[A++],o=e[A++],i.moveTo(a,o),u||n.updatePathMinMax(c,a,o);break;case ye.lineTo:a=e[A++],o=e[A++],i.lineTo(a,o),u||n.updatePathMinMax(c,a,o);break;case ye.curveTo:h=a,l=o,a=e[A+4],o=e[A+5],i.bezierCurveTo(e[A],e[A+1],e[A+2],e[A+3],a,o),n.updateCurvePathMinMax(c,h,l,e[A],e[A+1],e[A+2],e[A+3],a,o,f),A+=6;break;case ye.curveTo2:h=a,l=o,i.bezierCurveTo(a,o,e[A],e[A+1],e[A+2],e[A+3]),n.updateCurvePathMinMax(c,h,l,a,o,e[A],e[A+1],e[A+2],e[A+3],f),a=e[A+2],o=e[A+3],A+=4;break;case ye.curveTo3:h=a,l=o,a=e[A+2],o=e[A+3],i.bezierCurveTo(e[A],e[A+1],a,o,a,o),n.updateCurvePathMinMax(c,h,l,e[A],e[A+1],a,o,a,o,f),A+=4;break;case ye.closePath:i.closePath();break}u&&n.updateScalingPathMinMax(c,f),n.setCurrentPoint(a,o)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof s=="object"&&(s!=null&&s.getPattern)?(e.save(),e.strokeStyle=s.getPattern(e,this,is(e),Wt.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;let n=!1;i&&(e.save(),e.fillStyle=s.getPattern(e,this,is(e),Wt.FILL),n=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Vf}eoClip(){this.pendingClip=Qc}beginText(){this.current.textMatrix=id,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(t===void 0){e.beginPath();return}e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var c;const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||al,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&U("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const n=s.loadedName||"sans-serif",a=((c=s.systemFontInfo)==null?void 0:c.css)||`"${n}", ${s.fallbackName}`;let o="normal";s.black?o="900":s.bold&&(o="bold");const h=s.italic?"italic":"normal";let l=e;e<jc?l=jc:e>Wc&&(l=Wc),this.current.fontSizeScale=e/l,this.ctx.font=`${h} ${o} ${l}px ${a}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,n,a){this.current.textMatrix=[t,e,s,i,n,a],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const n=this.ctx,a=this.current,o=a.font,h=a.textRenderingMode,l=a.fontSize/a.fontSizeScale,c=h&Ft.FILL_STROKE_MASK,u=!!(h&Ft.ADD_TO_PATH_FLAG),f=a.patternFill&&!o.missingFile;let m;(o.disableFontFace||u||f)&&(m=o.getPathGenerator(this.commonObjs,t)),o.disableFontFace||f?(n.save(),n.translate(e,s),n.beginPath(),m(n,l),i&&n.setTransform(...i),(c===Ft.FILL||c===Ft.FILL_STROKE)&&n.fill(),(c===Ft.STROKE||c===Ft.FILL_STROKE)&&n.stroke(),n.restore(
2)):((c===Ft.FILL||c===Ft.FILL_STROKE)&&n.fillText(t,e,s),(c===Ft.STROKE||c===Ft.FILL_STROKE)&&n.strokeText(t,e,s)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:lt(n),x:e,y:s,fontSize:l,addToPath:m})}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 V(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(i===0)return;const n=this.ctx,a=e.fontSizeScale,o=e.charSpacing,h=e.wordSpacing,l=e.fontDirection,c=e.textHScale*l,u=t.length,f=s.vertical,m=f?1:-1,A=s.defaultVMetrics,v=i*e.fontMatrix[0],y=e.textRenderingMode===Ft.FILL&&!s.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),l>0?n.scale(c,-1):n.scale(c,1);let _;if(e.patternFill){n.save();const C=e.fillColor.getPattern(n,this,is(n),Wt.FILL);_=lt(n),n.restore(),n.fillStyle=C}let w=e.lineWidth;const E=e.textMatrixScale;if(E===0||w===0){const C=e.textRenderingMode&Ft.FILL_STROKE_MASK;(C===Ft.STROKE||C===Ft.FILL_STROKE)&&(w=this.getSinglePixelWidth())}else w/=E;if(a!==1&&(n.scale(a,a),w/=a),n.lineWidth=w,s.isInvalidPDFjsFont){const C=[];let R=0;for(const I of t)C.push(I.unicode),R+=I.width;n.fillText(C.join(""),0,0),e.x+=R*v*c,n.restore(),this.compose();return}let S=0,x;for(x=0;x<u;++x){const C=t[x];if(typeof C=="number"){S+=m*C*i/1e3;continue}let R=!1;const I=(C.isSpace?h:0)+o,N=C.fontChar,q=C.accent;let D,at,it=C.width;if(f){const ot=C.vmetric||A,It=-(C.vmetric?ot[1]:it*.5)*v,H=ot[2]*v;it=ot?-ot[0]:it,D=It/a,at=(S+H)/a}else D=S/a,at=0;if(s.remeasure&&it>0){const ot=n.measureText(N).width*1e3/i*a;if(it<ot&&this.isFontSubpixelAAEnabled){const It=it/ot;R=!0,n.save(),n.scale(It,1),D/=It}else it!==ot&&(D+=(it-ot)/2e3*i/a)}if(this.contentVisible&&(C.isInFont||s.missingFile)){if(y&&!q)n.fillText(N,D,at);else if(this.paintChar(N,D,at,_),q){const ot=D+i*q.offset.x/a,It=at-i*q.offset.y/a;this.paintChar(q.fontChar,ot,It,_)}}const rt=f?it*v-I*l:it*v+I*l;S+=rt,R&&n.restore()}f?e.y-=S:e.x+=S*c,n.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,n=s.fontSize,a=s.fontDirection,o=i.vertical?1:-1,h=s.charSpacing,l=s.wordSpacing,c=s.textHScale*a,u=s.fontMatrix||al,f=t.length,m=s.textRenderingMode===Ft.INVISIBLE;let A,v,y,_;if(!(m||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(c,a),A=0;A<f;++A){if(v=t[A],typeof v=="number"){_=o*v*n/1e3,this.ctx.translate(_,0),s.x+=_*c;continue}const w=(v.isSpace?l:0)+h,E=i.charProcOperatorList[v.operatorListId];if(!E){U(`Type3 character "${v.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=v,this.save(),e.scale(n,n),e.transform(...u),this.executeOperatorList(E),this.restore()),y=P.applyTransform([v.width,0],u)[0]*n+w,e.translate(y,0),s.x+=y*c}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,n,a){this.ctx.rect(s,i,n-s,a-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){const s=t[1],i=this.baseTransform||lt(this.ctx),n={createCanvasGraphics:a=>new Fc(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Fl(t,s,this.ctx,n,i)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){const i=P.makeHexColor(t,e,s);this.ctx.strokeStyle=i,this.current.strokeColor=i}setFillRGBColor(t,e,s){const i=P.makeHexColor(t,e,s);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=Hf(this.getObject(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,is(e),Wt.SHADING);const i=is(e);if(i){const{width:n,height:a}=e.canvas,[o,h,l,c]=P.getAxialAlignedBoundingBox([0,0,n,a],i);this.ctx.fillRect(o,h,l-o,c-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore(
2)}beginInlineImage(){Z("Should not call beginInlineImage")}beginImageData(){Z("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=lt(this.ctx),e)){const s=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],s,i),this.current.updateRectMinMax(lt(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Gh("TODO: Support non-isolated groups."),t.knockout&&U("Knockout groups not supported.");const s=lt(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=P.getAxialAlignedBoundingBox(t.bbox,lt(e));const n=[0,0,e.canvas.width,e.canvas.height];i=P.intersect(i,n)||[0,0,0,0];const a=Math.floor(i[0]),o=Math.floor(i[1]),h=Math.max(Math.ceil(i[2])-a,1),l=Math.max(Math.ceil(i[3])-o,1);this.current.startNewPathAndClipBox([0,0,h,l]);let c="groupAt"+this.groupLevel;t.smask&&(c+="_smask_"+this.smaskCounter++%2);const u=this.cachedCanvases.getCanvas(c,h,l),f=u.context;f.translate(-a,-o),f.transform(...s),t.smask?this.smaskStack.push({canvas:u.canvas,context:f,offsetX:a,offsetY:o,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,o),e.save()),Pr(e,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const i=lt(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...i);const n=P.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],i);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,s,i,n){if(g(this,fi,Dl).call(this),Uo(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){s=s.slice(),s[4]-=e[0],s[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o;const[h,l]=P.singularValueDecompose2dScale(lt(this.ctx)),{viewportScale:c}=this,u=Math.ceil(a*this.outputScaleX*c),f=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,f);const{canvas:m,context:A}=this.annotationCanvas;this.annotationCanvasMap.set(t,m),this.annotationCanvas.savedCtx=this.ctx,this.ctx=A,this.ctx.save(),this.ctx.setTransform(h,0,0,-l,0,o*l),Uo(this.ctx)}else Uo(this.ctx),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.endPath()}this.current=new qc(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...i)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),g(this,fi,Ol).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const s=this.ctx,i=this.processingType3;if(i&&(i.compiled===void 0&&(i.compiled=jf(t)),i.compiled)){i.compiled(s);return}const n=this._createMaskCanvas(t),a=n.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(a,n.offsetX,n.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,n,a){if(!this.contentVisible)return;t=this.getObject(t.data,t);const o=this.ctx;o.save();const h=lt(o);o.transform(e,s,i,n,0,0);const l=this._createMaskCanvas(t);o.setTransform(1,0,0,1,l.offsetX-h[4],l.offsetY-h[5]);for(let c=0,u=a.length;c<u;c+=2){const f=P.transform(h,[e,s,i,n,a[c],a[c+1]]),[m,A]=P.applyTransform([0,0],f);o.drawImage(l.canvas,m,A)}o.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const n of t){const{data:a,width:o,height:h,transform:l}=n,c=this.cachedCanvases.getCanvas("maskCanvas",o,h),u=c.context;u.save();const f=this.getObject(a,n);Yc(u,f),u.globalCompositeOperation="source-in",u.fillStyle=i?s.getPattern(u,this,is(e),Wt.FILL):s,u.fillRect(0,0,o,h),u.restore(
2),e.save(),e.transform(...l),e.scale(1,-1),zo(e,c.canvas,0,0,o,h,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);if(!e){U("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const n=this.getObject(t);if(!n){U("Dependent image isn't ready yet");return}const a=n.width,o=n.height,h=[];for(let l=0,c=i.length;l<c;l+=2)h.push({transform:[e,0,0,s,i[l],i[l+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(n,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,n=this.cachedCanvases.getCanvas("inlineImage",s,i),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;if(this.save(),!Bt){const{filter:o}=i;o!=="none"&&o!==""&&(i.filter="none")}i.scale(1/e,-1/s);let n;if(t.bitmap)n=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)n=t;else{const h=this.cachedCanvases.getCanvas("inlineImage",e,s).context;Xc(h,t),n=this.applyTransferMapsToCanvas(h)}const a=this._scaleImage(n,is(i));i.imageSmoothingEnabled=Kc(lt(i),t.interpolate),zo(i,a.img,0,0,a.paintWidth,a.paintHeight,0,-s,e,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx;let i;if(t.bitmap)i=t.bitmap;else{const n=t.width,a=t.height,h=this.cachedCanvases.getCanvas("inlineImage",n,a).context;Xc(h,t),i=this.applyTransferMapsToCanvas(h)}for(const n of e)s.save(),s.transform(...n.transform),s.scale(1,-1),zo(s,i,n.x,n.y,n.w,n.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===Qc?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=lt(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:n}=this.ctx.getTransform();let a,o;if(s===0&&i===0){const h=Math.abs(e),l=Math.abs(n);if(h===l)if(t===0)a=o=1/h;else{const c=h*t;a=o=c<1?1/c:1}else if(t===0)a=1/h,o=1/l;else{const c=h*t,u=l*t;a=c<1?1/c:1,o=u<1?1/u:1}}else{const h=Math.abs(e*n-s*i),l=Math.hypot(e,s),c=Math.hypot(i,n);if(t===0)a=c/h,o=l/h;else{const u=t*h;a=c>u?c/u:1,o=l>u?l/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,n]=this.getScaleForStroking();if(e.lineWidth=s||1,i===1&&n===1){e.stroke();return}const a=e.getLineDash();if(t&&e.save(),e.scale(i,n),a.length>0){const o=Math.max(i,n);e.setLineDash(a.map(h=>h/o)),e.lineDashOffset/=o}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};fi=new WeakSet,Dl=function(){for(;this.stateStack.length||this.inSMaskMode;
2)this.restore();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)},Ol=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}}};let Mn=Fc;for(const d in ye)Mn.prototype[d]!==void 0&&(Mn.prototype[ye[d]]=Mn.prototype[d]);var Ta,ka;class Is{static get workerPort(){return r(this,Ta)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Ta,t)}static get workerSrc(){return r(this,ka)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,ka,t)}}Ta=new WeakMap,ka=new WeakMap,b(Is,Ta,null),b(Is,ka,"");const $o={DATA:1,ERROR:2},ft={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ee(d){switch(d instanceof Error||typeof d=="object"&&d!==null||Z('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new En(d.message);case"MissingPDFException":return new wn(d.message);case"PasswordException":return new hl(d.message,d.code);case"UnexpectedResponseException":return new Vh(d.message,d.status);case"UnknownErrorException":return new ll(d.message,d.details);default:return new ll(d.message,d.toString())}}var Je,zd,Ud,Qo;class Br{constructor(t,e,s){b(this,Je);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),this._onComObjOnMessage=i=>{const n=i.data;if(n.targetName!==this.sourceName)return;if(n.stream){g(this,Je,Ud).call(this,n);return}if(n.callback){const o=n.callbackId,h=this.callbackCapabilities[o];if(!h)throw new Error(`Cannot resolve callback ${o}`);if(delete this.callbackCapabilities[o],n.callback===$o.DATA)h.resolve(n.data);else if(n.callback===$o.ERROR)h.reject(ee(n.reason));else throw new Error("Unexpected callback case");return}const a=this.actionHandler[n.action];if(!a)throw new Error(`Unknown action from worker: ${n.action}`);if(n.callbackId){const o=this.sourceName,h=n.sourceName;new Promise(function(l){l(a(n.data))}).then(function(l){s.postMessage({sourceName:o,targetName:h,callback:$o.DATA,callbackId:n.callbackId,data:l})},function(l){s.postMessage({sourceName:o,targetName:h,callback:$o.ERROR,callbackId:n.callbackId,reason:ee(l)})});return}if(n.streamId){g(this,Je,zd).call(this,n);return}a(n.data)},s.addEventListener("message",this._onComObjOnMessage)}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)}sendWithPromise(t,e,s){const i=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[i]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:i,data:e},s)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,s,i){const n=this.streamId++,a=this.sourceName,o=this.targetName,h=this.comObj;return new ReadableStream({start:l=>{const c=Promise.withResolvers();return this.streamControllers[n]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:a,targetName:o,action:t,streamId:n,data:e,desiredSize:l.desiredSize},i),c.promise},pull:l=>{const c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,h.postMessage({sourceName:a,targetName:o,stream:ft.PULL,streamId:n,desiredSize:l.desiredSize}),c.promise},cancel:l=>{yt(l instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,h.postMessage({sourceName:a,targetName:o,stream:ft.CANCEL,streamId:n,reason:ee(l)}),c.promise}},s)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Je=new WeakSet,zd=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this,o=this.actionHandler[t.action],h={enqueue(l,c=1,u){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=c,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:s,targetName:i,stream:ft.ENQUEUE,streamId:e,chunk:l},u)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ft.CLOSE,streamId:e}),delete a.streamSinks[e])},error(l){yt(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:s,targetName:i,stream:ft.ERROR,streamId:e,reason:ee(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[e]=h,new Promise(function(l){l(o(t.data,h))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ft.START_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:s,targetName:i,stream:ft.START_COMPLETE,streamId:e,reason:ee(l)})})},Ud=function(t){const e=t.streamId,s=this.sourceName,i=t.sourceName,n=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case ft.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(ee(t.reason));break;case ft.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(ee(t.reason));break;case ft.PULL:if(!o){n.postMessage({sourceName:s,targetName:i,stream:ft.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,new Promise(function(h){var l;h((l=o.onPull)==null?void 0:l.call(o))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ft.PULL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:ft.PULL_COMPLETE,streamId:e,reason:ee(h)})});break;case ft.ENQUEUE:if(yt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case ft.CLOSE:if(yt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),g(this,Je,Qo).call(this,a,e);break;case ft.ERROR:yt(a,"error should have stream controller"),a.controller.error(ee(t.reason)),g(this,Je,Qo).call(this,a,e);break;case ft.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(ee(t.reason)),g(this,Je,Qo).call(this,a,e);break;case ft.CANCEL:if(!o)break;new Promise(function(h){var l;h((l=o.onCancel)==null?void 0:l.call(o,ee(t.reason)))}).then(function(){n.postMessage({sourceName:s,targetName:i,stream:ft.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:s,targetName:i,stream:ft.CANCEL_COMPLETE,streamId:e,reason:ee(h)})}),o.sinkCapability.reject(ee(t.reason)),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},Qo=async function(t,e){var s,i,n;await Promise.allSettled([(s=t.startCall)==null?void 0:s.promise,(i=t.pullCall)==null?void 0:i.promise,(n=t.cancelCall)==null?void 0:n.promise]),delete this.streamControllers[e]};var Hi,Ra;class qf{constructor({parsedData:t,rawData:e}){b(this,Hi);b(this,Ra);p(this,Hi,t),p(this,Ra,e)}getRaw(){return r(this,Ra)}get(t){return r(this,Hi).get(t)??null}getAll(){return wc(r(this,Hi))}has(t){return r(this,Hi).has(t)}}Hi=new WeakMap,Ra=new WeakMap;const Us=Symbol("INTERNAL");var La,Pa,Ma,qn;class Xf{constructor(t,{name:e,intent:s,usage:i}){b(this,La,!1);b(this,Pa,!1);b(this,Ma,!1);b(this,qn,!0);p(this,La,!!(t&be.DISPLAY)),p(this,Pa,!!(t&be.PRINT)),this.name=e,this.intent=s,this.usage=i}get visible(){if(r(this,Ma))return r(this,qn);if(!r(this,qn))return!1;const{print:t,view:e}=this.usage;return r(this,La)?(e==null?void 0:e.viewState)!=="OFF":r(this,Pa)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==Us&&Z("Internal method `_setVisible` called."),p(this,Ma,s),p(this,qn,e)}}La=new WeakMap,Pa=new WeakMap,Ma=new WeakMap,qn=new WeakMap;var Ys,J,Xn,Yn,Ia,Nl;class Yf{constructor(t,e=be.DISPLAY){b(this,Ia);b(this,Ys,null);b(this,J,new Map);b(this,Xn,null);b(this,Yn,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,Yn,t.order);for(const s of t.groups)r(this,J).set(s.id,new Xf(e,s));if(t.baseState==="OFF")for(const s of r(this,J).values())s._setVisible(Us,!1);for(const s of t.on)r(this,J).get(s)._setVisible(Us,!0);for(const s of t.off)r(this,J).get(s)._setVisible(Us,!1);p(this,Xn,this.getHash())}}isVisible(t){if(r(this,J).size===0)return!0;
2if(!t)return Gh("Optional content group not defined."),!0;if(t.type==="OCG")return r(this,J).has(t.id)?r(this,J).get(t.id).visible:(U(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return g(this,Ia,Nl).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!r(this,J).has(e))return U(`Optional content group not found: ${e}`),!0;if(r(this,J).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!r(this,J).has(e))return U(`Optional content group not found: ${e}`),!0;if(!r(this,J).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!r(this,J).has(e))return U(`Optional content group not found: ${e}`),!0;if(!r(this,J).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!r(this,J).has(e))return U(`Optional content group not found: ${e}`),!0;if(r(this,J).get(e).visible)return!1}return!0}return U(`Unknown optional content policy ${t.policy}.`),!0}return U(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0){const s=r(this,J).get(t);if(!s){U(`Optional content group not found: ${t}`);return}s._setVisible(Us,!!e,!0),p(this,Ys,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 n=r(this,J).get(i);if(n)switch(s){case"ON":n._setVisible(Us,!0);break;case"OFF":n._setVisible(Us,!1);break;case"Toggle":n._setVisible(Us,!n.visible);break}}p(this,Ys,null)}get hasInitialVisibility(){return r(this,Xn)===null||this.getHash()===r(this,Xn)}getOrder(){return r(this,J).size?r(this,Yn)?r(this,Yn).slice():[...r(this,J).keys()]:null}getGroups(){return r(this,J).size>0?wc(r(this,J)):null}getGroup(t){return r(this,J).get(t)||null}getHash(){if(r(this,Ys)!==null)return r(this,Ys);const t=new Od;for(const[e,s]of r(this,J))t.update(`${e}:${s.visible}`);return p(this,Ys,t.hexdigest())}}Ys=new WeakMap,J=new WeakMap,Xn=new WeakMap,Yn=new WeakMap,Ia=new WeakSet,Nl=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const n=t[i];let a;if(Array.isArray(n))a=g(this,Ia,Nl).call(this,n);else if(r(this,J).has(n))a=r(this,J).get(n).visible;else return U(`Optional content group not found: ${n}`),!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 Kf{constructor(t,{disableRange:e=!1,disableStream:s=!1}){yt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:i,initialData:n,progressiveDone:a,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=o,(n==null?void 0:n.length)>0){const h=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(h)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!s,this._isRangeSupported=!e,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((h,l)=>{this._onReceiveData({begin:h,chunk:l})}),t.addProgressListener((h,l)=>{this._onProgress({loaded:h,total:l})}),t.addProgressiveReadListener(h=>{this._onReceiveData({chunk:h})}),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(n){return n._begin!==t?!1:(n._enqueue(s),!0)});yt(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,n;t.total===void 0?(s=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||s.call(e,{loaded:t.loaded}):(n=(i=this._fullRequestReader)==null?void 0:i.onProgress)==null||n.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(){yt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Qf(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new Jf(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 Qf{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=Tc(i)?i:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;
2this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}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 Jf{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 Zf(d){let t=!0,e=s("filename\\*","i").exec(d);if(e){e=e[1];let c=o(e);return c=unescape(c),c=h(c),c=l(c),n(c)}if(e=a(d),e){const c=l(e);return n(c)}if(e=s("filename","i").exec(d),e){e=e[1];let c=o(e);return c=l(c),n(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 f=new TextDecoder(c,{fatal:!0}),m=qh(u);u=f.decode(m),t=!1}catch{}}return u}function n(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 f;const m=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=m.exec(c))!==null;){let[,v,y,_]=f;if(v=parseInt(v,10),v in u){if(v===0)break;continue}u[v]=[y,_]}const A=[];for(let v=0;v<u.length&&v in u;++v){let[y,_]=u[v];_=o(_),y&&(_=unescape(_),v===0&&(_=h(_))),A.push(_)}return A.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let f=0;f<u.length;++f){const m=u[f].indexOf('"');m!==-1&&(u[f]=u[f].slice(0,m),u.length=f+1),u[f]=u[f].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function h(c){const u=c.indexOf("'");if(u===-1)return c;const f=c.slice(0,u),A=c.slice(u+1).replace(/^[^']*'/,"");return i(f,A)}function l(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,f,m,A){if(m==="q"||m==="Q")return A=A.replaceAll("_"," "),A=A.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,y){return String.fromCharCode(parseInt(y,16))}),i(f,A);try{A=atob(A)}catch{}return i(f,A)})}return""}function Lc({getResponseHeader:d,isHttp:t,rangeChunkSize:e,disableRange:s}){const i={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(d("Content-Length"),10);return!Number.isInteger(n)||(i.suggestedLength=n,n<=2*e)||s||!t||d("Accept-Ranges")!=="bytes"||(d("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function Pc(d){const t=d("Content-Disposition");if(t){let e=Zf(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Tc(e))return e}return null}function Jh(d,t){return d===404||d===0&&t.startsWith("file:")?new wn('Missing PDF "'+t+'".'):new Vh(`Unexpected server response (${d}) while retrieving PDF "${t}".`,d)}function $d(d){return d===200||d===206}function jd(d,t,e){return{method:"GET",headers:d,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Wd(d){const t=new Headers;for(const e in d){const s=d[e];
2s!==void 0&&t.append(e,s)}return t}function Gd(d){return d instanceof Uint8Array?d.buffer:d instanceof ArrayBuffer?d:(U(`getArrayBuffer - unexpected data format: ${d}`),new Uint8Array(d).buffer)}class Jc{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=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 yt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new tp(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new ep(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 tp{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,this._headers=Wd(this._stream.httpHeaders);const s=e.url;fetch(s,jd(this._headers,this._withCredentials,this._abortController)).then(i=>{if(!$d(i.status))throw Jh(i.status,s);this._reader=i.body.getReader(),this._headersCapability.resolve();const n=h=>i.headers.get(h),{allowRangeRequests:a,suggestedLength:o}=Lc({getResponseHeader:n,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=Pc(n),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new En("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:Gd(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class ep{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,this._headers=Wd(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${s-1}`);const n=i.url;fetch(n,jd(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!$d(a.status))throw Jh(a.status,n);this._readCapability.resolve(),this._reader=a.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:Gd(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}const nl=200,rl=206;function sp(d){const t=d.response;return typeof t!="string"?t:qh(t).buffer}class ip{constructor(t,e={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const n in s)i[n]=s[n];return this.request(i)}requestFull(t){return this.request(t)}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 n in this.httpHeaders){const a=this.httpHeaders[n];a!==void 0&&e.setRequestHeader(n,a)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=rl):i.expectedStatus=nl,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){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){var h,l,c;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){(h=s.onError)==null||h.call(s,i.status);return}const n=i.status||nl;if(!(n===nl&&s.expectedStatus===rl)&&n!==s.expectedStatus){(l=s.onError)==null||l.call(s,i.status);return}const o=sp(i);if(n===rl){const u=i.getResponseHeader("Content-Range"),f=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);s.onDone({begin:parseInt(f[1],10),chunk:o})}else o?s.onDone({begin:0,chunk:o}):(c=s.onError)==null||c.call(s,i.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
2abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class np{constructor(t){this._source=t,this._manager=new ip(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),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 yt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new rp(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new ap(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 rp{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersReceivedCapability=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),s=a=>e.getResponseHeader(a),{allowRangeRequests:i,suggestedLength:n}=Lc({getResponseHeader:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=Pc(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.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=Jh(t,this._url),this._headersReceivedCapability.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._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.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 ap{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_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=Jh(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
2(this._requestId),this._close()}}const Vd=/^file:\/\/\/[a-zA-Z]:\//;function op(d){const t=ts.get("url"),e=t.parse(d);return e.protocol==="file:"||e.host?e:/^[a-z]:[/\\]/i.test(d)?t.parse(`file:///${d}`):(e.host||(e.protocol="file:"),e)}class hp{constructor(t){this.source=t,this.url=op(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=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 yt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new dp(this):new lp(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new up(this,t,e):new cp(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 qd{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()}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 En("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Xd{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}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)}}function _h(d,t){return{protocol:d.protocol,auth:d.auth,host:d.hostname,port:d.port,path:d.path,method:"GET",headers:t}}class lp extends qd{constructor(t){super(t);const e=s=>{if(s.statusCode===404){const o=new wn(`Missing PDF "${this._url}".`);this._storedError=o,this._headersCapability.reject(o);return}this._headersCapability.resolve(),this._setReadableStream(s);const i=o=>this._readableStream.headers[o.toLowerCase()],{allowRangeRequests:n,suggestedLength:a}=Lc({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=a||this._contentLength,this._filename=Pc(i)};if(this._request=null,this._url.protocol==="http:"){const s=ts.get("http");this._request=s.request(_h(this._url,t.httpHeaders),e)}else{const s=ts.get("https");this._request=s.request(_h(this._url,t.httpHeaders),e)}this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}class cp extends Xd{constructor(t,e,s){super(t),this._httpHeaders={};for(const n in t.httpHeaders){const a=t.httpHeaders[n];a!==void 0&&(this._httpHeaders[n]=a)}this._httpHeaders.Range=`bytes=${e}-${s-1}`;const i=n=>{if(n.statusCode===404){const a=new wn(`Missing PDF "${this._url}".`);this._storedError=a;return}this._setReadableStream(n)};if(this._request=null,this._url.protocol==="http:"){const n=ts.get("http");this._request=n.request(_h(this._url,this._httpHeaders),i)}else{const n=ts.get("https");this._request=n.request(_h(this._url,this._httpHeaders),i)}this._request.on("error",n=>{this._storedError=n}),this._request.end()}}class dp extends qd{constructor(t){super(t);let e=decodeURIComponent(this._url.path);Vd.test(this._url.href)&&(e=e.replace(/^\//,""));const s=ts.get("fs");s.promises.lstat(e).then(i=>{this._contentLength=i.size,this._setReadableStream(s.createReadStream(e)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=new wn(`Missing PDF "${e}".`)),this._storedError=i,this._headersCapability.reject(i)})}}class up extends Xd{constructor(t,e,s){super(t);let i=decodeURIComponent(this._url.path);Vd.test(this._url.href)&&(i=i.replace(/^\//,""));const n=ts.get("fs");this._setReadableStream(n.createReadStream(i,{start:e,end:s-1}))}}const fp=1e5,qt=30,pp=.8;var sd,Ks,Yt,Fa,Da,Bi,bs,Oa,Na,zi,Kn,Qn,Qs,Jn,Ha,Zn,Ui,Ba,za,$i,ji,Js,tr,Ns,Yd,Kd,Hl,Ze,Jo,Qd,Jd;const Ot=class Ot{constructor({textContentSource:t,container:e,viewport:s}){b(this,Ns);b(this,Ks,Promise.withResolvers());b(this,Yt,null);b(this,Fa,!1);b(this,Da,!!((sd=globalThis.FontInspector)!=null&&sd.enabled));b(this,Bi,null);b(this,bs,null);b(this,Oa,0);b(this,Na,0);b(this,zi,null);b(this,Kn,null);b(this,Qn,0);b(this,Qs,0);b(this,Jn,Object.create(null));b(this,Ha,[]);b(this,Zn,null);b(this,Ui,[]);b(this,Ba,new WeakMap);b(this,za,null);var h;if(t instanceof ReadableStream)p(this,Zn,t);else if(typeof t=="object")p(this,Zn,new ReadableStream({start(l){l.enqueue(t),l.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Yt,p(this,Kn,e)),p(this,Qs,s.scale*(globalThis.devicePixelRatio||1)),p(this,Qn,s.rotation),p(this,bs,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:i,pageHeight:n,pageX:a,pageY:o}=s.rawDims;p(this,za,[1,0,0,-1,-a,o+n]),p(this,Na,i),p(this,Oa,n),g(h=Ot,Ze,Qd).call(h),bn(e,s),r(this,Ks).promise.catch(()=>{}).then(()=>{r(Ot,tr).delete(this),p(this,bs,null),p(this,Jn,null)})}render(){const t=()=>{r(this,zi).read().then(({value:e,done:s})=>{if(s){r(this,Ks).resolve();return}r(this,Bi)??p(this,Bi,e.lang),Object.assign(r(this,Jn),e.styles),g(this,Ns,Yd).call(this,e.items),t()},r(this,Ks).reject)};return p(this,zi,r(this,Zn).getReader()),r(Ot,tr).add(this),t(),r(this,Ks).promise}update({viewport:t,onBefore:e=null}){var n;const s=t.scale*(globalThis.devicePixelRatio||1),i=t.rotation;if(i!==r(this,Qn)&&(e==null||e(),p(this,Qn,i),bn(r(this,Kn),{rotation:i})),s!==r(this,Qs)){e==null||e(),p(this,Qs,s);const a={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:g(n=Ot,Ze,Jo).call(n,r(this,Bi))};for(const o of r(this,Ui))a.properties=r(this,Ba).get(o),a.div=o,g(this,Ns,Hl).call(this,a)}}cancel(){var e;const t=new En("TextLayer task cancelled.");(e=r(this,zi))==null||e.cancel(t).catch(()=>{}),p(this,zi,null),r(this,Ks).reject(t)}get textDivs(){return r(this,Ui)}get textContentItemsStr(){return r(this,Ha)}static cleanup(){if(!(r(this,tr).size>0)){r(this,$i).clear();for(const{canvas:t}of r(this,ji).values())t.remove();r(this,ji).clear()}}};Ks=new WeakMap,Yt=new WeakMap,Fa=new WeakMap,Da=new WeakMap,Bi=new WeakMap,bs=new WeakMap,Oa=new WeakMap,Na=new WeakMap,zi=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Qs=new WeakMap,Jn=new WeakMap,Ha=new WeakMap,Zn=new WeakMap,Ui=new WeakMap,Ba=new WeakMap,za=new WeakMap,$i=new WeakMap,ji=new WeakMap,Js=new WeakMap,tr=new WeakMap,Ns=new WeakSet,Yd=function(t){var i,n;if(r(this,Fa))return;(n=r(this,bs)).ctx??(n.ctx=g(i=Ot,Ze,Jo).call(i,r(this,Bi)));const e=r(this,Ui),s=r(this,Ha);for(const a of t){if(e.length>fp){U("Ignoring additional textDivs for performance reasons."),p(this,Fa,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=r(this,Yt);p(this,Yt,document.createElement("span")),r(this,Yt).classList.add("markedContent"),a.id!==null&&r(this,Yt).setAttribute("id",`${a.id}`),o.append(r(this,Yt))}else a.type==="endMarkedContent"&&p(this,Yt,r(this,Yt).parentNode);continue}s.push(a.str),g(this,Ns,Kd).call(this,a)}},Kd=function(t){var v;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};r(this,Ui).push(e);const i=P.transform(r(this,za),t.transform);let n=Math.atan2(i[1],i[0]);const a=r(this,Jn)[t.fontName];a.vertical&&(n+=Math.PI/2);const o=r(this,Da)&&a.fontSubstitution||a.fontFamily,h=Math.hypot(i[2],i[3]),l=h*g(v=Ot,Ze,Jd).call(v,o,r(this,Bi));let c,u;n===0?(c=i[4],u=i[5]-l):(c=i[4]+l*Math.sin(n),u=i[5]-l*Math.cos(n));const f="calc(var(--scale-factor)*",m=e.style;r(this,Yt)===r(this,Kn)?(m.left=`${(100*c/r(this,Na)).toFixed(2)}
2%`,m.top=`${(100*u/r(this,Oa)).toFixed(2)}%`):(m.left=`${f}${c.toFixed(2)}px)`,m.top=`${f}${u.toFixed(2)}px)`),m.fontSize=`${f}${(r(Ot,Js)*h).toFixed(2)}px)`,m.fontFamily=o,s.fontSize=h,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,r(this,Da)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),n!==0&&(s.angle=n*(180/Math.PI));let A=!1;if(t.str.length>1)A=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const y=Math.abs(t.transform[0]),_=Math.abs(t.transform[3]);y!==_&&Math.max(y,_)/Math.min(y,_)>1.5&&(A=!0)}if(A&&(s.canvasWidth=a.vertical?t.height:t.width),r(this,Ba).set(e,s),r(this,bs).div=e,r(this,bs).properties=s,g(this,Ns,Hl).call(this,r(this,bs)),s.hasText&&r(this,Yt).append(e),s.hasEOL){const y=document.createElement("br");y.setAttribute("role","presentation"),r(this,Yt).append(y)}},Hl=function(t){const{div:e,properties:s,ctx:i,prevFontSize:n,prevFontFamily:a}=t,{style:o}=e;let h="";if(r(Ot,Js)>1&&(h=`scale(${1/r(Ot,Js)})`),s.canvasWidth!==0&&s.hasText){const{fontFamily:l}=o,{canvasWidth:c,fontSize:u}=s;(n!==u||a!==l)&&(i.font=`${u*r(this,Qs)}px ${l}`,t.prevFontSize=u,t.prevFontFamily=l);const{width:f}=i.measureText(e.textContent);f>0&&(h=`scaleX(${c*r(this,Qs)/f}) ${h}`)}s.angle!==0&&(h=`rotate(${s.angle}deg) ${h}`),h.length>0&&(o.transform=h)},Ze=new WeakSet,Jo=function(t=null){let e=r(this,ji).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}),r(this,ji).set(t,e)}return e},Qd=function(){if(r(this,Js)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),p(this,Js,t.getBoundingClientRect().height),t.remove()},Jd=function(t,e){const s=r(this,$i).get(t);if(s)return s;const i=g(this,Ze,Jo).call(this,e),n=i.font;i.canvas.width=i.canvas.height=qt,i.font=`${qt}px ${t}`;const a=i.measureText("");let o=a.fontBoundingBoxAscent,h=Math.abs(a.fontBoundingBoxDescent);if(o){const u=o/(o+h);return r(this,$i).set(t,u),i.canvas.width=i.canvas.height=0,i.font=n,u}i.strokeStyle="red",i.clearRect(0,0,qt,qt),i.strokeText("g",0,0);let l=i.getImageData(0,0,qt,qt).data;h=0;for(let u=l.length-1-3;u>=0;u-=4)if(l[u]>0){h=Math.ceil(u/4/qt);break}i.clearRect(0,0,qt,qt),i.strokeText("A",0,qt),l=i.getImageData(0,0,qt,qt).data,o=0;for(let u=0,f=l.length;u<f;u+=4)if(l[u]>0){o=qt-Math.floor(u/4/qt);break}i.canvas.width=i.canvas.height=0,i.font=n;const c=o?o/(o+h):pp;return r(this,$i).set(t,c),c},b(Ot,Ze),b(Ot,$i,new Map),b(Ot,ji,new Map),b(Ot,Js,null),b(Ot,tr,new Set);let Rr=Ot;function gp(){cd("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:d,container:t,viewport:e,...s}=arguments[0],i=Object.keys(s);i.length>0&&U("Ignoring `renderTextLayer` parameters: "+i.join(", "));const n=new Rr({textContentSource:d,container:t,viewport:e}),{textDivs:a,textContentItemsStr:o}=n;return{promise:n.render(),textDivs:a,textContentItemsStr:o}}function mp(){cd("`updateTextLayer`, please use `TextLayer` instead.")}class Qr{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function i(n){var h;if(!n)return;let a=null;const o=n.name;if(o==="#text")a=n.value;else if(Qr.shouldBuildText(o))(h=n==null?void 0:n.attributes)!=null&&h.textContent?a=n.attributes.textContent:n.value&&(
2a=n.value);else return;if(a!==null&&e.push({str:a}),!!n.children)for(const l of n.children)i(l)}return i(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const bp=65536,Ap=100,vp=5e3,_p=Bt?Pf:Af,yp=Bt?Mf:hd,wp=Bt?Lf:bf,Ep=Bt?If:ld;function Sp(d={}){typeof d=="string"||d instanceof URL?d={url:d}:(d instanceof ArrayBuffer||ArrayBuffer.isView(d))&&(d={data:d});const t=new Bl,{docId:e}=t,s=d.url?Cp(d.url):null,i=d.data?xp(d.data):null,n=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,h=d.range instanceof Zd?d.range:null,l=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:bp;let c=d.worker instanceof In?d.worker:null;const u=d.verbosity,f=typeof d.docBaseUrl=="string"&&!xc(d.docBaseUrl)?d.docBaseUrl:null,m=typeof d.cMapUrl=="string"?d.cMapUrl:null,A=d.cMapPacked!==!1,v=d.CMapReaderFactory||yp,y=typeof d.standardFontDataUrl=="string"?d.standardFontDataUrl:null,_=d.StandardFontDataFactory||Ep,w=d.stopAtErrors!==!0,E=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,S=d.isEvalSupported!==!1,x=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!Bt,C=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,R=typeof d.disableFontFace=="boolean"?d.disableFontFace:Bt,I=d.fontExtraProperties===!0,N=d.enableXfa===!0,q=d.ownerDocument||globalThis.document,D=d.disableRange===!0,at=d.disableStream===!0,it=d.disableAutoFetch===!0,rt=d.pdfBug===!0,ot=d.enableHWA===!0,It=h?h.length:d.length??NaN,H=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!Bt&&!R,z=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:v===hd&&_===ld&&m&&y&&Or(m,document.baseURI)&&Or(y,document.baseURI),Do=d.canvasFactory||new _p({ownerDocument:q,enableHWA:ot}),Oo=d.filterFactory||new wp({docId:e,ownerDocument:q}),No=null;af(u);const zt={canvasFactory:Do,filterFactory:Oo};if(z||(zt.cMapReaderFactory=new v({baseUrl:m,isCompressed:A}),zt.standardFontDataFactory=new _({baseUrl:y})),!c){const gi={verbosity:u,port:Is.workerPort};c=gi.port?In.fromPort(gi):new In(gi),t._worker=c}const St={docId:e,apiVersion:"4.4.168",data:i,password:o,disableAutoFetch:it,rangeChunkSize:l,length:It,docBaseUrl:f,enableXfa:N,evaluatorOptions:{maxImageSize:E,disableFontFace:R,ignoreErrors:w,isEvalSupported:S,isOffscreenCanvasSupported:x,canvasMaxAreaInBytes:C,fontExtraProperties:I,useSystemFonts:H,cMapUrl:z?m:null,standardFontDataUrl:z?y:null}},Ho={disableFontFace:R,fontExtraProperties:I,ownerDocument:q,pdfBug:rt,styleElement:No,loadingParams:{disableAutoFetch:it,enableXfa:N}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const gi=c.messageHandler.sendWithPromise("GetDocRequest",St,i?[i.buffer]:null);let Bs;if(h)Bs=new Kf(h,{disableRange:D,disableStream:at});else if(!i){if(!s)throw new Error("getDocument - no `url` parameter provided.");Bs=(es=>Bt?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&Or(es.url)?new Jc(es):new hp(es):Or(es.url)?new Jc(es):new np(es))({url:s,length:It,httpHeaders:n,withCredentials:a,rangeChunkSize:l,disableRange:D,disableStream:at})}return gi.then(gt=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const es=new Br(e,gt,c.port),Oc=new Lp(es,t,Bs,Ho,zt);t._transport=Oc,es.send("Ready",null)})}).catch(t._capability.reject),t}function Cp(d){if(d instanceof URL)return d.href;try{return new URL(d,window.location).href}catch{if(Bt&&typeof d=="string")return d}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function xp(d){if(Bt&&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 qh(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 Zc(d){return 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}var Dh;const Oh=class Oh{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${te(Oh,Dh)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var t,e,s;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(i){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,i}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};Dh=new WeakMap,b(Oh,Dh,0);let Bl=Oh;class Zd{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){Z("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Tp{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return V(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}
2=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 Zs,As,Ae,kn,Zo;class kp{constructor(t,e,s,i=!1){b(this,Ae);b(this,Zs,null);b(this,As,!1);this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=i?new Bc:null,this._pdfBug=i,this.commonObjs=s.commonObjs,this.objs=new tu,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:n=!1}={}){return new Po({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:n})}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 V(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=js.ENABLE,transform:n=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:h=null,pageColors:l=null,printAnnotationStorage:c=null}){var E,S;(E=this._stats)==null||E.time("Overall");const u=this._transport.getRenderingIntent(s,i,c),{renderingIntent:f,cacheKey:m}=u;p(this,As,!1),g(this,Ae,Zo).call(this),o||(o=this._transport.getOptionalContentConfig(f));let A=this._intentStates.get(m);A||(A=Object.create(null),this._intentStates.set(m,A)),A.streamReaderCancelTimeout&&(clearTimeout(A.streamReaderCancelTimeout),A.streamReaderCancelTimeout=null);const v=!!(f&be.PRINT);A.displayReadyCapability||(A.displayReadyCapability=Promise.withResolvers(),A.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(S=this._stats)==null||S.time("Page Request"),this._pumpOperatorList(u));const y=x=>{var C;A.renderTasks.delete(_),(this._maybeCleanupAfterRender||v)&&p(this,As,!0),g(this,Ae,kn).call(this,!v),x?(_.capability.reject(x),this._abortOperatorList({intentState:A,reason:x instanceof Error?x:new Error(x)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(C=globalThis.Stats)!=null&&C.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new Ul({callback:y,params:{canvasContext:t,viewport:e,transform:n,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:l});(A.renderTasks||(A.renderTasks=new Set)).add(_);const w=_.task;return Promise.all([A.displayReadyCapability.promise,o]).then(([x,C])=>{var R;if(this.destroyed){y();return}if((R=this._stats)==null||R.time("Rendering"),!(C.renderingIntent&f))throw new Error("Mu
2st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:x,optionalContentConfig:C}),_.operatorListChanged()}).catch(y),w}getOperatorList({intent:t="display",annotationMode:e=js.ENABLE,printAnnotationStorage:s=null}={}){var h;function i(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(o))}const n=this._transport.getRenderingIntent(t,e,s,!0);let a=this._intentStates.get(n.cacheKey);a||(a=Object.create(null),this._intentStates.set(n.cacheKey,a));let o;return a.opListReadCapability||(o=Object.create(null),o.operatorListChanged=i,a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||(a.renderTasks=new Set)).add(o),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(n)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(i){return i.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Qr.textContent(s));const e=this.streamTextContent(t);return new Promise(function(s,i){function n(){a.read().then(function({value:h,done:l}){if(l){s(o);return}o.lang??(o.lang=h.lang),Object.assign(o.styles,h.styles),o.items.push(...h.items),n()},i)}const a=e.getReader(),o={items:[],styles:Object.create(null),lang:null};n()})}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(),p(this,As,!1),g(this,Ae,Zo).call(this),Promise.all(t)}cleanup(t=!1){p(this,As,!0);const e=g(this,Ae,kn).call(this,!1);return t&&e&&this._stats&&(this._stats=new Bc),e}_startRenderPage(t,e){var i,n;const s=this._intentStates.get(e);s&&((i=this._stats)==null||i.timeEnd("Page Request"),(n=s.displayReadyCapability)==null||n.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&&g(this,Ae,kn).call(this,!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s}){const{map:i,transfer:n}=s,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:i},n).getReader(),h=this._intentStates.get(e);h.streamReader=o;const l=()=>{o.read().then(({value:c,done:u})=>{if(u){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(c,h),l())},c=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const u of h.renderTasks)u.operatorListChanged();g(this,Ae,kn).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(c);else if(h.opListReadCapability)h.opListReadCapability.reject(c);else throw c}})};l()}_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 Cc){let i=Ap;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 En(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[i,n]of this._intentStates)if(n===t){this._intentStates.delete(i);break}this.cleanup()}}}get stats(){return this._stats}}Zs=new WeakMap,As=new WeakMap,Ae=new WeakSet,kn=function(t=!1){if(g(this,Ae,Zo).call(this),!r(this,As)||this.destroyed)return!1;if(t)return p(this,Zs,setTimeout(()=>{p(this,Zs,null),g(this,Ae,kn).call(this,!1)},vp)),!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,As,!1),!0},Zo=function(){r(this,Zs)&&(clearTimeout(r(this,Zs)),p(this,Zs,null))};var Wi,Nh;class Rp{constructor(){b(this,Wi,new Set);b(this,Nh,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};r(this,Nh).then(()=>{for(const i of r(this,Wi))i.call(this,s)})}addEventListener(t,e){r(this,Wi).add(e)}removeEventListener(t,e){r(this,Wi).delete(e)}terminate(){r(this,Wi).clear()}}Wi=new WeakMap,Nh=new WeakMap;const hs={isWorkerDisabled:!1,fakeWorkerId:0};
2Bt&&(hs.isWorkerDisabled=!0,Is.workerSrc||(Is.workerSrc="./pdf.worker.mjs")),hs.isSameOrigin=function(d,t){let e;try{if(e=new URL(d),!e.origin||e.origin==="null")return!1}catch{return!1}const s=new URL(t,e);return e.origin===s.origin},hs.createCDNWrapper=function(d){const t=`await import("${d}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};var Gi,er,th,sr,eh;const se=class se{constructor({name:t=null,port:e=null,verbosity:s=of()}={}){b(this,er);var i;if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((i=r(se,Gi))!=null&&i.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(r(se,Gi)||p(se,Gi,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return Bt?Promise.all([ts.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new Br("main","worker",t),this._messageHandler.on("ready",function(){}),g(this,er,th).call(this)}_initialize(){if(hs.isWorkerDisabled||r(se,sr,eh)){this._setupFakeWorker();return}let{workerSrc:t}=se;try{hs.isSameOrigin(window.location.href,t)||(t=hs.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),s=new Br("main","worker",e),i=()=>{n.abort(),s.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||i()},{signal:n.signal}),s.on("test",o=>{if(n.abort(),this.destroyed||!o){i();return}this._messageHandler=s,this._port=e,this._webWorker=e,g(this,er,th).call(this)}),s.on("ready",o=>{if(n.abort(),this.destroyed){i();return}try{a()}catch{this._setupFakeWorker()}});const a=()=>{const o=new Uint8Array;s.send("test",o,[o.buffer])};a();return}catch{Gh("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){hs.isWorkerDisabled||(U("Setting up fake worker."),hs.isWorkerDisabled=!0),se._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new Rp;this._port=e;const s=`fake${hs.fakeWorkerId++}`,i=new Br(s+"_worker",s,e);t.setup(i,e),this._messageHandler=new Br(s,s+"_worker",e),g(this,er,th).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(t=r(se,Gi))==null||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var s;if(!(t!=null&&t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(s=r(this,Gi))==null?void 0:s.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new se(t)}static get workerSrc(){if(Is.workerSrc)return Is.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return V(this,"_setupFakeWorkerGlobal",(async()=>r(this,sr,eh)?r(this,sr,eh):(await import(this.workerSrc)).WorkerMessageHandler)())}};Gi=new WeakMap,er=new WeakSet,th=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},sr=new WeakSet,eh=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},b(se,sr),b(se,Gi);let In=se;
2var vs,$e,ir,nr,je,Vi,zr;class Lp{constructor(t,e,s,i,n){b(this,Vi);b(this,vs,new Map);b(this,$e,new Map);b(this,ir,new Map);b(this,nr,new Map);b(this,je,null);this.messageHandler=t,this.loadingTask=e,this.commonObjs=new tu,this.fontLoader=new kf({ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this.loadingParams=i.loadingParams,this._params=i,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return V(this,"annotationStorage",new Rc)}getRenderingIntent(t,e=js.ENABLE,s=null,i=!1){let n=be.DISPLAY,a=Pl;switch(t){case"any":n=be.ANY;break;case"display":break;case"print":n=be.PRINT;break;default:U(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case js.DISABLE:n+=be.ANNOTATIONS_DISABLE;break;case js.ENABLE:break;case js.ENABLE_FORMS:n+=be.ANNOTATIONS_FORMS;break;case js.ENABLE_STORAGE:n+=be.ANNOTATIONS_STORAGE,a=(n&be.PRINT&&s instanceof Hd?s:this.annotationStorage).serializable;break;default:U(`getRenderingIntent - invalid annotationMode: ${e}`)}return i&&(n+=be.OPLIST),{renderingIntent:n,cacheKey:`${n}_${a.hash}`,annotationStorageSerializable:a}}destroy(){var s;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(s=r(this,je))==null||s.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of r(this,$e).values())t.push(i._destroy());r(this,$e).clear(),r(this,ir).clear(),r(this,nr).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var i;this.commonObjs.clear(),this.fontLoader.clear(),r(this,vs).clear(),this.filterFactory.destroy(),Rr.cleanup(),(i=this._networkStream)==null||i.cancelAllRequests(new En("Worker was terminated.")),this.messageHandler&&(this.messageHandler.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)=>{yt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},i.onPull=()=>{this._fullReader.read().then(function({value:n,done:a}){if(a){i.close();return}yt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{i.error(n)})},i.onCancel=n=>{this._fullReader.cancel(n),i.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",s=>{const i=Promise.withResolvers(),n=this._fullReader;return n.headersReady.then(()=>{var a;(!n.isStreamingSupported||!n.isRangeSupported)&&(this._lastProgress&&((a=e.onProgress)==null||a.call(e,this._lastProgress)),n.onProgress=o=>{var h;(h=e.onProgress)==null||h.call(e,{loaded:o.loaded,total:o.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})},i.reject),i.promise}),t.on("GetRangeReader",(s,i)=>{yt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(s.begin,s.end);if(!n){i.close();return}i.onPull=()=>{n.read().then(function({value:a,done:o}){if(o){i.close();return}yt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),i.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{i.error(a)})},i.onCancel=a=>{n.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 Tp(s,this))}),t.on("DocException",function(s){let i;switch(s.name){case"PasswordException":i=new hl(s.message,s.code);break;case"InvalidPDFException":i=new nd(s.message);break;case"MissingPDFException":i=new wn(s.message);break;case"UnexpectedResponseException":i=new Vh(s.message,s.status);break;case"UnknownErrorException":i=new ll(s.message,s.details);break;default:Z("DocException - expected a valid Error.")}e._capability.reject(i)}),t.on("PasswordRequest",s=>{if(p(this,je,Promise.withResolvers()),e.onPassword){const i=n=>{n instanceof Error?r(this,je).reject(n):r(this,je).resolve({password:n})};try{e.onPassword(i,s.code)}catch(n){r(this,je).reject(n)}}else r(this,je).reject(new hl(s.message,s.code));return r(this,je).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;r(this,$e).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,i,n])=>{var a;if(this.destroyed||this.commonObjs.has(s))return null;switch(i){case"Font":const{disableFontFace:o,fontExtraProperties:h,pdfBug:l}=this._params;if("error"in n){const m=n.error;U(`Error during font loading: ${m}`),this.commonObjs.resolve(s,m);break}const c=l&&((a=globalThis.FontInspector)!=null&&a.enabled)?(m,A)=>globalThis.FontInspector.fontAdded(m,A):null,u=new Rf(n,{disableFontFace:o,inspectFont:c});this.fontLoader.bind(u).catch(()=>
2t.sendWithPromise("FontFallback",{id:s})).finally(()=>{!h&&u.data&&(u.data=null),this.commonObjs.resolve(s,u)});break;case"CopyLocalImage":const{imageRef:f}=n;yt(f,"The imageRef must be defined.");for(const m of r(this,$e).values())for(const[,A]of m.objs)if((A==null?void 0:A.ref)===f)return A.dataLen?(this.commonObjs.resolve(s,structuredClone(A)),A.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(s,n);break;default:throw new Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([s,i,n,a])=>{var h;if(this.destroyed)return;const o=r(this,$e).get(i);if(!o.objs.has(s)){if(o._intentStates.size===0){(h=a==null?void 0:a.bitmap)==null||h.close();return}switch(n){case"Image":o.objs.resolve(s,a),(a==null?void 0:a.dataLen)>ef&&(o._maybeCleanupAfterRender=!0);break;case"Pattern":o.objs.resolve(s,a);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",s=>{var i;this.destroyed||(i=e.onProgress)==null||i.call(e,{loaded:s.loaded,total:s.total})}),t.on("FetchBuiltInCMap",s=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(s):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",s=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(s):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var s;this.annotationStorage.size<=0&&U("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=r(this,ir).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&r(this,nr).set(n.refStr,t);const a=new kp(e,n,this,this._params.pdfBug);return r(this,$e).set(e,a),a});return r(this,ir).set(e,i),i}getPageIndex(t){return Zc(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 g(this,Vi,zr).call(this,"GetFieldObjects")}hasJSActions(){return g(this,Vi,zr).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)}getDocJSActions(){return g(this,Vi,zr).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 g(this,Vi,zr).call(this,"GetOptionalContentConfig").then(e=>new Yf(e,t))}
2getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=r(this,vs).get(t);if(e)return e;const s=this.messageHandler.sendWithPromise(t,null).then(i=>{var n,a;return{info:i[0],metadata:i[1]?new qf(i[1]):null,contentDispositionFilename:((n=this._fullReader)==null?void 0:n.filename)??null,contentLength:((a=this._fullReader)==null?void 0:a.contentLength)??null}});return r(this,vs).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 r(this,$e).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),r(this,vs).clear(),this.filterFactory.destroy(!0),Rr.cleanup()}}cachedPageNumber(t){if(!Zc(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return r(this,nr).get(e)??null}}vs=new WeakMap,$e=new WeakMap,ir=new WeakMap,nr=new WeakMap,je=new WeakMap,Vi=new WeakSet,zr=function(t,e=null){const s=r(this,vs).get(t);if(s)return s;const i=this.messageHandler.sendWithPromise(t,e);return r(this,vs).set(t,i),i};const jo=Symbol("INITIAL_DATA");var Te,Ua,zl;class tu{constructor(){b(this,Ua);b(this,Te,Object.create(null))}get(t,e=null){if(e){const i=g(this,Ua,zl).call(this,t);return i.promise.then(()=>e(i.data)),null}const s=r(this,Te)[t];if(!s||s.data===jo)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=r(this,Te)[t];return!!e&&e.data!==jo}resolve(t,e=null){const s=g(this,Ua,zl).call(this,t);s.data=e,s.resolve()}clear(){var t;for(const e in r(this,Te)){const{data:s}=r(this,Te)[e];(t=s==null?void 0:s.bitmap)==null||t.close()}p(this,Te,Object.create(null))}*[Symbol.iterator](){for(const t in r(this,Te)){const{data:e}=r(this,Te)[t];e!==jo&&(yield[t,e])}}}Te=new WeakMap,Ua=new WeakSet,zl=function(t){var e;return(e=r(this,Te))[t]||(e[t]={...Promise.withResolvers(),data:jo})};var ti;class Pp{constructor(t){b(this,ti,null);p(this,ti,t),this.onContinue=null}get promise(){return r(this,ti).capability.promise}cancel(t=0){r(this,ti).cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=r(this,ti).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=r(this,ti);return t.form||t.canvas&&(e==null?void 0:e.size)>0}}ti=new WeakMap;var ei,qi;const _i=class _i{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:n,operatorList:a,pageIndex:o,canvasFactory:h,filterFactory:l,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:f=null}){b(this,ei,null);this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=h,this.filterFactory=l,this._pdfBug=u,this.pageColors=f,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 Pp(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var o,h;if(this.cancelled)return;if(this._canvas){if(r(_i,qi).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.");r(_i,qi).add(this._canvas)}this._pdfBug&&((o=globalThis.StepperManager)!=null&&o.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:i,transform:n,background:a}=this.params;this.gfx=new Mn(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(h=this.graphicsReadyCallback)==null||h.call(this)}cancel(t=null,e=0){var s;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),r(this,ei)&&(window.cancelAnimationFrame(r(this,ei)),p(this,ei,null)),r(_i,qi).delete(this._canvas),this.callback(t||new Cc(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.stepper)==null||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?p(this,ei,window.requestAnimationFrame(()=>{p(this,ei,null),this._nextBound().catch(this._cancelBound)}
2)):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),r(_i,qi).delete(this._canvas),this.callback())))}};ei=new WeakMap,qi=new WeakMap,b(_i,qi,new WeakSet);let Ul=_i;const Mp="4.4.168",Ip="19fbc8998";function td(d){return Math.floor(Math.max(0,Math.min(1,d))*255).toString(16).padStart(2,"0")}function Mr(d){return Math.max(0,Math.min(255,255*d))}class ed{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=Mr(t),[t,t,t]}static G_HTML([t]){const e=td(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(Mr)}static RGB_HTML(t){return`#${t.map(td).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[Mr(1-Math.min(1,t+i)),Mr(1-Math.min(1,s+i)),Mr(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,n=1-e,a=1-s,o=Math.min(i,n,a);return["CMYK",i,n,a,o]}}class eu{static setupStorage(t,e,s,i,n){const a=i.getValue(e,{value:null});switch(s.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),n==="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"),n==="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),n==="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 h=o.target.options,l=h.selectedIndex===-1?"":h[h.selectedIndex].value;i.setValue(e,{value:l})});break}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:n}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${i}`);for(const[h,l]of Object.entries(a))if(l!=null)switch(h){case"class":l.length&&t.setAttribute(h,l.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",l);break;case"style":Object.assign(t.style,l);break;case"textContent":t.textContent=l;break;default:(!o||h!=="href"&&h!=="newWindow")&&t.setAttribute(h,l)}o&&n.addLinkAttributes(t,a.href,a.newWindow),s&&a.dataId&&this.setupStorage(t,a.dataId,e,s)}static render(t){var u,f;const e=t.annotationStorage,s=t.linkService,i=t.xfaHtml,n=t.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:n,linkService:s});const o=n!=="richText",h=t.div;if(h.append(a),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;h.style.transform=m}o&&h.setAttribute("class","xfaLayer xfaFont");const l=[];if(i.children.length===0){if(i.value){const m=document.createTextNode(i.value);a.append(m),o&&Qr.shouldBuildText(i.name)&&l.push(m)}return{textDivs:l}}const c=[[i,-1,a]];for(;c.length>0;){const[m,A,v]=c.at(-1);if(A+1===m.children.length){c.pop();continue}const y=m.children[++c.at(-1)[1]];if(y===null)continue;const{name:_}=y;if(_==="#text"){const E=document.createTextNode(y.value);l.push(E),v.append(E);continue}const w=(u=y==null?void 0:y.attributes)!=null&&u.xmlns?document.createElementNS(y.attributes.xmlns,_):document.createElement(_);
2if(v.append(w),y.attributes&&this.setAttributes({html:w,element:y,storage:e,intent:n,linkService:s}),((f=y.children)==null?void 0:f.length)>0)c.push([y,-1,w]);else if(y.value){const E=document.createTextNode(y.value);o&&Qr.shouldBuildText(_)&&l.push(E),w.append(E)}}for(const m of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const Fo=1e3,Fp=9,vn=new WeakSet;function Fs(d){return{width:d[2]-d[0],height:d[3]-d[1]}}class Dp{static create(t){switch(t.data.annotationType){case mt.LINK:return new su(t);case mt.TEXT:return new Op(t);case mt.WIDGET:switch(t.data.fieldType){case"Tx":return new Np(t);case"Btn":return t.data.radioButton?new ru(t):t.data.checkBox?new Bp(t):new zp(t);case"Ch":return new Up(t);case"Sig":return new Hp(t)}return new Sn(t);case mt.POPUP:return new jl(t);case mt.FREETEXT:return new cu(t);case mt.LINE:return new jp(t);case mt.SQUARE:return new Wp(t);case mt.CIRCLE:return new Gp(t);case mt.POLYLINE:return new du(t);case mt.CARET:return new qp(t);case mt.INK:return new uu(t);case mt.POLYGON:return new Vp(t);case mt.HIGHLIGHT:return new Xp(t);case mt.UNDERLINE:return new Yp(t);case mt.SQUIGGLY:return new Kp(t);case mt.STRIKEOUT:return new Qp(t);case mt.STAMP:return new fu(t);case mt.FILEATTACHMENT:return new Jp(t);default:return new ut(t)}}}var Xi,rr,ar,$a,$l;const Dc=class Dc{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){b(this,$a);b(this,Xi,null);b(this,rr,!1);b(this,ar,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(s)),i&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:s}){return!!(t!=null&&t.str||e!=null&&e.str||s!=null&&s.str)}get hasPopupData(){return Dc._hasPopupData(this.data)}updateEdited(t){var s;if(!this.container)return;r(this,Xi)||p(this,Xi,{rect:this.data.rect.slice(0)});const{rect:e}=t;e&&g(this,$a,$l).call(this,e),(s=r(this,ar))==null||s.popup.updateEdited(t)}resetEdited(){var t;r(this,Xi)&&(g(this,$a,$l).call(this,r(this,Xi).rect),(t=r(this,ar))==null||t.popup.resetEdited(),p(this,Xi,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:i}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof Sn||(n.tabIndex=Fo);const{style:a}=n;if(a.zIndex=this.parent.zIndex++,e.popupRef&&n.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof jl){const{rotation:v}=e;return!e.hasOwnCanvas&&v!==0&&this.setRotation(v,n),n}const{width:o,height:h}=Fs(e.rect);if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const v=e.borderStyle.horizontalCornerRadius,y=e.borderStyle.verticalCornerRadius;if(v>0||y>0){const w=`calc(${v}px * var(--scale-factor)) / calc(${y}px * var(--scale-factor))`;a.borderRadius=w}else if(this instanceof ru){const w=`calc(${o}px * var(--scale-factor)) / calc(${h}px * var(--scale-factor))`;a.borderRadius=w}switch(e.borderStyle.style){case Lr.SOLID:a.borderStyle="solid";break;case Lr.DASHED:a.borderStyle="dashed";break;case Lr.BEVELED:U("Unimplemented border style: beveled");break;case Lr.INSET:U("Unimplemented border style: inset");break;case Lr.UNDERLINE:a.borderBottomStyle="solid";break}const _=e.borderColor||null;_?(p(this,rr,!0),a.borderColor=P.makeHexColor(_[0]|0,_[1]|0,_[2]|0)):a.borderWidth=0}const l=P.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:f,pageY:m}=i.rawDims;a.left=`${100*(l[0]-f)/c}%`,a.top=`${100*(l[1]-m)/u}%`;const{rotation:A}=e;return e.hasOwnCanvas||A===0?(a.width=`${100*o/c}%`,a.height=`${100*h/u}%`):this.setRotation(A,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:i}=this.parent.viewport.rawDims,{width:n,height:a}=Fs(this.data.rect);let o,h;t%180===0?(o=100*n/s,h=100*a/i):(o=100*a/s,h=100*n/i),e.style.width=`${o}%`,e.style.height=`${h}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,i)=>{const n=i.detail[e],a=n[0],o=n.slice(1);i.target.style[s]=ed[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[s]:ed[`${a}_rgb`](o)})};return V(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(()=>
2e.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 n=t[i]||s[i];n==null||n(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,n]of Object.entries(e)){const a=s[i];if(a){const o={detail:{[i]:n},target:t};a(o),delete e[i]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,i,n]=this.data.rect.map(v=>Math.fround(v));if(t.length===8){const[v,y,_,w]=t.subarray(2,6);if(i===v&&n===y&&e===_&&s===w)return}const{style:a}=this.container;let o;if(r(this,rr)){const{borderColor:v,borderWidth:y}=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="${v}" stroke-width="${y}">`],this.container.classList.add("hasBorder")}const h=i-e,l=n-s,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0);const f=c.createElement("defs");u.append(f);const m=c.createElement("clipPath"),A=`clippath_${this.data.id}`;m.setAttribute("id",A),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let v=2,y=t.length;v<y;v+=8){const _=t[v],w=t[v+1],E=t[v+2],S=t[v+3],x=c.createElement("rect"),C=(E-e)/h,R=(n-w)/l,I=(_-E)/h,N=(w-S)/l;x.setAttribute("x",C),x.setAttribute("y",R),x.setAttribute("width",I),x.setAttribute("height",N),m.append(x),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${R}" width="${I}" height="${N}"/>`)}r(this,rr)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${A})`}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const s=p(this,ar,new jl({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(s.render())}render(){Z("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:n,id:a,exportValues:o}of i){if(n===-1||a===e)continue;const h=typeof o=="string"?o:null,l=document.querySelector(`[data-element-id="${a}"]`);if(l&&!vn.has(l)){U(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:h,domElement:l})}return s}for(const i of document.getElementsByName(t)){const{exportValue:n}=i,a=i.getAttribute("data-element-id");a!==e&&vn.has(i)&&s.push({id:a,exportValue:n,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")}get _isEditable(){return!1}_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})})}};Xi=new WeakMap,rr=new WeakMap,ar=new WeakMap,$a=new WeakSet,$l=function(t){const{container:{style:e},data:{rect:s,rotation:i},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:a,pageX:o,pageY:h}}}}=this;s==null||s.splice(0,4,...t);const{width:l,height:c}=Fs(t);e.left=`${100*(t[0]-o)/n}%`,e.top=`${100*(a-t[3]+h)/a}%`,i===0?(e.width=`${100*l/n}%`,e.height=`${100*c/a}%`):this.setRotation(i)};let ut=Dc;var de,mi,iu,nu;class su extends ut{constructor(e,s=null){super(e,{isRenderable:!0,ignoreBorder:!!(s!=null&&s.ignoreBorder),createQuadrilaterals:!0});b(this,de);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:s}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(s.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(g(this,de,iu).call(this,i,e.attachment,e.attachmentDest),n=!0):e.setOCGState?(g(this,de,nu).call(this,i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkA
2nnotation"),n&&this.container.append(i),this.container}_bindLink(e,s){e.href=this.linkService.getDestinationHash(s),e.onclick=()=>(s&&this.linkService.goToDestination(s),!1),(s||s==="")&&g(this,de,mi).call(this)}_bindNamedAction(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(s),!1),g(this,de,mi).call(this)}_bindJSAction(e,s){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(s.actions)){const a=i.get(n);a&&(e[a]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s.id,name:n}}),!1})}e.onclick||(e.onclick=()=>!1),g(this,de,mi).call(this)}_bindResetFormAction(e,s){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),g(this,de,mi).call(this),!this._fieldObjects){U('_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:n,refs:a,include:o}=s,h=[];if(n.length!==0||a.length!==0){const f=new Set(a);for(const m of n){const A=this._fieldObjects[m]||[];for(const{id:v}of A)f.add(v)}for(const m of Object.values(this._fieldObjects))for(const A of m)f.has(A.id)===o&&h.push(A)}else for(const f of Object.values(this._fieldObjects))h.push(...f);const l=this.annotationStorage,c=[];for(const f of h){const{id:m}=f;switch(c.push(m),f.type){case"text":{const v=f.defaultValue||"";l.setValue(m,{value:v});break}case"checkbox":case"radiobutton":{const v=f.defaultValue===f.exportValues;l.setValue(m,{value:v});break}case"combobox":case"listbox":{const v=f.defaultValue||"";l.setValue(m,{value:v});break}default:continue}const A=document.querySelector(`[data-element-id="${m}"]`);if(A){if(!vn.has(A)){U(`_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}}}de=new WeakSet,mi=function(){this.container.setAttribute("data-internal-link","")},iu=function(e,s,i=null){e.href=this.linkService.getAnchorUrl(""),s.description&&(e.title=s.description),e.onclick=()=>{var n;return(n=this.downloadManager)==null||n.openOrDownloadData(s.content,s.filename,i),!1},g(this,de,mi).call(this)},nu=function(e,s){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(s),!1),g(this,de,mi).call(this)};class Op extends ut{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}}class Sn extends ut{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 Qt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,i,n){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:n(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}n&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(a)}}))})}_setEventListeners(t,e,s,i){var n,a,o;for(const[h,l]of s)(l==="Action"||(n=this.data.actions)!=null&&n[l])&&((l==="Focus"||l==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,h,l,i),l==="Focus"&&!((a=this.data.actions)!=null&&a.Blur)?this._setEventListener(t,e,"blur","Blur",null):l==="Blur"&&!((o=this.data.actions)!=null&&o.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}
2_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":P.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||Fp,n=t.style;let a;const o=2,h=l=>Math.round(10*l)/10;if(this.data.multiLine){const l=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(l/(tl*i))||1,u=l/c;a=Math.min(i,h(u/tl))}else{const l=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(i,h(l/tl))}n.fontSize=`calc(${a}px * var(--scale-factor))`,n.color=P.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Np extends Sn{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 n=this.annotationStorage;
2for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=s),n.setValue(a.id,{[i]:s})}render(){var i,n;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 h=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;h&&o.length>h&&(o=o.slice(0,h));let l=a.formattedValue||((i=this.data.textContent)==null?void 0:i.join(`
3`))||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=l??o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",l??o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),vn.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=Fo,this._setRequired(s,this.data.required),h&&(s.maxLength=h),s.addEventListener("input",f=>{t.setValue(e,{value:f.target.value}),this.setPropertyOnSiblings(s,"value",f.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",f=>{const m=this.data.defaultFieldValue??"";s.value=c.userValue=m,c.formattedValue=null});let u=f=>{const{formattedValue:m}=c;m!=null&&(f.target.value=m),f.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",m=>{var v;if(c.focused)return;const{target:A}=m;c.userValue&&(A.value=c.userValue),c.lastCommittedValue=A.value,c.commitKey=1,(v=this.data.actions)!=null&&v.Focus||(c.focused=!0)}),s.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const A={value(v){c.userValue=v.detail.value??"",t.setValue(e,{value:c.userValue.toString()}),v.target.value=c.userValue},formattedValue(v){const{formattedValue:y}=v.detail;c.formattedValue=y,y!=null&&v.target!==document.activeElement&&(v.target.value=y),t.setValue(e,{formattedValue:y})},selRange(v){v.target.setSelectionRange(...v.detail.selRange)},charLimit:v=>{var E;const{charLimit:y}=v.detail,{target:_}=v;if(y===0){_.removeAttribute("maxLength");return}_.setAttribute("maxLength",y);let w=c.userValue;!w||w.length<=y||(w=w.slice(0,y),_.value=c.userValue=w,t.setValue(e,{value:w}),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:1,selStart:_.selectionStart,selEnd:_.selectionEnd}}))}};this._dispatchEventFromSandbox(A,m)}),s.addEventListener("keydown",m=>{var y;c.commitKey=1;let A=-1;if(m.key==="Escape"?A=0:m.key==="Enter"&&!this.data.multiLine?A=2:m.key==="Tab"&&(c.commitKey=3),A===-1)return;const{value:v}=m.target;c.lastCommittedValue!==v&&(c.lastCommittedValue=v,c.userValue=v,(y=this.linkService.eventBus)==null||y.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,willCommit:!0,commitKey:A,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const f=u;u=null,s.addEventListener("blur",m=>{var v,y;if(!c.focused||!m.relatedTarget)return;(v=this.data.actions)!=null&&v.Blur||(c.focused=!1);const{value:A}=m.target;c.userValue=A,c.lastCommittedValue!==A&&((y=this.linkService.eventBus)==null||y.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:c.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}})),f(m)}),(n=this.data.actions)!=null&&n.Keystroke&&s.addEventListener("beforeinput",m=>{var x;c.lastCommittedValue=null;const{data:A,target:v}=m,{value:y,selectionStart:_,selectionEnd:w}=v;let E=_,S=w;switch(m.inputType){case"deleteWordBackward":{const C=y.substring(0,_).match(/\w*[^\w]*$/);C&&(E-=C[0].length);break}
3case"deleteWordForward":{const C=y.substring(_).match(/^[^\w]*\w*/);C&&(S+=C[0].length);break}case"deleteContentBackward":_===w&&(E-=1);break;case"deleteContentForward":_===w&&(S+=1);break}m.preventDefault(),(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,change:A||"",willCommit:!1,selStart:E,selEnd:S}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(u&&s.addEventListener("blur",u),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/h;s.classList.add("comb"),s.style.letterSpacing=`calc(${m}px * var(--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 Hp extends Sn{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Bp extends Sn{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 n=document.createElement("input");return vn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=Fo,n.addEventListener("change",a=>{const{name:o,checked:h}=a.target;for(const l of this._getElementsByName(o,s)){const c=h&&l.exportValue===e.exportValue;l.domElement&&(l.domElement.checked=c),t.setValue(l.id,{value:c})}t.setValue(s,{value:h})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",a=>{const o={value(h){h.target.checked=h.detail.value!=="Off",t.setValue(s,{value:h.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class ru extends Sn{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 n=document.createElement("input");if(vn.add(n),n.setAttribute("data-element-id",s),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,i&&n.setAttribute("checked",!0),n.tabIndex=Fo,n.addEventListener("change",a=>{const{name:o,checked:h}=a.target;for(const l of this._getElementsByName(o,s))t.setValue(l.id,{value:!1});t.setValue(s,{value:h})}),n.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;n.addEventListener("updatefromsandbox",o=>{const h={value:l=>{const c=a===l.detail.value;for(const u of this._getElementsByName(l.target.name)){const f=c&&u.id===s;u.domElement&&(u.domElement.checked=f),t.setValue(u.id,{value:f})}}};this._dispatchEventFromSandbox(h,o)}),this._setEventListeners(n,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)}
3return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class zp extends su{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 Up extends Sn{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");vn.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=Fo;let n=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 f of i.options)f.selected=f.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),n=!1),i.append(u)}let a=null;if(n){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:f,multiple:m}=i;return m?Array.prototype.filter.call(f,A=>A.selected).map(A=>A[u]):f.selectedIndex===-1?null:f[f.selectedIndex][u]};let h=o(!1);const l=c=>{const u=c.target.options;return Array.prototype.map.call(u,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",c=>{const u={value(f){a==null||a();const m=f.detail.value,A=new Set(Array.isArray(m)?m:[m]);for(const v of i.options)v.selected=A.has(v.value);t.setValue(e,{value:o(!0)}),h=o(!1)},multipleSelection(f){i.multiple=!0},remove(f){const m=i.options,A=f.detail.remove;m[A].selected=!1,i.remove(A),m.length>0&&Array.prototype.findIndex.call(m,y=>y.selected)===-1&&(m[0].selected=!0),t.setValue(e,{value:o(!0),items:l(f)}),h=o(!1)},clear(f){for(;i.length!==0;)i.remove(0);t.setValue(e,{value:null,items:[]}),h=o(!1)},insert(f){const{index:m,displayValue:A,exportValue:v}=f.detail.insert,y=i.children[m],_=document.createElement("option");_.textContent=A,_.value=v,y?y.before(_):i.append(_),t.setValue(e,{value:o(!0),items:l(f)}),h=o(!1)},items(f){const{items:m}=f.detail;for(;i.length!==0;)i.remove(0);for(const A of m){const{displayValue:v,exportValue:y}=A,_=document.createElement("option");_.textContent=v,_.value=y,i.append(_)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:o(!0),items:l(f)}),h=o(!1)},indices(f){const m=new Set(f.detail.indices);for(const A of f.target.options)A.selected=m.has(A.index);t.setValue(e,{value:o(!0)}),h=o(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(u,c)}),i.addEventListener("input",c=>{var m;const u=o(!0),f=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:h,change:f,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}}class jl extends ut{constructor(t){const{data:e,elements:s}=t;super(t,{isRenderable:ut._hasPopupData(e)}),this.elements=s,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new $p({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(const s of this.elements)s.popup=t,e.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(s=>`${ad}${s}`).join(",")),this.container}}
3var or,Hh,Bh,hr,Yi,ct,_s,Ki,ja,Wa,lr,ys,ke,ws,Ga,Es,Va,Qi,Ji,tt,sh,Wl,au,ou,hu,lu,ih,nh,Gl;class $p{constructor({container:t,color:e,elements:s,titleObj:i,modificationDate:n,contentsObj:a,richText:o,parent:h,rect:l,parentRect:c,open:u}){b(this,tt);b(this,or,g(this,tt,hu).bind(this));b(this,Hh,g(this,tt,Gl).bind(this));b(this,Bh,g(this,tt,nh).bind(this));b(this,hr,g(this,tt,ih).bind(this));b(this,Yi,null);b(this,ct,null);b(this,_s,null);b(this,Ki,null);b(this,ja,null);b(this,Wa,null);b(this,lr,null);b(this,ys,!1);b(this,ke,null);b(this,ws,null);b(this,Ga,null);b(this,Es,null);b(this,Va,null);b(this,Qi,null);b(this,Ji,!1);var f;p(this,ct,t),p(this,Va,i),p(this,_s,a),p(this,Es,o),p(this,Wa,h),p(this,Yi,e),p(this,Ga,l),p(this,lr,c),p(this,ja,s),p(this,Ki,dd.toDateObject(n)),this.trigger=s.flatMap(m=>m.getElementsToTriggerPopup());for(const m of this.trigger)m.addEventListener("click",r(this,hr)),m.addEventListener("mouseenter",r(this,Bh)),m.addEventListener("mouseleave",r(this,Hh)),m.classList.add("popupTriggerArea");for(const m of s)(f=m.container)==null||f.addEventListener("keydown",r(this,or));r(this,ct).hidden=!0,u&&g(this,tt,ih).call(this)}render(){if(r(this,ke))return;const t=p(this,ke,document.createElement("div"));if(t.className="popup",r(this,Yi)){const n=t.style.outlineColor=P.makeHexColor(...r(this,Yi));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=P.makeHexColor(...r(this,Yi).map(o=>Math.floor(.7*(255-o)+o)))}const e=document.createElement("span");e.className="header";const s=document.createElement("h1");if(e.append(s),{dir:s.dir,str:s.textContent}=r(this,Va),t.append(e),r(this,Ki)){const n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),n.setAttribute("data-l10n-args",JSON.stringify({date:r(this,Ki).toLocaleDateString(),time:r(this,Ki).toLocaleTimeString()})),e.append(n)}const i=r(this,tt,sh);if(i)eu.render({xfaHtml:i,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const n=this._formatContents(r(this,_s));t.append(n)}r(this,ct).append(t)}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let n=0,a=i.length;n<a;++n){const o=i[n];s.append(document.createTextNode(o)),n<a-1&&s.append(document.createElement("br"))}return s}updateEdited({rect:t,popupContent:e}){var s;r(this,Qi)||p(this,Qi,{contentsObj:r(this,_s),richText:r(this,Es)}),t&&p(this,ws,null),e&&(p(this,Es,g(this,tt,ou).call(this,e)),p(this,_s,null)),(s=r(this,ke))==null||s.remove(),p(this,ke,null)}resetEdited(){var t;r(this,Qi)&&({contentsObj:te(this,_s)._,richText:te(this,Es)._}=r(this,Qi),p(this,Qi,null),(t=r(this,ke))==null||t.remove(),p(this,ke,null),p(this,ws,null))}forceHide(){p(this,Ji,this.isVisible),r(this,Ji)&&(r(this,ct).hidden=!0)}maybeShow(){r(this,Ji)&&(r(this,ke)||g(this,tt,nh).call(this),p(this,Ji,!1),r(this,ct).hidden=!1)}get isVisible(){return r(this,ct).hidden===!1}}or=new WeakMap,Hh=new WeakMap,Bh=new WeakMap,hr=new WeakMap,Yi=new WeakMap,ct=new WeakMap,_s=new WeakMap,Ki=new WeakMap,ja=new WeakMap,Wa=new WeakMap,lr=new WeakMap,ys=new WeakMap,ke=new WeakMap,ws=new WeakMap,Ga=new WeakMap,Es=new WeakMap,Va=new WeakMap,Qi=new WeakMap,Ji=new WeakMap,tt=new WeakSet,sh=function(){const t=r(this,Es),e=r(this,_s);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&r(this,Es).html||null},Wl=function(){var t,e,s;return((s=(e=(t=r(this,tt,sh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.fontSize)||0},au=function(){var t,e,s;return((s=(e=(t=r(this,tt,sh))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:s.color)||null},ou=function(t){const e=[],s={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},i={style:{color:r(this,tt,au),fontSize:r(this,tt,Wl)?`calc(${r(this,tt,Wl)}px * var(--scale-factor))`:""}};for(const n of t.split(`
4`))e.push({name:"span",value:n,attributes:i});return s},hu=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&r(this,ys))&&g(this,tt,ih).call(this)},lu=function(){if(r(this,ws)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:n}}}=r(this,Wa);let a=!!r(this,lr),o=a?r(this,lr):r(this,Ga);for(const A of r(this,ja))if(!o||P.intersect(A.data.rect,o)!==null){o=A.data.rect,a=!0;break}const h=P.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=h[0]+c,f=h[1];p(this,ws,[100*(u-i)/e,100*(f-n)/s]);const{style:m}=r(this,ct);m.left=`${r(this,ws)[0]}%`,m.top=`${r(this,ws)[1]}%`},ih=function(){p(this,ys,!r(this,ys)),r(this,ys)?(g(this,tt,nh).call(this),r(this,ct).addEventListener("click",r(this,hr)),r(this,ct).addEventListener("keydown",r(this,or))):(g(this,tt,Gl).call(this),r(this,ct).removeEventListener("click",r(this,hr)),r(this,ct).removeEventListener("keydown",r(this,or)))},nh=function(){r(this,ke)||this.render(),this.isVisible?r(this,ys)&&r(this,ct).classList.add("focused"):(g(this,tt,lu).call(this),r(this,ct).hidden=!1,r(this,ct).style.zIndex=parseInt(r(this,ct).style.zIndex)+1e3)},Gl=function(){r(this,ct).classList.remove("focused"),!(r(this,ys)||!this.isVisible)&&(r(this,ct).hidden=!0,r(this,ct).style.zIndex=parseInt(r(this,ct).style.zIndex)-1e3)};class cu extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=G.FREETEXT}
4render(){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}get _isEditable(){return this.data.hasOwnCanvas}}var qa;class jp extends ut{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});b(this,qa,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=Fs(e.rect),n=this.svgFactory.create(s,i,!0),a=p(this,qa,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"),n.append(a),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,qa)}addHighlightArea(){this.container.classList.add("highlightArea")}}qa=new WeakMap;var Xa;class Wp extends ut{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});b(this,Xa,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=Fs(e.rect),n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Xa,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"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Xa)}addHighlightArea(){this.container.classList.add("highlightArea")}}Xa=new WeakMap;var Ya;class Gp extends ut{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});b(this,Ya,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=Fs(e.rect),n=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,Ya,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"),n.append(o),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Ya)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ya=new WeakMap;var Ka;class du extends ut{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});b(this,Ka,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:s,borderStyle:i,popupRef:n}}=this;if(!s)return this.container;const{width:a,height:o}=Fs(e),h=this.svgFactory.create(a,o,!0);let l=[];for(let u=0,f=s.length;u<f;u+=2){const m=s[u]-e[0],A=e[3]-s[u+1];l.push(`${m},${A}`)}l=l.join(" ");const c=p(this,Ka,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",l),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),h.append(c),this.container.append(h),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return r(this,Ka)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ka=new WeakMap;class Vp extends du{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class qp extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
4var Qa;class uu extends ut{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});b(this,Qa,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=G.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,inkLists:s,borderStyle:i,popupRef:n}}=this,{width:a,height:o}=Fs(e),h=this.svgFactory.create(a,o,!0);for(const l of s){let c=[];for(let f=0,m=l.length;f<m;f+=2){const A=l[f]-e[0],v=e[3]-l[f+1];c.push(`${A},${v}`)}c=c.join(" ");const u=this.svgFactory.createElement(this.svgElementName);r(this,Qa).push(u),u.setAttribute("points",c),u.setAttribute("stroke-width",i.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),!n&&this.hasPopupData&&this._createPopup(),h.append(u)}return this.container.append(h),this.container}getElementsToTriggerPopup(){return r(this,Qa)}addHighlightArea(){this.container.classList.add("highlightArea")}}Qa=new WeakMap;class Xp extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class Yp extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Kp extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Qp extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class fu extends ut{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}var Ja,Za,Vl;class Jp extends ut{constructor(e){var i;super(e,{isRenderable:!0});b(this,Za);b(this,Ja,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",g(this,Za,Vl).bind(this)),p(this,Ja,i);const{isMac:n}=Qt.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(n?a.metaKey:a.ctrlKey)&&g(this,Za,Vl).call(this)}),!s.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return r(this,Ja)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ja=new WeakMap,Za=new WeakSet,Vl=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var to,Zi,cr,_n,pu,ql;class Zp{constructor({div:t,accessibilityManager:e,annotationCanvasMap:s,annotationEditorUIManager:i,page:n,viewport:a}){b(this,_n);b(this,to,null);b(this,Zi,null);b(this,cr,new Map);this.div=t,p(this,to,e),p(this,Zi,s),this.page=n,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=i}async render(t){var a;const{annotations:e}=t,s=this.div;bn(s,this.viewport);const i=new Map,n={data:null,layer:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Sc,annotationStorage:t.annotationStorage||new Rc,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const o of e){if(o.noHTML)continue;const h=o.annotationType===mt.POPUP;if(h){const u=i.get(o.id);if(!u)continue;n.elements=u}else{const{width:u,height:f}=Fs(o.rect);if(u<=0||f<=0)continue}n.data=o;const l=Dp.create(n);if(!l.isRenderable)continue;if(!h&&o.popupRef){const u=i.get(o.popupRef);u?u.push(l):i.set(o.popupRef,[l])}const c=l.render();o.hidden&&(c.style.visibility="hidden"),g(this,_n,pu).call(this,c,o.id),l.annotationEditorType>0&&(r(this,cr).set(l.data.id,l),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(l))}g(this,_n,ql).call(this)}update({viewport:t}){const e=this.div;this.viewport=t,bn(e,{rotation:t.rotation}),g(this,_n,ql).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(r(this,cr).values())}getEditableAnnotation(t){return r(this,cr).get(t)}}to=new WeakMap,Zi=new WeakMap,cr=new WeakMap,_n=new WeakSet,pu=function(t,e){var i;const s=t.firstChild||t;s.id=`${ad}${e}`,this.div.append(t),(i=r(this,to))==null||i.moveElementInDOM(this.div,t,s,!1)},ql=function(){if(!r(this,Zi))return;const t=this.div;for(const[e,s]of r(this,Zi)){const i=t.querySelector(`[data-annotation-id="${e}"]`);if(!i)continue;s.className="annotationContent";const{firstChild:n}=i;n?n.nodeName==="CANVAS"?n.replaceWith(s):n.classList.contains("annotationContent")?n.after(s):n.before(s):i.append(s)}r(this,Zi).clear()};const Wo=/\r\n?|\n/g;var eo,so,io,no,ro,Re,ae,ao,oe,dr,pt,gu,mu,bu,rh,Os,ah,oh,Au,Yl,vu;const nt=class nt extends Q{constructor(e){super({...e,name:"freeTextEditor"});b(this,pt);b(this,eo,this.editorDivBlur.bind(this));b(this,so,this.editorDivFocus.bind(this));b(this,io,this.editorDivInput.bind(this));b(this,no,this.editorDivKeydown.bind(this));b(this,ro,this.editorDivPaste.bind(this));b(this,Re);b(this,ae,"");b(this,ao,`${this.id}-editor`);b(this,oe);b(this,dr,null);p(this,Re,e.color||nt._defaultColor||Q._defaultLineColor),p(this,oe,e.fontSize||nt._defaultFontSize)}static get _keyboardManager(){const e=nt.prototype,s=a=>a.isEmpty(),i=An.TRANSLATE_SMALL,n=An.TRANSLATE_BIG;return V(this,"_keyboardManager",new Mo([[["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:[-n,0],checker:s}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:s}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[n,0],checker:s}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:s}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:s}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:s}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,n],checker:s}]]))}static initialize(e,s){Q.initialize(e,s,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
4static updateDefaultParams(e,s){switch(e){case O.FREETEXT_SIZE:nt._defaultFontSize=s;break;case O.FREETEXT_COLOR:nt._defaultColor=s;break}}updateParams(e,s){switch(e){case O.FREETEXT_SIZE:g(this,pt,gu).call(this,s);break;case O.FREETEXT_COLOR:g(this,pt,mu).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[O.FREETEXT_SIZE,nt._defaultFontSize],[O.FREETEXT_COLOR,nt._defaultColor||Q._defaultLineColor]]}get propertiesToUpdate(){return[[O.FREETEXT_SIZE,r(this,oe)],[O.FREETEXT_COLOR,r(this,Re)]]}_translateEmpty(e,s){this._uiManager.translateSelectedEditors(e,s,!0)}getInitialTranslation(){const e=this.parentScale;return[-nt._internalPadding*e,-(nt._internalPadding+r(this,oe))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(G.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const e=this._uiManager._signal;this.editorDiv.addEventListener("keydown",r(this,no),{signal:e}),this.editorDiv.addEventListener("focus",r(this,so),{signal:e}),this.editorDiv.addEventListener("blur",r(this,eo),{signal:e}),this.editorDiv.addEventListener("input",r(this,io),{signal:e}),this.editorDiv.addEventListener("paste",r(this,ro),{signal:e})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",r(this,ao)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",r(this,no)),this.editorDiv.removeEventListener("focus",r(this,so)),this.editorDiv.removeEventListener("blur",r(this,eo)),this.editorDiv.removeEventListener("input",r(this,io)),this.editorDiv.removeEventListener("paste",r(this,ro)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var e;this.width||(this.enableEditMode(),this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=r(this,ae),s=p(this,ae,g(this,pt,bu).call(this).trimEnd());if(e===s)return;const i=n=>{if(p(this,ae,n),!n){this.remove();return}g(this,pt,oh).call(this),this._uiManager.rebuild(this),g(this,pt,rh).call(this)};this.addCommands({cmd:()=>{i(s)},undo:()=>{i(e)},mustExec:!1}),g(this,pt,rh).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){nt._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)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",r(this,ao)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Q._l10nPromise.get("pdfjs-free-text-default-content").then(n=>{var a;return(a=this.editorDiv)==null?void 0:a.setAttribute("default-content",n)}),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${r(this,oe)}px * var(--scale-factor))`,i.color=r(this,Re),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Ah(this,this.div,["dblclick","keydown"]),this.width){const[n,a]=this.parentDimensions;
4if(this.annotationElementId){const{position:o}=r(this,dr);let[h,l]=this.getInitialTranslation();[h,l]=this.pageTranslationToScreen(h,l);const[c,u]=this.pageDimensions,[f,m]=this.pageTranslation;let A,v;switch(this.rotation){case 0:A=e+(o[0]-f)/c,v=s+this.height-(o[1]-m)/u;break;case 90:A=e+(o[0]-f)/c,v=s-(o[1]-m)/u,[h,l]=[l,-h];break;case 180:A=e-this.width+(o[0]-f)/c,v=s-(o[1]-m)/u,[h,l]=[-h,-l];break;case 270:A=e+(o[0]-f-this.height*u)/c,v=s+(o[1]-m-this.width*c)/u,[h,l]=[-l,h];break}this.setAt(A*n,v*a,h,l)}else this.setAt(e*n,s*a,this.width*n,this.height*a);g(this,pt,oh).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var A,v,y;const s=e.clipboardData||window.clipboardData,{types:i}=s;if(i.length===1&&i[0]==="text/plain")return;e.preventDefault();const n=g(A=nt,Os,Yl).call(A,s.getData("text")||"").replaceAll(Wo,`
5`);if(!n)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!n.includes(`
6`)){o.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:h,startOffset:l}=o,c=[],u=[];if(h.nodeType===Node.TEXT_NODE){const _=h.parentElement;if(u.push(h.nodeValue.slice(l).replaceAll(Wo,"")),_!==this.editorDiv){let w=c;for(const E of this.editorDiv.childNodes){if(E===_){w=u;continue}w.push(g(v=nt,Os,ah).call(v,E))}}c.push(h.nodeValue.slice(0,l).replaceAll(Wo,""))}else if(h===this.editorDiv){let _=c,w=0;for(const E of this.editorDiv.childNodes)w++===l&&(_=u),_.push(g(y=nt,Os,ah).call(y,E))}p(this,ae,`${c.join(`
7`)}${n}${u.join(`
8`)}`),g(this,pt,oh).call(this);const f=new Range;let m=c.reduce((_,w)=>_+w.length,0);for(const{firstChild:_}of this.editorDiv.childNodes)if(_.nodeType===Node.TEXT_NODE){const w=_.nodeValue.length;if(m<=w){f.setStart(_,m),f.setEnd(_,m);break}m-=w}a.removeAllRanges(),a.addRange(f)}get contentDiv(){return this.editorDiv}static deserialize(e,s,i){var o;let n=null;if(e instanceof cu){const{data:{defaultAppearanceData:{fontSize:h,fontColor:l},rect:c,rotation:u,id:f},textContent:m,textPosition:A,parent:{page:{pageNumber:v}}}=e;if(!m||m.length===0)return null;n=e={annotationType:G.FREETEXT,color:Array.from(l),fontSize:h,value:m.join(`
9`),position:A,pageIndex:v-1,rect:c.slice(0),rotation:u,id:f,deleted:!1}}const a=super.deserialize(e,s,i);return p(a,oe,e.fontSize),p(a,Re,P.makeHexColor(...e.color)),p(a,ae,g(o=nt,Os,Yl).call(o,e.value)),a.annotationElementId=e.id||null,p(a,dr,n),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const s=nt._internalPadding*this.parentScale,i=this.getRect(s,s),n=Q._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:r(this,Re)),a={annotationType:G.FREETEXT,color:n,fontSize:r(this,oe),value:g(this,pt,Au).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!g(this,pt,vu).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${r(this,oe)}px * var(--scale-factor))`,i.color=r(this,Re),s.replaceChildren();for(const a of r(this,ae).split(`
10`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),s.append(o)}const n=nt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(n,n),popupContent:r(this,ae)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};eo=new WeakMap,so=new WeakMap,io=new WeakMap,no=new WeakMap,ro=new WeakMap,Re=new WeakMap,ae=new WeakMap,ao=new WeakMap,oe=new WeakMap,dr=new WeakMap,pt=new WeakSet,gu=function(e){const s=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-r(this,oe))*this.parentScale),p(this,oe,n),g(this,pt,rh).call(this)},i=r(this,oe);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.FREETEXT_S
10IZE,overwriteIfSameType:!0,keepUndo:!0})},mu=function(e){const s=n=>{p(this,Re,this.editorDiv.style.color=n)},i=r(this,Re);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},bu=function(){var s;const e=[];this.editorDiv.normalize();for(const i of this.editorDiv.childNodes)e.push(g(s=nt,Os,ah).call(s,i));return e.join(`
11`)},rh=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:a}=this,o=a.style.display,h=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",n.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",h)}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()},Os=new WeakSet,ah=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Wo,"")},oh=function(){if(this.editorDiv.replaceChildren(),!!r(this,ae))for(const e of r(this,ae).split(`
12`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},Au=function(){return r(this,ae).replaceAll(" "," ")},Yl=function(e){return e.replaceAll(" "," ")},vu=function(e){const{value:s,fontSize:i,color:n,pageIndex:a}=r(this,dr);return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,h)=>o!==n[h])||e.pageIndex!==a},b(nt,Os),B(nt,"_freeTextDefaultContent",""),B(nt,"_internalPadding",0),B(nt,"_defaultColor",null),B(nt,"_defaultFontSize",10),B(nt,"_type","freetext"),B(nt,"_editorType",G.FREETEXT);let Xl=nt;var oo,si,Le,Vt,_u,hh,yu,wu,Ql;class Kl{constructor(t,e=0,s=0,i=!0){b(this,Vt);b(this,oo);b(this,si,[]);b(this,Le,[]);let n=1/0,a=-1/0,o=1/0,h=-1/0;const l=10**-4;for(const{x:y,y:_,width:w,height:E}of t){const S=Math.floor((y-e)/l)*l,x=Math.ceil((y+w+e)/l)*l,C=Math.floor((_-e)/l)*l,R=Math.ceil((_+E+e)/l)*l,I=[S,C,R,!0],N=[x,C,R,!1];r(this,si).push(I,N),n=Math.min(n,S),a=Math.max(a,x),o=Math.min(o,C),h=Math.max(h,R)}const c=a-n+2*s,u=h-o+2*s,f=n-s,m=o-s,A=r(this,si).at(i?-1:-2),v=[A[0],A[2]];for(const y of r(this,si)){const[_,w,E]=y;y[0]=(_-f)/c,y[1]=(w-m)/u,y[2]=(E-m)/u}p(this,oo,{x:f,y:m,width:c,height:u,lastPoint:v})}getOutlines(){r(this,si).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of r(this,si))e[3]?(t.push(...g(this,Vt,Ql).call(this,e)),g(this,Vt,yu).call(this,e)):(g(this,Vt,wu).call(this,e),t.push(...g(this,Vt,Ql).call(this,e)));return g(this,Vt,_u).call(this,t)}}oo=new WeakMap,si=new WeakMap,Le=new WeakMap,Vt=new WeakSet,_u=function(t){const e=[],s=new Set;for(const a of t){const[o,h,l]=a;e.push([o,h,a],[o,l,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 h=e[a][2],l=e[a+1][2];h.push(l),l.push(h),s.add(h),s.add(l)}const i=[];let n;for(;s.size>0;){const a=s.values().next().value;let[o,h,l,c,u]=a;s.delete(a);let f=o,m=h;for(n=[o,l],i.push(n);;){let A;if(s.has(c))A=c;else if(s.has(u))A=u;else break;s.delete(A),[o,h,l,c,u]=A,f!==o&&(n.push(f,m,o,m===h?h:l),f=o),m=m===h?l:h}n.push(f,m)}return new tg(i,r(this,oo))},hh=function(t){const e=r(this,Le);let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,a=e[n][0];if(a===t)return n;a<t?s=n+1:i=n-1}return i+1},yu=function([,t,e]){const s=g(this,Vt,hh).call(this,t);r(this,Le).splice(s,0,[t,e])},wu=function([,t,e]){const s=g(this,Vt,hh).call(this,t);for(let i=s;i<r(this,Le).length;i++){const[n,a]=r(this,Le)[i];if(n!==t)break;if(n===t&&a===e){r(this,Le).splice(i,1);return}}for(let i=s-1;i>=0;i--){const[n,a]=r(this,Le)[i];if(n!==t)break;if(n===t&&a===e){r(this,Le).splice(i,1);return}}},Ql=function(t){const[e,s,i]=t,n=[[e,s,i]],a=g(this,Vt,hh).call(this,i);for(let o=0;o<a;o++){const[h,l]=r(this,Le)[o];for(let c=0,u=n.length;c<u;c++){const[,f,m]=n[c];if(!(l<=f||m<=h)){if(f>=h){if(m>l)n[c][1]=l;else{if(u===1)return[];n.splice(c,1),c--,u--}continue}n[c][2]=h,m>l&&n.push([e,l,m])}}}return n};class Eu{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof Zl}}var ho,ur;
12class tg extends Eu{constructor(e,s){super();b(this,ho);b(this,ur);p(this,ur,e),p(this,ho,s)}toSVGPath(){const e=[];for(const s of r(this,ur)){let[i,n]=s;e.push(`M${i} ${n}`);for(let a=2;a<s.length;a+=2){const o=s[a],h=s[a+1];o===i?(e.push(`V${h}`),n=h):h===n&&(e.push(`H${o}`),i=o)}e.push("Z")}return e.join(" ")}serialize([e,s,i,n],a){const o=[],h=i-e,l=n-s;for(const c of r(this,ur)){const u=new Array(c.length);for(let f=0;f<c.length;f+=2)u[f]=e+c[f]*h,u[f+1]=n-c[f+1]*l;o.push(u)}return o}get box(){return r(this,ho)}}ho=new WeakMap,ur=new WeakMap;var We,Ss,fr,pr,Ge,W,tn,en,lo,co,gr,mr,ii,uo,zh,Uh,fo,Jl;const as=class as{constructor({x:t,y:e},s,i,n,a,o=0){b(this,fo);b(this,We);b(this,Ss,[]);b(this,fr);b(this,pr);b(this,Ge,[]);b(this,W,new Float64Array(18));b(this,tn);b(this,en);b(this,lo);b(this,co);b(this,gr);b(this,mr);b(this,ii,[]);p(this,We,s),p(this,mr,n*i),p(this,pr,a),r(this,W).set([NaN,NaN,NaN,NaN,t,e],6),p(this,fr,o),p(this,co,r(as,uo)*i),p(this,lo,r(as,Uh)*i),p(this,gr,i),r(this,ii).push(t,e)}get free(){return!0}isEmpty(){return isNaN(r(this,W)[8])}add({x:t,y:e}){var N;p(this,tn,t),p(this,en,e);const[s,i,n,a]=r(this,We);let[o,h,l,c]=r(this,W).subarray(8,12);const u=t-l,f=e-c,m=Math.hypot(u,f);if(m<r(this,lo))return!1;const A=m-r(this,co),v=A/m,y=v*u,_=v*f;let w=o,E=h;o=l,h=c,l+=y,c+=_,(N=r(this,ii))==null||N.push(t,e);const S=-_/A,x=y/A,C=S*r(this,mr),R=x*r(this,mr);return r(this,W).set(r(this,W).subarray(2,8),0),r(this,W).set([l+C,c+R],4),r(this,W).set(r(this,W).subarray(14,18),12),r(this,W).set([l-C,c-R],16),isNaN(r(this,W)[6])?(r(this,Ge).length===0&&(r(this,W).set([o+C,h+R],2),r(this,Ge).push(NaN,NaN,NaN,NaN,(o+C-s)/n,(h+R-i)/a),r(this,W).set([o-C,h-R],14),r(this,Ss).push(NaN,NaN,NaN,NaN,(o-C-s)/n,(h-R-i)/a)),r(this,W).set([w,E,o,h,l,c],6),!this.isEmpty()):(r(this,W).set([w,E,o,h,l,c],6),Math.abs(Math.atan2(E-h,w-o)-Math.atan2(_,y))<Math.PI/2?([o,h,l,c]=r(this,W).subarray(2,6),r(this,Ge).push(NaN,NaN,NaN,NaN,((o+l)/2-s)/n,((h+c)/2-i)/a),[o,h,w,E]=r(this,W).subarray(14,18),r(this,Ss).push(NaN,NaN,NaN,NaN,((w+o)/2-s)/n,((E+h)/2-i)/a),!0):([w,E,o,h,l,c]=r(this,W).subarray(0,6),r(this,Ge).push(((w+5*o)/6-s)/n,((E+5*h)/6-i)/a,((5*o+l)/6-s)/n,((5*h+c)/6-i)/a,((o+l)/2-s)/n,((h+c)/2-i)/a),[l,c,o,h,w,E]=r(this,W).subarray(12,18),r(this,Ss).push(((w+5*o)/6-s)/n,((E+5*h)/6-i)/a,((5*o+l)/6-s)/n,((5*h+c)/6-i)/a,((o+l)/2-s)/n,((h+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=r(this,Ge),e=r(this,Ss),s=r(this,W).subarray(4,6),i=r(this,W).subarray(16,18),[n,a,o,h]=r(this,We),[l,c,u,f]=g(this,fo,Jl).call(this);if(isNaN(r(this,W)[6])&&!this.isEmpty())return`M${(r(this,W)[2]-n)/o} ${(r(this,W)[3]-a)/h} L${(r(this,W)[4]-n)/o} ${(r(this,W)[5]-a)/h} L${l} ${c} L${u} ${f} L${(r(this,W)[16]-n)/o} ${(r(this,W)[17]-a)/h} L${(r(this,W)[14]-n)/o} ${(r(this,W)[15]-a)/h} Z`;const m=[];m.push(`M${t[4]} ${t[5]}`);for(let A=6;A<t.length;A+=6)isNaN(t[A])?m.push(`L${t[A+4]} ${t[A+5]}`):m.push(`C${t[A]} ${t[A+1]} ${t[A+2]} ${t[A+3]} ${t[A+4]} ${t[A+5]}`);m.push(`L${(s[0]-n)/o} ${(s[1]-a)/h} L${l} ${c} L${u} ${f} L${(i[0]-n)/o} ${(i[1]-a)/h}`);for(let A=e.length-6;A>=6;A-=6)isNaN(e[A])?m.push(`L${e[A+4]} ${e[A+5]}`):m.push(`C${e[A]} ${e[A+1]} ${e[A+2]} ${e[A+3]} ${e[A+4]} ${e[A+5]}`);return m.push(`L${e[4]} ${e[5]} Z`),m.join(" ")}getOutlines(){var _;const t=r(this,Ge),e=r(this,Ss),s=r(this,W),i=s.subarray(4,6),n=s.subarray(16,18),[a,o,h,l]=r(this,We),c=new Float64Array((((_=r(this,ii))==null?void 0:_.length)??0)+2);for(let w=0,E=c.length-2;w<E;w+=2)c[w]=(r(this,ii)[w]-a)/h,c[w+1]=(r(this,ii)[w+1]-o)/l;c[c.length-2]=(r(this,tn)-a)/h,c[c.length-1]=(r(this,en)-o)/l;const[u,f,m,A]=g(this,fo,Jl).call(this);if(isNaN(s[6])&&!this.isEmpty()){const w=new Float64Array(36);return w.set([NaN,NaN,NaN,NaN,(s[2]-a)/h,(s[3]-o)/l,NaN,NaN,NaN,NaN,(s[4]-a)/h,(s[5]-o)/l,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,m,A,NaN,NaN,NaN,NaN,(s[16]-a)/h,(s[17]-o)/l,NaN,NaN,NaN,NaN,(s[14]-a)/h,(s[15]-o)/l],0),new Zl(w,c,r(this,We),r(this,gr),r(this,fr),r(this,pr))}const v=new Float64Array(r(this,Ge).length+24+r(this,Ss).length);let y=t.length;for(let w=0;w<y;w+=2){if(isNaN(t[w])){v[w]=v[w+1]=NaN;continue}v[w]=t[w],v[w+1]=t[w+1]}v.set([NaN,NaN,NaN,NaN,(i[0]-a)/h,(i[1]-o)/l,NaN,NaN,NaN,NaN,u,f,NaN,NaN,NaN,NaN,m,A,NaN,NaN,NaN,NaN,(n[0]-a)/h,(n[1]-o)/l],y),y+=24;for(let w=e.length-6;
12w>=6;w-=6)for(let E=0;E<6;E+=2){if(isNaN(e[w+E])){v[y]=v[y+1]=NaN,y+=2;continue}v[y]=e[w+E],v[y+1]=e[w+E+1],y+=2}return v.set([NaN,NaN,NaN,NaN,e[4],e[5]],y),new Zl(v,c,r(this,We),r(this,gr),r(this,fr),r(this,pr))}};We=new WeakMap,Ss=new WeakMap,fr=new WeakMap,pr=new WeakMap,Ge=new WeakMap,W=new WeakMap,tn=new WeakMap,en=new WeakMap,lo=new WeakMap,co=new WeakMap,gr=new WeakMap,mr=new WeakMap,ii=new WeakMap,uo=new WeakMap,zh=new WeakMap,Uh=new WeakMap,fo=new WeakSet,Jl=function(){const t=r(this,W).subarray(4,6),e=r(this,W).subarray(16,18),[s,i,n,a]=r(this,We);return[(r(this,tn)+(t[0]-e[0])/2-s)/n,(r(this,en)+(t[1]-e[1])/2-i)/a,(r(this,tn)+(e[0]-t[0])/2-s)/n,(r(this,en)+(e[1]-t[1])/2-i)/a]},b(as,uo,8),b(as,zh,2),b(as,Uh,r(as,uo)+r(as,zh));let yh=as;var br,sn,Cs,po,he,go,dt,Jt,Ur,$r,Su;class Zl extends Eu{constructor(e,s,i,n,a,o){super();b(this,Jt);b(this,br);b(this,sn,null);b(this,Cs);b(this,po);b(this,he);b(this,go);b(this,dt);p(this,dt,e),p(this,he,s),p(this,br,i),p(this,go,n),p(this,Cs,a),p(this,po,o),g(this,Jt,Su).call(this,o);const{x:h,y:l,width:c,height:u}=r(this,sn);for(let f=0,m=e.length;f<m;f+=2)e[f]=(e[f]-h)/c,e[f+1]=(e[f+1]-l)/u;for(let f=0,m=s.length;f<m;f+=2)s[f]=(s[f]-h)/c,s[f+1]=(s[f+1]-l)/u}toSVGPath(){const e=[`M${r(this,dt)[4]} ${r(this,dt)[5]}`];for(let s=6,i=r(this,dt).length;s<i;s+=6){if(isNaN(r(this,dt)[s])){e.push(`L${r(this,dt)[s+4]} ${r(this,dt)[s+5]}`);continue}e.push(`C${r(this,dt)[s]} ${r(this,dt)[s+1]} ${r(this,dt)[s+2]} ${r(this,dt)[s+3]} ${r(this,dt)[s+4]} ${r(this,dt)[s+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,s,i,n],a){const o=i-e,h=n-s;let l,c;switch(a){case 0:l=g(this,Jt,Ur).call(this,r(this,dt),e,n,o,-h),c=g(this,Jt,Ur).call(this,r(this,he),e,n,o,-h);break;case 90:l=g(this,Jt,$r).call(this,r(this,dt),e,s,o,h),c=g(this,Jt,$r).call(this,r(this,he),e,s,o,h);break;case 180:l=g(this,Jt,Ur).call(this,r(this,dt),i,s,-o,h),c=g(this,Jt,Ur).call(this,r(this,he),i,s,-o,h);break;case 270:l=g(this,Jt,$r).call(this,r(this,dt),i,n,-o,-h),c=g(this,Jt,$r).call(this,r(this,he),i,n,-o,-h);break}return{outline:Array.from(l),points:[Array.from(c)]}}get box(){return r(this,sn)}getNewOutline(e,s){const{x:i,y:n,width:a,height:o}=r(this,sn),[h,l,c,u]=r(this,br),f=a*c,m=o*u,A=i*c+h,v=n*u+l,y=new yh({x:r(this,he)[0]*f+A,y:r(this,he)[1]*m+v},r(this,br),r(this,go),e,r(this,po),s??r(this,Cs));for(let _=2;_<r(this,he).length;_+=2)y.add({x:r(this,he)[_]*f+A,y:r(this,he)[_+1]*m+v});return y.getOutlines()}}br=new WeakMap,sn=new WeakMap,Cs=new WeakMap,po=new WeakMap,he=new WeakMap,go=new WeakMap,dt=new WeakMap,Jt=new WeakSet,Ur=function(e,s,i,n,a){const o=new Float64Array(e.length);for(let h=0,l=e.length;h<l;h+=2)o[h]=s+e[h]*n,o[h+1]=i+e[h+1]*a;return o},$r=function(e,s,i,n,a){const o=new Float64Array(e.length);for(let h=0,l=e.length;h<l;h+=2)o[h]=s+e[h+1]*n,o[h+1]=i+e[h]*a;return o},Su=function(e){const s=r(this,dt);let i=s[4],n=s[5],a=i,o=n,h=i,l=n,c=i,u=n;const f=e?Math.max:Math.min;for(let _=6,w=s.length;_<w;_+=6){if(isNaN(s[_]))a=Math.min(a,s[_+4]),o=Math.min(o,s[_+5]),h=Math.max(h,s[_+4]),l=Math.max(l,s[_+5]),u<s[_+5]?(c=s[_+4],u=s[_+5]):u===s[_+5]&&(c=f(c,s[_+4]));else{const E=P.bezierBoundingBox(i,n,...s.slice(_,_+6));a=Math.min(a,E[0]),o=Math.min(o,E[1]),h=Math.max(h,E[2]),l=Math.max(l,E[3]),u<E[3]?(c=E[2],u=E[3]):u===E[3]&&(c=f(c,E[2]))}i=s[_+4],n=s[_+5]}const m=a-r(this,Cs),A=o-r(this,Cs),v=h-a+2*r(this,Cs),y=l-o+2*r(this,Cs);p(this,sn,{x:m,y:A,width:v,height:y,lastPoint:[c,u]})};var mo,bo,Pe,nn,Ar,At,Ao,vr,vo,_o,Me,_r,st,tc,ec,Cu,bi,xu,$s;const os=class os{constructor({editor:t=null,uiManager:e=null}){b(this,st);b(this,mo,g(this,st,Cu).bind(this));b(this,bo,g(this,st,xu).bind(this));b(this,Pe,null);b(this,nn,null);b(this,Ar);b(this,At,null);b(this,Ao,!1);b(this,vr,!1);b(this,vo,null);b(this,_o);b(this,Me,null);b(this,_r);var s;t?(p(this,vr,!1),p(this,_r,O.HIGHLIGHT_COLOR),p(this,vo,t)):(p(this,vr,!0),p(this,_r,O.HIGHLIGHT_DEFAULT_COLOR)),p(this,Me,(t==null?void 0:t._uiManager)||e),p(this,_o,r(this,Me)._eventBus),p(this,Ar,(t==null?void 0:t.color)||((s=r(this,Me))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return V(this,"_keyboardManager",new Mo([[["Escape","mac+Escape"],os.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],os.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],os.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],os.prototype._moveToPrevious],[["Home","mac+Home"],os.prototype._moveToBeginning],[["End","mac+End"],os.prototype._moveToEnd]]))}renderButton(){const t=p(this,Pe,document.createElement("button"));
12t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=r(this,Me)._signal;t.addEventListener("click",g(this,st,bi).bind(this),{signal:e}),t.addEventListener("keydown",r(this,mo),{signal:e});const s=p(this,nn,document.createElement("span"));return s.className="swatch",s.setAttribute("aria-hidden",!0),s.style.backgroundColor=r(this,Ar),t.append(s),t}renderMainDropdown(){const t=p(this,At,g(this,st,tc).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===r(this,Pe)){g(this,st,bi).call(this,t);return}const e=t.target.getAttribute("data-color");e&&g(this,st,ec).call(this,e,t)}_moveToNext(t){var e,s;if(!r(this,st,$s)){g(this,st,bi).call(this,t);return}if(t.target===r(this,Pe)){(e=r(this,At).firstChild)==null||e.focus();return}(s=t.target.nextSibling)==null||s.focus()}_moveToPrevious(t){var e,s;if(t.target===((e=r(this,At))==null?void 0:e.firstChild)||t.target===r(this,Pe)){r(this,st,$s)&&this._hideDropdownFromKeyboard();return}r(this,st,$s)||g(this,st,bi).call(this,t),(s=t.target.previousSibling)==null||s.focus()}_moveToBeginning(t){var e;if(!r(this,st,$s)){g(this,st,bi).call(this,t);return}(e=r(this,At).firstChild)==null||e.focus()}_moveToEnd(t){var e;if(!r(this,st,$s)){g(this,st,bi).call(this,t);return}(e=r(this,At).lastChild)==null||e.focus()}hideDropdown(){var t;(t=r(this,At))==null||t.classList.add("hidden"),window.removeEventListener("pointerdown",r(this,bo))}_hideDropdownFromKeyboard(){var t;if(!r(this,vr)){if(!r(this,st,$s)){(t=r(this,vo))==null||t.unselect();return}this.hideDropdown(),r(this,Pe).focus({preventScroll:!0,focusVisible:r(this,Ao)})}}updateColor(t){if(r(this,nn)&&(r(this,nn).style.backgroundColor=t),!r(this,At))return;const e=r(this,Me).highlightColors.values();for(const s of r(this,At).children)s.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;(t=r(this,Pe))==null||t.remove(),p(this,Pe,null),p(this,nn,null),(e=r(this,At))==null||e.remove(),p(this,At,null)}};mo=new WeakMap,bo=new WeakMap,Pe=new WeakMap,nn=new WeakMap,Ar=new WeakMap,At=new WeakMap,Ao=new WeakMap,vr=new WeakMap,vo=new WeakMap,_o=new WeakMap,Me=new WeakMap,_r=new WeakMap,st=new WeakSet,tc=function(){const t=document.createElement("div"),e=r(this,Me)._signal;t.addEventListener("contextmenu",Zt,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[s,i]of r(this,Me).highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",i),n.title=s,n.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${s}`);const a=document.createElement("span");n.append(a),a.className="swatch",a.style.backgroundColor=i,n.setAttribute("aria-selected",i===r(this,Ar)),n.addEventListener("click",g(this,st,ec).bind(this,i),{signal:e}),t.append(n)}return t.addEventListener("keydown",r(this,mo),{signal:e}),t},ec=function(t,e){e.stopPropagation(),r(this,_o).dispatch("switchannotationeditorparams",{source:this,type:r(this,_r),value:t})},Cu=function(t){os._keyboardManager.exec(this,t)},bi=function(t){if(r(this,st,$s)){this.hideDropdown();return}if(p(this,Ao,t.detail===0),window.addEventListener("pointerdown",r(this,bo),{signal:r(this,Me)._signal}),r(this,At)){r(this,At).classList.remove("hidden");return}const e=p(this,At,g(this,st,tc).call(this));r(this,Pe).append(e)},xu=function(t){var e;(e=r(this,At))!=null&&e.contains(t.target)||this.hideDropdown()},$s=function(){return r(this,At)&&!r(this,At).classList.contains("hidden")};let wh=os;var yr,yo,ni,rn,wr,ge,wo,Eo,an,Ie,$t,le,$h,Er,on,vt,Sr,Ve,So,j,sc,ic,Tu,ku,Ru,nc,jr,ve,Rn,Lu,lh,Wr,Pu,Mu,Iu,Fu;const Y=class Y extends Q{constructor(e){super({...e,name:"highlightEditor"});b(this,j);b(this,yr,null);b(this,yo,0);b(this,ni);b(this,rn,null);b(this,wr,null);b(this,ge,null);b(this,wo,null);b(this,Eo,0);b(this,an,null);b(this,Ie,null);b(this,$t,null);b(this,le,!1);b(this,$h,g(this,j,Lu).bind(this));b(this,Er,null);b(this,on);b(this,vt,null);b(this,Sr,"");b(this,Ve);b(this,So,"");this.color=e.color||Y._defaultColor,p(this,Ve,e.thickness||Y._defaultThickness),p(this,on,e.opacity||Y._defaultOpacity),p(this,ni,e.boxes||null),p(this,So,e.methodOfCreation||""),p(this,Sr,e.text||""),this._isDraggable=!1,e.highlightId>-1?(p(this,le,!0),g(this,j,ic).call(this,e),g(this,j,jr).call(this)):(p(this,yr,e.anchorNode),p(this,yo,e.anchorOffset),p(this,wo,e.focusNode),p(this,Eo,e.focusOffset),g(this,j,sc).call(this),g(this,j,jr).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=Y.prototype;return V(this,"_keyboardManager",new Mo([[["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:r(this,le)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:r(this,Ve),methodOfCreation:r(this,So
12)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,s){var i;Q.initialize(e,s),Y._defaultColor||(Y._defaultColor=((i=s.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(e,s){switch(e){case O.HIGHLIGHT_DEFAULT_COLOR:Y._defaultColor=s;break;case O.HIGHLIGHT_THICKNESS:Y._defaultThickness=s;break}}translateInPage(e,s){}get toolbarPosition(){return r(this,Er)}updateParams(e,s){switch(e){case O.HIGHLIGHT_COLOR:g(this,j,Tu).call(this,s);break;case O.HIGHLIGHT_THICKNESS:g(this,j,ku).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[O.HIGHLIGHT_DEFAULT_COLOR,Y._defaultColor],[O.HIGHLIGHT_THICKNESS,Y._defaultThickness]]}get propertiesToUpdate(){return[[O.HIGHLIGHT_COLOR,this.color||Y._defaultColor],[O.HIGHLIGHT_THICKNESS,r(this,Ve)||Y._defaultThickness],[O.HIGHLIGHT_FREE,r(this,le)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(p(this,wr,new wh({editor:this})),e.addColorPicker(r(this,wr))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(g(this,j,Wr).call(this))}getBaseTranslation(){return[0,0]}getRect(e,s){return super.getRect(e,s,g(this,j,Wr).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){g(this,j,nc).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(g(this,j,jr).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var i;let s=!1;this.parent&&!e?g(this,j,nc).call(this):e&&(g(this,j,jr).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 n,a,o;const{drawLayer:s}=this.parent;let i;r(this,le)?(e=(e-this.rotation+360)%360,i=g(n=Y,ve,Rn).call(n,r(this,Ie).box,e)):i=g(a=Y,ve,Rn).call(a,this,e),s.rotate(r(this,$t),e),s.rotate(r(this,vt),e),s.updateBox(r(this,$t),i),s.updateBox(r(this,vt),g(o=Y,ve,Rn).call(o,r(this,ge).box,e))}render(){if(this.div)return this.div;const e=super.render();r(this,Sr)&&(e.setAttribute("aria-label",r(this,Sr)),e.setAttribute("role","mark")),r(this,le)?e.classList.add("free"):this.div.addEventListener("keydown",r(this,$h),{signal:this._uiManager._signal});const s=p(this,an,document.createElement("div"));e.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",s.style.clipPath=r(this,rn);const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),Ah(this,r(this,an),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.parent.drawLayer.addClass(r(this,vt),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(r(this,vt),"hovered")}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:g(this,j,lh).call(this,!0);break;case 1:case 3:g(this,j,lh).call(this,!1);break}}select(){var e,s;super.select(),r(this,vt)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,vt),"hovered"),(s=this.parent)==null||s.drawLayer.addClass(r(this,vt),"selected"))}unselect(){var e;super.unselect(),r(this,vt)&&((e=this.parent)==null||e.drawLayer.removeClass(r(this,vt),"selected"),r(this,le)||g(this,j,lh).call(this,!1))}get _mustFixPosition(){return!r(this,le)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.show(r(this,$t),e),this.parent.drawLayer.show(r(this,vt),e))}static startHighlighting(e,s,{target:i,x:n,y:a}){const{x:o,y:h,width:l,height:c}=i.getBoundingClientRect(),u=y=>{g(this,ve,Iu).call(this,e,y)},f=e._signal,m={capture:!0,passive:!1,signal:f},A=y=>{y.preventDefault(),y.stopPropagation()},v=y=>{i.removeEventListener("pointermove",u),window.removeEventListener("blur",v),window.removeEventListener("pointerup",v),window.removeEventListener("pointerdown",A,m),window.removeEventListener("contextmenu",Zt),g(this,ve,Fu).call(this,e,y)};window.addEventListener("blur",v,{signal:f}),window.addEventListener("pointerup",v,{signal:f}),window.addEventListener("pointerdown",A,m),window.addEventListener("contextmenu",Zt,{signal:f}),i.addEventListener("pointermove",u,{signal:f}),this._freeHighlight=new yh({x:n,y:a},[o,h,l,c],e.scale,this._defaultThickness/2,s,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(e,s,i){var v;const n=super.deserialize(e,s,i),{rect:[a,o,h,l],color:c,quadPoints:u}=e;n.color=P.makeHexColor(...c),p(n,on,e.opacity);const[f,m]=n.pageDimensions;n.width=(h-a)/f,n.height=(l-o)/m;const A=p(n,ni,[]);for(let y=0;y<u.length;y+=8)A.push({x:(u[4]-h)/f,y:(l-(1-u[y+5]))/m,width:(u[y+2]-u[y])/f,height:(u[y+5]-u[y+1])
12/m});return g(v=n,j,sc).call(v),n}serialize(e=!1){if(this.isEmpty()||e)return null;const s=this.getRect(0,0),i=Q._colorManager.convert(this.color);return{annotationType:G.HIGHLIGHT,color:i,opacity:r(this,on),thickness:r(this,Ve),quadPoints:g(this,j,Pu).call(this),outlines:g(this,j,Mu).call(this,s),pageIndex:this.pageIndex,rect:s,rotation:g(this,j,Wr).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};yr=new WeakMap,yo=new WeakMap,ni=new WeakMap,rn=new WeakMap,wr=new WeakMap,ge=new WeakMap,wo=new WeakMap,Eo=new WeakMap,an=new WeakMap,Ie=new WeakMap,$t=new WeakMap,le=new WeakMap,$h=new WeakMap,Er=new WeakMap,on=new WeakMap,vt=new WeakMap,Sr=new WeakMap,Ve=new WeakMap,So=new WeakMap,j=new WeakSet,sc=function(){const e=new Kl(r(this,ni),.001);p(this,Ie,e.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=r(this,Ie).box;const s=new Kl(r(this,ni),.0025,.001,this._uiManager.direction==="ltr");p(this,ge,s.getOutlines());const{lastPoint:i}=r(this,ge).box;p(this,Er,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},ic=function({highlightOutlines:e,highlightId:s,clipPathId:i}){var u,f;if(p(this,Ie,e),p(this,ge,e.getNewOutline(r(this,Ve)/2+1.5,.0025)),s>=0)p(this,$t,s),p(this,rn,i),this.parent.drawLayer.finalizeLine(s,e),p(this,vt,this.parent.drawLayer.highlightOutline(r(this,ge)));else if(this.parent){const m=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(r(this,$t),e),this.parent.drawLayer.updateBox(r(this,$t),g(u=Y,ve,Rn).call(u,r(this,Ie).box,(m-this.rotation+360)%360)),this.parent.drawLayer.updateLine(r(this,vt),r(this,ge)),this.parent.drawLayer.updateBox(r(this,vt),g(f=Y,ve,Rn).call(f,r(this,ge).box,m))}const{x:a,y:o,width:h,height:l}=e.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=h,this.height=l;break;case 90:{const[m,A]=this.parentDimensions;this.x=o,this.y=1-a,this.width=h*A/m,this.height=l*m/A;break}case 180:this.x=1-a,this.y=1-o,this.width=h,this.height=l;break;case 270:{const[m,A]=this.parentDimensions;this.x=1-o,this.y=a,this.width=h*A/m,this.height=l*m/A;break}}const{lastPoint:c}=r(this,ge).box;p(this,Er,[(c[0]-a)/h,(c[1]-o)/l])},Tu=function(e){const s=n=>{var a,o;this.color=n,(a=this.parent)==null||a.drawLayer.changeColor(r(this,$t),n),(o=r(this,wr))==null||o.updateColor(n)},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:O.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},ku=function(e){const s=r(this,Ve),i=n=>{p(this,Ve,n),g(this,j,Ru).call(this,n)};this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},Ru=function(e){if(!r(this,le))return;g(this,j,ic).call(this,{highlightOutlines:r(this,Ie).getNewOutline(e/2)}),this.fixAndSetPosition();const[s,i]=this.parentDimensions;this.setDims(this.width*s,this.height*i)},nc=function(){r(this,$t)===null||!this.parent||(this.parent.drawLayer.remove(r(this,$t)),p(this,$t,null),this.parent.drawLayer.remove(r(this,vt)),p(this,vt,null))},jr=function(e=this.parent){r(this,$t)===null&&({id:te(this,$t)._,clipPathId:te(this,rn)._}=e.drawLayer.highlight(r(this,Ie),this.color,r(this,on)),p(this,vt,e.drawLayer.highlightOutline(r(this,ge))),r(this,an)&&(r(this,an).style.clipPath=r(this,rn)))},ve=new WeakSet,Rn=function({x:e,y:s,width:i,height:n},a){switch(a){case 90:return{x:1-s-n,y:e,width:n,height:i};case 180:return{x:1-e-i,y:1-s-n,width:i,height:n};case 270:return{x:s,y:1-e-i,width:n,height:i}}return{x:e,y:s,width:i,height:n}},Lu=function(e){Y._keyboardManager.exec(this,e)},lh=function(e){if(!r(this,yr))return;const s=window.getSelection();e?s.setPosition(r(this,yr),r(this,yo)):s.setPosition(r(this,wo),r(this,Eo))},Wr=function(){return r(this,le)?this.rotation:0},Pu=function(){if(r(this,le))return null;const[e,s]=this.pageDimensions,i=r(this,ni),n=new Float32Array(i.length*8);let a=0;for(const{x:o,y:h,width:l,height:c}
12of i){const u=o*e,f=(1-h-c)*s;n[a]=n[a+4]=u,n[a+1]=n[a+3]=f,n[a+2]=n[a+6]=u+l*e,n[a+5]=n[a+7]=f+c*s,a+=8}return n},Mu=function(e){return r(this,Ie).serialize(e,g(this,j,Wr).call(this))},Iu=function(e,s){this._freeHighlight.add(s)&&e.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Fu=function(e,s){this._freeHighlight.isEmpty()?e.drawLayer.removeFreeHighlight(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=""},b(Y,ve),B(Y,"_defaultColor",null),B(Y,"_defaultOpacity",1),B(Y,"_defaultThickness",12),B(Y,"_l10nPromise"),B(Y,"_type","highlight"),B(Y,"_editorType",G.HIGHLIGHT),B(Y,"_freeHighlightId",-1),B(Y,"_freeHighlight",null),B(Y,"_freeHighlightClipId","");let Eh=Y;var hn,ln,Co,xo,To,cn,qe,xs,me,dn,un,Ts,fn,pn,ri,k,Du,Ou,Nu,Hu,ac,Bu,oc,zu,Uu,$u,ju,Wu,Ai,hc,ch,dh,Ln,lc,uh,Hs,Gu,cc,Vu,qu,dc,fh,Gr;const ht=class ht extends Q{constructor(e){super({...e,name:"inkEditor"});b(this,k);b(this,hn,0);b(this,ln,0);b(this,Co,this.canvasPointermove.bind(this));b(this,xo,this.canvasPointerleave.bind(this));b(this,To,this.canvasPointerup.bind(this));b(this,cn,this.canvasPointerdown.bind(this));b(this,qe,null);b(this,xs,new Path2D);b(this,me,!1);b(this,dn,!1);b(this,un,!1);b(this,Ts,null);b(this,fn,0);b(this,pn,0);b(this,ri,null);this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e,s){Q.initialize(e,s)}static updateDefaultParams(e,s){switch(e){case O.INK_THICKNESS:ht._defaultThickness=s;break;case O.INK_COLOR:ht._defaultColor=s;break;case O.INK_OPACITY:ht._defaultOpacity=s/100;break}}updateParams(e,s){switch(e){case O.INK_THICKNESS:g(this,k,Du).call(this,s);break;case O.INK_COLOR:g(this,k,Ou).call(this,s);break;case O.INK_OPACITY:g(this,k,Nu).call(this,s);break}}static get defaultPropertiesToUpdate(){return[[O.INK_THICKNESS,ht._defaultThickness],[O.INK_COLOR,ht._defaultColor||Q._defaultLineColor],[O.INK_OPACITY,Math.round(ht._defaultOpacity*100)]]}get propertiesToUpdate(){return[[O.INK_THICKNESS,this.thickness||ht._defaultThickness],[O.INK_COLOR,this.color||ht._defaultColor||Q._defaultLineColor],[O.INK_OPACITY,Math.round(100*(this.opacity??ht._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(g(this,k,ch).call(this),g(this,k,dh).call(this)),this.isAttachedToDOM||(this.parent.add(this),g(this,k,Ln).call(this)),g(this,k,Gr).call(this)))}remove(){var e;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,r(this,qe)&&(clearTimeout(r(this,qe)),p(this,qe,null)),(e=r(this,Ts))==null||e.disconnect(),p(this,Ts,null),super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,s]=this.parentDimensions,i=this.width*e,n=this.height*s;this.setDimensions(i,n)}enableEditMode(){r(this,me)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",r(this,cn),{signal:this._uiManager._signal}))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",r(this,cn)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){r(this,me)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),p(this,me,!0),this.div.classList.add("disabled"),g(this,k,Gr).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||r(this,me)||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),g(this,k,Bu).call(this,e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),g(this,k,oc).call(this,e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),g(this,k,hc).call(this,e)}canvasPointerleave(e){g(this,k,hc).call(this,e)}get isResizable(){return!this.isEmpty()&&r(this,me)}
12render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,a,o]=g(this,k,Hu).call(this);if(this.setAt(i,n,0,0),this.setDims(a,o),g(this,k,ch).call(this),this.width){const[h,l]=this.parentDimensions;this.setAspectRatio(this.width*h,this.height*l),this.setAt(e*h,s*l,this.width*h,this.height*l),p(this,un,!0),g(this,k,Ln).call(this),this.setDims(this.width*h,this.height*l),g(this,k,Ai).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return g(this,k,dh).call(this),this.div}setDimensions(e,s){const i=Math.round(e),n=Math.round(s);if(r(this,fn)===i&&r(this,pn)===n)return;p(this,fn,i),p(this,pn,n),this.canvas.style.visibility="hidden";const[a,o]=this.parentDimensions;this.width=e/a,this.height=s/o,this.fixAndSetPosition(),r(this,me)&&g(this,k,lc).call(this,e,s),g(this,k,Ln).call(this),g(this,k,Ai).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(e,s,i){var y,_,w;if(e instanceof uu)return null;const n=super.deserialize(e,s,i);n.thickness=e.thickness,n.color=P.makeHexColor(...e.color),n.opacity=e.opacity;const[a,o]=n.pageDimensions,h=n.width*a,l=n.height*o,c=n.parentScale,u=e.thickness/2;p(n,me,!0),p(n,fn,Math.round(h)),p(n,pn,Math.round(l));const{paths:f,rect:m,rotation:A}=e;for(let{bezier:E}of f){E=g(y=ht,Hs,Vu).call(y,E,m,A);const S=[];n.paths.push(S);let x=c*(E[0]-u),C=c*(E[1]-u);for(let I=2,N=E.length;I<N;I+=6){const q=c*(E[I]-u),D=c*(E[I+1]-u),at=c*(E[I+2]-u),it=c*(E[I+3]-u),rt=c*(E[I+4]-u),ot=c*(E[I+5]-u);S.push([[x,C],[q,D],[at,it],[rt,ot]]),x=rt,C=ot}const R=g(this,Hs,Gu).call(this,S);n.bezierPath2D.push(R)}const v=g(_=n,k,dc).call(_);return p(n,ln,Math.max(Q.MIN_SIZE,v[2]-v[0])),p(n,hn,Math.max(Q.MIN_SIZE,v[3]-v[1])),g(w=n,k,lc).call(w,h,l),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),s=Q._colorManager.convert(this.ctx.strokeStyle);return{annotationType:G.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:g(this,k,qu).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};hn=new WeakMap,ln=new WeakMap,Co=new WeakMap,xo=new WeakMap,To=new WeakMap,cn=new WeakMap,qe=new WeakMap,xs=new WeakMap,me=new WeakMap,dn=new WeakMap,un=new WeakMap,Ts=new WeakMap,fn=new WeakMap,pn=new WeakMap,ri=new WeakMap,k=new WeakSet,Du=function(e){const s=n=>{this.thickness=n,g(this,k,Gr).call(this)},i=this.thickness;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Ou=function(e){const s=n=>{this.color=n,g(this,k,Ai).call(this)},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:O.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Nu=function(e){const s=n=>{this.opacity=n,g(this,k,Ai).call(this)};e/=100;const i=this.opacity;this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:O.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Hu=function(){const{parentRotation:e,parentDimensions:[s,i]}=this;switch(e){case 90:return[0,i,i,s];case 180:return[s,i,s,i];case 270:return[s,0,i,s];default:return[0,0,s,i]}},ac=function(){const{ctx:e,color:s,opacity:i,thickness:n,parentScale:a,scaleFactor:o}=this;e.lineWidth=n*a/o,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${s}${Sf(i)}`},Bu=function(e,s){const i=this._uiManager._signal;this.canvas.addEventListener("contextmenu",Zt,{signal:i}),this.canvas.addEventListener("pointerleave",r(this,xo),{signal:i}),this.canvas.addEventListener("pointermove",r(this,Co),{signal:i}),this.canvas.addEventListener("pointerup",r(this,To),{signal:i}),this.canvas.removeEventListener("pointerdown",r(this,cn)),this.isEditing=!0,r(this,un)||(p(this,un,!0),g(this,k,Ln).call(this),this.thickness||(this.thickness=ht._defaultThickness),this.color||(this.color=ht._defaultColor||Q._defaultLineColor),this.opacity??(this.opacity=ht._defaultOpacity)),this.currentPath.push([e,s]),p(this,dn,!1),g(this,k,ac).call(this),p(this,ri,()=>{g(this,k,$u).call(this),r(this,ri)&&window.requestAnimationFrame(r(this,ri))}),window.requestAnimationFrame(r(this,ri))},oc=function(e,s){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&s===n)return;const a=this.currentPath;
12let o=r(this,xs);if(a.push([e,s]),p(this,dn,!0),a.length<=2){o.moveTo(...a[0]),o.lineTo(e,s);return}a.length===3&&(p(this,xs,o=new Path2D),o.moveTo(...a[0])),g(this,k,ju).call(this,o,...a.at(-3),...a.at(-2),e,s)},zu=function(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);r(this,xs).lineTo(...e)},Uu=function(e,s){p(this,ri,null),e=Math.min(Math.max(e,0),this.canvas.width),s=Math.min(Math.max(s,0),this.canvas.height),g(this,k,oc).call(this,e,s),g(this,k,zu).call(this);let i;if(this.currentPath.length!==1)i=g(this,k,Wu).call(this);else{const l=[e,s];i=[[l,l.slice(),l.slice(),l]]}const n=r(this,xs),a=this.currentPath;this.currentPath=[],p(this,xs,new Path2D);const o=()=>{this.allRawPaths.push(a),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},h=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(g(this,k,ch).call(this),g(this,k,dh).call(this)),g(this,k,Gr).call(this))};this.addCommands({cmd:o,undo:h,mustExec:!0})},$u=function(){if(!r(this,dn))return;p(this,dn,!1);const e=Math.ceil(this.thickness*this.parentScale),s=this.currentPath.slice(-3),i=s.map(o=>o[0]),n=s.map(o=>o[1]);Math.min(...i)-e,Math.max(...i)+e,Math.min(...n)-e,Math.max(...n)+e;const{ctx:a}=this;a.save(),a.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)a.stroke(o);a.stroke(r(this,xs)),a.restore()},ju=function(e,s,i,n,a,o,h){const l=(s+n)/2,c=(i+a)/2,u=(n+o)/2,f=(a+h)/2;e.bezierCurveTo(l+2*(n-l)/3,c+2*(a-c)/3,u+2*(n-u)/3,f+2*(a-f)/3,u,f)},Wu=function(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const s=[];let i,[n,a]=e[0];for(i=1;i<e.length-2;i++){const[m,A]=e[i],[v,y]=e[i+1],_=(m+v)/2,w=(A+y)/2,E=[n+2*(m-n)/3,a+2*(A-a)/3],S=[_+2*(m-_)/3,w+2*(A-w)/3];s.push([[n,a],E,S,[_,w]]),[n,a]=[_,w]}const[o,h]=e[i],[l,c]=e[i+1],u=[n+2*(o-n)/3,a+2*(h-a)/3],f=[l+2*(o-l)/3,c+2*(h-c)/3];return s.push([[n,a],u,f,[l,c]]),s},Ai=function(){if(this.isEmpty()){g(this,k,uh).call(this);return}g(this,k,ac).call(this);const{canvas:e,ctx:s}=this;s.setTransform(1,0,0,1,0,0),s.clearRect(0,0,e.width,e.height),g(this,k,uh).call(this);for(const i of this.bezierPath2D)s.stroke(i)},hc=function(e){this.canvas.removeEventListener("pointerleave",r(this,xo)),this.canvas.removeEventListener("pointermove",r(this,Co)),this.canvas.removeEventListener("pointerup",r(this,To)),this.canvas.addEventListener("pointerdown",r(this,cn),{signal:this._uiManager._signal}),r(this,qe)&&clearTimeout(r(this,qe)),p(this,qe,setTimeout(()=>{p(this,qe,null),this.canvas.removeEventListener("contextmenu",Zt)},10)),g(this,k,Uu).call(this,e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()},ch=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},dh=function(){p(this,Ts,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&this.setDimensions(s.width,s.height)})),r(this,Ts).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Ts))==null||e.disconnect(),p(this,Ts,null)},{once:!0})},Ln=function(){if(!r(this,un))return;const[e,s]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*s),g(this,k,uh).call(this)},lc=function(e,s){const i=g(this,k,fh).call(this),n=(e-i)/r(this,ln),a=(s-i)/r(this,hn);this.scaleFactor=Math.min(n,a)},uh=function(){const e=g(this,k,fh).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)},Hs=new WeakSet,Gu=function(e){const s=new Path2D;for(let i=0,n=e.length;i<n;i++){const[a,o,h,l]=e[i];i===0&&s.moveTo(...a),s.bezierCurveTo(o[0],o[1],h[0],h[1],l[0],l[1])}return s},cc=function(e,s,i){const[n,a,o,h]=s;switch(i){case 0:for(let l=0,c=e.length;l<c;l+=2)e[l]+=n,e[l+1]=h-e[l+1];break;case 90:for(let l=0,c=e.length;l<c;l+=2){const u=e[l];e[l]=e[l+1]+n,e[l+1]=u+a}break;case 180:for(let l=0,c=e.length;l<c;l+=2)e[l]=o-e[l],e[l+1]+=a;break;case 270:for(let l=0,c=e.length;l<c;l+=2){const u=e[l];e[l]=o-e[l+1],e[l+1]=h-u}break;default:throw new Error("Invalid rotation")}return e},Vu=function(e,s,i){const[n,a,o,h]=s;switch(i){case 0:for(let l=0,c=e.length;l<c;l+=2)e[l]-=n,e[l+1]=h-e[l+1];break;case 90:for(let l=0,c=e.length;l<c;l+=2){const u=e[l];e[l]=e[l+1]-a,e[l+1]=u-n}break;case 180:for(let l=0,c=e.length;l<c;l+=2)e[l]=o-e[l],e[l+1]-=a;break;case 270:for(let l=0,c=e.length;l<c;l+=2){const u=e[l];e[l]=h-e[l+1],e[l+1]=o-u}break;default:throw new Error("Invalid rotation")}return e},qu=function(e,s,i,n){var c,u;const a=[],o=this.thickness/2,h=e*s+o,l=e*i+o;for(const f of this.paths){const m=[],A=[];for(let v=0,y=f.length;v<y;v++){const[_,w,E,S]=f[v];if(_[0]===S[0]&&_[1]===S[1]&&y===1){const it=e*_[0]+h,rt=e*_[1]+l;m.push(it,rt),A.push(it,rt);break}const x=e*_[0]+h,C=e*_[1]+l,R=e*w[0]+h,I=e*w[1]+l,N=e*E[0]+h,q=e*E[1]+l,D=e*S[0]+h,at=e*S[1]+l;v===0&&(m.push(x,C),A.push(x,C)),m.push(R,I,N,q,D,at),A.push(R,I),v===y-1&&A.push(D,at)}a.push({bezier:g(c=ht,Hs,cc).call(c,m,n,this.rotation),points:g(u=ht,Hs,cc).call(u,A,n,this.rotation)})}return a},dc=function(){let e=1/0,s=-1/0,i=1/0,n=-1/0;for(const a of this.paths)for(const[o,h,l,c]of a){const u=P.bezierBoundingBox(...o,...h,...l,...c);e=Math.min(e,u[0]),i=Math.min(i,u[1]),s=Math.max(s,u[2]),n=Math.max(n,u[3])}return[e,i,s,n]},fh=function(){return r(this,me)?Math.ceil(this.thickness*this.parentScale):0},Gr=function(e=!1){if(this.isEmpty())return;if(!r(this,me)){g(this,k,Ai).call(this);return}const s=g(this,k,dc).call(this),i=g(this,k,fh).call(this);p(this,ln,Math.max(Q.MIN_SIZE,s[2]-s[0])),p(this,hn,Math.max(Q.MIN_SIZE,s[3]-s[1]));const n=Math.ceil(i+r(this,ln)*this.scaleFactor),a=Math.ceil(i+r(this,hn)*this.scaleFactor),[o,h]=this.parentDimensions;this.width=n/o,this.height=a/h,this.setAspectRatio(n,a);const l=this.translationX,c=this.translationY;this.translationX=-s[0],this.translationY=-s[1],g(this,k,Ln).call(this),g(this,k,Ai).call(this),p(this,fn,n),p(this,pn,a),this.setDims(n,a);const u=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-u,c-this.translationY-u)},b(ht,Hs),B(ht,"_defaultColor",null),B(ht,"_defaultOpacity",1),B(ht,"_defaultThickness",1),B(ht,"_type","ink"),B(ht,"_editorType",G.INK);let rc=ht;var Lt,Pt,ai,ks,oi,Cr,Xe,Rs,Ye,Fe,ko,X,Vr,qr,ph,fc,Xu,Yu,pc,gh,Ku;const Kr=class Kr extends Q{constructor(e){super({...e,name:"stampEditor"});b(this,X);b(this,Lt,null);b(this,Pt,null);b(this,ai,null);b(this,ks,null);b(this,oi,null);b(this,Cr,"");b(this,Xe,null);b(this,Rs,null);b(this,Ye,null);b(this,Fe,!1);b(this,ko,!1);p(this,ks,e.bitmapUrl),p(this,oi,e.bitmapFile)}static initialize(e,s){Q.initialize(e,s)}static get supportedTypes(){return V(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(s=>`image/${s}`))}static get supportedTypesStr(){return V(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,s){s.pasteEditor(G.STAMP,{bitmapFile:e.getAsFile()})}remove(){var e,s;r(this,Pt)&&(p(this,Lt,null),this._uiManager.imageManager.deleteId(r(this,Pt)),(e=r(this,Xe))==null||e.remove(),p(this,Xe,null),(s=r
12(this,Rs))==null||s.disconnect(),p(this,Rs,null),r(this,Ye)&&(clearTimeout(r(this,Ye)),p(this,Ye,null))),super.remove()}rebuild(){if(!this.parent){r(this,Pt)&&g(this,X,ph).call(this);return}super.rebuild(),this.div!==null&&(r(this,Pt)&&r(this,Xe)===null&&g(this,X,ph).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(r(this,ai)||r(this,Lt)||r(this,ks)||r(this,oi)||r(this,Pt))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,s;if(this.width&&(e=this.x,s=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),r(this,Lt)?g(this,X,fc).call(this):g(this,X,ph).call(this),this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,s*n,this.width*i,this.height*n)}return this.div}getImageForAltText(){return r(this,Xe)}static deserialize(e,s,i){if(e instanceof fu)return null;const n=super.deserialize(e,s,i),{rect:a,bitmapUrl:o,bitmapId:h,isSvg:l,accessibilityData:c}=e;h&&i.imageManager.isValidId(h)?p(n,Pt,h):p(n,ks,o),p(n,Fe,l);const[u,f]=n.pageDimensions;return n.width=(a[2]-a[0])/u,n.height=(a[3]-a[1])/f,c&&(n.altTextData=c),n}serialize(e=!1,s=null){if(this.isEmpty())return null;const i={annotationType:G.STAMP,bitmapId:r(this,Pt),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:r(this,Fe),structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=g(this,X,gh).call(this,!0),i.accessibilityData=this.altTextData,i;const{decorative:n,altText:a}=this.altTextData;if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),s===null)return i;s.stamps||(s.stamps=new Map);const o=r(this,Fe)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!s.stamps.has(r(this,Pt)))s.stamps.set(r(this,Pt),{area:o,serialized:i}),i.bitmap=g(this,X,gh).call(this,!1);else if(r(this,Fe)){const h=s.stamps.get(r(this,Pt));o>h.area&&(h.area=o,h.serialized.bitmap.close(),h.serialized.bitmap=g(this,X,gh).call(this,!1))}return i}};Lt=new WeakMap,Pt=new WeakMap,ai=new WeakMap,ks=new WeakMap,oi=new WeakMap,Cr=new WeakMap,Xe=new WeakMap,Rs=new WeakMap,Ye=new WeakMap,Fe=new WeakMap,ko=new WeakMap,X=new WeakSet,Vr=function(e,s=!1){if(!e){this.remove();return}p(this,Lt,e.bitmap),s||(p(this,Pt,e.id),p(this,Fe,e.isSvg)),e.file&&p(this,Cr,e.file.name),g(this,X,fc).call(this)},qr=function(){p(this,ai,null),this._uiManager.enableWaiting(!1),r(this,Xe)&&this.div.focus()},ph=function(){if(r(this,Pt)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(r(this,Pt)).then(i=>g(this,X,Vr).call(this,i,!0)).finally(()=>g(this,X,qr).call(this));return}if(r(this,ks)){const i=r(this,ks);p(this,ks,null),this._uiManager.enableWaiting(!0),p(this,ai,this._uiManager.imageManager.getFromUrl(i).then(n=>g(this,X,Vr).call(this,n)).finally(()=>g(this,X,qr).call(this)));return}if(r(this,oi)){const i=r(this,oi);p(this,oi,null),this._uiManager.enableWaiting(!0),p(this,ai,this._uiManager.imageManager.getFromFile(i).then(n=>g(this,X,Vr).call(this,n)).finally(()=>g(this,X,qr).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=Kr.supportedTypesStr;const s=this._uiManager._signal;p(this,ai,new Promise(i=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const n=await this._uiManager.imageManager.getFromFile(e.files[0]);g(this,X,Vr).call(this,n)}i()},{signal:s}),e.addEventListener("cancel",()=>{this.remove(),i()},{signal:s})}).finally(()=>g(this,X,qr).call(this))),e.click()},fc=function(){const{div:e}=this;let{width:s,height:i}=r(this,Lt);const[n,a]=this.pageDimensions,o=.75;if(this.width)s=this.width*n,i=this.height*a;else if(s>o*n||i>o*a){const u=Math.min(o*n/s,o*a/i);s*=u,i*=u}const[h,l]=this.parentDimensions;this.setDims(s*h/n,i*l/a),this._uiManager.enableWaiting(!1);const c=p(this,Xe,document.createElement("canvas"));e.append(c),e.hidden=!1,g(this,X,pc).call(this,s,i),g(this,X,Ku).call(this),r(this,ko)||(this.parent.addUndoableEditor(this),p(this,ko,!0)),this._reportTelemetry({action:"inserted_image"}),r(this,Cr)&&c.setAttribute("aria-label",r(this,Cr))},Xu=function(e,s){var o;const[i,n]=this.parentDimensions;
12this.width=e/i,this.height=s/n,this.setDims(e,s),(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,r(this,Ye)!==null&&clearTimeout(r(this,Ye)),p(this,Ye,setTimeout(()=>{p(this,Ye,null),g(this,X,pc).call(this,e,s)},200))},Yu=function(e,s){const{width:i,height:n}=r(this,Lt);let a=i,o=n,h=r(this,Lt);for(;a>2*e||o>2*s;){const l=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(h,0,0,l,c,0,0,a,o),h=u.transferToImageBitmap()}return h},pc=function(e,s){e=Math.ceil(e),s=Math.ceil(s);const i=r(this,Xe);if(!i||i.width===e&&i.height===s)return;i.width=e,i.height=s;const n=r(this,Fe)?r(this,Lt):g(this,X,Yu).call(this,e,s);if(this._uiManager.hasMLManager&&!this.hasAltText()){const h=new OffscreenCanvas(e,s).getContext("2d");h.drawImage(n,0,0,n.width,n.height,0,0,e,s),this._uiManager.mlGuess({service:"image-to-text",request:{data:h.getImageData(0,0,e,s).data,width:e,height:s,channels:4}}).then(l=>{const c=(l==null?void 0:l.output)||"";this.parent&&c&&!this.hasAltText()&&(this.altTextData={altText:c,decorative:!1})})}const a=i.getContext("2d");a.filter=this._uiManager.hcmFilter,a.drawImage(n,0,0,n.width,n.height,0,0,e,s)},gh=function(e){if(e){if(r(this,Fe)){const n=this._uiManager.imageManager.getSvgUrl(r(this,Pt));if(n)return n}const s=document.createElement("canvas");return{width:s.width,height:s.height}=r(this,Lt),s.getContext("2d").drawImage(r(this,Lt),0,0),s.toDataURL()}if(r(this,Fe)){const[s,i]=this.pageDimensions,n=Math.round(this.width*s*di.PDF_TO_CSS_UNITS),a=Math.round(this.height*i*di.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(n,a);return o.getContext("2d").drawImage(r(this,Lt),0,0,r(this,Lt).width,r(this,Lt).height,0,0,n,a),o.transferToImageBitmap()}return structuredClone(r(this,Lt))},Ku=function(){this._uiManager._signal&&(p(this,Rs,new ResizeObserver(e=>{const s=e[0].contentRect;s.width&&s.height&&g(this,X,Xu).call(this,s.width,s.height)})),r(this,Rs).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var e;(e=r(this,Rs))==null||e.disconnect(),p(this,Rs,null)},{once:!0}))},B(Kr,"_type","stamp"),B(Kr,"_editorType",G.STAMP);let uc=Kr;var gn,xr,Ke,mn,Ls,Ps,Ms,ce,hi,Tr,kr,jt,M,li,Mt,Qu,mc,bc,Ac,mh;const _e=class _e{constructor({uiManager:t,pageIndex:e,div:s,accessibilityManager:i,annotationLayer:n,drawLayer:a,textLayer:o,viewport:h,l10n:l}){b(this,Mt);b(this,gn);b(this,xr,!1);b(this,Ke,null);b(this,mn,null);b(this,Ls,null);b(this,Ps,null);b(this,Ms,null);b(this,ce,new Map);b(this,hi,!1);b(this,Tr,!1);b(this,kr,!1);b(this,jt,null);b(this,M);const c=[...r(_e,li).values()];if(!_e._initialized){_e._initialized=!0;for(const u of c)u.initialize(l,t)}t.registerEditorTypes(c),p(this,M,t),this.pageIndex=e,this.div=s,p(this,gn,i),p(this,Ke,n),this.viewport=h,p(this,jt,o),this.drawLayer=a,r(this,M).addLayer(this)}get isEmpty(){return r(this,ce).size===0}get isInvisible(){return this.isEmpty&&r(this,M).getMode()===G.NONE}updateToolbar(t){r(this,M).updateToolbar(t)}updateMode(t=r(this,M).getMode()){switch(g(this,Mt,mh).call(this),t){case G.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case G.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case G.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;for(const s of r(_e,li).values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=r(this,jt))==null?void 0:e.div)}addInkEditorIfNeeded(t){if(r(this,M).getMode()!==G.INK)return;if(!t){for(const s of r(this,ce).values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){r(this,M).setEditingState(t)}addCommands(t){r(this,M).addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=r(this,Ke))==null||e.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of r(this,ce).values())s.enableEditing(),s.show(!0),s.annotationElementId&&(r(this,M).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!r(this,Ke))return;const e=r(this,Ke).getEditableAnnotations();for(const s of e){if(s.hide(),r(this,M).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;p(this,kr,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const n of r(this,ce).values())if(n.disableEditing(),!!n.annotationElementId){if
12(n.serialize()!==null){t.set(n.annotationElementId,n);continue}else e.set(n.annotationElementId,n);(i=this.getEditableAnnotation(n.annotationElementId))==null||i.show(),n.remove()}if(r(this,Ke)){const n=r(this,Ke).getEditableAnnotations();for(const a of n){const{id:o}=a.data;if(r(this,M).isDeletedAnnotationElement(o))continue;let h=e.get(o);if(h){h.resetAnnotationElement(a),h.show(!1),a.show();continue}h=t.get(o),h&&(r(this,M).addChangedExistingAnnotation(h),h.renderAnnotationElement(a),h.show(!1)),a.show()}}g(this,Mt,mh).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const n of r(_e,li).values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),p(this,kr,!1)}getEditableAnnotation(t){var e;return((e=r(this,Ke))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){r(this,M).getActive()!==t&&r(this,M).setActiveEditor(t)}enableTextSelection(){var t;this.div.tabIndex=-1,(t=r(this,jt))!=null&&t.div&&!r(this,Ps)&&(p(this,Ps,g(this,Mt,Qu).bind(this)),r(this,jt).div.addEventListener("pointerdown",r(this,Ps),{signal:r(this,M)._signal}),r(this,jt).div.classList.add("highlighting"))}disableTextSelection(){var t;this.div.tabIndex=0,(t=r(this,jt))!=null&&t.div&&r(this,Ps)&&(r(this,jt).div.removeEventListener("pointerdown",r(this,Ps)),p(this,Ps,null),r(this,jt).div.classList.remove("highlighting"))}enableClick(){if(r(this,Ls))return;const t=r(this,M)._signal;p(this,Ls,this.pointerdown.bind(this)),p(this,mn,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",r(this,Ls),{signal:t}),this.div.addEventListener("pointerup",r(this,mn),{signal:t})}disableClick(){r(this,Ls)&&(this.div.removeEventListener("pointerdown",r(this,Ls)),this.div.removeEventListener("pointerup",r(this,mn)),p(this,Ls,null),p(this,mn,null))}attach(t){r(this,ce).set(t.id,t);const{annotationElementId:e}=t;e&&r(this,M).isDeletedAnnotationElement(e)&&r(this,M).removeDeletedAnnotationElement(t)}detach(t){var e;r(this,ce).delete(t.id),(e=r(this,gn))==null||e.removePointerInTextLayer(t.contentDiv),!r(this,kr)&&t.annotationElementId&&r(this,M).addDeletedAnnotationElement(t)}remove(t){this.detach(t),r(this,M).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,r(this,Tr)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(r(this,M).addDeletedAnnotationElement(t.annotationElementId),Q.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),r(this,M).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),r(this,M).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var s;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!r(this,Ms)&&(t._focusEventsAllowed=!1,p(this,Ms,setTimeout(()=>{p(this,Ms,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:r(this,M)._signal}),e.focus())},0))),t._structTreeParentId=(s=r(this,gn))==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})}getNextId(){return r(this,M).getId()}get _signal(){return r(this,M)._signal}canCreateNewEmptyEditor(){var t;return(t=r(this,Mt,mc))==null?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){r(this,M).updateToolbar(t),r(this,M).updateMode(t);const{offsetX:s,offsetY:i}=g(this,Mt,Ac).call(this),n=this.getNextId(),a=g(this,Mt,bc).call(this,{parent:this,id:n,x:s,y:i,uiManager:r(this,M),isCentered:!0,...e});a&&this.add(a)}deserialize(t){var e;return((e=r(_e,li).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,r(this,M)))||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=g(this,Mt,bc).call(this,{parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:r(this,M),isCentered:e,...s});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor(g(this,Mt,Ac).call(this),!0)}setSelected(t){r(this,M).setSelected(t)}toggleSelected(t){r(this,M).toggleSelected(t)}isSelected(t){return r(this,M).isSelected(t)}unselect(t){r(this,M).unselect(t)}pointerup(t){const{isMac:e}=Qt.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&r(this,hi)){if(p(this,hi,!1),!r(this,xr)){p(this,xr,!0);return}if(r(this,M).getMode()===G.STAMP){r(this,M).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(r(this,M).getMode()===G.HIGHLIGHT&&this.enableTextSelection(),r(this,hi)){p(this,hi,!1);return}const{isMac:e}=Qt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;p(this,hi,!0);const s=r(this,M).getActive();p(this,xr,!s||s.isEmpty())}findNewParent(t,e,s){const i=r(this,M).findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){var t,e;((t=r(this,M).getActive())==null?void 0:t.parent)===this&&(r(this,M).commitOrRemove(),r(this,M).setActiveEditor(null)),r(this,Ms)&&(clearTimeout(r(this,Ms)),p(this,Ms,null));for(const s of r(this,ce).values())(e=r(this,gn))==null||e.removePointerInTextLayer(s.contentDiv),s.setParent(null),s.isAttachedToDOM=!1,s.div.remove();this.div=null,r(this,ce).clear(),r(this,M).removeLayer(this)}render({viewport:t}){this.viewport=t,bn(this.div,t);for(const e of r(this,M).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){r(this,M).commitOrRemove(),g(this,Mt,mh).call(this);const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,bn(this.div,{rotation:s}),e!==s)for(const i of r(this,ce).values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return r(this,M).viewParameters.realScale}};gn=new WeakMap,xr=new WeakMap,Ke=new WeakMap,mn=new WeakMap,Ls=new WeakMap,Ps=new WeakMap,Ms=new WeakMap,ce=new WeakMap,hi=new WeakMap,Tr=new WeakMap,kr=new WeakMap,jt=new WeakMap,M=new WeakMap,li=new WeakMap,Mt=new WeakSet,Qu=function(t){if(r(this,M).unselectAll(),t.target===r(this,jt).div){const{isMac:e}=Qt.platform;if(t.button!==0||t.ctrlKey&&e)return;r(this,M).showAllEditors("highlight",!0,!0),r(this,jt).div.classList.add("free"),Eh.startHighlighting(this,r(this,M).direction==="ltr",t),r(this,jt).div.addEventListener("pointerup",()=>{r(this,jt).div.classList.remove("free")},{once:!0,signal:r(this,M)._signal}),t.preventDefault()}},mc=function(){return r(_e,li).get(r(this,M).getMode())},bc=function(t){const e=r(this,Mt,mc);return e?new e.prototype.constructor(t):null},Ac=function(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+s),h=Math.min(window.innerHeight,e+i),l=(n+o)/2-t,c=(a+h)/2-e,[u,f]=this.viewport.rotation%180===0?[l,c]:[c,l];return{offsetX:u,offsetY:f}},mh=function(){p(this,Tr,!0);for(const t of r(this,ce).values())t.isEmpty()&&t.remove();p(this,Tr,!1)},B(_e,"_initialized",!1),b(_e,li,new Map([Xl,rc,uc,Eh].map(t=>[t._editorType,t])));let gc=_e;var Qe,Ro,_t,ci,Lo,_c,yn,yc,Ju;const Ct=class Ct{constructor({pageIndex:t}){b(this,yn);b(this,Qe,null);b(this,Ro,0);b(this,_t,new Map);b(this,ci,new Map);this.pageIndex=t}setParent(t){if(!r(this,Qe)){p(this,Qe,t);return}if(r(this,Qe)!==t){if(r(this,_t).size>0)for(const e of r(this,_t).values())e.remove(),t.append(e);p(this,Qe,t)}}static get _svgFactory(){return V(this,"_svgFactory",new Sc)}highlight(t,e,s,i=!1){const n=te(this,Ro)._++,a=g(this,yn,yc).call(this,t.box);a.classList.add("highlight"),t.free&&a.classList.add("free");const o=Ct._svgFactory.createElement("defs");a.append(o);const h=Ct._svgFactory.createElement("path");o.append(h);const l=`path_p${this.pageIndex}_${n}`;h.setAttribute("id",l),h.setAttribute("d",t.toSVGPath()),i&&r(this,ci).set(n,h);const c=g(this,yn,Ju).call(this,o,l),u=Ct._svgFactory.createElement("use");return a.append(u),a.setAttribute("fill",e),a.setAttribute("fill-opacity",s),u.setAttribute("href",`#${l}`),r(this,_t).set(n,a),{id:n,clipPathId:`url(#${c})`}}highlightOutline(t){const e=te(this,Ro)._++,s=g(this,yn,yc).call(this,t.box);s.classList.add("highlightOutline");const i=Ct._svgFactory.createElement("defs");s.append(i);const n=Ct._svgFactory.createElement("path");i.append(n);const a=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",a),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let o;if(t.free){s.classList.add("free");const c=Ct._svgFactory.createElement("mask");i.append(c),o=`mask_p${this.pageIndex}_${e}`,c.setAttribute("id",o),c.setAttribute("maskUnits","objectBoundingBox");const u=Ct._svgFactory.createElement("rect");c.append(u),u.setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","white");const f=Ct._svgFactory.createElement("use");c.append(f),f.setAttribute("href",`#${a}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const h=Ct._svgFactory.createElement("use");s.append(h),h.setAttribute("href",`#${a}`),o&&h.setAttribute("mask",`url(#${o})`);const l=h.cloneNode();return s.append(l),h.classList.add("mainOutline"),l.classList.add("secondaryOutline"),r(this,_t).set(e,s),e}finalizeLine(t,e){const s=r(this,ci).get(t);r(this,ci).delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){r(this,_t).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),r(this,ci).delete(t)}updatePath(t,e){r(this,ci).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){var s;g(s=Ct,Lo,_c).call(s,r(this,_t).get(t),e)}show(t,e){r(this,_t).get(t).classList.toggle("hidden",!e)}rotate(t,e){r(this,_t).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){r(this,_t).get(t).setAttribute("fill",e)}
12changeOpacity(t,e){r(this,_t).get(t).setAttribute("fill-opacity",e)}addClass(t,e){r(this,_t).get(t).classList.add(e)}removeClass(t,e){r(this,_t).get(t).classList.remove(e)}remove(t){r(this,Qe)!==null&&(r(this,_t).get(t).remove(),r(this,_t).delete(t))}destroy(){p(this,Qe,null);for(const t of r(this,_t).values())t.remove();r(this,_t).clear()}};Qe=new WeakMap,Ro=new WeakMap,_t=new WeakMap,ci=new WeakMap,Lo=new WeakSet,_c=function(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:a}=t;a.top=`${100*s}%`,a.left=`${100*e}%`,a.width=`${100*i}%`,a.height=`${100*n}%`},yn=new WeakSet,yc=function(t){var s;const e=Ct._svgFactory.create(1,1,!0);return r(this,Qe).append(e),e.setAttribute("aria-hidden",!0),g(s=Ct,Lo,_c).call(s,e,t),e},Ju=function(t,e){const s=Ct._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=Ct._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i}
12,b(Ct,Lo);let vc=Ct;var eg=F.AbortException,sg=F.AnnotationEditorLayer,ig=F.AnnotationEditorParamsType,ng=F.AnnotationEditorType,rg=F.AnnotationEditorUIManager,ag=F.AnnotationLayer,og=F.AnnotationMode,hg=F.CMapCompressionType,lg=F.ColorPicker,cg=F.DOMSVGFactory,dg=F.DrawLayer,ug=F.FeatureTest,fg=F.GlobalWorkerOptions,pg=F.ImageKind,gg=F.InvalidPDFException,mg=F.MissingPDFException,bg=F.OPS,Ag=F.Outliner,vg=F.PDFDataRangeTransport,_g=F.PDFDateString,yg=F.PDFWorker,wg=F.PasswordResponses,Eg=F.PermissionFlag,Sg=F.PixelsPerInch,Cg=F.RenderingCancelledException,xg=F.TextLayer,Tg=F.UnexpectedResponseException,kg=F.Util,Rg=F.VerbosityLevel,Lg=F.XfaLayer,Pg=F.build,Mg=F.createValidAbsoluteUrl,Ig=F.fetchData,Fg=F.getDocument,Dg=F.getFilenameFromUrl,Og=F.getPdfFilenameFromUrl,Ng=F.getXfaPageViewport,Hg=F.isDataScheme,Bg=F.isPdfFile,zg=F.noContextMenu,Ug=F.normalizeUnicode,$g=F.renderTextLayer,jg=F.setLayerDimensions,Wg=F.shadow,Gg=F.updateTextLayer,Vg=F.version;const Yg=Object.freeze(Object.defineProperty({__proto__:null,AbortException:eg,AnnotationEditorLayer:sg,AnnotationEditorParamsType:ig,AnnotationEditorType:ng,AnnotationEditorUIManager:rg,AnnotationLayer:ag,AnnotationMode:og,CMapCompressionType:hg,ColorPicker:lg,DOMSVGFactory:cg,DrawLayer:dg,FeatureTest:ug,GlobalWorkerOptions:fg,ImageKind:pg,InvalidPDFException:gg,MissingPDFException:mg,OPS:bg,Outliner:Ag,PDFDataRangeTransport:vg,PDFDateString:_g,PDFWorker:yg,PasswordResponses:wg,PermissionFlag:Eg,PixelsPerInch:Sg,RenderingCancelledException:Cg,TextLayer:xg,UnexpectedResponseException:Tg,Util:kg,VerbosityLevel:Rg,XfaLayer:Lg,build:Pg,createValidAbsoluteUrl:Mg,fetchData:Ig,getDocument:Fg,getFilenameFromUrl:Dg,getPdfFilenameFromUrl:Og,getXfaPageViewport:Ng,isDataScheme:Hg,isPdfFile:Bg,noContextMenu:zg,normalizeUnicode:Ug,renderTextLayer:$g,setLayerDimensions:jg,shadow:Wg,updateTextLayer:Gg,version:Vg},Symbol.toStringTag,{value:"Module"}));export{Fg as _,fg as a,yg as b,Yg as p};

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.