chat/assets/pdf-fYUGKa6J.js
2025-06-19 22:14:16 +02:00

12 lines
342 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-71ZZmCGz.js","assets/index-CPhM6onp.css"])))=>i.map(i=>d[i]);
var _a=Object.defineProperty;var gn=xe=>{throw TypeError(xe)};var xa=(xe,Ee,Se)=>Ee in xe?_a(xe,Ee,{enumerable:!0,configurable:!0,writable:!0,value:Se}):xe[Ee]=Se;var he=(xe,Ee,Se)=>xa(xe,typeof Ee!="symbol"?Ee+"":Ee,Se),mi=(xe,Ee,Se)=>Ee.has(xe)||gn("Cannot "+Se);var t=(xe,Ee,Se)=>(mi(xe,Ee,"read from private field"),Se?Se.call(xe):Ee.get(xe)),_=(xe,Ee,Se)=>Ee.has(xe)?gn("Cannot add the same private member more than once"):Ee instanceof WeakSet?Ee.add(xe):Ee.set(xe,Se),w=(xe,Ee,Se,se)=>(mi(xe,Ee,"write to private field"),se?se.call(xe,Se):Ee.set(xe,Se),Se),b=(xe,Ee,Se)=>(mi(xe,Ee,"access private method"),Se);var Je=(xe,Ee,Se,se)=>({set _(ie){w(xe,Ee,ie,Se)},get _(){return t(xe,Ee,se)}});import{Z as fn,$ as os,__tla as Ea}from"./index-71ZZmCGz.js";let mn,An,bn,vn,yn,wn,_n,xn,En,Sn,Cn,Tn,Mn,Rn,Ln,kn,Pn,In,Dn,Fn,Nn,On,Hn,Bn,Un,zn,Vn,jn,qn,Gn,Wn,$n,Xn,Kn,Yn,Jn,Qn,Zn,tr,er,sr,ir,nr,rr,ar,Sa=Promise.all([(()=>{try{return Ea}catch{}})()]).then(async()=>{var xe={976:(ie,$t,dt)=>{var le,ee,ce,Ai,mt,hs,or,hr,s,a,h,l,g,u,p,R,e,i,o,m,M,$,W,tt,gt,it,lr,qs,bi,vi,Ut,lt,ut,T,X,Y,vt,yi,Lt,Ht,te,de,cr,wi;dt.d($t,{AnnotationLayer:()=>Bt,FreeTextAnnotationElement:()=>ot,InkAnnotationElement:()=>Jt,StampAnnotationElement:()=>ue});var d=dt(292),Q=dt(419),H=dt(792);function J(Wt){return Math.floor(Math.max(0,Math.min(1,Wt))*255).toString(16).padStart(2,"0")}function At(Wt){return Math.max(0,Math.min(255,255*Wt))}class z{static CMYK_G([v,f,x,U]){return["G",1-Math.min(1,.3*v+.59*x+.11*f+U)]}static G_CMYK([v]){return["CMYK",0,0,0,1-v]}static G_RGB([v]){return["RGB",v,v,v]}static G_rgb([v]){return v=At(v),[v,v,v]}static G_HTML([v]){const f=J(v);return`#${f}${f}${f}`}static RGB_G([v,f,x]){return["G",.3*v+.59*f+.11*x]}static RGB_rgb(v){return v.map(At)}static RGB_HTML(v){return`#${v.map(J).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([v,f,x,U]){return["RGB",1-Math.min(1,v+U),1-Math.min(1,x+U),1-Math.min(1,f+U)]}static CMYK_rgb([v,f,x,U]){return[At(1-Math.min(1,v+U)),At(1-Math.min(1,x+U)),At(1-Math.min(1,f+U))]}static CMYK_HTML(v){const f=this.CMYK_RGB(v).slice(1);return this.RGB_HTML(f)}static RGB_CMYK([v,f,x]){const U=1-v,q=1-f,ft=1-x,yt=Math.min(U,q,ft);return["CMYK",U,q,ft,yt]}}var F=dt(284);const I=1e3,V=9,E=new WeakSet;function y(Wt){return{width:Wt[2]-Wt[0],height:Wt[3]-Wt[1]}}class D{static create(v){switch(v.data.annotationType){case d.AnnotationType.LINK:return new Z(v);case d.AnnotationType.TEXT:return new B(v);case d.AnnotationType.WIDGET:switch(v.data.fieldType){case"Tx":return new k(v);case"Btn":return v.data.radioButton?new P(v):v.data.checkBox?new C(v):new ht(v);case"Ch":return new st(v);case"Sig":return new O(v)}return new K(v);case d.AnnotationType.POPUP:return new bt(v);case d.AnnotationType.FREETEXT:return new ot(v);case d.AnnotationType.LINE:return new nt(v);case d.AnnotationType.SQUARE:return new Mt(v);case d.AnnotationType.CIRCLE:return new It(v);case d.AnnotationType.POLYLINE:return new Pt(v);case d.AnnotationType.CARET:return new ae(v);case d.AnnotationType.INK:return new Jt(v);case d.AnnotationType.POLYGON:return new Xt(v);case d.AnnotationType.HIGHLIGHT:return new re(v);case d.AnnotationType.UNDERLINE:return new oe(v);case d.AnnotationType.SQUIGGLY:return new Rt(v);case d.AnnotationType.STRIKEOUT:return new Qt(v);case d.AnnotationType.STAMP:return new ue(v);case d.AnnotationType.FILEATTACHMENT:return new Ae(v);default:return new L(v)}}}const Nt=class Nt{constructor(v,{isRenderable:f=!1,ignoreBorder:x=!1,createQuadrilaterals:U=!1}={}){_(this,ce);_(this,le,null);_(this,ee,!1);this.isRenderable=f,this.data=v.data,this.layer=v.layer,this.linkService=v.linkService,this.downloadManager=v.downloadManager,this.imageResourcesPath=v.imageResourcesPath,this.renderForms=v.renderForms,this.svgFactory=v.svgFactory,this.annotationStorage=v.annotationStorage,this.enableScripting=v.enableScripting,this.hasJSActions=v.hasJSActions,this._fieldObjects=v.fieldObjects,this.parent=v.parent,f&&(this.container=this._createContainer(x)),U&&this._createQuadrilaterals()}static _hasPopupData({titleObj:v,contentsObj:f,richText:x}){return!!(v!=null&&v.str||f!=null&&f.str||x!=null&&x.str)}get hasPopupData(){return Nt._hasPopupData(this.data)}updateEdited(v){if(!this.container)return;t(this,le)||w(this,le,{rect:this.data.rect.slice(0)});const{rect:f}=v;f&&b(this,ce,Ai).call(this,f)}resetEdited(){t(this,le)&&(b(this,ce,Ai).call(this,t(this,le).rect),w(this,le,null))}_createContainer(v){const{data:f,parent:{page:x,viewport:U}}=this,q=document.createElement("section");q.setAttribute("data-annotation-id",f.id),this instanceof K||(q.tabIndex=I);const{style:ft}=q;if(ft.zIndex=this.parent.zIndex++,f.popupRef&&q.setAttribute("aria-haspopup","dialog"),f.alternativeText&&(q.title=f.alternativeText),f.noRotate&&q.classList.add("norotate"),!f.rect||this instanceof bt){const{rotation:xt}=f;return!f.hasOwnCanvas&&xt!==0&&this.setRotation(xt,q),q}const{width:yt,height:zt}=y(f.rect);if(!v&&f.borderStyle.width>0){ft.borderWidth=`${f.borderStyle.width}px`;const xt=f.borderStyle.horizontalCornerRadius,Dt=f.borderStyle.verticalCornerRadius;if(xt>0||Dt>0){const Yt=`calc(${xt}px * var(--scale-factor)) / calc(${Dt}px * var(--scale-factor))`;ft.borderRadius=Yt}else if(this instanceof P){const Yt=`calc(${yt}px * var(--scale-factor)) / calc(${zt}px * var(--scale-factor))`;ft.borderRadius=Yt}switch(f.borderStyle.style){case d.AnnotationBorderStyleType.SOLID:ft.borderStyle="solid";break;case d.AnnotationBorderStyleType.DASHED:ft.borderStyle="dashed";break;case d.AnnotationBorderStyleType.BEVELED:(0,d.warn)("Unimplemented border style: beveled");break;case d.AnnotationBorderStyleType.INSET:(0,d.warn)("Unimplemented border style: inset");break;case d.AnnotationBorderStyleType.UNDERLINE:ft.borderBottomStyle="solid";break}const Kt=f.borderColor||null;Kt?(w(this,ee,!0),ft.borderColor=d.Util.makeHexColor(Kt[0]|0,Kt[1]|0,Kt[2]|0)):ft.borderWidth=0}const Ft=d.Util.normalizeRect([f.rect[0],x.view[3]-f.rect[1]+x.view[1],f.rect[2],x.view[3]-f.rect[3]+x.view[1]]),{pageWidth:c,pageHeight:N,pageX:et,pageY:ct}=U.rawDims;ft.left=`${100*(Ft[0]-et)/c}%`,ft.top=`${100*(Ft[1]-ct)/N}%`;const{rotation:St}=f;return f.hasOwnCanvas||St===0?(ft.width=`${100*yt/c}%`,ft.height=`${100*zt/N}%`):this.setRotation(St,q),q}setRotation(v,f=this.container){if(!this.data.rect)return;const{pageWidth:x,pageHeight:U}=this.parent.viewport.rawDims,{width:q,height:ft}=y(this.data.rect);let yt,zt;v%180===0?(yt=100*q/x,zt=100*ft/U):(yt=100*ft/x,zt=100*q/U),f.style.width=`${yt}%`,f.style.height=`${zt}%`,f.setAttribute("data-main-rotation",(360-v)%360)}get _commonActions(){const v=(f,x,U)=>{const q=U.detail[f],ft=q[0],yt=q.slice(1);U.target.style[x]=z[`${ft}_HTML`](yt),this.annotationStorage.setValue(this.data.id,{[x]:z[`${ft}_rgb`](yt)})};return(0,d.shadow)(this,"_commonActions",{display:f=>{const{display:x}=f.detail,U=x%2===1;this.container.style.visibility=U?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:U,noPrint:x===1||x===2})},print:f=>{this.annotationStorage.setValue(this.data.id,{noPrint:!f.detail.print})},hidden:f=>{const{hidden:x}=f.detail;this.container.style.visibility=x?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:x,noView:x})},focus:f=>{setTimeout(()=>f.target.focus({preventScroll:!1}),0)},userName:f=>{f.target.title=f.detail.userName},readonly:f=>{f.target.disabled=f.detail.readonly},required:f=>{this._setRequired(f.target,f.detail.required)},bgColor:f=>{v("bgColor","backgroundColor",f)},fillColor:f=>{v("fillColor","backgroundColor",f)},fgColor:f=>{v("fgColor","color",f)},textColor:f=>{v("textColor","color",f)},borderColor:f=>{v("borderColor","borderColor",f)},strokeColor:f=>{v("strokeColor","borderColor",f)},rotation:f=>{const x=f.detail.rotation;this.setRotation(x),this.annotationStorage.setValue(this.data.id,{rotation:x})}})}_dispatchEventFromSandbox(v,f){var U;const x=this._commonActions;for(const q of Object.keys(f.detail))(U=v[q]||x[q])==null||U(f)}_setDefaultPropertiesFromJS(v){if(!this.enableScripting)return;const f=this.annotationStorage.getRawValue(this.data.id);if(!f)return;const x=this._commonActions;for(const[U,q]of Object.entries(f)){const ft=x[U];if(ft){const yt={detail:{[U]:q},target:v};ft(yt),delete f[U]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:v}=this.data;if(!v)return;const[f,x,U,q]=this.data.rect;if(v.length===1){const[,{x:xt,y:Dt},{x:Kt,y:Yt}]=v[0];if(U===xt&&q===Dt&&f===Kt&&x===Yt)return}const{style:ft}=this.container;let yt;if(t(this,ee)){const{borderColor:xt,borderWidth:Dt}=ft;ft.borderWidth=0,yt=["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="${xt}" stroke-width="${Dt}">`],this.container.classList.add("hasBorder")}const zt=U-f,Ft=q-x,{svgFactory:c}=this,N=c.createElement("svg");N.classList.add("quadrilateralsContainer"),N.setAttribute("width",0),N.setAttribute("height",0);const et=c.createElement("defs");N.append(et);const ct=c.createElement("clipPath"),St=`clippath_${this.data.id}`;ct.setAttribute("id",St),ct.setAttribute("clipPathUnits","objectBoundingBox"),et.append(ct);for(const[,{x:xt,y:Dt},{x:Kt,y:Yt}]of v){const fe=c.createElement("rect"),Me=(Kt-f)/zt,Re=(q-Dt)/Ft,Be=(xt-Kt)/zt,De=(Dt-Yt)/Ft;fe.setAttribute("x",Me),fe.setAttribute("y",Re),fe.setAttribute("width",Be),fe.setAttribute("height",De),ct.append(fe),yt==null||yt.push(`<rect vector-effect="non-scaling-stroke" x="${Me}" y="${Re}" width="${Be}" height="${De}"/>`)}t(this,ee)&&(yt.push("</g></svg>')"),ft.backgroundImage=yt.join("")),this.container.append(N),this.container.style.clipPath=`url(#${St})`}_createPopup(){const{container:v,data:f}=this;v.setAttribute("aria-haspopup","dialog");const x=new bt({data:{color:f.color,titleObj:f.titleObj,modificationDate:f.modificationDate,contentsObj:f.contentsObj,richText:f.richText,parentRect:f.rect,borderStyle:0,id:`popup_${f.id}`,rotation:f.rotation},parent:this.parent,elements:[this]});this.parent.div.append(x.render())}render(){(0,d.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(v,f=null){const x=[];if(this._fieldObjects){const U=this._fieldObjects[v];if(U)for(const{page:q,id:ft,exportValues:yt}of U){if(q===-1||ft===f)continue;const zt=typeof yt=="string"?yt:null,Ft=document.querySelector(`[data-element-id="${ft}"]`);if(Ft&&!E.has(Ft)){(0,d.warn)(`_getElementsByName - element not allowed: ${ft}`);continue}x.push({id:ft,exportValue:zt,domElement:Ft})}return x}for(const U of document.getElementsByName(v)){const{exportValue:q}=U,ft=U.getAttribute("data-element-id");ft!==f&&E.has(U)&&x.push({id:ft,exportValue:q,domElement:U})}return x}show(){var v;this.container&&(this.container.hidden=!1),(v=this.popup)==null||v.maybeShow()}hide(){var v;this.container&&(this.container.hidden=!0),(v=this.popup)==null||v.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const v=this.getElementsToTriggerPopup();if(Array.isArray(v))for(const f of v)f.classList.add("highlightArea");else v.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:v,data:{id:f}}=this;this.container.addEventListener("dblclick",()=>{var x;(x=this.linkService.eventBus)==null||x.dispatch("switchannotationeditormode",{source:this,mode:v,editId:f})})}};le=new WeakMap,ee=new WeakMap,ce=new WeakSet,Ai=function(v){const{container:{style:f},data:{rect:x,rotation:U},parent:{viewport:{rawDims:{pageWidth:q,pageHeight:ft,pageX:yt,pageY:zt}}}}=this;x==null||x.splice(0,4,...v);const{width:Ft,height:c}=y(v);f.left=`${100*(v[0]-yt)/q}%`,f.top=`${100*(ft-v[3]+zt)/ft}%`,U===0?(f.width=`${100*Ft/q}%`,f.height=`${100*c/ft}%`):this.setRotation(U)};let L=Nt;class Z extends L{constructor(f,x=null){super(f,{isRenderable:!0,ignoreBorder:!!(x!=null&&x.ignoreBorder),createQuadrilaterals:!0});_(this,mt);this.isTooltipOnly=f.data.isTooltipOnly}render(){const{data:f,linkService:x}=this,U=document.createElement("a");U.setAttribute("data-element-id",f.id);let q=!1;return f.url?(x.addLinkAttributes(U,f.url,f.newWindow),q=!0):f.action?(this._bindNamedAction(U,f.action),q=!0):f.attachment?(b(this,mt,or).call(this,U,f.attachment,f.attachmentDest),q=!0):f.setOCGState?(b(this,mt,hr).call(this,U,f.setOCGState),q=!0):f.dest?(this._bindLink(U,f.dest),q=!0):(f.actions&&(f.actions.Action||f.actions["Mouse Up"]||f.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(U,f),q=!0),f.resetForm?(this._bindResetFormAction(U,f.resetForm),q=!0):this.isTooltipOnly&&!q&&(this._bindLink(U,""),q=!0)),this.container.classList.add("linkAnnotation"),q&&this.container.append(U),this.container}_bindLink(f,x){f.href=this.linkService.getDestinationHash(x),f.onclick=()=>(x&&this.linkService.goToDestination(x),!1),(x||x==="")&&b(this,mt,hs).call(this)}_bindNamedAction(f,x){f.href=this.linkService.getAnchorUrl(""),f.onclick=()=>(this.linkService.executeNamedAction(x),!1),b(this,mt,hs).call(this)}_bindJSAction(f,x){f.href=this.linkService.getAnchorUrl("");const U=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const q of Object.keys(x.actions)){const ft=U.get(q);ft&&(f[ft]=()=>{var yt;return(yt=this.linkService.eventBus)==null||yt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x.id,name:q}}),!1})}f.onclick||(f.onclick=()=>!1),b(this,mt,hs).call(this)}_bindResetFormAction(f,x){const U=f.onclick;if(U||(f.href=this.linkService.getAnchorUrl("")),b(this,mt,hs).call(this),!this._fieldObjects){(0,d.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),U||(f.onclick=()=>!1);return}f.onclick=()=>{var N;U==null||U();const{fields:q,refs:ft,include:yt}=x,zt=[];if(q.length!==0||ft.length!==0){const et=new Set(ft);for(const ct of q){const St=this._fieldObjects[ct]||[];for(const{id:xt}of St)et.add(xt)}for(const ct of Object.values(this._fieldObjects))for(const St of ct)et.has(St.id)===yt&&zt.push(St)}else for(const et of Object.values(this._fieldObjects))zt.push(...et);const Ft=this.annotationStorage,c=[];for(const et of zt){const{id:ct}=et;switch(c.push(ct),et.type){case"text":{const xt=et.defaultValue||"";Ft.setValue(ct,{value:xt});break}case"checkbox":case"radiobutton":{const xt=et.defaultValue===et.exportValues;Ft.setValue(ct,{value:xt});break}case"combobox":case"listbox":{const xt=et.defaultValue||"";Ft.setValue(ct,{value:xt});break}default:continue}const St=document.querySelector(`[data-element-id="${ct}"]`);if(St){if(!E.has(St)){(0,d.warn)(`_bindResetFormAction - element not allowed: ${ct}`);continue}}else continue;St.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}mt=new WeakSet,hs=function(){this.container.setAttribute("data-internal-link","")},or=function(f,x,U=null){f.href=this.linkService.getAnchorUrl(""),f.onclick=()=>{var q;return(q=this.downloadManager)==null||q.openOrDownloadData(x.content,x.filename,U),!1},b(this,mt,hs).call(this)},hr=function(f,x){f.href=this.linkService.getAnchorUrl(""),f.onclick=()=>(this.linkService.executeSetOCGState(x),!1),b(this,mt,hs).call(this)};class B extends L{constructor(v){super(v,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const v=document.createElement("img");return v.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",v.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),v.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(v),this.container}}class K extends L{render(){return this.container}showElementAndHideCanvas(v){var f;this.data.hasOwnCanvas&&(((f=v.previousSibling)==null?void 0:f.nodeName)==="CANVAS"&&(v.previousSibling.hidden=!0),v.hidden=!1)}_getKeyModifier(v){return d.FeatureTest.platform.isMac?v.metaKey:v.ctrlKey}_setEventListener(v,f,x,U,q){x.includes("mouse")?v.addEventListener(x,ft=>{var yt;(yt=this.linkService.eventBus)==null||yt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:U,value:q(ft),shift:ft.shiftKey,modifier:this._getKeyModifier(ft)}})}):v.addEventListener(x,ft=>{var yt;if(x==="blur"){if(!f.focused||!ft.relatedTarget)return;f.focused=!1}else if(x==="focus"){if(f.focused)return;f.focused=!0}q&&((yt=this.linkService.eventBus)==null||yt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:U,value:q(ft)}}))})}_setEventListeners(v,f,x,U){var q,ft,yt;for(const[zt,Ft]of x)(Ft==="Action"||(q=this.data.actions)!=null&&q[Ft])&&((Ft==="Focus"||Ft==="Blur")&&(f||(f={focused:!1})),this._setEventListener(v,f,zt,Ft,U),Ft==="Focus"&&!((ft=this.data.actions)!=null&&ft.Blur)?this._setEventListener(v,f,"blur","Blur",null):Ft==="Blur"&&!((yt=this.data.actions)!=null&&yt.Focus)&&this._setEventListener(v,f,"focus","Focus",null))}_setBackgroundColor(v){const f=this.data.backgroundColor||null;v.style.backgroundColor=f===null?"transparent":d.Util.makeHexColor(f[0],f[1],f[2])}_setTextStyle(v){const f=["left","center","right"],{fontColor:x}=this.data.defaultAppearanceData,U=this.data.defaultAppearanceData.fontSize||V,q=v.style;let ft;const yt=2,zt=Ft=>Math.round(10*Ft)/10;if(this.data.multiLine){const Ft=Math.abs(this.data.rect[3]-this.data.rect[1]-yt),c=Math.round(Ft/(d.LINE_FACTOR*U))||1,N=Ft/c;ft=Math.min(U,zt(N/d.LINE_FACTOR))}else{const Ft=Math.abs(this.data.rect[3]-this.data.rect[1]-yt);ft=Math.min(U,zt(Ft/d.LINE_FACTOR))}q.fontSize=`calc(${ft}px * var(--scale-factor))`,q.color=d.Util.makeHexColor(x[0],x[1],x[2]),this.data.textAlignment!==null&&(q.textAlign=f[this.data.textAlignment])}_setRequired(v,f){f?v.setAttribute("required",!0):v.removeAttribute("required"),v.setAttribute("aria-required",f)}}class k extends K{constructor(v){const f=v.renderForms||v.data.hasOwnCanvas||!v.data.hasAppearance&&!!v.data.fieldValue;super(v,{isRenderable:f})}setPropertyOnSiblings(v,f,x,U){const q=this.annotationStorage;for(const ft of this._getElementsByName(v.name,v.id))ft.domElement&&(ft.domElement[f]=x),q.setValue(ft.id,{[U]:x})}render(){var U,q;const v=this.annotationStorage,f=this.data.id;this.container.classList.add("textWidgetAnnotation");let x=null;if(this.renderForms){const ft=v.getValue(f,{value:this.data.fieldValue});let yt=ft.value||"";const zt=v.getValue(f,{charLimit:this.data.maxLen}).charLimit;zt&&yt.length>zt&&(yt=yt.slice(0,zt));let Ft=ft.formattedValue||((U=this.data.textContent)==null?void 0:U.join(`
`))||null;Ft&&this.data.comb&&(Ft=Ft.replaceAll(/\s+/g,""));const c={userValue:yt,formattedValue:Ft,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(x=document.createElement("textarea"),x.textContent=Ft??yt,this.data.doNotScroll&&(x.style.overflowY="hidden")):(x=document.createElement("input"),x.type="text",x.setAttribute("value",Ft??yt),this.data.doNotScroll&&(x.style.overflowX="hidden")),this.data.hasOwnCanvas&&(x.hidden=!0),E.add(x),x.setAttribute("data-element-id",f),x.disabled=this.data.readOnly,x.name=this.data.fieldName,x.tabIndex=I,this._setRequired(x,this.data.required),zt&&(x.maxLength=zt),x.addEventListener("input",et=>{v.setValue(f,{value:et.target.value}),this.setPropertyOnSiblings(x,"value",et.target.value,"value"),c.formattedValue=null}),x.addEventListener("resetform",et=>{const ct=this.data.defaultFieldValue??"";x.value=c.userValue=ct,c.formattedValue=null});let N=et=>{const{formattedValue:ct}=c;ct!=null&&(et.target.value=ct),et.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){x.addEventListener("focus",ct=>{var xt;if(c.focused)return;const{target:St}=ct;c.userValue&&(St.value=c.userValue),c.lastCommittedValue=St.value,c.commitKey=1,(xt=this.data.actions)!=null&&xt.Focus||(c.focused=!0)}),x.addEventListener("updatefromsandbox",ct=>{this.showElementAndHideCanvas(ct.target);const St={value(xt){c.userValue=xt.detail.value??"",v.setValue(f,{value:c.userValue.toString()}),xt.target.value=c.userValue},formattedValue(xt){const{formattedValue:Dt}=xt.detail;c.formattedValue=Dt,Dt!=null&&xt.target!==document.activeElement&&(xt.target.value=Dt),v.setValue(f,{formattedValue:Dt})},selRange(xt){xt.target.setSelectionRange(...xt.detail.selRange)},charLimit:xt=>{var fe;const{charLimit:Dt}=xt.detail,{target:Kt}=xt;if(Dt===0){Kt.removeAttribute("maxLength");return}Kt.setAttribute("maxLength",Dt);let Yt=c.userValue;!Yt||Yt.length<=Dt||(Yt=Yt.slice(0,Dt),Kt.value=c.userValue=Yt,v.setValue(f,{value:Yt}),(fe=this.linkService.eventBus)==null||fe.dispatch("dispatcheventinsandbox",{source:this,detail:{id:f,name:"Keystroke",value:Yt,willCommit:!0,commitKey:1,selStart:Kt.selectionStart,selEnd:Kt.selectionEnd}}))}};this._dispatchEventFromSandbox(St,ct)}),x.addEventListener("keydown",ct=>{var Dt;c.commitKey=1;let St=-1;if(ct.key==="Escape"?St=0:ct.key==="Enter"&&!this.data.multiLine?St=2:ct.key==="Tab"&&(c.commitKey=3),St===-1)return;const{value:xt}=ct.target;c.lastCommittedValue!==xt&&(c.lastCommittedValue=xt,c.userValue=xt,(Dt=this.linkService.eventBus)==null||Dt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:f,name:"Keystroke",value:xt,willCommit:!0,commitKey:St,selStart:ct.target.selectionStart,selEnd:ct.target.selectionEnd}}))});const et=N;N=null,x.addEventListener("blur",ct=>{var xt,Dt;if(!c.focused||!ct.relatedTarget)return;(xt=this.data.actions)!=null&&xt.Blur||(c.focused=!1);const{value:St}=ct.target;c.userValue=St,c.lastCommittedValue!==St&&((Dt=this.linkService.eventBus)==null||Dt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:f,name:"Keystroke",value:St,willCommit:!0,commitKey:c.commitKey,selStart:ct.target.selectionStart,selEnd:ct.target.selectionEnd}})),et(ct)}),(q=this.data.actions)!=null&&q.Keystroke&&x.addEventListener("beforeinput",ct=>{var Re;c.lastCommittedValue=null;const{data:St,target:xt}=ct,{value:Dt,selectionStart:Kt,selectionEnd:Yt}=xt;let fe=Kt,Me=Yt;switch(ct.inputType){case"deleteWordBackward":{const Be=Dt.substring(0,Kt).match(/\w*[^\w]*$/);Be&&(fe-=Be[0].length);break}case"deleteWordForward":{const Be=Dt.substring(Kt).match(/^[^\w]*\w*/);Be&&(Me+=Be[0].length);break}case"deleteContentBackward":Kt===Yt&&(fe-=1);break;case"deleteContentForward":Kt===Yt&&(Me+=1);break}ct.preventDefault(),(Re=this.linkService.eventBus)==null||Re.dispatch("dispatcheventinsandbox",{source:this,detail:{id:f,name:"Keystroke",value:Dt,change:St||"",willCommit:!1,selStart:fe,selEnd:Me}})}),this._setEventListeners(x,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],ct=>ct.target.value)}if(N&&x.addEventListener("blur",N),this.data.comb){const et=(this.data.rect[2]-this.data.rect[0])/zt;x.classList.add("comb"),x.style.letterSpacing=`calc(${et}px * var(--scale-factor) - 1ch)`}}else x=document.createElement("div"),x.textContent=this.data.fieldValue,x.style.verticalAlign="middle",x.style.display="table-cell",this.data.hasOwnCanvas&&(x.hidden=!0);return this._setTextStyle(x),this._setBackgroundColor(x),this._setDefaultPropertiesFromJS(x),this.container.append(x),this.container}}class O extends K{constructor(v){super(v,{isRenderable:!!v.data.hasOwnCanvas})}}class C extends K{constructor(v){super(v,{isRenderable:v.renderForms})}render(){const v=this.annotationStorage,f=this.data,x=f.id;let U=v.getValue(x,{value:f.exportValue===f.fieldValue}).value;typeof U=="string"&&(U=U!=="Off",v.setValue(x,{value:U})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const q=document.createElement("input");return E.add(q),q.setAttribute("data-element-id",x),q.disabled=f.readOnly,this._setRequired(q,this.data.required),q.type="checkbox",q.name=f.fieldName,U&&q.setAttribute("checked",!0),q.setAttribute("exportValue",f.exportValue),q.tabIndex=I,q.addEventListener("change",ft=>{const{name:yt,checked:zt}=ft.target;for(const Ft of this._getElementsByName(yt,x)){const c=zt&&Ft.exportValue===f.exportValue;Ft.domElement&&(Ft.domElement.checked=c),v.setValue(Ft.id,{value:c})}v.setValue(x,{value:zt})}),q.addEventListener("resetform",ft=>{const yt=f.defaultFieldValue||"Off";ft.target.checked=yt===f.exportValue}),this.enableScripting&&this.hasJSActions&&(q.addEventListener("updatefromsandbox",ft=>{const yt={value(zt){zt.target.checked=zt.detail.value!=="Off",v.setValue(x,{value:zt.target.checked})}};this._dispatchEventFromSandbox(yt,ft)}),this._setEventListeners(q,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],ft=>ft.target.checked)),this._setBackgroundColor(q),this._setDefaultPropertiesFromJS(q),this.container.append(q),this.container}}class P extends K{constructor(v){super(v,{isRenderable:v.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const v=this.annotationStorage,f=this.data,x=f.id;let U=v.getValue(x,{value:f.fieldValue===f.buttonValue}).value;if(typeof U=="string"&&(U=U!==f.buttonValue,v.setValue(x,{value:U})),U)for(const ft of this._getElementsByName(f.fieldName,x))v.setValue(ft.id,{value:!1});const q=document.createElement("input");if(E.add(q),q.setAttribute("data-element-id",x),q.disabled=f.readOnly,this._setRequired(q,this.data.required),q.type="radio",q.name=f.fieldName,U&&q.setAttribute("checked",!0),q.tabIndex=I,q.addEventListener("change",ft=>{const{name:yt,checked:zt}=ft.target;for(const Ft of this._getElementsByName(yt,x))v.setValue(Ft.id,{value:!1});v.setValue(x,{value:zt})}),q.addEventListener("resetform",ft=>{const yt=f.defaultFieldValue;ft.target.checked=yt!=null&&yt===f.buttonValue}),this.enableScripting&&this.hasJSActions){const ft=f.buttonValue;q.addEventListener("updatefromsandbox",yt=>{const zt={value:Ft=>{const c=ft===Ft.detail.value;for(const N of this._getElementsByName(Ft.target.name)){const et=c&&N.id===x;N.domElement&&(N.domElement.checked=et),v.setValue(N.id,{value:et})}}};this._dispatchEventFromSandbox(zt,yt)}),this._setEventListeners(q,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],yt=>yt.target.checked)}return this._setBackgroundColor(q),this._setDefaultPropertiesFromJS(q),this.container.append(q),this.container}}class ht extends Z{constructor(v){super(v,{ignoreBorder:v.data.hasAppearance})}render(){const v=super.render();v.classList.add("buttonWidgetAnnotation","pushButton");const f=v.lastChild;return this.enableScripting&&this.hasJSActions&&f&&(this._setDefaultPropertiesFromJS(f),f.addEventListener("updatefromsandbox",x=>{this._dispatchEventFromSandbox({},x)})),v}}class st extends K{constructor(v){super(v,{isRenderable:v.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const v=this.annotationStorage,f=this.data.id,x=v.getValue(f,{value:this.data.fieldValue}),U=document.createElement("select");E.add(U),U.setAttribute("data-element-id",f),U.disabled=this.data.readOnly,this._setRequired(U,this.data.required),U.name=this.data.fieldName,U.tabIndex=I;let q=this.data.combo&&this.data.options.length>0;this.data.combo||(U.size=this.data.options.length,this.data.multiSelect&&(U.multiple=!0)),U.addEventListener("resetform",c=>{const N=this.data.defaultFieldValue;for(const et of U.options)et.selected=et.value===N});for(const c of this.data.options){const N=document.createElement("option");N.textContent=c.displayValue,N.value=c.exportValue,x.value.includes(c.exportValue)&&(N.setAttribute("selected",!0),q=!1),U.append(N)}let ft=null;if(q){const c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),U.prepend(c),ft=()=>{c.remove(),U.removeEventListener("input",ft),ft=null},U.addEventListener("input",ft)}const yt=c=>{const N=c?"value":"textContent",{options:et,multiple:ct}=U;return ct?Array.prototype.filter.call(et,St=>St.selected).map(St=>St[N]):et.selectedIndex===-1?null:et[et.selectedIndex][N]};let zt=yt(!1);const Ft=c=>{const N=c.target.options;return Array.prototype.map.call(N,et=>({displayValue:et.textContent,exportValue:et.value}))};return this.enableScripting&&this.hasJSActions?(U.addEventListener("updatefromsandbox",c=>{const N={value(et){ft==null||ft();const ct=et.detail.value,St=new Set(Array.isArray(ct)?ct:[ct]);for(const xt of U.options)xt.selected=St.has(xt.value);v.setValue(f,{value:yt(!0)}),zt=yt(!1)},multipleSelection(et){U.multiple=!0},remove(et){const ct=U.options,St=et.detail.remove;ct[St].selected=!1,U.remove(St),ct.length>0&&Array.prototype.findIndex.call(ct,xt=>xt.selected)===-1&&(ct[0].selected=!0),v.setValue(f,{value:yt(!0),items:Ft(et)}),zt=yt(!1)},clear(et){for(;U.length!==0;)U.remove(0);v.setValue(f,{value:null,items:[]}),zt=yt(!1)},insert(et){const{index:ct,displayValue:St,exportValue:xt}=et.detail.insert,Dt=U.children[ct],Kt=document.createElement("option");Kt.textContent=St,Kt.value=xt,Dt?Dt.before(Kt):U.append(Kt),v.setValue(f,{value:yt(!0),items:Ft(et)}),zt=yt(!1)},items(et){const{items:ct}=et.detail;for(;U.length!==0;)U.remove(0);for(const St of ct){const{displayValue:xt,exportValue:Dt}=St,Kt=document.createElement("option");Kt.textContent=xt,Kt.value=Dt,U.append(Kt)}U.options.length>0&&(U.options[0].selected=!0),v.setValue(f,{value:yt(!0),items:Ft(et)}),zt=yt(!1)},indices(et){const ct=new Set(et.detail.indices);for(const St of et.target.options)St.selected=ct.has(St.index);v.setValue(f,{value:yt(!0)}),zt=yt(!1)},editable(et){et.target.disabled=!et.detail.editable}};this._dispatchEventFromSandbox(N,c)}),U.addEventListener("input",c=>{var ct;const N=yt(!0),et=yt(!1);v.setValue(f,{value:N}),c.preventDefault(),(ct=this.linkService.eventBus)==null||ct.dispatch("dispatcheventinsandbox",{source:this,detail:{id:f,name:"Keystroke",value:zt,change:et,changeEx:N,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(U,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)):U.addEventListener("input",function(c){v.setValue(f,{value:yt(!0)})}),this.data.combo&&this._setTextStyle(U),this._setBackgroundColor(U),this._setDefaultPropertiesFromJS(U),this.container.append(U),this.container}}class bt extends L{constructor(v){const{data:f,elements:x}=v;super(v,{isRenderable:L._hasPopupData(f)}),this.elements=x}render(){this.container.classList.add("popupAnnotation");const v=new Tt({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}),f=[];for(const x of this.elements)x.popup=v,f.push(x.data.id),x.addHighlightArea();return this.container.setAttribute("aria-controls",f.map(x=>`${d.AnnotationPrefix}${x}`).join(",")),this.container}}class Tt{constructor({container:v,color:f,elements:x,titleObj:U,modificationDate:q,contentsObj:ft,richText:yt,parent:zt,rect:Ft,parentRect:c,open:N}){_(this,it);_(this,s,b(this,it,lr).bind(this));_(this,a,b(this,it,vi).bind(this));_(this,h,b(this,it,bi).bind(this));_(this,l,b(this,it,qs).bind(this));_(this,g,null);_(this,u,null);_(this,p,null);_(this,R,null);_(this,e,null);_(this,i,null);_(this,o,null);_(this,m,!1);_(this,M,null);_(this,$,null);_(this,W,null);_(this,tt,null);_(this,gt,!1);var et;w(this,u,v),w(this,tt,U),w(this,p,ft),w(this,W,yt),w(this,i,zt),w(this,g,f),w(this,$,Ft),w(this,o,c),w(this,e,x),w(this,R,Q.PDFDateString.toDateObject(q)),this.trigger=x.flatMap(ct=>ct.getElementsToTriggerPopup());for(const ct of this.trigger)ct.addEventListener("click",t(this,l)),ct.addEventListener("mouseenter",t(this,h)),ct.addEventListener("mouseleave",t(this,a)),ct.classList.add("popupTriggerArea");for(const ct of x)(et=ct.container)==null||et.addEventListener("keydown",t(this,s));t(this,u).hidden=!0,N&&b(this,it,qs).call(this)}render(){if(t(this,M))return;const{page:{view:v},viewport:{rawDims:{pageWidth:f,pageHeight:x,pageX:U,pageY:q}}}=t(this,i),ft=w(this,M,document.createElement("div"));if(ft.className="popup",t(this,g)){const Yt=ft.style.outlineColor=d.Util.makeHexColor(...t(this,g));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?ft.style.backgroundColor=`color-mix(in srgb, ${Yt} 30%, white)`:ft.style.backgroundColor=d.Util.makeHexColor(...t(this,g).map(fe=>Math.floor(.7*(255-fe)+fe)))}const yt=document.createElement("span");yt.className="header";const zt=document.createElement("h1");if(yt.append(zt),{dir:zt.dir,str:zt.textContent}=t(this,tt),ft.append(yt),t(this,R)){const Yt=document.createElement("span");Yt.classList.add("popupDate"),Yt.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),Yt.setAttribute("data-l10n-args",JSON.stringify({date:t(this,R).toLocaleDateString(),time:t(this,R).toLocaleTimeString()})),yt.append(Yt)}const Ft=t(this,p),c=t(this,W);if(c!=null&&c.str&&(!(Ft!=null&&Ft.str)||Ft.str===c.str))F.XfaLayer.render({xfaHtml:c.html,intent:"richText",div:ft}),ft.lastChild.classList.add("richText","popupContent");else{const Yt=this._formatContents(Ft);ft.append(Yt)}let N=!!t(this,o),et=N?t(this,o):t(this,$);for(const Yt of t(this,e))if(!et||d.Util.intersect(Yt.data.rect,et)!==null){et=Yt.data.rect,N=!0;break}const ct=d.Util.normalizeRect([et[0],v[3]-et[1]+v[1],et[2],v[3]-et[3]+v[1]]),St=N?et[2]-et[0]+5:0,xt=ct[0]+St,Dt=ct[1],{style:Kt}=t(this,u);Kt.left=`${100*(xt-U)/f}%`,Kt.top=`${100*(Dt-q)/x}%`,t(this,u).append(ft)}_formatContents({str:v,dir:f}){const x=document.createElement("p");x.classList.add("popupContent"),x.dir=f;const U=v.split(/(?:\r\n?|\n)/);for(let q=0,ft=U.length;q<ft;++q){const yt=U[q];x.append(document.createTextNode(yt)),q<ft-1&&x.append(document.createElement("br"))}return x}forceHide(){w(this,gt,this.isVisible),t(this,gt)&&(t(this,u).hidden=!0)}maybeShow(){t(this,gt)&&(w(this,gt,!1),t(this,u).hidden=!1)}get isVisible(){return t(this,u).hidden===!1}}s=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,g=new WeakMap,u=new WeakMap,p=new WeakMap,R=new WeakMap,e=new WeakMap,i=new WeakMap,o=new WeakMap,m=new WeakMap,M=new WeakMap,$=new WeakMap,W=new WeakMap,tt=new WeakMap,gt=new WeakMap,it=new WeakSet,lr=function(v){v.altKey||v.shiftKey||v.ctrlKey||v.metaKey||(v.key==="Enter"||v.key==="Escape"&&t(this,m))&&b(this,it,qs).call(this)},qs=function(){w(this,m,!t(this,m)),t(this,m)?(b(this,it,bi).call(this),t(this,u).addEventListener("click",t(this,l)),t(this,u).addEventListener("keydown",t(this,s))):(b(this,it,vi).call(this),t(this,u).removeEventListener("click",t(this,l)),t(this,u).removeEventListener("keydown",t(this,s)))},bi=function(){t(this,M)||this.render(),this.isVisible?t(this,m)&&t(this,u).classList.add("focused"):(t(this,u).hidden=!1,t(this,u).style.zIndex=parseInt(t(this,u).style.zIndex)+1e3)},vi=function(){t(this,u).classList.remove("focused"),!(t(this,m)||!this.isVisible)&&(t(this,u).hidden=!0,t(this,u).style.zIndex=parseInt(t(this,u).style.zIndex)-1e3)};class ot extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0}),this.textContent=v.data.textContent,this.textPosition=v.data.textPosition,this.annotationEditorType=d.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const v=document.createElement("div");v.classList.add("annotationTextContent"),v.setAttribute("role","comment");for(const f of this.textContent){const x=document.createElement("span");x.textContent=f,v.append(x)}this.container.append(v)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class nt extends L{constructor(f){super(f,{isRenderable:!0,ignoreBorder:!0});_(this,Ut,null)}render(){this.container.classList.add("lineAnnotation");const f=this.data,{width:x,height:U}=y(f.rect),q=this.svgFactory.create(x,U,!0),ft=w(this,Ut,this.svgFactory.createElement("svg:line"));return ft.setAttribute("x1",f.rect[2]-f.lineCoordinates[0]),ft.setAttribute("y1",f.rect[3]-f.lineCoordinates[1]),ft.setAttribute("x2",f.rect[2]-f.lineCoordinates[2]),ft.setAttribute("y2",f.rect[3]-f.lineCoordinates[3]),ft.setAttribute("stroke-width",f.borderStyle.width||1),ft.setAttribute("stroke","transparent"),ft.setAttribute("fill","transparent"),q.append(ft),this.container.append(q),!f.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,Ut)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ut=new WeakMap;class Mt extends L{constructor(f){super(f,{isRenderable:!0,ignoreBorder:!0});_(this,lt,null)}render(){this.container.classList.add("squareAnnotation");const f=this.data,{width:x,height:U}=y(f.rect),q=this.svgFactory.create(x,U,!0),ft=f.borderStyle.width,yt=w(this,lt,this.svgFactory.createElement("svg:rect"));return yt.setAttribute("x",ft/2),yt.setAttribute("y",ft/2),yt.setAttribute("width",x-ft),yt.setAttribute("height",U-ft),yt.setAttribute("stroke-width",ft||1),yt.setAttribute("stroke","transparent"),yt.setAttribute("fill","transparent"),q.append(yt),this.container.append(q),!f.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,lt)}addHighlightArea(){this.container.classList.add("highlightArea")}}lt=new WeakMap;class It extends L{constructor(f){super(f,{isRenderable:!0,ignoreBorder:!0});_(this,ut,null)}render(){this.container.classList.add("circleAnnotation");const f=this.data,{width:x,height:U}=y(f.rect),q=this.svgFactory.create(x,U,!0),ft=f.borderStyle.width,yt=w(this,ut,this.svgFactory.createElement("svg:ellipse"));return yt.setAttribute("cx",x/2),yt.setAttribute("cy",U/2),yt.setAttribute("rx",x/2-ft/2),yt.setAttribute("ry",U/2-ft/2),yt.setAttribute("stroke-width",ft||1),yt.setAttribute("stroke","transparent"),yt.setAttribute("fill","transparent"),q.append(yt),this.container.append(q),!f.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,ut)}addHighlightArea(){this.container.classList.add("highlightArea")}}ut=new WeakMap;class Pt extends L{constructor(f){super(f,{isRenderable:!0,ignoreBorder:!0});_(this,T,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const f=this.data,{width:x,height:U}=y(f.rect),q=this.svgFactory.create(x,U,!0);let ft=[];for(const zt of f.vertices){const Ft=zt.x-f.rect[0],c=f.rect[3]-zt.y;ft.push(Ft+","+c)}ft=ft.join(" ");const yt=w(this,T,this.svgFactory.createElement(this.svgElementName));return yt.setAttribute("points",ft),yt.setAttribute("stroke-width",f.borderStyle.width||1),yt.setAttribute("stroke","transparent"),yt.setAttribute("fill","transparent"),q.append(yt),this.container.append(q),!f.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,T)}addHighlightArea(){this.container.classList.add("highlightArea")}}T=new WeakMap;class Xt extends Pt{constructor(v){super(v),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ae extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Jt extends L{constructor(f){super(f,{isRenderable:!0,ignoreBorder:!0});_(this,X,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=d.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const f=this.data,{width:x,height:U}=y(f.rect),q=this.svgFactory.create(x,U,!0);for(const ft of f.inkLists){let yt=[];for(const Ft of ft){const c=Ft.x-f.rect[0],N=f.rect[3]-Ft.y;yt.push(`${c},${N}`)}yt=yt.join(" ");const zt=this.svgFactory.createElement(this.svgElementName);t(this,X).push(zt),zt.setAttribute("points",yt),zt.setAttribute("stroke-width",f.borderStyle.width||1),zt.setAttribute("stroke","transparent"),zt.setAttribute("fill","transparent"),!f.popupRef&&this.hasPopupData&&this._createPopup(),q.append(zt)}return this.container.append(q),this.container}getElementsToTriggerPopup(){return t(this,X)}addHighlightArea(){this.container.classList.add("highlightArea")}}X=new WeakMap;class re extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class oe extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Rt extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Qt extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ue extends L{constructor(v){super(v,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Ae extends L{constructor(f){var q;super(f,{isRenderable:!0});_(this,vt);_(this,Y,null);const{filename:x,content:U}=this.data.file;this.filename=(0,Q.getFilenameFromUrl)(x,!0),this.content=U,(q=this.linkService.eventBus)==null||q.dispatch("fileattachmentannotation",{source:this,filename:x,content:U})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:f,data:x}=this;let U;x.hasAppearance||x.fillAlpha===0?U=document.createElement("div"):(U=document.createElement("img"),U.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(x.name)?"paperclip":"pushpin"}.svg`,x.fillAlpha&&x.fillAlpha<1&&(U.style=`filter: opacity(${Math.round(x.fillAlpha*100)}%);`)),U.addEventListener("dblclick",b(this,vt,yi).bind(this)),w(this,Y,U);const{isMac:q}=d.FeatureTest.platform;return f.addEventListener("keydown",ft=>{ft.key==="Enter"&&(q?ft.metaKey:ft.ctrlKey)&&b(this,vt,yi).call(this)}),!x.popupRef&&this.hasPopupData?this._createPopup():U.classList.add("popupTriggerArea"),f.append(U),f}getElementsToTriggerPopup(){return t(this,Y)}addHighlightArea(){this.container.classList.add("highlightArea")}}Y=new WeakMap,vt=new WeakSet,yi=function(){var f;(f=this.downloadManager)==null||f.openOrDownloadData(this.content,this.filename)};class Bt{constructor({div:v,accessibilityManager:f,annotationCanvasMap:x,annotationEditorUIManager:U,page:q,viewport:ft}){_(this,de);_(this,Lt,null);_(this,Ht,null);_(this,te,new Map);this.div=v,w(this,Lt,f),w(this,Ht,x),this.page=q,this.viewport=ft,this.zIndex=0,this._annotationEditorUIManager=U}async render(v){var ft;const{annotations:f}=v,x=this.div;(0,Q.setLayerDimensions)(x,this.viewport);const U=new Map,q={data:null,layer:x,linkService:v.linkService,downloadManager:v.downloadManager,imageResourcesPath:v.imageResourcesPath||"",renderForms:v.renderForms!==!1,svgFactory:new Q.DOMSVGFactory,annotationStorage:v.annotationStorage||new H.AnnotationStorage,enableScripting:v.enableScripting===!0,hasJSActions:v.hasJSActions,fieldObjects:v.fieldObjects,parent:this,elements:null};for(const yt of f){if(yt.noHTML)continue;const zt=yt.annotationType===d.AnnotationType.POPUP;if(zt){const N=U.get(yt.id);if(!N)continue;q.elements=N}else{const{width:N,height:et}=y(yt.rect);if(N<=0||et<=0)continue}q.data=yt;const Ft=D.create(q);if(!Ft.isRenderable)continue;if(!zt&&yt.popupRef){const N=U.get(yt.popupRef);N?N.push(Ft):U.set(yt.popupRef,[Ft])}const c=Ft.render();yt.hidden&&(c.style.visibility="hidden"),b(this,de,cr).call(this,c,yt.id),Ft.annotationEditorType>0&&(t(this,te).set(Ft.data.id,Ft),(ft=this._annotationEditorUIManager)==null||ft.renderAnnotationElement(Ft))}b(this,de,wi).call(this)}update({viewport:v}){const f=this.div;this.viewport=v,(0,Q.setLayerDimensions)(f,{rotation:v.rotation}),b(this,de,wi).call(this),f.hidden=!1}getEditableAnnotations(){return Array.from(t(this,te).values())}getEditableAnnotation(v){return t(this,te).get(v)}}Lt=new WeakMap,Ht=new WeakMap,te=new WeakMap,de=new WeakSet,cr=function(v,f){var U;const x=v.firstChild||v;x.id=`${d.AnnotationPrefix}${f}`,this.div.append(v),(U=t(this,Lt))==null||U.moveElementInDOM(this.div,v,x,!1)},wi=function(){if(!t(this,Ht))return;const v=this.div;for(const[f,x]of t(this,Ht)){const U=v.querySelector(`[data-annotation-id="${f}"]`);if(!U)continue;x.className="annotationContent";const{firstChild:q}=U;q?q.nodeName==="CANVAS"?q.replaceWith(x):q.classList.contains("annotationContent")?q.after(x):q.before(x):U.append(x)}t(this,Ht).clear()}},792:(ie,$t,dt)=>{var F,I,V,dr,y;dt.d($t,{AnnotationStorage:()=>At,PrintAnnotationStorage:()=>z,SerializableEmpty:()=>J});var d=dt(292),Q=dt(310),H=dt(651);const J=Object.freeze({map:null,hash:"",transfer:void 0});class At{constructor(){_(this,V);_(this,F,!1);_(this,I,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(L,Z){const B=t(this,I).get(L);return B===void 0?Z:Object.assign(Z,B)}getRawValue(L){return t(this,I).get(L)}remove(L){if(t(this,I).delete(L),t(this,I).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const Z of t(this,I).values())if(Z instanceof Q.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(L,Z){const B=t(this,I).get(L);let K=!1;if(B!==void 0)for(const[k,O]of Object.entries(Z))B[k]!==O&&(K=!0,B[k]=O);else K=!0,t(this,I).set(L,Z);K&&b(this,V,dr).call(this),Z instanceof Q.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(Z.constructor._type)}has(L){return t(this,I).has(L)}getAll(){return t(this,I).size>0?(0,d.objectFromMap)(t(this,I)):null}setAll(L){for(const[Z,B]of Object.entries(L))this.setValue(Z,B)}get size(){return t(this,I).size}resetModified(){t(this,F)&&(w(this,F,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new z(this)}get serializable(){if(t(this,I).size===0)return J;const L=new Map,Z=new H.MurmurHash3_64,B=[],K=Object.create(null);let k=!1;for(const[O,C]of t(this,I)){const P=C instanceof Q.AnnotationEditor?C.serialize(!1,K):C;P&&(L.set(O,P),Z.update(`${O}:${JSON.stringify(P)}`),k||(k=!!P.bitmap))}if(k)for(const O of L.values())O.bitmap&&B.push(O.bitmap);return L.size>0?{map:L,hash:Z.hexdigest(),transfer:B}:J}get editorStats(){let L=null;const Z=new Map;for(const B of t(this,I).values()){if(!(B instanceof Q.AnnotationEditor))continue;const K=B.telemetryFinalData;if(!K)continue;const{type:k}=K;Z.has(k)||Z.set(k,Object.getPrototypeOf(B).constructor),L||(L=Object.create(null));const O=L[k]||(L[k]=new Map);for(const[C,P]of Object.entries(K)){if(C==="type")continue;let ht=O.get(C);ht||(ht=new Map,O.set(C,ht));const st=ht.get(P)??0;ht.set(P,st+1)}}for(const[B,K]of Z)L[B]=K.computeTelemetryFinalData(L[B]);return L}}F=new WeakMap,I=new WeakMap,V=new WeakSet,dr=function(){t(this,F)||(w(this,F,!0),typeof this.onSetModified=="function"&&this.onSetModified())};class z extends At{constructor(Z){super();_(this,y);const{map:B,hash:K,transfer:k}=Z.serializable,O=structuredClone(B,k?{transfer:k}:null);w(this,y,{map:O,hash:K,transfer:k})}get print(){(0,d.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return t(this,y)}}y=new WeakMap},831:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{var P,ht,st,bt,fs,Gs,nt,Mt,It,Pt,Xt,Ws,Jt,re,oe,Rt,Qt,ue,Ts,Bt,le,_i,ce,Zt;try{let Nt=function(ut){if(typeof ut=="string"||ut instanceof URL?ut={url:ut}:(ut instanceof ArrayBuffer||ArrayBuffer.isView(ut))&&(ut={data:ut}),typeof ut!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!ut.url&&!ut.data&&!ut.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const T=new R,{docId:X}=T,Y=ut.url?mt(ut.url):null,vt=ut.data?pt(ut.data):null,Et=ut.httpHeaders||null,Lt=ut.withCredentials===!0,Ht=ut.password??null,te=ut.range instanceof e?ut.range:null,de=Number.isInteger(ut.rangeChunkSize)&&ut.rangeChunkSize>0?ut.rangeChunkSize:n;let be=ut.worker instanceof $?ut.worker:null;const we=ut.verbosity,Wt=typeof ut.docBaseUrl=="string"&&!(0,At.isDataScheme)(ut.docBaseUrl)?ut.docBaseUrl:null,v=typeof ut.cMapUrl=="string"?ut.cMapUrl:null,f=ut.cMapPacked!==!1,x=ut.CMapReaderFactory||l,U=typeof ut.standardFontDataUrl=="string"?ut.standardFontDataUrl:null,q=ut.StandardFontDataFactory||u,ft=ut.stopAtErrors!==!0,yt=Number.isInteger(ut.maxImageSize)&&ut.maxImageSize>-1?ut.maxImageSize:-1,zt=ut.isEvalSupported!==!1,Ft=typeof ut.isOffscreenCanvasSupported=="boolean"?ut.isOffscreenCanvasSupported:!H.isNodeJS,c=Number.isInteger(ut.canvasMaxAreaInBytes)?ut.canvasMaxAreaInBytes:-1,N=typeof ut.disableFontFace=="boolean"?ut.disableFontFace:H.isNodeJS,et=ut.fontExtraProperties===!0,ct=ut.enableXfa===!0,St=ut.ownerDocument||globalThis.document,xt=ut.disableRange===!0,Dt=ut.disableStream===!0,Kt=ut.disableAutoFetch===!0,Yt=ut.pdfBug===!0,fe=te?te.length:ut.length??NaN,Me=typeof ut.useSystemFonts=="boolean"?ut.useSystemFonts:!H.isNodeJS&&!N,Re=typeof ut.useWorkerFetch=="boolean"?ut.useWorkerFetch:x===At.DOMCMapReaderFactory&&q===At.DOMStandardFontDataFactory&&v&&U&&(0,At.isValidFetchUrl)(v,document.baseURI)&&(0,At.isValidFetchUrl)(U,document.baseURI),Be=ut.canvasFactory||new h({ownerDocument:St}),De=ut.filterFactory||new g({docId:X,ownerDocument:St}),Bs=null;(0,H.setVerbosityLevel)(we);const ui={canvasFactory:Be,filterFactory:De};if(Re||(ui.cMapReaderFactory=new x({baseUrl:v,isCompressed:f}),ui.standardFontDataFactory=new q({baseUrl:U})),!be){const ws={verbosity:we,port:E.GlobalWorkerOptions.workerPort};be=ws.port?$.fromPort(ws):new $(ws),T._worker=be}const va={docId:X,apiVersion:"4.2.67",data:vt,password:Ht,disableAutoFetch:Kt,rangeChunkSize:de,length:fe,docBaseUrl:Wt,enableXfa:ct,evaluatorOptions:{maxImageSize:yt,disableFontFace:N,ignoreErrors:ft,isEvalSupported:zt,isOffscreenCanvasSupported:Ft,canvasMaxAreaInBytes:c,fontExtraProperties:et,useSystemFonts:Me,cMapUrl:Re?v:null,standardFontDataUrl:Re?U:null}},ya={ignoreErrors:ft,disableFontFace:N,fontExtraProperties:et,enableXfa:ct,ownerDocument:St,disableAutoFetch:Kt,pdfBug:Yt,styleElement:Bs};return be.promise.then(function(){if(T.destroyed)throw new Error("Loading aborted");const ws=p(be,va),wa=new Promise(function(pi){let _e;te?_e=new Z.PDFDataTransportStream(te,{disableRange:xt,disableStream:Dt}):vt||(_e=(Ce=>H.isNodeJS?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&(0,At.isValidFetchUrl)(Ce.url)?new B.PDFFetchStream(Ce):new k.PDFNodeStream(Ce):(0,At.isValidFetchUrl)(Ce.url)?new B.PDFFetchStream(Ce):new K.PDFNetworkStream(Ce))({url:Y,length:fe,httpHeaders:Et,withCredentials:Lt,rangeChunkSize:de,disableRange:xt,disableStream:Dt})),pi(_e)});return Promise.all([ws,wa]).then(function([pi,_e]){if(T.destroyed)throw new Error("Loading aborted");const Ce=new y.MessageHandler(X,pi,be.port),Pe=new W(Ce,T,_e,ya,ui);T._transport=Pe,Ce.send("Ready",null)})}).catch(T._capability.reject),T},mt=function(ut){if(ut instanceof URL)return ut.href;try{return new URL(ut,window.location).href}catch{if(H.isNodeJS&&typeof ut=="string")return ut}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")},pt=function(ut){if(H.isNodeJS&&typeof fn.Buffer<"u"&&ut instanceof fn.Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(ut instanceof Uint8Array&&ut.byteLength===ut.buffer.byteLength)return ut;if(typeof ut=="string")return(0,H.stringToBytes)(ut);if(ut instanceof ArrayBuffer||ArrayBuffer.isView(ut)||typeof ut=="object"&&!isNaN(ut==null?void 0:ut.length))return new Uint8Array(ut);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")},S=function(ut){return typeof ut=="object"&&Number.isInteger(ut==null?void 0:ut.num)&&ut.num>=0&&Number.isInteger(ut==null?void 0:ut.gen)&&ut.gen>=0};dt.d($t,{PDFDataRangeTransport:()=>e,PDFWorker:()=>$,build:()=>jt,getDocument:()=>Nt,version:()=>Ot});var H=dt(292),J=dt(792),At=dt(419),z=dt(10),F=dt(573),I=dt(923),V=dt(814),E=dt(164),y=dt(178),D=dt(62),L=dt(626),Z=dt(585),B=dt(94),K=dt(457),k=dt(786),O=dt(50),C=d([F,k]);[F,k]=C.then?(await C)():C;const n=65536,s=100,a=5e3,h=H.isNodeJS?F.NodeCanvasFactory:At.DOMCanvasFactory,l=H.isNodeJS?F.NodeCMapReaderFactory:At.DOMCMapReaderFactory,g=H.isNodeJS?F.NodeFilterFactory:At.DOMFilterFactory,u=H.isNodeJS?F.NodeStandardFontDataFactory:At.DOMStandardFontDataFactory;async function p(ut,T){if(ut.destroyed)throw new Error("Worker was destroyed");const X=await ut.messageHandler.sendWithPromise("GetDocRequest",T,T.data?[T.data.buffer]:null);if(ut.destroyed)throw new Error("Worker was destroyed");return X}const Gt=class Gt{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${Je(Gt,P)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var T,X,Y;this.destroyed=!0;try{(T=this._worker)!=null&&T.port&&(this._worker._pendingDestroy=!0),await((X=this._transport)==null?void 0:X.destroy())}catch(vt){throw(Y=this._worker)!=null&&Y.port&&delete this._worker._pendingDestroy,vt}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};P=new WeakMap,_(Gt,P,0);let R=Gt;class e{constructor(T,X,Y=!1,vt=null){this.length=T,this.initialData=X,this.progressiveDone=Y,this.contentDispositionFilename=vt,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,X){for(const Y of this._rangeListeners)Y(T,X)}onDataProgress(T,X){this._readyCapability.promise.then(()=>{for(const Y of this._progressListeners)Y(T,X)})}onDataProgressiveRead(T){this._readyCapability.promise.then(()=>{for(const X of this._progressiveReadListeners)X(T)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const T of this._progressiveDoneListeners)T()})}transportReady(){this._readyCapability.resolve()}requestDataRange(T,X){(0,H.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class i{constructor(T,X){this._pdfInfo=T,this._transport=X}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(0,H.shadow)(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:X}=this._transport.getRenderingIntent(T);return this._transport.getOptionalContentConfig(X)}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()}}class o{constructor(T,X,Y,vt=!1){_(this,bt);_(this,ht,null);_(this,st,!1);this._pageIndex=T,this._pageInfo=X,this._transport=Y,this._stats=vt?new At.StatTimer:null,this._pdfBug=vt,this.commonObjs=Y.commonObjs,this.objs=new gt,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:X=this.rotate,offsetX:Y=0,offsetY:vt=0,dontFlip:Et=!1}={}){return new At.PageViewport({viewBox:this.view,scale:T,rotation:X,offsetX:Y,offsetY:vt,dontFlip:Et})}getAnnotations({intent:T="display"}={}){const{renderingIntent:X}=this._transport.getRenderingIntent(T);return this._transport.getAnnotations(this._pageIndex,X)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,H.shadow)(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:X,intent:Y="display",annotationMode:vt=H.AnnotationMode.ENABLE,transform:Et=null,background:Lt=null,optionalContentConfigPromise:Ht=null,annotationCanvasMap:te=null,pageColors:de=null,printAnnotationStorage:be=null}){var yt,zt;(yt=this._stats)==null||yt.time("Overall");const we=this._transport.getRenderingIntent(Y,vt,be),{renderingIntent:Wt,cacheKey:v}=we;w(this,st,!1),b(this,bt,Gs).call(this),Ht||(Ht=this._transport.getOptionalContentConfig(Wt));let f=this._intentStates.get(v);f||(f=Object.create(null),this._intentStates.set(v,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const x=!!(Wt&H.RenderingIntentFlag.PRINT);f.displayReadyCapability||(f.displayReadyCapability=Promise.withResolvers(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(zt=this._stats)==null||zt.time("Page Request"),this._pumpOperatorList(we));const U=Ft=>{var c,N;f.renderTasks.delete(q),(this._maybeCleanupAfterRender||x)&&w(this,st,!0),b(this,bt,fs).call(this,!x),Ft?(q.capability.reject(Ft),this._abortOperatorList({intentState:f,reason:Ft instanceof Error?Ft:new Error(Ft)})):q.capability.resolve(),(c=this._stats)==null||c.timeEnd("Rendering"),(N=this._stats)==null||N.timeEnd("Overall")},q=new _t({callback:U,params:{canvasContext:T,viewport:X,transform:Et,background:Lt},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:te,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!x,pdfBug:this._pdfBug,pageColors:de});(f.renderTasks||(f.renderTasks=new Set)).add(q);const ft=q.task;return Promise.all([f.displayReadyCapability.promise,Ht]).then(([Ft,c])=>{var N;if(this.destroyed){U();return}if((N=this._stats)==null||N.time("Rendering"),!(c.renderingIntent&Wt))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");q.initializeGraphics({transparency:Ft,optionalContentConfig:c}),q.operatorListChanged()}).catch(U),ft}getOperatorList({intent:T="display",annotationMode:X=H.AnnotationMode.ENABLE,printAnnotationStorage:Y=null}={}){var te;function vt(){Lt.operatorList.lastChunk&&(Lt.opListReadCapability.resolve(Lt.operatorList),Lt.renderTasks.delete(Ht))}const Et=this._transport.getRenderingIntent(T,X,Y,!0);let Lt=this._intentStates.get(Et.cacheKey);Lt||(Lt=Object.create(null),this._intentStates.set(Et.cacheKey,Lt));let Ht;return Lt.opListReadCapability||(Ht=Object.create(null),Ht.operatorListChanged=vt,Lt.opListReadCapability=Promise.withResolvers(),(Lt.renderTasks||(Lt.renderTasks=new Set)).add(Ht),Lt.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(te=this._stats)==null||te.time("Page Request"),this._pumpOperatorList(Et)),Lt.opListReadCapability.promise}streamTextContent({includeMarkedContent:T=!1,disableNormalization:X=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:T===!0,disableNormalization:X===!0},{highWaterMark:100,size(Y){return Y.items.length}})}getTextContent(T={}){if(this._transport._htmlForXfa)return this.getXfa().then(Y=>O.XfaText.textContent(Y));const X=this.streamTextContent(T);return new Promise(function(Y,vt){function Et(){Lt.read().then(function({value:te,done:de}){if(de){Y(Ht);return}Object.assign(Ht.styles,te.styles),Ht.items.push(...te.items),Et()},vt)}const Lt=X.getReader(),Ht={items:[],styles:Object.create(null)};Et()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const T=[];for(const X of this._intentStates.values())if(this._abortOperatorList({intentState:X,reason:new Error("Page was destroyed."),force:!0}),!X.opListReadCapability)for(const Y of X.renderTasks)T.push(Y.completed),Y.cancel();return this.objs.clear(),w(this,st,!1),b(this,bt,Gs).call(this),Promise.all(T)}cleanup(T=!1){w(this,st,!0);const X=b(this,bt,fs).call(this,!1);return T&&X&&this._stats&&(this._stats=new At.StatTimer),X}_startRenderPage(T,X){var vt,Et;const Y=this._intentStates.get(X);Y&&((vt=this._stats)==null||vt.timeEnd("Page Request"),(Et=Y.displayReadyCapability)==null||Et.resolve(T))}_renderPageChunk(T,X){for(let Y=0,vt=T.length;Y<vt;Y++)X.operatorList.fnArray.push(T.fnArray[Y]),X.operatorList.argsArray.push(T.argsArray[Y]);X.operatorList.lastChunk=T.lastChunk,X.operatorList.separateAnnots=T.separateAnnots;for(const Y of X.renderTasks)Y.operatorListChanged();T.lastChunk&&b(this,bt,fs).call(this,!0)}_pumpOperatorList({renderingIntent:T,cacheKey:X,annotationStorageSerializable:Y}){const{map:vt,transfer:Et}=Y,Lt=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:T,cacheKey:X,annotationStorage:vt},Et).getReader(),Ht=this._intentStates.get(X);Ht.streamReader=Lt;const te=()=>{Lt.read().then(({value:de,done:be})=>{if(be){Ht.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(de,Ht),te())},de=>{if(Ht.streamReader=null,!this._transport.destroyed){if(Ht.operatorList){Ht.operatorList.lastChunk=!0;for(const be of Ht.renderTasks)be.operatorListChanged();b(this,bt,fs).call(this,!0)}if(Ht.displayReadyCapability)Ht.displayReadyCapability.reject(de);else if(Ht.opListReadCapability)Ht.opListReadCapability.reject(de);else throw de}})};te()}_abortOperatorList({intentState:T,reason:X,force:Y=!1}){if(T.streamReader){if(T.streamReaderCancelTimeout&&(clearTimeout(T.streamReaderCancelTimeout),T.streamReaderCancelTimeout=null),!Y){if(T.renderTasks.size>0)return;if(X instanceof At.RenderingCancelledException){let vt=s;X.extraDelay>0&&X.extraDelay<1e3&&(vt+=X.extraDelay),T.streamReaderCancelTimeout=setTimeout(()=>{T.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:T,reason:X,force:!0})},vt);return}}if(T.streamReader.cancel(new H.AbortException(X.message)).catch(()=>{}),T.streamReader=null,!this._transport.destroyed){for(const[vt,Et]of this._intentStates)if(Et===T){this._intentStates.delete(vt);break}this.cleanup()}}}get stats(){return this._stats}}ht=new WeakMap,st=new WeakMap,bt=new WeakSet,fs=function(T=!1){if(b(this,bt,Gs).call(this),!t(this,st)||this.destroyed)return!1;if(T)return w(this,ht,setTimeout(()=>{w(this,ht,null),b(this,bt,fs).call(this,!1)},a)),!1;for(const{renderTasks:X,operatorList:Y}of this._intentStates.values())if(X.size>0||!Y.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),w(this,st,!1),!0},Gs=function(){t(this,ht)&&(clearTimeout(t(this,ht)),w(this,ht,null))};class m{constructor(){_(this,nt,new Set);_(this,Mt,Promise.resolve())}postMessage(T,X){const Y={data:structuredClone(T,X?{transfer:X}:null)};t(this,Mt).then(()=>{for(const vt of t(this,nt))vt.call(this,Y)})}addEventListener(T,X){t(this,nt).add(X)}removeEventListener(T,X){t(this,nt).delete(X)}terminate(){t(this,nt).clear()}}nt=new WeakMap,Mt=new WeakMap;const M={isWorkerDisabled:!1,fakeWorkerId:0};H.isNodeJS&&(M.isWorkerDisabled=!0,(It=E.GlobalWorkerOptions).workerSrc||(It.workerSrc="./pdf.worker.mjs")),M.isSameOrigin=function(ut,T){let X;try{if(X=new URL(ut),!X.origin||X.origin==="null")return!1}catch{return!1}const Y=new URL(T,X);return X.origin===Y.origin},M.createCDNWrapper=function(ut){const T=`await import("${ut}");`;return URL.createObjectURL(new Blob([T],{type:"text/javascript"}))};const Ut=class Ut{constructor({name:T=null,port:X=null,verbosity:Y=(0,H.getVerbosityLevel)()}={}){var vt;if(this.name=T,this.destroyed=!1,this.verbosity=Y,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,X){if((vt=t(Ut,Pt))!=null&&vt.has(X))throw new Error("Cannot use more than one PDFWorker per port.");(t(Ut,Pt)||w(Ut,Pt,new WeakMap)).set(X,this),this._initializeFromPort(X);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(T){this._port=T,this._messageHandler=new y.MessageHandler("main","worker",T),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!M.isWorkerDisabled&&!t(Ut,Xt,Ws)){let{workerSrc:T}=Ut;try{M.isSameOrigin(window.location.href,T)||(T=M.createCDNWrapper(new URL(T,window.location).href));const X=new Worker(T,{type:"module"}),Y=new y.MessageHandler("main","worker",X),vt=()=>{X.removeEventListener("error",Et),Y.destroy(),X.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},Et=()=>{this._webWorker||vt()};X.addEventListener("error",Et),Y.on("test",Ht=>{if(X.removeEventListener("error",Et),this.destroyed){vt();return}Ht?(this._messageHandler=Y,this._port=X,this._webWorker=X,this._readyCapability.resolve(),Y.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),Y.destroy(),X.terminate())}),Y.on("ready",Ht=>{if(X.removeEventListener("error",Et),this.destroyed){vt();return}try{Lt()}catch{this._setupFakeWorker()}});const Lt=()=>{const Ht=new Uint8Array;Y.send("test",Ht,[Ht.buffer])};Lt();return}catch{(0,H.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){M.isWorkerDisabled||((0,H.warn)("Setting up fake worker."),M.isWorkerDisabled=!0),Ut._setupFakeWorkerGlobal.then(T=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const X=new m;this._port=X;const Y=`fake${M.fakeWorkerId++}`,vt=new y.MessageHandler(Y+"_worker",Y,X);T.setup(vt,X);const Et=new y.MessageHandler(Y,Y+"_worker",X);this._messageHandler=Et,this._readyCapability.resolve(),Et.send("configure",{verbosity:this.verbosity})}).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=t(Ut,Pt))==null||T.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(T){var Y;if(!(T!=null&&T.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const X=(Y=t(this,Pt))==null?void 0:Y.get(T.port);if(X){if(X._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return X}return new Ut(T)}static get workerSrc(){if(E.GlobalWorkerOptions.workerSrc)return E.GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){const T=async()=>t(this,Xt,Ws)?t(this,Xt,Ws):(await import(this.workerSrc).then(async X=>(await X.__tla,X))).WorkerMessageHandler;return(0,H.shadow)(this,"_setupFakeWorkerGlobal",T())}};Pt=new WeakMap,Xt=new WeakSet,Ws=function(){var T;try{return((T=globalThis.pdfjsWorker)==null?void 0:T.WorkerMessageHandler)||null}catch{return null}},_(Ut,Xt),_(Ut,Pt);let $=Ut;class W{constructor(T,X,Y,vt,Et){_(this,ue);_(this,Jt,new Map);_(this,re,new Map);_(this,oe,new Map);_(this,Rt,new Map);_(this,Qt,null);this.messageHandler=T,this.loadingTask=X,this.commonObjs=new gt,this.fontLoader=new z.FontLoader({ownerDocument:vt.ownerDocument,styleElement:vt.styleElement}),this._params=vt,this.canvasFactory=Et.canvasFactory,this.filterFactory=Et.filterFactory,this.cMapReaderFactory=Et.cMapReaderFactory,this.standardFontDataFactory=Et.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=Y,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return(0,H.shadow)(this,"annotationStorage",new J.AnnotationStorage)}getRenderingIntent(T,X=H.AnnotationMode.ENABLE,Y=null,vt=!1){let Et=H.RenderingIntentFlag.DISPLAY,Lt=J.SerializableEmpty;switch(T){case"any":Et=H.RenderingIntentFlag.ANY;break;case"display":break;case"print":Et=H.RenderingIntentFlag.PRINT;break;default:(0,H.warn)(`getRenderingIntent - invalid intent: ${T}`)}switch(X){case H.AnnotationMode.DISABLE:Et+=H.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case H.AnnotationMode.ENABLE:break;case H.AnnotationMode.ENABLE_FORMS:Et+=H.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case H.AnnotationMode.ENABLE_STORAGE:Et+=H.RenderingIntentFlag.ANNOTATIONS_STORAGE,Lt=(Et&H.RenderingIntentFlag.PRINT&&Y instanceof J.PrintAnnotationStorage?Y:this.annotationStorage).serializable;break;default:(0,H.warn)(`getRenderingIntent - invalid annotationMode: ${X}`)}return vt&&(Et+=H.RenderingIntentFlag.OPLIST),{renderingIntent:Et,cacheKey:`${Et}_${Lt.hash}`,annotationStorageSerializable:Lt}}destroy(){var Y;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(Y=t(this,Qt))==null||Y.reject(new Error("Worker was destroyed during onPassword callback"));const T=[];for(const vt of t(this,re).values())T.push(vt._destroy());t(this,re).clear(),t(this,oe).clear(),t(this,Rt).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const X=this.messageHandler.sendWithPromise("Terminate",null);return T.push(X),Promise.all(T).then(()=>{var vt;this.commonObjs.clear(),this.fontLoader.clear(),t(this,Jt).clear(),this.filterFactory.destroy(),(0,V.cleanupTextLayer)(),(vt=this._networkStream)==null||vt.cancelAllRequests(new H.AbortException("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:X}=this;T.on("GetReader",(Y,vt)=>{(0,H.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=Et=>{this._lastProgress={loaded:Et.loaded,total:Et.total}},vt.onPull=()=>{this._fullReader.read().then(function({value:Et,done:Lt}){if(Lt){vt.close();return}(0,H.assert)(Et instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),vt.enqueue(new Uint8Array(Et),1,[Et])}).catch(Et=>{vt.error(Et)})},vt.onCancel=Et=>{this._fullReader.cancel(Et),vt.ready.catch(Lt=>{if(!this.destroyed)throw Lt})}}),T.on("ReaderHeadersReady",Y=>{const vt=Promise.withResolvers(),Et=this._fullReader;return Et.headersReady.then(()=>{var Lt;(!Et.isStreamingSupported||!Et.isRangeSupported)&&(this._lastProgress&&((Lt=X.onProgress)==null||Lt.call(X,this._lastProgress)),Et.onProgress=Ht=>{var te;(te=X.onProgress)==null||te.call(X,{loaded:Ht.loaded,total:Ht.total})}),vt.resolve({isStreamingSupported:Et.isStreamingSupported,isRangeSupported:Et.isRangeSupported,contentLength:Et.contentLength})},vt.reject),vt.promise}),T.on("GetRangeReader",(Y,vt)=>{(0,H.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const Et=this._networkStream.getRangeReader(Y.begin,Y.end);if(!Et){vt.close();return}vt.onPull=()=>{Et.read().then(function({value:Lt,done:Ht}){if(Ht){vt.close();return}(0,H.assert)(Lt instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),vt.enqueue(new Uint8Array(Lt),1,[Lt])}).catch(Lt=>{vt.error(Lt)})},vt.onCancel=Lt=>{Et.cancel(Lt),vt.ready.catch(Ht=>{if(!this.destroyed)throw Ht})}}),T.on("GetDoc",({pdfInfo:Y})=>{this._numPages=Y.numPages,this._htmlForXfa=Y.htmlForXfa,delete Y.htmlForXfa,X._capability.resolve(new i(Y,this))}),T.on("DocException",function(Y){let vt;switch(Y.name){case"PasswordException":vt=new H.PasswordException(Y.message,Y.code);break;case"InvalidPDFException":vt=new H.InvalidPDFException(Y.message);break;case"MissingPDFException":vt=new H.MissingPDFException(Y.message);break;case"UnexpectedResponseException":vt=new H.UnexpectedResponseException(Y.message,Y.status);break;case"UnknownErrorException":vt=new H.UnknownErrorException(Y.message,Y.details);break;default:(0,H.unreachable)("DocException - expected a valid Error.")}X._capability.reject(vt)}),T.on("PasswordRequest",Y=>{if(w(this,Qt,Promise.withResolvers()),X.onPassword){const vt=Et=>{Et instanceof Error?t(this,Qt).reject(Et):t(this,Qt).resolve({password:Et})};try{X.onPassword(vt,Y.code)}catch(Et){t(this,Qt).reject(Et)}}else t(this,Qt).reject(new H.PasswordException(Y.message,Y.code));return t(this,Qt).promise}),T.on("DataLoaded",Y=>{var vt;(vt=X.onProgress)==null||vt.call(X,{loaded:Y.length,total:Y.length}),this.downloadInfoCapability.resolve(Y)}),T.on("StartRenderPage",Y=>{this.destroyed||t(this,re).get(Y.pageIndex)._startRenderPage(Y.transparency,Y.cacheKey)}),T.on("commonobj",([Y,vt,Et])=>{var Lt;if(this.destroyed||this.commonObjs.has(Y))return null;switch(vt){case"Font":const Ht=this._params;if("error"in Et){const we=Et.error;(0,H.warn)(`Error during font loading: ${we}`),this.commonObjs.resolve(Y,we);break}const te=Ht.pdfBug&&((Lt=globalThis.FontInspector)!=null&&Lt.enabled)?(we,Wt)=>globalThis.FontInspector.fontAdded(we,Wt):null,de=new z.FontFaceObject(Et,{disableFontFace:Ht.disableFontFace,ignoreErrors:Ht.ignoreErrors,inspectFont:te});this.fontLoader.bind(de).catch(()=>T.sendWithPromise("FontFallback",{id:Y})).finally(()=>{!Ht.fontExtraProperties&&de.data&&(de.data=null),this.commonObjs.resolve(Y,de)});break;case"CopyLocalImage":const{imageRef:be}=Et;(0,H.assert)(be,"The imageRef must be defined.");for(const we of t(this,re).values())for(const[,Wt]of we.objs)if(Wt.ref===be)return Wt.dataLen?(this.commonObjs.resolve(Y,structuredClone(Wt)),Wt.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(Y,Et);break;default:throw new Error(`Got unknown common object type ${vt}`)}return null}),T.on("obj",([Y,vt,Et,Lt])=>{var te;if(this.destroyed)return;const Ht=t(this,re).get(vt);if(!Ht.objs.has(Y)){if(Ht._intentStates.size===0){(te=Lt==null?void 0:Lt.bitmap)==null||te.close();return}switch(Et){case"Image":Ht.objs.resolve(Y,Lt),(Lt==null?void 0:Lt.dataLen)>H.MAX_IMAGE_SIZE_TO_CACHE&&(Ht._maybeCleanupAfterRender=!0);break;case"Pattern":Ht.objs.resolve(Y,Lt);break;default:throw new Error(`Got unknown object type ${Et}`)}}}),T.on("DocProgress",Y=>{var vt;this.destroyed||((vt=X.onProgress)==null||vt.call(X,{loaded:Y.loaded,total:Y.total}))}),T.on("FetchBuiltInCMap",Y=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(Y):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),T.on("FetchStandardFontData",Y=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(Y):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var Y;this.annotationStorage.size<=0&&(0,H.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:T,transfer:X}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:T,filename:((Y=this._fullReader)==null?void 0:Y.filename)??null},X).finally(()=>{this.annotationStorage.resetModified()})}getPage(T){if(!Number.isInteger(T)||T<=0||T>this._numPages)return Promise.reject(new Error("Invalid page request."));const X=T-1,Y=t(this,oe).get(X);if(Y)return Y;const vt=this.messageHandler.sendWithPromise("GetPage",{pageIndex:X}).then(Et=>{if(this.destroyed)throw new Error("Transport destroyed");Et.refStr&&t(this,Rt).set(Et.refStr,T);const Lt=new o(X,Et,this,this._params.pdfBug);return t(this,re).set(X,Lt),Lt});return t(this,oe).set(X,vt),vt}getPageIndex(T){return S(T)?this.messageHandler.sendWithPromise("GetPageIndex",{num:T.num,gen:T.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(T,X){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:T,intent:X})}getFieldObjects(){return b(this,ue,Ts).call(this,"GetFieldObjects")}hasJSActions(){return b(this,ue,Ts).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 b(this,ue,Ts).call(this,"GetDocJSActions")}getPageJSActions(T){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:T})}getStructTree(T){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:T})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(T){return b(this,ue,Ts).call(this,"GetOptionalContentConfig").then(X=>new L.OptionalContentConfig(X,T))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const T="GetMetadata",X=t(this,Jt).get(T);if(X)return X;const Y=this.messageHandler.sendWithPromise(T,null).then(vt=>{var Et,Lt;return{info:vt[0],metadata:vt[1]?new D.Metadata(vt[1]):null,contentDispositionFilename:((Et=this._fullReader)==null?void 0:Et.filename)??null,contentLength:((Lt=this._fullReader)==null?void 0:Lt.contentLength)??null}});return t(this,Jt).set(T,Y),Y}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(T=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const X of t(this,re).values())if(!X.cleanup())throw new Error(`startCleanup: Page ${X.pageNumber} is currently rendering.`);this.commonObjs.clear(),T||this.fontLoader.clear(),t(this,Jt).clear(),this.filterFactory.destroy(!0),(0,V.cleanupTextLayer)()}}cachedPageNumber(T){if(!S(T))return null;const X=T.gen===0?`${T.num}R`:`${T.num}R${T.gen}`;return t(this,Rt).get(X)??null}get loadingParams(){const{disableAutoFetch:T,enableXfa:X}=this._params;return(0,H.shadow)(this,"loadingParams",{disableAutoFetch:T,enableXfa:X})}}Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakMap,Qt=new WeakMap,ue=new WeakSet,Ts=function(T,X=null){const Y=t(this,Jt).get(T);if(Y)return Y;const vt=this.messageHandler.sendWithPromise(T,X);return t(this,Jt).set(T,vt),vt};const tt=Symbol("INITIAL_DATA");class gt{constructor(){_(this,le);_(this,Bt,Object.create(null))}get(T,X=null){if(X){const vt=b(this,le,_i).call(this,T);return vt.promise.then(()=>X(vt.data)),null}const Y=t(this,Bt)[T];if(!Y||Y.data===tt)throw new Error(`Requesting object that isn't resolved yet ${T}.`);return Y.data}has(T){const X=t(this,Bt)[T];return!!X&&X.data!==tt}resolve(T,X=null){const Y=b(this,le,_i).call(this,T);Y.data=X,Y.resolve()}clear(){var T;for(const X in t(this,Bt)){const{data:Y}=t(this,Bt)[X];(T=Y==null?void 0:Y.bitmap)==null||T.close()}w(this,Bt,Object.create(null))}*[Symbol.iterator](){for(const T in t(this,Bt)){const{data:X}=t(this,Bt)[T];X!==tt&&(yield[T,X])}}}Bt=new WeakMap,le=new WeakSet,_i=function(T){var X;return(X=t(this,Bt))[T]||(X[T]={...Promise.withResolvers(),data:tt})};class it{constructor(T){_(this,ce,null);w(this,ce,T),this.onContinue=null}get promise(){return t(this,ce).capability.promise}cancel(T=0){t(this,ce).cancel(null,T)}get separateAnnots(){const{separateAnnots:T}=t(this,ce).operatorList;if(!T)return!1;const{annotationCanvasMap:X}=t(this,ce);return T.form||T.canvas&&(X==null?void 0:X.size)>0}}ce=new WeakMap;const lt=class lt{constructor({callback:T,params:X,objs:Y,commonObjs:vt,annotationCanvasMap:Et,operatorList:Lt,pageIndex:Ht,canvasFactory:te,filterFactory:de,useRequestAnimationFrame:be=!1,pdfBug:we=!1,pageColors:Wt=null}){this.callback=T,this.params=X,this.objs=Y,this.commonObjs=vt,this.annotationCanvasMap=Et,this.operatorListIdx=null,this.operatorList=Lt,this._pageIndex=Ht,this.canvasFactory=te,this.filterFactory=de,this._pdfBug=we,this.pageColors=Wt,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=be===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new it(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=X.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:T=!1,optionalContentConfig:X}){var Ht,te;if(this.cancelled)return;if(this._canvas){if(t(lt,Zt).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.");t(lt,Zt).add(this._canvas)}this._pdfBug&&((Ht=globalThis.StepperManager)!=null&&Ht.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:Y,viewport:vt,transform:Et,background:Lt}=this.params;this.gfx=new I.CanvasGraphics(Y,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:X},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:Et,viewport:vt,transparency:T,background:Lt}),this.operatorListIdx=0,this.graphicsReady=!0,(te=this.graphicsReadyCallback)==null||te.call(this)}cancel(T=null,X=0){var Y;this.running=!1,this.cancelled=!0,(Y=this.gfx)==null||Y.endDrawing(),t(lt,Zt).delete(this._canvas),this.callback(T||new At.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,X))}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?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),t(lt,Zt).delete(this._canvas),this.callback())))}};Zt=new WeakMap,_(lt,Zt,new WeakSet);let _t=lt;const Ot="4.2.67",jt="49b388101";Q()}catch(Nt){Q(Nt)}})},583:(ie,$t,dt)=>{dt.d($t,{BaseCMapReaderFactory:()=>J,BaseCanvasFactory:()=>H,BaseFilterFactory:()=>Q,BaseSVGFactory:()=>z,BaseStandardFontDataFactory:()=>At});var d=dt(292);class Q{constructor(){this.constructor===Q&&(0,d.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(I){return"none"}addHCMFilter(I,V){return"none"}addHighlightHCMFilter(I,V,E,y,D){return"none"}destroy(I=!1){}}class H{constructor(){this.constructor===H&&(0,d.unreachable)("Cannot initialize BaseCanvasFactory.")}create(I,V){if(I<=0||V<=0)throw new Error("Invalid canvas size");const E=this._createCanvas(I,V);return{canvas:E,context:E.getContext("2d")}}reset(I,V,E){if(!I.canvas)throw new Error("Canvas is not specified");if(V<=0||E<=0)throw new Error("Invalid canvas size");I.canvas.width=V,I.canvas.height=E}destroy(I){if(!I.canvas)throw new Error("Canvas is not specified");I.canvas.width=0,I.canvas.height=0,I.canvas=null,I.context=null}_createCanvas(I,V){(0,d.unreachable)("Abstract method `_createCanvas` called.")}}class J{constructor({baseUrl:I=null,isCompressed:V=!0}){this.constructor===J&&(0,d.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=I,this.isCompressed=V}async fetch({name:I}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!I)throw new Error("CMap name must be specified.");const V=this.baseUrl+I+(this.isCompressed?".bcmap":""),E=this.isCompressed?d.CMapCompressionType.BINARY:d.CMapCompressionType.NONE;return this._fetchData(V,E).catch(y=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${V}`)})}_fetchData(I,V){(0,d.unreachable)("Abstract method `_fetchData` called.")}}class At{constructor({baseUrl:I=null}){this.constructor===At&&(0,d.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=I}async fetch({filename:I}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!I)throw new Error("Font filename must be specified.");const V=`${this.baseUrl}${I}`;return this._fetchData(V).catch(E=>{throw new Error(`Unable to load font data at: ${V}`)})}_fetchData(I){(0,d.unreachable)("Abstract method `_fetchData` called.")}}class z{constructor(){this.constructor===z&&(0,d.unreachable)("Cannot initialize BaseSVGFactory.")}create(I,V,E=!1){if(I<=0||V<=0)throw new Error("Invalid SVG dimensions");const y=this._createSVG("svg:svg");return y.setAttribute("version","1.1"),E||(y.setAttribute("width",`${I}px`),y.setAttribute("height",`${V}px`)),y.setAttribute("preserveAspectRatio","none"),y.setAttribute("viewBox",`0 0 ${I} ${V}`),y}createElement(I){if(typeof I!="string")throw new Error("Invalid SVG element type");return this._createSVG(I)}_createSVG(I){(0,d.unreachable)("Abstract method `_createSVG` called.")}}},923:(ie,$t,dt)=>{var Zt,xi,Ei;dt.d($t,{CanvasGraphics:()=>ee});var d=dt(292),Q=dt(419);const H={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function J(S,n){if(!n)return;const s=n[2]-n[0],a=n[3]-n[1],h=new Path2D;h.rect(n[0],n[1],s,a),S.clip(h)}class At{constructor(){this.constructor===At&&(0,d.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,d.unreachable)("Abstract method `getPattern` called.")}}class z extends At{constructor(n){super(),this._type=n[1],this._bbox=n[2],this._colorStops=n[3],this._p0=n[4],this._p1=n[5],this._r0=n[6],this._r1=n[7],this.matrix=null}_createGradient(n){let s;this._type==="axial"?s=n.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(s=n.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const a of this._colorStops)s.addColorStop(a[0],a[1]);return s}getPattern(n,s,a,h){let l;if(h===H.STROKE||h===H.FILL){const g=s.current.getClippedPathBoundingBox(h,(0,Q.getCurrentTransform)(n))||[0,0,0,0],u=Math.ceil(g[2]-g[0])||1,p=Math.ceil(g[3]-g[1])||1,R=s.cachedCanvases.getCanvas("pattern",u,p,!0),e=R.context;e.clearRect(0,0,e.canvas.width,e.canvas.height),e.beginPath(),e.rect(0,0,e.canvas.width,e.canvas.height),e.translate(-g[0],-g[1]),a=d.Util.transform(a,[1,0,0,1,g[0],g[1]]),e.transform(...s.baseTransform),this.matrix&&e.transform(...this.matrix),J(e,this._bbox),e.fillStyle=this._createGradient(e),e.fill(),l=n.createPattern(R.canvas,"no-repeat");const i=new DOMMatrix(a);l.setTransform(i)}else J(n,this._bbox),l=this._createGradient(n);return l}}function F(S,n,s,a,h,l,g,u){const p=n.coords,R=n.colors,e=S.data,i=S.width*4;let o;p[s+1]>p[a+1]&&(o=s,s=a,a=o,o=l,l=g,g=o),p[a+1]>p[h+1]&&(o=a,a=h,h=o,o=g,g=u,u=o),p[s+1]>p[a+1]&&(o=s,s=a,a=o,o=l,l=g,g=o);const m=(p[s]+n.offsetX)*n.scaleX,M=(p[s+1]+n.offsetY)*n.scaleY,$=(p[a]+n.offsetX)*n.scaleX,W=(p[a+1]+n.offsetY)*n.scaleY,tt=(p[h]+n.offsetX)*n.scaleX,gt=(p[h+1]+n.offsetY)*n.scaleY;if(M>=gt)return;const it=R[l],_t=R[l+1],Ot=R[l+2],jt=R[g],Gt=R[g+1],Ut=R[g+2],lt=R[u],ut=R[u+1],T=R[u+2],X=Math.round(M),Y=Math.round(gt);let vt,Et,Lt,Ht,te,de,be,we;for(let Wt=X;Wt<=Y;Wt++){if(Wt<W){const q=Wt<M?0:(M-Wt)/(M-W);vt=m-(m-$)*q,Et=it-(it-jt)*q,Lt=_t-(_t-Gt)*q,Ht=Ot-(Ot-Ut)*q}else{let q;Wt>gt?q=1:W===gt?q=0:q=(W-Wt)/(W-gt),vt=$-($-tt)*q,Et=jt-(jt-lt)*q,Lt=Gt-(Gt-ut)*q,Ht=Ut-(Ut-T)*q}let v;Wt<M?v=0:Wt>gt?v=1:v=(M-Wt)/(M-gt),te=m-(m-tt)*v,de=it-(it-lt)*v,be=_t-(_t-ut)*v,we=Ot-(Ot-T)*v;const f=Math.round(Math.min(vt,te)),x=Math.round(Math.max(vt,te));let U=i*Wt+f*4;for(let q=f;q<=x;q++)v=(vt-q)/(vt-te),v<0?v=0:v>1&&(v=1),e[U++]=Et-(Et-de)*v|0,e[U++]=Lt-(Lt-be)*v|0,e[U++]=Ht-(Ht-we)*v|0,e[U++]=255}}function I(S,n,s){const a=n.coords,h=n.colors;let l,g;switch(n.type){case"lattice":const u=n.verticesPerRow,p=Math.floor(a.length/u)-1,R=u-1;for(l=0;l<p;l++){let e=l*u;for(let i=0;i<R;i++,e++)F(S,s,a[e],a[e+1],a[e+u],h[e],h[e+1],h[e+u]),F(S,s,a[e+u+1],a[e+1],a[e+u],h[e+u+1],h[e+1],h[e+u])}break;case"triangles":for(l=0,g=a.length;l<g;l+=3)F(S,s,a[l],a[l+1],a[l+2],h[l],h[l+1],h[l+2]);break;default:throw new Error("illegal figure")}}class V extends At{constructor(n){super(),this._coords=n[2],this._colors=n[3],this._figures=n[4],this._bounds=n[5],this._bbox=n[7],this._background=n[8],this.matrix=null}_createMeshCanvas(n,s,a){const h=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),g=Math.ceil(this._bounds[2])-h,u=Math.ceil(this._bounds[3])-l,p=Math.min(Math.ceil(Math.abs(g*n[0]*1.1)),3e3),R=Math.min(Math.ceil(Math.abs(u*n[1]*1.1)),3e3),e=g/p,i=u/R,o={coords:this._coords,colors:this._colors,offsetX:-h,offsetY:-l,scaleX:1/e,scaleY:1/i},m=p+2*2,M=R+2*2,$=a.getCanvas("mesh",m,M,!1),W=$.context,tt=W.createImageData(p,R);if(s){const gt=tt.data;for(let it=0,_t=gt.length;it<_t;it+=4)gt[it]=s[0],gt[it+1]=s[1],gt[it+2]=s[2],gt[it+3]=255}for(const gt of this._figures)I(tt,gt,o);return W.putImageData(tt,2,2),{canvas:$.canvas,offsetX:h-2*e,offsetY:l-2*i,scaleX:e,scaleY:i}}getPattern(n,s,a,h){J(n,this._bbox);let l;if(h===H.SHADING)l=d.Util.singularValueDecompose2dScale((0,Q.getCurrentTransform)(n));else if(l=d.Util.singularValueDecompose2dScale(s.baseTransform),this.matrix){const u=d.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*u[0],l[1]*u[1]]}const g=this._createMeshCanvas(l,h===H.SHADING?null:this._background,s.cachedCanvases);return h!==H.SHADING&&(n.setTransform(...s.baseTransform),this.matrix&&n.transform(...this.matrix)),n.translate(g.offsetX,g.offsetY),n.scale(g.scaleX,g.scaleY),n.createPattern(g.canvas,"no-repeat")}}class E extends At{getPattern(){return"hotpink"}}function y(S){switch(S[0]){case"RadialAxial":return new z(S);case"Mesh":return new V(S);case"Dummy":return new E}throw new Error(`Unknown IR type: ${S[0]}`)}const D={COLORED:1,UNCOLORED:2},ce=class ce{constructor(n,s,a,h,l){this.operatorList=n[2],this.matrix=n[3]||[1,0,0,1,0,0],this.bbox=n[4],this.xstep=n[5],this.ystep=n[6],this.paintType=n[7],this.tilingType=n[8],this.color=s,this.ctx=a,this.canvasGraphicsFactory=h,this.baseTransform=l}createPatternCanvas(n){const s=this.operatorList,a=this.bbox,h=this.xstep,l=this.ystep,g=this.paintType,u=this.tilingType,p=this.color,R=this.canvasGraphicsFactory;(0,d.info)("TilingType: "+u);const e=a[0],i=a[1],o=a[2],m=a[3],M=d.Util.singularValueDecompose2dScale(this.matrix),$=d.Util.singularValueDecompose2dScale(this.baseTransform),W=[M[0]*$[0],M[1]*$[1]],tt=this.getSizeAndScale(h,this.ctx.canvas.width,W[0]),gt=this.getSizeAndScale(l,this.ctx.canvas.height,W[1]),it=n.cachedCanvases.getCanvas("pattern",tt.size,gt.size,!0),_t=it.context,Ot=R.createCanvasGraphics(_t);Ot.groupLevel=n.groupLevel,this.setFillAndStrokeStyleToContext(Ot,g,p);let jt=e,Gt=i,Ut=o,lt=m;return e<0&&(jt=0,Ut+=Math.abs(e)),i<0&&(Gt=0,lt+=Math.abs(i)),_t.translate(-(tt.scale*jt),-(gt.scale*Gt)),Ot.transform(tt.scale,0,0,gt.scale,0,0),_t.save(),this.clipBbox(Ot,jt,Gt,Ut,lt),Ot.baseTransform=(0,Q.getCurrentTransform)(Ot.ctx),Ot.executeOperatorList(s),Ot.endDrawing(),{canvas:it.canvas,scaleX:tt.scale,scaleY:gt.scale,offsetX:jt,offsetY:Gt}}getSizeAndScale(n,s,a){n=Math.abs(n);const h=Math.max(ce.MAX_PATTERN_SIZE,s);let l=Math.ceil(n*a);return l>=h?l=h:a=l/n,{scale:a,size:l}}clipBbox(n,s,a,h,l){const g=h-s,u=l-a;n.ctx.rect(s,a,g,u),n.current.updateRectMinMax((0,Q.getCurrentTransform)(n.ctx),[s,a,h,l]),n.clip(),n.endPath()}setFillAndStrokeStyleToContext(n,s,a){const h=n.ctx,l=n.current;switch(s){case D.COLORED:const g=this.ctx;h.fillStyle=g.fillStyle,h.strokeStyle=g.strokeStyle,l.fillColor=g.fillStyle,l.strokeColor=g.strokeStyle;break;case D.UNCOLORED:const u=d.Util.makeHexColor(a[0],a[1],a[2]);h.fillStyle=u,h.strokeStyle=u,l.fillColor=u,l.strokeColor=u;break;default:throw new d.FormatError(`Unsupported paint type: ${s}`)}}getPattern(n,s,a,h){let l=a;h!==H.SHADING&&(l=d.Util.transform(l,s.baseTransform),this.matrix&&(l=d.Util.transform(l,this.matrix)));const g=this.createPatternCanvas(s);let u=new DOMMatrix(l);u=u.translate(g.offsetX,g.offsetY),u=u.scale(1/g.scaleX,1/g.scaleY);const p=n.createPattern(g.canvas,"repeat");return p.setTransform(u),p}};he(ce,"MAX_PATTERN_SIZE",3e3);let L=ce;function Z({src:S,srcPos:n=0,dest:s,width:a,height:h,nonBlackColor:l=4294967295,inverseDecode:g=!1}){const u=d.FeatureTest.isLittleEndian?4278190080:255,[p,R]=g?[l,u]:[u,l],e=a>>3,i=a&7,o=S.length;s=new Uint32Array(s.buffer);let m=0;for(let M=0;M<h;M++){for(const W=n+e;n<W;n++){const tt=n<o?S[n]:255;s[m++]=tt&128?R:p,s[m++]=tt&64?R:p,s[m++]=tt&32?R:p,s[m++]=tt&16?R:p,s[m++]=tt&8?R:p,s[m++]=tt&4?R:p,s[m++]=tt&2?R:p,s[m++]=tt&1?R:p}if(i===0)continue;const $=n<o?S[n++]:255;for(let W=0;W<i;W++)s[m++]=$&1<<7-W?R:p}return{srcPos:n,destPos:m}}const B=16,K=100,k=4096,O=15,C=10,P=1e3,ht=16;function st(S,n){if(S._removeMirroring)throw new Error("Context is already forwarding operations.");S.__originalSave=S.save,S.__originalRestore=S.restore,S.__originalRotate=S.rotate,S.__originalScale=S.scale,S.__originalTranslate=S.translate,S.__originalTransform=S.transform,S.__originalSetTransform=S.setTransform,S.__originalResetTransform=S.resetTransform,S.__originalClip=S.clip,S.__originalMoveTo=S.moveTo,S.__originalLineTo=S.lineTo,S.__originalBezierCurveTo=S.bezierCurveTo,S.__originalRect=S.rect,S.__originalClosePath=S.closePath,S.__originalBeginPath=S.beginPath,S._removeMirroring=()=>{S.save=S.__originalSave,S.restore=S.__originalRestore,S.rotate=S.__originalRotate,S.scale=S.__originalScale,S.translate=S.__originalTranslate,S.transform=S.__originalTransform,S.setTransform=S.__originalSetTransform,S.resetTransform=S.__originalResetTransform,S.clip=S.__originalClip,S.moveTo=S.__originalMoveTo,S.lineTo=S.__originalLineTo,S.bezierCurveTo=S.__originalBezierCurveTo,S.rect=S.__originalRect,S.closePath=S.__originalClosePath,S.beginPath=S.__originalBeginPath,delete S._removeMirroring},S.save=function(){n.save(),this.__originalSave()},S.restore=function(){n.restore(),this.__originalRestore()},S.translate=function(s,a){n.translate(s,a),this.__originalTranslate(s,a)},S.scale=function(s,a){n.scale(s,a),this.__originalScale(s,a)},S.transform=function(s,a,h,l,g,u){n.transform(s,a,h,l,g,u),this.__originalTransform(s,a,h,l,g,u)},S.setTransform=function(s,a,h,l,g,u){n.setTransform(s,a,h,l,g,u),this.__originalSetTransform(s,a,h,l,g,u)},S.resetTransform=function(){n.resetTransform(),this.__originalResetTransform()},S.rotate=function(s){n.rotate(s),this.__originalRotate(s)},S.clip=function(s){n.clip(s),this.__originalClip(s)},S.moveTo=function(s,a){n.moveTo(s,a),this.__originalMoveTo(s,a)},S.lineTo=function(s,a){n.lineTo(s,a),this.__originalLineTo(s,a)},S.bezierCurveTo=function(s,a,h,l,g,u){n.bezierCurveTo(s,a,h,l,g,u),this.__originalBezierCurveTo(s,a,h,l,g,u)},S.rect=function(s,a,h,l){n.rect(s,a,h,l),this.__originalRect(s,a,h,l)},S.closePath=function(){n.closePath(),this.__originalClosePath()},S.beginPath=function(){n.beginPath(),this.__originalBeginPath()}}class bt{constructor(n){this.canvasFactory=n,this.cache=Object.create(null)}getCanvas(n,s,a){let h;return this.cache[n]!==void 0?(h=this.cache[n],this.canvasFactory.reset(h,s,a)):(h=this.canvasFactory.create(s,a),this.cache[n]=h),h}delete(n){delete this.cache[n]}clear(){for(const n in this.cache){const s=this.cache[n];this.canvasFactory.destroy(s),delete this.cache[n]}}}function Tt(S,n,s,a,h,l,g,u,p,R){const[e,i,o,m,M,$]=(0,Q.getCurrentTransform)(S);if(i===0&&o===0){const gt=g*e+M,it=Math.round(gt),_t=u*m+$,Ot=Math.round(_t),jt=(g+p)*e+M,Gt=Math.abs(Math.round(jt)-it)||1,Ut=(u+R)*m+$,lt=Math.abs(Math.round(Ut)-Ot)||1;return S.setTransform(Math.sign(e),0,0,Math.sign(m),it,Ot),S.drawImage(n,s,a,h,l,0,0,Gt,lt),S.setTransform(e,i,o,m,M,$),[Gt,lt]}if(e===0&&m===0){const gt=u*o+M,it=Math.round(gt),_t=g*i+$,Ot=Math.round(_t),jt=(u+R)*o+M,Gt=Math.abs(Math.round(jt)-it)||1,Ut=(g+p)*i+$,lt=Math.abs(Math.round(Ut)-Ot)||1;return S.setTransform(0,Math.sign(i),Math.sign(o),0,it,Ot),S.drawImage(n,s,a,h,l,0,0,lt,Gt),S.setTransform(e,i,o,m,M,$),[lt,Gt]}S.drawImage(n,s,a,h,l,g,u,p,R);const W=Math.hypot(e,i),tt=Math.hypot(o,m);return[W*p,tt*R]}function ot(S){const{width:n,height:s}=S;if(n>P||s>P)return null;const a=1e3,h=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=n+1;let g=new Uint8Array(l*(s+1)),u,p,R;const e=n+7&-8;let i=new Uint8Array(e*s),o=0;for(const W of S.data){let tt=128;for(;tt>0;)i[o++]=W&tt?0:255,tt>>=1}let m=0;for(o=0,i[o]!==0&&(g[0]=1,++m),p=1;p<n;p++)i[o]!==i[o+1]&&(g[p]=i[o]?2:1,++m),o++;for(i[o]!==0&&(g[p]=2,++m),u=1;u<s;u++){o=u*e,R=u*l,i[o-e]!==i[o]&&(g[R]=i[o]?1:8,++m);let W=(i[o]?4:0)+(i[o-e]?8:0);for(p=1;p<n;p++)W=(W>>2)+(i[o+1]?4:0)+(i[o-e+1]?8:0),h[W]&&(g[R+p]=h[W],++m),o++;if(i[o-e]!==i[o]&&(g[R+p]=i[o]?2:4,++m),m>a)return null}for(o=e*(s-1),R=u*l,i[o]!==0&&(g[R]=8,++m),p=1;p<n;p++)i[o]!==i[o+1]&&(g[R+p]=i[o]?4:8,++m),o++;if(i[o]!==0&&(g[R+p]=4,++m),m>a)return null;const M=new Int32Array([0,l,-1,0,-l,0,0,0,1]),$=new Path2D;for(u=0;m&&u<=s;u++){let W=u*l;const tt=W+n;for(;W<tt&&!g[W];)W++;if(W===tt)continue;$.moveTo(W%l,u);const gt=W;let it=g[W];do{const _t=M[it];do W+=_t;while(!g[W]);const Ot=g[W];Ot!==5&&Ot!==10?(it=Ot,g[W]=0):(it=Ot&51*it>>4,g[W]&=it>>2|it<<2),$.lineTo(W%l,W/l|0),g[W]||--m}while(gt!==W);--u}return i=null,g=null,function(W){W.save(),W.scale(1/n,-1/s),W.translate(0,-s),W.fill($),W.beginPath(),W.restore()}}class nt{constructor(n,s){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=d.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=d.FONT_IDENTITY_MATRIX,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=d.TextRenderingMode.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,n,s])}clone(){const n=Object.create(this);return n.clipBox=this.clipBox.slice(),n}setCurrentPoint(n,s){this.x=n,this.y=s}updatePathMinMax(n,s,a){[s,a]=d.Util.applyTransform([s,a],n),this.minX=Math.min(this.minX,s),this.minY=Math.min(this.minY,a),this.maxX=Math.max(this.maxX,s),this.maxY=Math.max(this.maxY,a)}updateRectMinMax(n,s){const a=d.Util.applyTransform(s,n),h=d.Util.applyTransform(s.slice(2),n),l=d.Util.applyTransform([s[0],s[3]],n),g=d.Util.applyTransform([s[2],s[1]],n);this.minX=Math.min(this.minX,a[0],h[0],l[0],g[0]),this.minY=Math.min(this.minY,a[1],h[1],l[1],g[1]),this.maxX=Math.max(this.maxX,a[0],h[0],l[0],g[0]),this.maxY=Math.max(this.maxY,a[1],h[1],l[1],g[1])}updateScalingPathMinMax(n,s){d.Util.scaleMinMax(n,s),this.minX=Math.min(this.minX,s[0]),this.minY=Math.min(this.minY,s[1]),this.maxX=Math.max(this.maxX,s[2]),this.maxY=Math.max(this.maxY,s[3])}updateCurvePathMinMax(n,s,a,h,l,g,u,p,R,e){const i=d.Util.bezierBoundingBox(s,a,h,l,g,u,p,R,e);e||this.updateRectMinMax(n,i)}getPathBoundingBox(n=H.FILL,s=null){const a=[this.minX,this.minY,this.maxX,this.maxY];if(n===H.STROKE){s||(0,d.unreachable)("Stroke bounding box must include transform.");const h=d.Util.singularValueDecompose2dScale(s),l=h[0]*this.lineWidth/2,g=h[1]*this.lineWidth/2;a[0]-=l,a[1]-=g,a[2]+=l,a[3]+=g}return a}updateClipFromPath(){const n=d.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(n||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(n){this.clipBox=n,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(n=H.FILL,s=null){return d.Util.intersect(this.clipBox,this.getPathBoundingBox(n,s))}}function Mt(S,n){if(typeof ImageData<"u"&&n instanceof ImageData){S.putImageData(n,0,0);return}const s=n.height,a=n.width,h=s%ht,l=(s-h)/ht,g=h===0?l:l+1,u=S.createImageData(a,ht);let p=0,R;const e=n.data,i=u.data;let o,m,M,$;if(n.kind===d.ImageKind.GRAYSCALE_1BPP){const W=e.byteLength,tt=new Uint32Array(i.buffer,0,i.byteLength>>2),gt=tt.length,it=a+7>>3,_t=4294967295,Ot=d.FeatureTest.isLittleEndian?4278190080:255;for(o=0;o<g;o++){for(M=o<l?ht:h,R=0,m=0;m<M;m++){const jt=W-p;let Gt=0;const Ut=jt>it?a:jt*8-7,lt=Ut&-8;let ut=0,T=0;for(;Gt<lt;Gt+=8)T=e[p++],tt[R++]=T&128?_t:Ot,tt[R++]=T&64?_t:Ot,tt[R++]=T&32?_t:Ot,tt[R++]=T&16?_t:Ot,tt[R++]=T&8?_t:Ot,tt[R++]=T&4?_t:Ot,tt[R++]=T&2?_t:Ot,tt[R++]=T&1?_t:Ot;for(;Gt<Ut;Gt++)ut===0&&(T=e[p++],ut=128),tt[R++]=T&ut?_t:Ot,ut>>=1}for(;R<gt;)tt[R++]=0;S.putImageData(u,0,o*ht)}}else if(n.kind===d.ImageKind.RGBA_32BPP){for(m=0,$=a*ht*4,o=0;o<l;o++)i.set(e.subarray(p,p+$)),p+=$,S.putImageData(u,0,m),m+=ht;o<g&&($=a*h*4,i.set(e.subarray(p,p+$)),S.putImageData(u,0,m))}else if(n.kind===d.ImageKind.RGB_24BPP)for(M=ht,$=a*M,o=0;o<g;o++){for(o>=l&&(M=h,$=a*M),R=0,m=$;m--;)i[R++]=e[p++],i[R++]=e[p++],i[R++]=e[p++],i[R++]=255;S.putImageData(u,0,o*ht)}else throw new Error(`bad image kind: ${n.kind}`)}function It(S,n){if(n.bitmap){S.drawImage(n.bitmap,0,0);return}const s=n.height,a=n.width,h=s%ht,l=(s-h)/ht,g=h===0?l:l+1,u=S.createImageData(a,ht);let p=0;const R=n.data,e=u.data;for(let i=0;i<g;i++){const o=i<l?ht:h;({srcPos:p}=Z({src:R,srcPos:p,dest:e,width:a,height:o,nonBlackColor:0})),S.putImageData(u,0,i*ht)}}function Pt(S,n){const s=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const a of s)S[a]!==void 0&&(n[a]=S[a]);S.setLineDash!==void 0&&(n.setLineDash(S.getLineDash()),n.lineDashOffset=S.lineDashOffset)}function Xt(S){if(S.strokeStyle=S.fillStyle="#000000",S.fillRule="nonzero",S.globalAlpha=1,S.lineWidth=1,S.lineCap="butt",S.lineJoin="miter",S.miterLimit=10,S.globalCompositeOperation="source-over",S.font="10px sans-serif",S.setLineDash!==void 0&&(S.setLineDash([]),S.lineDashOffset=0),!d.isNodeJS){const{filter:n}=S;n!=="none"&&n!==""&&(S.filter="none")}}function ae(S,n,s,a){const h=S.length;for(let l=3;l<h;l+=4){const g=S[l];if(g===0)S[l-3]=n,S[l-2]=s,S[l-1]=a;else if(g<255){const u=255-g;S[l-3]=S[l-3]*g+n*u>>8,S[l-2]=S[l-2]*g+s*u>>8,S[l-1]=S[l-1]*g+a*u>>8}}}function Jt(S,n,s){const a=S.length,h=1/255;for(let l=3;l<a;l+=4){const g=s?s[S[l]]:S[l];n[l]=n[l]*g*h|0}}function re(S,n,s){const a=S.length;for(let h=3;h<a;h+=4){const l=S[h-3]*77+S[h-2]*152+S[h-1]*28;n[h]=s?n[h]*s[l>>8]>>8:n[h]*l>>16}}function oe(S,n,s,a,h,l,g,u,p,R,e){const i=!!l,o=i?l[0]:0,m=i?l[1]:0,M=i?l[2]:0,$=h==="Luminosity"?re:Jt,W=Math.min(a,Math.ceil(1048576/s));for(let tt=0;tt<a;tt+=W){const gt=Math.min(W,a-tt),it=S.getImageData(u-R,tt+(p-e),s,gt),_t=n.getImageData(u,tt+p,s,gt);i&&ae(it.data,o,m,M),$(it.data,_t.data,g),n.putImageData(_t,u,tt+p)}}function Rt(S,n,s,a){const h=a[0],l=a[1],g=a[2]-h,u=a[3]-l;g===0||u===0||(oe(n.context,s,g,u,n.subtype,n.backdrop,n.transferMap,h,l,n.offsetX,n.offsetY),S.save(),S.globalAlpha=1,S.globalCompositeOperation="source-over",S.setTransform(1,0,0,1,0,0),S.drawImage(s.canvas,0,0),S.restore())}function Qt(S,n){if(n)return!0;const s=d.Util.singularValueDecompose2dScale(S);s[0]=Math.fround(s[0]),s[1]=Math.fround(s[1]);const a=Math.fround((globalThis.devicePixelRatio||1)*Q.PixelsPerInch.PDF_TO_CSS_UNITS);return s[0]<=a&&s[1]<=a}const ue=["butt","round","square"],Ae=["miter","round","bevel"],Bt={},le={},pt=class pt{constructor(n,s,a,h,l,{optionalContentConfig:g,markedContentStack:u=null},p,R){_(this,Zt);this.ctx=n,this.current=new nt(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=s,this.objs=a,this.canvasFactory=h,this.filterFactory=l,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=u||[],this.optionalContentConfig=g,this.cachedCanvases=new bt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=p,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=R,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(n,s=null){return typeof n=="string"?n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n):s}beginDrawing({transform:n,viewport:s,transparency:a=!1,background:h=null}){const l=this.ctx.canvas.width,g=this.ctx.canvas.height,u=this.ctx.fillStyle;if(this.ctx.fillStyle=h||"#ffffff",this.ctx.fillRect(0,0,l,g),this.ctx.fillStyle=u,a){const p=this.cachedCanvases.getCanvas("transparent",l,g);this.compositeCtx=this.ctx,this.transparentCanvas=p.canvas,this.ctx=p.context,this.ctx.save(),this.ctx.transform(...(0,Q.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),Xt(this.ctx),n&&(this.ctx.transform(...n),this.outputScaleX=n[0],this.outputScaleY=n[0]),this.ctx.transform(...s.transform),this.viewportScale=s.scale,this.baseTransform=(0,Q.getCurrentTransform)(this.ctx)}executeOperatorList(n,s,a,h){const l=n.argsArray,g=n.fnArray;let u=s||0;const p=l.length;if(p===u)return u;const R=p-u>C&&typeof a=="function",e=R?Date.now()+O:0;let i=0;const o=this.commonObjs,m=this.objs;let M;for(;;){if(h!==void 0&&u===h.nextBreakPoint)return h.breakIt(u,a),u;if(M=g[u],M!==d.OPS.dependency)this[M].apply(this,l[u]);else for(const $ of l[u]){const W=$.startsWith("g_")?o:m;if(!W.has($))return W.get($,a),u}if(u++,u===p)return u;if(R&&++i>C){if(Date.now()>e)return a(),u;i=0}}}endDrawing(){b(this,Zt,xi).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const n of this._cachedBitmapsMap.values()){for(const s of n.values())typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&(s.width=s.height=0);n.clear()}this._cachedBitmapsMap.clear(),b(this,Zt,Ei).call(this)}_scaleImage(n,s){const a=n.width,h=n.height;let l=Math.max(Math.hypot(s[0],s[1]),1),g=Math.max(Math.hypot(s[2],s[3]),1),u=a,p=h,R="prescale1",e,i;for(;l>2&&u>1||g>2&&p>1;){let o=u,m=p;l>2&&u>1&&(o=u>=16384?Math.floor(u/2)-1||1:Math.ceil(u/2),l/=u/o),g>2&&p>1&&(m=p>=16384?Math.floor(p/2)-1||1:Math.ceil(p)/2,g/=p/m),e=this.cachedCanvases.getCanvas(R,o,m),i=e.context,i.clearRect(0,0,o,m),i.drawImage(n,0,0,u,p,0,0,o,m),n=e.canvas,u=o,p=m,R=R==="prescale1"?"prescale2":"prescale1"}return{img:n,paintWidth:u,paintHeight:p}}_createMaskCanvas(n){const s=this.ctx,{width:a,height:h}=n,l=this.current.fillColor,g=this.current.patternFill,u=(0,Q.getCurrentTransform)(s);let p,R,e,i;if((n.bitmap||n.data)&&n.count>1){const Ut=n.bitmap||n.data.buffer;R=JSON.stringify(g?u:[u.slice(0,4),l]),p=this._cachedBitmapsMap.get(Ut),p||(p=new Map,this._cachedBitmapsMap.set(Ut,p));const lt=p.get(R);if(lt&&!g){const ut=Math.round(Math.min(u[0],u[2])+u[4]),T=Math.round(Math.min(u[1],u[3])+u[5]);return{canvas:lt,offsetX:ut,offsetY:T}}e=lt}e||(i=this.cachedCanvases.getCanvas("maskCanvas",a,h),It(i.context,n));let o=d.Util.transform(u,[1/a,0,0,-1/h,0,0]);o=d.Util.transform(o,[1,0,0,1,0,-h]);const[m,M,$,W]=d.Util.getAxialAlignedBoundingBox([0,0,a,h],o),tt=Math.round($-m)||1,gt=Math.round(W-M)||1,it=this.cachedCanvases.getCanvas("fillCanvas",tt,gt),_t=it.context,Ot=m,jt=M;_t.translate(-Ot,-jt),_t.transform(...o),e||(e=this._scaleImage(i.canvas,(0,Q.getCurrentTransformInverse)(_t)),e=e.img,p&&g&&p.set(R,e)),_t.imageSmoothingEnabled=Qt((0,Q.getCurrentTransform)(_t),n.interpolate),Tt(_t,e,0,0,e.width,e.height,0,0,a,h),_t.globalCompositeOperation="source-in";const Gt=d.Util.transform((0,Q.getCurrentTransformInverse)(_t),[1,0,0,1,-Ot,-jt]);return _t.fillStyle=g?l.getPattern(s,this,Gt,H.FILL):l,_t.fillRect(0,0,a,h),p&&!g&&(this.cachedCanvases.delete("fillCanvas"),p.set(R,it.canvas)),{canvas:it.canvas,offsetX:Math.round(Ot),offsetY:Math.round(jt)}}setLineWidth(n){n!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=n,this.ctx.lineWidth=n}setLineCap(n){this.ctx.lineCap=ue[n]}setLineJoin(n){this.ctx.lineJoin=Ae[n]}setMiterLimit(n){this.ctx.miterLimit=n}setDash(n,s){const a=this.ctx;a.setLineDash!==void 0&&(a.setLineDash(n),a.lineDashOffset=s)}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[s,a]of n)switch(s){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=a;break;case"ca":this.current.fillAlpha=a,this.ctx.globalAlpha=a;break;case"BM":this.ctx.globalCompositeOperation=a;break;case"SMask":this.current.activeSMask=a?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(a);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const n=this.inSMaskMode;this.current.activeSMask&&!n?this.beginSMaskMode():!this.current.activeSMask&&n&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const n=this.ctx.canvas.width,s=this.ctx.canvas.height,a="smaskGroupAt"+this.groupLevel,h=this.cachedCanvases.getCanvas(a,n,s);this.suspendedCtx=this.ctx,this.ctx=h.context;const l=this.ctx;l.setTransform(...(0,Q.getCurrentTransform)(this.suspendedCtx)),Pt(this.suspendedCtx,l),st(l,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(),Pt(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(n){if(!this.current.activeSMask)return;n?(n[0]=Math.floor(n[0]),n[1]=Math.floor(n[1]),n[2]=Math.ceil(n[2]),n[3]=Math.ceil(n[3])):n=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const s=this.current.activeSMask,a=this.suspendedCtx;Rt(a,s,this.ctx,n),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()}save(){this.inSMaskMode?(Pt(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const n=this.current;this.stateStack.push(n),this.current=n.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Pt(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(n,s,a,h,l,g){this.ctx.transform(n,s,a,h,l,g),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(n,s,a){const h=this.ctx,l=this.current;let g=l.x,u=l.y,p,R;const e=(0,Q.getCurrentTransform)(h),i=e[0]===0&&e[3]===0||e[1]===0&&e[2]===0,o=i?a.slice(0):null;for(let m=0,M=0,$=n.length;m<$;m++)switch(n[m]|0){case d.OPS.rectangle:g=s[M++],u=s[M++];const W=s[M++],tt=s[M++],gt=g+W,it=u+tt;h.moveTo(g,u),W===0||tt===0?h.lineTo(gt,it):(h.lineTo(gt,u),h.lineTo(gt,it),h.lineTo(g,it)),i||l.updateRectMinMax(e,[g,u,gt,it]),h.closePath();break;case d.OPS.moveTo:g=s[M++],u=s[M++],h.moveTo(g,u),i||l.updatePathMinMax(e,g,u);break;case d.OPS.lineTo:g=s[M++],u=s[M++],h.lineTo(g,u),i||l.updatePathMinMax(e,g,u);break;case d.OPS.curveTo:p=g,R=u,g=s[M+4],u=s[M+5],h.bezierCurveTo(s[M],s[M+1],s[M+2],s[M+3],g,u),l.updateCurvePathMinMax(e,p,R,s[M],s[M+1],s[M+2],s[M+3],g,u,o),M+=6;break;case d.OPS.curveTo2:p=g,R=u,h.bezierCurveTo(g,u,s[M],s[M+1],s[M+2],s[M+3]),l.updateCurvePathMinMax(e,p,R,g,u,s[M],s[M+1],s[M+2],s[M+3],o),g=s[M+2],u=s[M+3],M+=4;break;case d.OPS.curveTo3:p=g,R=u,g=s[M+2],u=s[M+3],h.bezierCurveTo(s[M],s[M+1],g,u,g,u),l.updateCurvePathMinMax(e,p,R,s[M],s[M+1],g,u,g,u,o),M+=4;break;case d.OPS.closePath:h.closePath();break}i&&l.updateScalingPathMinMax(e,o),l.setCurrentPoint(g,u)}closePath(){this.ctx.closePath()}stroke(n=!0){const s=this.ctx,a=this.current.strokeColor;s.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof a=="object"&&(a!=null&&a.getPattern)?(s.save(),s.strokeStyle=a.getPattern(s,this,(0,Q.getCurrentTransformInverse)(s),H.STROKE),this.rescaleAndStroke(!1),s.restore()):this.rescaleAndStroke(!0)),n&&this.consumePath(this.current.getClippedPathBoundingBox()),s.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(n=!0){const s=this.ctx,a=this.current.fillColor,h=this.current.patternFill;let l=!1;h&&(s.save(),s.fillStyle=a.getPattern(s,this,(0,Q.getCurrentTransformInverse)(s),H.FILL),l=!0);const g=this.current.getClippedPathBoundingBox();this.contentVisible&&g!==null&&(this.pendingEOFill?(s.fill("evenodd"),this.pendingEOFill=!1):s.fill()),l&&s.restore(),n&&this.consumePath(g)}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=Bt}eoClip(){this.pendingClip=le}beginText(){this.current.textMatrix=d.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const n=this.pendingTextPaths,s=this.ctx;if(n===void 0){s.beginPath();return}s.save(),s.beginPath();for(const a of n)s.setTransform(...a.transform),s.translate(a.x,a.y),a.addToPath(s,a.fontSize);s.restore(),s.clip(),s.beginPath(),delete this.pendingTextPaths}setCharSpacing(n){this.current.charSpacing=n}setWordSpacing(n){this.current.wordSpacing=n}setHScale(n){this.current.textHScale=n/100}setLeading(n){this.current.leading=-n}setFont(n,s){var e;const a=this.commonObjs.get(n),h=this.current;if(!a)throw new Error(`Can't find font for ${n}`);if(h.fontMatrix=a.fontMatrix||d.FONT_IDENTITY_MATRIX,(h.fontMatrix[0]===0||h.fontMatrix[3]===0)&&(0,d.warn)("Invalid font matrix for font "+n),s<0?(s=-s,h.fontDirection=-1):h.fontDirection=1,this.current.font=a,this.current.fontSize=s,a.isType3Font)return;const l=a.loadedName||"sans-serif",g=((e=a.systemFontInfo)==null?void 0:e.css)||`"${l}", ${a.fallbackName}`;let u="normal";a.black?u="900":a.bold&&(u="bold");const p=a.italic?"italic":"normal";let R=s;s<B?R=B:s>K&&(R=K),this.current.fontSizeScale=s/R,this.ctx.font=`${p} ${u} ${R}px ${g}`}setTextRenderingMode(n){this.current.textRenderingMode=n}setTextRise(n){this.current.textRise=n}moveText(n,s){this.current.x=this.current.lineX+=n,this.current.y=this.current.lineY+=s}setLeadingMoveText(n,s){this.setLeading(-s),this.moveText(n,s)}setTextMatrix(n,s,a,h,l,g){this.current.textMatrix=[n,s,a,h,l,g],this.current.textMatrixScale=Math.hypot(n,s),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(n,s,a,h){const l=this.ctx,g=this.current,u=g.font,p=g.textRenderingMode,R=g.fontSize/g.fontSizeScale,e=p&d.TextRenderingMode.FILL_STROKE_MASK,i=!!(p&d.TextRenderingMode.ADD_TO_PATH_FLAG),o=g.patternFill&&!u.missingFile;let m;(u.disableFontFace||i||o)&&(m=u.getPathGenerator(this.commonObjs,n)),u.disableFontFace||o?(l.save(),l.translate(s,a),l.beginPath(),m(l,R),h&&l.setTransform(...h),(e===d.TextRenderingMode.FILL||e===d.TextRenderingMode.FILL_STROKE)&&l.fill(),(e===d.TextRenderingMode.STROKE||e===d.TextRenderingMode.FILL_STROKE)&&l.stroke(),l.restore()):((e===d.TextRenderingMode.FILL||e===d.TextRenderingMode.FILL_STROKE)&&l.fillText(n,s,a),(e===d.TextRenderingMode.STROKE||e===d.TextRenderingMode.FILL_STROKE)&&l.strokeText(n,s,a)),i&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,Q.getCurrentTransform)(l),x:s,y:a,fontSize:R,addToPath:m})}get isFontSubpixelAAEnabled(){const{context:n}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);n.scale(1.5,1),n.fillText("I",0,10);const s=n.getImageData(0,0,10,10).data;let a=!1;for(let h=3;h<s.length;h+=4)if(s[h]>0&&s[h]<255){a=!0;break}return(0,d.shadow)(this,"isFontSubpixelAAEnabled",a)}showText(n){const s=this.current,a=s.font;if(a.isType3Font)return this.showType3Text(n);const h=s.fontSize;if(h===0)return;const l=this.ctx,g=s.fontSizeScale,u=s.charSpacing,p=s.wordSpacing,R=s.fontDirection,e=s.textHScale*R,i=n.length,o=a.vertical,m=o?1:-1,M=a.defaultVMetrics,$=h*s.fontMatrix[0],W=s.textRenderingMode===d.TextRenderingMode.FILL&&!a.disableFontFace&&!s.patternFill;l.save(),l.transform(...s.textMatrix),l.translate(s.x,s.y+s.textRise),R>0?l.scale(e,-1):l.scale(e,1);let tt;if(s.patternFill){l.save();const jt=s.fillColor.getPattern(l,this,(0,Q.getCurrentTransformInverse)(l),H.FILL);tt=(0,Q.getCurrentTransform)(l),l.restore(),l.fillStyle=jt}let gt=s.lineWidth;const it=s.textMatrixScale;if(it===0||gt===0){const jt=s.textRenderingMode&d.TextRenderingMode.FILL_STROKE_MASK;(jt===d.TextRenderingMode.STROKE||jt===d.TextRenderingMode.FILL_STROKE)&&(gt=this.getSinglePixelWidth())}else gt/=it;if(g!==1&&(l.scale(g,g),gt/=g),l.lineWidth=gt,a.isInvalidPDFjsFont){const jt=[];let Gt=0;for(const Ut of n)jt.push(Ut.unicode),Gt+=Ut.width;l.fillText(jt.join(""),0,0),s.x+=Gt*$*e,l.restore(),this.compose();return}let _t=0,Ot;for(Ot=0;Ot<i;++Ot){const jt=n[Ot];if(typeof jt=="number"){_t+=m*jt*h/1e3;continue}let Gt=!1;const Ut=(jt.isSpace?p:0)+u,lt=jt.fontChar,ut=jt.accent;let T,X,Y=jt.width;if(o){const Et=jt.vmetric||M,Lt=-(jt.vmetric?Et[1]:Y*.5)*$,Ht=Et[2]*$;Y=Et?-Et[0]:Y,T=Lt/g,X=(_t+Ht)/g}else T=_t/g,X=0;if(a.remeasure&&Y>0){const Et=l.measureText(lt).width*1e3/h*g;if(Y<Et&&this.isFontSubpixelAAEnabled){const Lt=Y/Et;Gt=!0,l.save(),l.scale(Lt,1),T/=Lt}else Y!==Et&&(T+=(Y-Et)/2e3*h/g)}if(this.contentVisible&&(jt.isInFont||a.missingFile)){if(W&&!ut)l.fillText(lt,T,X);else if(this.paintChar(lt,T,X,tt),ut){const Et=T+h*ut.offset.x/g,Lt=X-h*ut.offset.y/g;this.paintChar(ut.fontChar,Et,Lt,tt)}}const vt=o?Y*$-Ut*R:Y*$+Ut*R;_t+=vt,Gt&&l.restore()}o?s.y-=_t:s.x+=_t*e,l.restore(),this.compose()}showType3Text(n){const s=this.ctx,a=this.current,h=a.font,l=a.fontSize,g=a.fontDirection,u=h.vertical?1:-1,p=a.charSpacing,R=a.wordSpacing,e=a.textHScale*g,i=a.fontMatrix||d.FONT_IDENTITY_MATRIX,o=n.length,m=a.textRenderingMode===d.TextRenderingMode.INVISIBLE;let M,$,W,tt;if(!(m||l===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),s.transform(...a.textMatrix),s.translate(a.x,a.y),s.scale(e,g),M=0;M<o;++M){if($=n[M],typeof $=="number"){tt=u*$*l/1e3,this.ctx.translate(tt,0),a.x+=tt*e;continue}const gt=($.isSpace?R:0)+p,it=h.charProcOperatorList[$.operatorListId];if(!it){(0,d.warn)(`Type3 character "${$.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=$,this.save(),s.scale(l,l),s.transform(...i),this.executeOperatorList(it),this.restore()),W=d.Util.applyTransform([$.width,0],i)[0]*l+gt,s.translate(W,0),a.x+=W*e}s.restore(),this.processingType3=null}}setCharWidth(n,s){}setCharWidthAndBounds(n,s,a,h,l,g){this.ctx.rect(a,h,l-a,g-h),this.ctx.clip(),this.endPath()}getColorN_Pattern(n){let s;if(n[0]==="TilingPattern"){const a=n[1],h=this.baseTransform||(0,Q.getCurrentTransform)(this.ctx),l={createCanvasGraphics:g=>new pt(g,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};s=new L(n,a,this.ctx,l,h)}else s=this._getPattern(n[1],n[2]);return s}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(n,s,a){const h=d.Util.makeHexColor(n,s,a);this.ctx.strokeStyle=h,this.current.strokeColor=h}setFillRGBColor(n,s,a){const h=d.Util.makeHexColor(n,s,a);this.ctx.fillStyle=h,this.current.fillColor=h,this.current.patternFill=!1}_getPattern(n,s=null){let a;return this.cachedPatterns.has(n)?a=this.cachedPatterns.get(n):(a=y(this.getObject(n)),this.cachedPatterns.set(n,a)),s&&(a.matrix=s),a}shadingFill(n){if(!this.contentVisible)return;const s=this.ctx;this.save();const a=this._getPattern(n);s.fillStyle=a.getPattern(s,this,(0,Q.getCurrentTransformInverse)(s),H.SHADING);const h=(0,Q.getCurrentTransformInverse)(s);if(h){const{width:l,height:g}=s.canvas,[u,p,R,e]=d.Util.getAxialAlignedBoundingBox([0,0,l,g],h);this.ctx.fillRect(u,p,R-u,e-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,d.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,d.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(n,s){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(n)&&n.length===6&&this.transform(...n),this.baseTransform=(0,Q.getCurrentTransform)(this.ctx),s)){const a=s[2]-s[0],h=s[3]-s[1];this.ctx.rect(s[0],s[1],a,h),this.current.updateRectMinMax((0,Q.getCurrentTransform)(this.ctx),s),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(n){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;n.isolated||(0,d.info)("TODO: Support non-isolated groups."),n.knockout&&(0,d.warn)("Knockout groups not supported.");const a=(0,Q.getCurrentTransform)(s);if(n.matrix&&s.transform(...n.matrix),!n.bbox)throw new Error("Bounding box is required.");let h=d.Util.getAxialAlignedBoundingBox(n.bbox,(0,Q.getCurrentTransform)(s));const l=[0,0,s.canvas.width,s.canvas.height];h=d.Util.intersect(h,l)||[0,0,0,0];const g=Math.floor(h[0]),u=Math.floor(h[1]);let p=Math.max(Math.ceil(h[2])-g,1),R=Math.max(Math.ceil(h[3])-u,1),e=1,i=1;p>k&&(e=p/k,p=k),R>k&&(i=R/k,R=k),this.current.startNewPathAndClipBox([0,0,p,R]);let o="groupAt"+this.groupLevel;n.smask&&(o+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(o,p,R),M=m.context;M.scale(1/e,1/i),M.translate(-g,-u),M.transform(...a),n.smask?this.smaskStack.push({canvas:m.canvas,context:M,offsetX:g,offsetY:u,scaleX:e,scaleY:i,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null,startTransformInverse:null}):(s.setTransform(1,0,0,1,0,0),s.translate(g,u),s.scale(e,i),s.save()),Pt(s,M),this.ctx=M,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(n){if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,n.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const h=(0,Q.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...h);const l=d.Util.getAxialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],h);this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(n,s,a,h,l){if(b(this,Zt,xi).call(this),Xt(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(s)&&s.length===4){const g=s[2]-s[0],u=s[3]-s[1];if(l&&this.annotationCanvasMap){a=a.slice(),a[4]-=s[0],a[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=g,s[3]=u;const[p,R]=d.Util.singularValueDecompose2dScale((0,Q.getCurrentTransform)(this.ctx)),{viewportScale:e}=this,i=Math.ceil(g*this.outputScaleX*e),o=Math.ceil(u*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(i,o);const{canvas:m,context:M}=this.annotationCanvas;this.annotationCanvasMap.set(n,m),this.annotationCanvas.savedCtx=this.ctx,this.ctx=M,this.ctx.save(),this.ctx.setTransform(p,0,0,-R,0,u*R),Xt(this.ctx)}else Xt(this.ctx),this.ctx.rect(s[0],s[1],g,u),this.ctx.clip(),this.endPath()}this.current=new nt(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...a),this.transform(...h)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,Zt,Ei).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(n){if(!this.contentVisible)return;const s=n.count;n=this.getObject(n.data,n),n.count=s;const a=this.ctx,h=this.processingType3;if(h&&(h.compiled===void 0&&(h.compiled=ot(n)),h.compiled)){h.compiled(a);return}const l=this._createMaskCanvas(n),g=l.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(g,l.offsetX,l.offsetY),a.restore(),this.compose()}paintImageMaskXObjectRepeat(n,s,a=0,h=0,l,g){if(!this.contentVisible)return;n=this.getObject(n.data,n);const u=this.ctx;u.save();const p=(0,Q.getCurrentTransform)(u);u.transform(s,a,h,l,0,0);const R=this._createMaskCanvas(n);u.setTransform(1,0,0,1,R.offsetX-p[4],R.offsetY-p[5]);for(let e=0,i=g.length;e<i;e+=2){const o=d.Util.transform(p,[s,a,h,l,g[e],g[e+1]]),[m,M]=d.Util.applyTransform([0,0],o);u.drawImage(R.canvas,m,M)}u.restore(),this.compose()}paintImageMaskXObjectGroup(n){if(!this.contentVisible)return;const s=this.ctx,a=this.current.fillColor,h=this.current.patternFill;for(const l of n){const{data:g,width:u,height:p,transform:R}=l,e=this.cachedCanvases.getCanvas("maskCanvas",u,p),i=e.context;i.save();const o=this.getObject(g,l);It(i,o),i.globalCompositeOperation="source-in",i.fillStyle=h?a.getPattern(i,this,(0,Q.getCurrentTransformInverse)(s),H.FILL):a,i.fillRect(0,0,u,p),i.restore(),s.save(),s.transform(...R),s.scale(1,-1),Tt(s,e.canvas,0,0,u,p,0,-1,1,1),s.restore()}this.compose()}paintImageXObject(n){if(!this.contentVisible)return;const s=this.getObject(n);if(!s){(0,d.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(s)}paintImageXObjectRepeat(n,s,a,h){if(!this.contentVisible)return;const l=this.getObject(n);if(!l){(0,d.warn)("Dependent image isn't ready yet");return}const g=l.width,u=l.height,p=[];for(let R=0,e=h.length;R<e;R+=2)p.push({transform:[s,0,0,a,h[R],h[R+1]],x:0,y:0,w:g,h:u});this.paintInlineImageXObjectGroup(l,p)}applyTransferMapsToCanvas(n){return this.current.transferMaps!=="none"&&(n.filter=this.current.transferMaps,n.drawImage(n.canvas,0,0),n.filter="none"),n.canvas}applyTransferMapsToBitmap(n){if(this.current.transferMaps==="none")return n.bitmap;const{bitmap:s,width:a,height:h}=n,l=this.cachedCanvases.getCanvas("inlineImage",a,h),g=l.context;return g.filter=this.current.transferMaps,g.drawImage(s,0,0),g.filter="none",l.canvas}paintInlineImageXObject(n){if(!this.contentVisible)return;const s=n.width,a=n.height,h=this.ctx;if(this.save(),!d.isNodeJS){const{filter:u}=h;u!=="none"&&u!==""&&(h.filter="none")}h.scale(1/s,-1/a);let l;if(n.bitmap)l=this.applyTransferMapsToBitmap(n);else if(typeof HTMLElement=="function"&&n instanceof HTMLElement||!n.data)l=n;else{const u=this.cachedCanvases.getCanvas("inlineImage",s,a).context;Mt(u,n),l=this.applyTransferMapsToCanvas(u)}const g=this._scaleImage(l,(0,Q.getCurrentTransformInverse)(h));h.imageSmoothingEnabled=Qt((0,Q.getCurrentTransform)(h),n.interpolate),Tt(h,g.img,0,0,g.paintWidth,g.paintHeight,0,-a,s,a),this.compose(),this.restore()}paintInlineImageXObjectGroup(n,s){if(!this.contentVisible)return;const a=this.ctx;let h;if(n.bitmap)h=n.bitmap;else{const l=n.width,g=n.height,u=this.cachedCanvases.getCanvas("inlineImage",l,g).context;Mt(u,n),h=this.applyTransferMapsToCanvas(u)}for(const l of s)a.save(),a.transform(...l.transform),a.scale(1,-1),Tt(a,h,l.x,l.y,l.w,l.h,0,-1,1,1),a.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(n){}markPointProps(n,s){}beginMarkedContent(n){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(n,s){n==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(n){const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(n);const a=this.ctx;this.pendingClip&&(s||(this.pendingClip===le?a.clip("evenodd"):a.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),a.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const n=(0,Q.getCurrentTransform)(this.ctx);if(n[1]===0&&n[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(n[0]),Math.abs(n[3]));else{const s=Math.abs(n[0]*n[3]-n[2]*n[1]),a=Math.hypot(n[0],n[2]),h=Math.hypot(n[1],n[3]);this._cachedGetSinglePixelWidth=Math.max(a,h)/s}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:n}=this.current,{a:s,b:a,c:h,d:l}=this.ctx.getTransform();let g,u;if(a===0&&h===0){const p=Math.abs(s),R=Math.abs(l);if(p===R)if(n===0)g=u=1/p;else{const e=p*n;g=u=e<1?1/e:1}else if(n===0)g=1/p,u=1/R;else{const e=p*n,i=R*n;g=e<1?1/e:1,u=i<1?1/i:1}}else{const p=Math.abs(s*l-a*h),R=Math.hypot(s,a),e=Math.hypot(h,l);if(n===0)g=e/p,u=R/p;else{const i=n*p;g=e>i?e/i:1,u=R>i?R/i:1}}this._cachedScaleForStroking[0]=g,this._cachedScaleForStroking[1]=u}return this._cachedScaleForStroking}rescaleAndStroke(n){const{ctx:s}=this,{lineWidth:a}=this.current,[h,l]=this.getScaleForStroking();if(s.lineWidth=a||1,h===1&&l===1){s.stroke();return}const g=s.getLineDash();if(n&&s.save(),s.scale(h,l),g.length>0){const u=Math.max(h,l);s.setLineDash(g.map(p=>p/u)),s.lineDashOffset/=u}s.stroke(),n&&s.restore()}isContentVisible(){for(let n=this.markedContentStack.length-1;n>=0;n--)if(!this.markedContentStack[n].visible)return!1;return!0}};Zt=new WeakSet,xi=function(){for(;this.stateStack.length||this.inSMaskMode;)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)},Ei=function(){if(this.pageColors){const n=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(n!=="none"){const s=this.ctx.filter;this.ctx.filter=n,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=s}}};let ee=pt;for(const S in d.OPS)ee.prototype[S]!==void 0&&(ee.prototype[d.OPS[S]]=ee.prototype[S])},419:(ie,$t,dt)=>{var Pt,Xt,ae,Jt,re,oe,Rt,ms,As,bs,Si,$s,Xs,Ms,Rs;dt.d($t,{DOMCMapReaderFactory:()=>I,DOMCanvasFactory:()=>z,DOMFilterFactory:()=>At,DOMSVGFactory:()=>E,DOMStandardFontDataFactory:()=>V,PDFDateString:()=>ht,PageViewport:()=>y,PixelsPerInch:()=>J,RenderingCancelledException:()=>D,StatTimer:()=>k,fetchData:()=>F,getColorValues:()=>Tt,getCurrentTransform:()=>ot,getCurrentTransformInverse:()=>nt,getFilenameFromUrl:()=>B,getPdfFilenameFromUrl:()=>K,getRGB:()=>bt,getXfaPageViewport:()=>st,isDataScheme:()=>L,isPdfFile:()=>Z,isValidFetchUrl:()=>O,noContextMenu:()=>C,setLayerDimensions:()=>Mt});var d=dt(583),Q=dt(292);const H="http://www.w3.org/2000/svg",It=class It{};he(It,"CSS",96),he(It,"PDF",72),he(It,"PDF_TO_CSS_UNITS",It.CSS/It.PDF);let J=It;class At extends d.BaseFilterFactory{constructor({docId:pt,ownerDocument:S=globalThis.document}={}){super();_(this,Rt);_(this,Pt);_(this,Xt);_(this,ae);_(this,Jt);_(this,re);_(this,oe,0);w(this,ae,pt),w(this,Jt,S)}addFilter(pt){if(!pt)return"none";let S=t(this,Rt,ms).get(pt);if(S)return S;let n,s,a,h;if(pt.length===1){const p=pt[0],R=new Array(256);for(let e=0;e<256;e++)R[e]=p[e]/255;h=n=s=a=R.join(",")}else{const[p,R,e]=pt,i=new Array(256),o=new Array(256),m=new Array(256);for(let M=0;M<256;M++)i[M]=p[M]/255,o[M]=R[M]/255,m[M]=e[M]/255;n=i.join(","),s=o.join(","),a=m.join(","),h=`${n}${s}${a}`}if(S=t(this,Rt,ms).get(h),S)return t(this,Rt,ms).set(pt,S),S;const l=`g_${t(this,ae)}_transfer_map_${Je(this,oe)._++}`,g=`url(#${l})`;t(this,Rt,ms).set(pt,g),t(this,Rt,ms).set(h,g);const u=b(this,Rt,$s).call(this,l);return b(this,Rt,Ms).call(this,n,s,a,u),g}addHCMFilter(pt,S){var i;const n=`${pt}-${S}`,s="base";let a=t(this,Rt,As).get(s);if((a==null?void 0:a.key)===n||(a?((i=a.filter)==null||i.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},t(this,Rt,As).set(s,a)),!pt||!S))return a.url;const h=b(this,Rt,Rs).call(this,pt);pt=Q.Util.makeHexColor(...h);const l=b(this,Rt,Rs).call(this,S);if(S=Q.Util.makeHexColor(...l),t(this,Rt,bs).style.color="",pt==="#000000"&&S==="#ffffff"||pt===S)return a.url;const g=new Array(256);for(let o=0;o<=255;o++){const m=o/255;g[o]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}const u=g.join(","),p=`g_${t(this,ae)}_hcm_filter`,R=a.filter=b(this,Rt,$s).call(this,p);b(this,Rt,Ms).call(this,u,u,u,R),b(this,Rt,Si).call(this,R);const e=(o,m)=>{const M=h[o]/255,$=l[o]/255,W=new Array(m+1);for(let tt=0;tt<=m;tt++)W[tt]=M+tt/m*($-M);return W.join(",")};return b(this,Rt,Ms).call(this,e(0,5),e(1,5),e(2,5),R),a.url=`url(#${p})`,a.url}addHighlightHCMFilter(pt,S,n,s,a){var $;const h=`${S}-${n}-${s}-${a}`;let l=t(this,Rt,As).get(pt);if((l==null?void 0:l.key)===h||(l?(($=l.filter)==null||$.remove(),l.key=h,l.url="none",l.filter=null):(l={key:h,url:"none",filter:null},t(this,Rt,As).set(pt,l)),!S||!n))return l.url;const[g,u]=[S,n].map(b(this,Rt,Rs).bind(this));let p=Math.round(.2126*g[0]+.7152*g[1]+.0722*g[2]),R=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[e,i]=[s,a].map(b(this,Rt,Rs).bind(this));R<p&&([p,R,e,i]=[R,p,i,e]),t(this,Rt,bs).style.color="";const o=(W,tt,gt)=>{const it=new Array(256),_t=(R-p)/gt,Ot=W/255,jt=(tt-W)/(255*gt);let Gt=0;for(let Ut=0;Ut<=gt;Ut++){const lt=Math.round(p+Ut*_t),ut=Ot+Ut*jt;for(let T=Gt;T<=lt;T++)it[T]=ut;Gt=lt+1}for(let Ut=Gt;Ut<256;Ut++)it[Ut]=it[Gt-1];return it.join(",")},m=`g_${t(this,ae)}_hcm_${pt}_filter`,M=l.filter=b(this,Rt,$s).call(this,m);return b(this,Rt,Si).call(this,M),b(this,Rt,Ms).call(this,o(e[0],i[0],5),o(e[1],i[1],5),o(e[2],i[2],5),M),l.url=`url(#${m})`,l.url}destroy(pt=!1){pt&&t(this,Rt,As).size!==0||(t(this,Xt)&&(t(this,Xt).parentNode.parentNode.remove(),w(this,Xt,null)),t(this,Pt)&&(t(this,Pt).clear(),w(this,Pt,null)),w(this,oe,0))}}Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakSet,ms=function(){return t(this,Pt)||w(this,Pt,new Map)},As=function(){return t(this,re)||w(this,re,new Map)},bs=function(){if(!t(this,Xt)){const pt=t(this,Jt).createElement("div"),{style:S}=pt;S.visibility="hidden",S.contain="strict",S.width=S.height=0,S.position="absolute",S.top=S.left=0,S.zIndex=-1;const n=t(this,Jt).createElementNS(H,"svg");n.setAttribute("width",0),n.setAttribute("height",0),w(this,Xt,t(this,Jt).createElementNS(H,"defs")),pt.append(n),n.append(t(this,Xt)),t(this,Jt).body.append(pt)}return t(this,Xt)},Si=function(pt){const S=t(this,Jt).createElementNS(H,"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"),pt.append(S)},$s=function(pt){const S=t(this,Jt).createElementNS(H,"filter");return S.setAttribute("color-interpolation-filters","sRGB"),S.setAttribute("id",pt),t(this,Rt,bs).append(S),S},Xs=function(pt,S,n){const s=t(this,Jt).createElementNS(H,S);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),pt.append(s)},Ms=function(pt,S,n,s){const a=t(this,Jt).createElementNS(H,"feComponentTransfer");s.append(a),b(this,Rt,Xs).call(this,a,"feFuncR",pt),b(this,Rt,Xs).call(this,a,"feFuncG",S),b(this,Rt,Xs).call(this,a,"feFuncB",n)},Rs=function(pt){return t(this,Rt,bs).style.color=pt,bt(getComputedStyle(t(this,Rt,bs)).getPropertyValue("color"))};class z extends d.BaseCanvasFactory{constructor({ownerDocument:mt=globalThis.document}={}){super(),this._document=mt}_createCanvas(mt,pt){const S=this._document.createElement("canvas");return S.width=mt,S.height=pt,S}}async function F(Nt,mt="text"){if(O(Nt,document.baseURI)){const pt=await fetch(Nt);if(!pt.ok)throw new Error(pt.statusText);switch(mt){case"arraybuffer":return pt.arrayBuffer();case"blob":return pt.blob();case"json":return pt.json()}return pt.text()}return new Promise((pt,S)=>{const n=new XMLHttpRequest;n.open("GET",Nt,!0),n.responseType=mt,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(mt){case"arraybuffer":case"blob":case"json":pt(n.response);return}pt(n.responseText);return}S(new Error(n.statusText))}},n.send(null)})}class I extends d.BaseCMapReaderFactory{_fetchData(mt,pt){return F(mt,this.isCompressed?"arraybuffer":"text").then(S=>({cMapData:S instanceof ArrayBuffer?new Uint8Array(S):(0,Q.stringToBytes)(S),compressionType:pt}))}}class V extends d.BaseStandardFontDataFactory{_fetchData(mt){return F(mt,"arraybuffer").then(pt=>new Uint8Array(pt))}}class E extends d.BaseSVGFactory{_createSVG(mt){return document.createElementNS(H,mt)}}class y{constructor({viewBox:mt,scale:pt,rotation:S,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=mt,this.scale=pt,this.rotation=S,this.offsetX=n,this.offsetY=s;const h=(mt[2]+mt[0])/2,l=(mt[3]+mt[1])/2;let g,u,p,R;switch(S%=360,S<0&&(S+=360),S){case 180:g=-1,u=0,p=0,R=1;break;case 90:g=0,u=1,p=1,R=0;break;case 270:g=0,u=-1,p=-1,R=0;break;case 0:g=1,u=0,p=0,R=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(p=-p,R=-R);let e,i,o,m;g===0?(e=Math.abs(l-mt[1])*pt+n,i=Math.abs(h-mt[0])*pt+s,o=(mt[3]-mt[1])*pt,m=(mt[2]-mt[0])*pt):(e=Math.abs(h-mt[0])*pt+n,i=Math.abs(l-mt[1])*pt+s,o=(mt[2]-mt[0])*pt,m=(mt[3]-mt[1])*pt),this.transform=[g*pt,u*pt,p*pt,R*pt,e-g*pt*h-p*pt*l,i-u*pt*h-R*pt*l],this.width=o,this.height=m}get rawDims(){const{viewBox:mt}=this;return(0,Q.shadow)(this,"rawDims",{pageWidth:mt[2]-mt[0],pageHeight:mt[3]-mt[1],pageX:mt[0],pageY:mt[1]})}clone({scale:mt=this.scale,rotation:pt=this.rotation,offsetX:S=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new y({viewBox:this.viewBox.slice(),scale:mt,rotation:pt,offsetX:S,offsetY:n,dontFlip:s})}convertToViewportPoint(mt,pt){return Q.Util.applyTransform([mt,pt],this.transform)}convertToViewportRectangle(mt){const pt=Q.Util.applyTransform([mt[0],mt[1]],this.transform),S=Q.Util.applyTransform([mt[2],mt[3]],this.transform);return[pt[0],pt[1],S[0],S[1]]}convertToPdfPoint(mt,pt){return Q.Util.applyInverseTransform([mt,pt],this.transform)}}class D extends Q.BaseException{constructor(mt,pt=0){super(mt,"RenderingCancelledException"),this.extraDelay=pt}}function L(Nt){const mt=Nt.length;let pt=0;for(;pt<mt&&Nt[pt].trim()==="";)pt++;return Nt.substring(pt,pt+5).toLowerCase()==="data:"}function Z(Nt){return typeof Nt=="string"&&/\.pdf$/i.test(Nt)}function B(Nt,mt=!1){return mt||([Nt]=Nt.split(/[#?]/,1)),Nt.substring(Nt.lastIndexOf("/")+1)}function K(Nt,mt="document.pdf"){if(typeof Nt!="string")return mt;if(L(Nt))return(0,Q.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),mt;const pt=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,S=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=pt.exec(Nt);let s=S.exec(n[1])||S.exec(n[2])||S.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=S.exec(decodeURIComponent(s))[0]}catch{}return s||mt}class k{constructor(){he(this,"started",Object.create(null));he(this,"times",[])}time(mt){mt in this.started&&(0,Q.warn)(`Timer is already running for ${mt}`),this.started[mt]=Date.now()}timeEnd(mt){mt in this.started||(0,Q.warn)(`Timer has not been started for ${mt}`),this.times.push({name:mt,start:this.started[mt],end:Date.now()}),delete this.started[mt]}toString(){const mt=[];let pt=0;for(const{name:S}of this.times)pt=Math.max(S.length,pt);for(const{name:S,start:n,end:s}of this.times)mt.push(`${S.padEnd(pt)} ${s-n}ms
`);return mt.join("")}}function O(Nt,mt){try{const{protocol:pt}=mt?new URL(Nt,mt):new URL(Nt);return pt==="http:"||pt==="https:"}catch{return!1}}function C(Nt){Nt.preventDefault()}let P;class ht{static toDateObject(mt){if(!mt||typeof mt!="string")return null;P||(P=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const pt=P.exec(mt);if(!pt)return null;const S=parseInt(pt[1],10);let n=parseInt(pt[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(pt[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(pt[4],10);a=a>=0&&a<=23?a:0;let h=parseInt(pt[5],10);h=h>=0&&h<=59?h:0;let l=parseInt(pt[6],10);l=l>=0&&l<=59?l:0;const g=pt[7]||"Z";let u=parseInt(pt[8],10);u=u>=0&&u<=23?u:0;let p=parseInt(pt[9],10)||0;return p=p>=0&&p<=59?p:0,g==="-"?(a+=u,h+=p):g==="+"&&(a-=u,h-=p),new Date(Date.UTC(S,n,s,a,h,l))}}function st(Nt,{scale:mt=1,rotation:pt=0}){const{width:S,height:n}=Nt.attributes.style,s=[0,0,parseInt(S),parseInt(n)];return new y({viewBox:s,scale:mt,rotation:pt})}function bt(Nt){if(Nt.startsWith("#")){const mt=parseInt(Nt.slice(1),16);return[(mt&16711680)>>16,(mt&65280)>>8,mt&255]}return Nt.startsWith("rgb(")?Nt.slice(4,-1).split(",").map(mt=>parseInt(mt)):Nt.startsWith("rgba(")?Nt.slice(5,-1).split(",").map(mt=>parseInt(mt)).slice(0,3):((0,Q.warn)(`Not a valid color format: "${Nt}"`),[0,0,0])}function Tt(Nt){const mt=document.createElement("span");mt.style.visibility="hidden",document.body.append(mt);for(const pt of Nt.keys()){mt.style.color=pt;const S=window.getComputedStyle(mt).color;Nt.set(pt,bt(S))}mt.remove()}function ot(Nt){const{a:mt,b:pt,c:S,d:n,e:s,f:a}=Nt.getTransform();return[mt,pt,S,n,s,a]}function nt(Nt){const{a:mt,b:pt,c:S,d:n,e:s,f:a}=Nt.getTransform().invertSelf();return[mt,pt,S,n,s,a]}function Mt(Nt,mt,pt=!1,S=!0){if(mt instanceof y){const{pageWidth:n,pageHeight:s}=mt.rawDims,{style:a}=Nt,h=Q.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${n}px`,g=`var(--scale-factor) * ${s}px`,u=h?`round(${l}, 1px)`:`calc(${l})`,p=h?`round(${g}, 1px)`:`calc(${g})`;!pt||mt.rotation%180===0?(a.width=u,a.height=p):(a.width=p,a.height=u)}S&&Nt.setAttribute("data-main-rotation",mt.rotation)}},47:(ie,$t,dt)=>{var J,At,z,F,I,Ci,E,Ti,ur;dt.d($t,{DrawLayer:()=>H});var d=dt(419),Q=dt(292);const L=class L{constructor({pageIndex:B}){_(this,E);_(this,J,null);_(this,At,0);_(this,z,new Map);_(this,F,new Map);this.pageIndex=B}setParent(B){if(!t(this,J)){w(this,J,B);return}if(t(this,J)!==B){if(t(this,z).size>0)for(const K of t(this,z).values())K.remove(),B.append(K);w(this,J,B)}}static get _svgFactory(){return(0,Q.shadow)(this,"_svgFactory",new d.DOMSVGFactory)}highlight(B,K,k,O=!1){const C=Je(this,At)._++,P=b(this,E,Ti).call(this,B.box);P.classList.add("highlight"),B.free&&P.classList.add("free");const ht=L._svgFactory.createElement("defs");P.append(ht);const st=L._svgFactory.createElement("path");ht.append(st);const bt=`path_p${this.pageIndex}_${C}`;st.setAttribute("id",bt),st.setAttribute("d",B.toSVGPath()),O&&t(this,F).set(C,st);const Tt=b(this,E,ur).call(this,ht,bt),ot=L._svgFactory.createElement("use");return P.append(ot),P.setAttribute("fill",K),P.setAttribute("fill-opacity",k),ot.setAttribute("href",`#${bt}`),t(this,z).set(C,P),{id:C,clipPathId:`url(#${Tt})`}}highlightOutline(B){const K=Je(this,At)._++,k=b(this,E,Ti).call(this,B.box);k.classList.add("highlightOutline");const O=L._svgFactory.createElement("defs");k.append(O);const C=L._svgFactory.createElement("path");O.append(C);const P=`path_p${this.pageIndex}_${K}`;C.setAttribute("id",P),C.setAttribute("d",B.toSVGPath()),C.setAttribute("vector-effect","non-scaling-stroke");let ht;if(B.free){k.classList.add("free");const Tt=L._svgFactory.createElement("mask");O.append(Tt),ht=`mask_p${this.pageIndex}_${K}`,Tt.setAttribute("id",ht),Tt.setAttribute("maskUnits","objectBoundingBox");const ot=L._svgFactory.createElement("rect");Tt.append(ot),ot.setAttribute("width","1"),ot.setAttribute("height","1"),ot.setAttribute("fill","white");const nt=L._svgFactory.createElement("use");Tt.append(nt),nt.setAttribute("href",`#${P}`),nt.setAttribute("stroke","none"),nt.setAttribute("fill","black"),nt.setAttribute("fill-rule","nonzero"),nt.classList.add("mask")}const st=L._svgFactory.createElement("use");k.append(st),st.setAttribute("href",`#${P}`),ht&&st.setAttribute("mask",`url(#${ht})`);const bt=st.cloneNode();return k.append(bt),st.classList.add("mainOutline"),bt.classList.add("secondaryOutline"),t(this,z).set(K,k),K}finalizeLine(B,K){const k=t(this,F).get(B);t(this,F).delete(B),this.updateBox(B,K.box),k.setAttribute("d",K.toSVGPath())}updateLine(B,K){t(this,z).get(B).firstChild.firstChild.setAttribute("d",K.toSVGPath())}removeFreeHighlight(B){this.remove(B),t(this,F).delete(B)}updatePath(B,K){t(this,F).get(B).setAttribute("d",K.toSVGPath())}updateBox(B,K){var k;b(k=L,I,Ci).call(k,t(this,z).get(B),K)}show(B,K){t(this,z).get(B).classList.toggle("hidden",!K)}rotate(B,K){t(this,z).get(B).setAttribute("data-main-rotation",K)}changeColor(B,K){t(this,z).get(B).setAttribute("fill",K)}changeOpacity(B,K){t(this,z).get(B).setAttribute("fill-opacity",K)}addClass(B,K){t(this,z).get(B).classList.add(K)}removeClass(B,K){t(this,z).get(B).classList.remove(K)}remove(B){t(this,J)!==null&&(t(this,z).get(B).remove(),t(this,z).delete(B))}destroy(){w(this,J,null);for(const B of t(this,z).values())B.remove();t(this,z).clear()}};J=new WeakMap,At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakSet,Ci=function(B,{x:K=0,y:k=0,width:O=1,height:C=1}={}){const{style:P}=B;P.top=`${100*k}%`,P.left=`${100*K}%`,P.width=`${100*O}%`,P.height=`${100*C}%`},E=new WeakSet,Ti=function(B){var k;const K=L._svgFactory.create(1,1,!0);return t(this,J).append(K),K.setAttribute("aria-hidden",!0),b(k=L,I,Ci).call(k,K,B),K},ur=function(B,K){const k=L._svgFactory.createElement("clipPath");B.append(k);const O=`clip_${K}`;k.setAttribute("id",O),k.setAttribute("clipPathUnits","objectBoundingBox");const C=L._svgFactory.createElement("use");return k.append(C),C.setAttribute("href",`#${K}`),C.classList.add("clip"),O},_(L,I);let H=L},731:(ie,$t,dt)=>{var Z,B,K,k,O,C,P,ht,st,bt,Tt,pr,gr,fr,Ks,Pt,Ys,Js,mr,Mi,Ar,Qt,ue,Ae,Bt,le,ee,ce,Zt,Nt,mt,pt,S,n,s,a,h,l,g,u,p,Ri,Li,br,vr,yr,ki,Ls,W,vs,wr,Qs,ks,_r,xr,Er,Sr,ut,T,X,Y,vt,Et,Lt,Ht,te,de,be,we,Wt,v,f,x,Cr,Tr,Mr,Rr,Pi,Lr,Ii,kr,Pr,Ir,Dr,Fr,ls,Di,Zs,ti,ys,Fi,ei,De,Nr,Ni,Or,Hr,Oi,si,Ps,Ce,Pe,Qe,$e,Ze,ds,je,ns,qe,Ue,_s,ye,Is,Ds,ii,Hi,Br,Ur,Bi,ni,zr,rs,us,Ge,as,Xe,Ke,Ye,He,ts,ps,gs,Ne,ne,es,Fe,Vr,Ui,zi,Vi,ri;dt.d($t,{AnnotationEditorLayer:()=>L});var d=dt(292),Q=dt(310),H=dt(830),J=dt(976);const At=/\r\n?|\n/g,Rt=class Rt extends Q.AnnotationEditor{constructor(r){super({...r,name:"freeTextEditor"});_(this,Tt);_(this,Z,this.editorDivBlur.bind(this));_(this,B,this.editorDivFocus.bind(this));_(this,K,this.editorDivInput.bind(this));_(this,k,this.editorDivKeydown.bind(this));_(this,O,this.editorDivPaste.bind(this));_(this,C);_(this,P,"");_(this,ht,`${this.id}-editor`);_(this,st);_(this,bt,null);w(this,C,r.color||Rt._defaultColor||Q.AnnotationEditor._defaultLineColor),w(this,st,r.fontSize||Rt._defaultFontSize)}static get _keyboardManager(){const r=Rt.prototype,A=at=>at.isEmpty(),j=H.AnnotationEditorUIManager.TRANSLATE_SMALL,G=H.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,d.shadow)(this,"_keyboardManager",new H.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],r.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],r.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],r._translateEmpty,{args:[-j,0],checker:A}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],r._translateEmpty,{args:[-G,0],checker:A}],[["ArrowRight","mac+ArrowRight"],r._translateEmpty,{args:[j,0],checker:A}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],r._translateEmpty,{args:[G,0],checker:A}],[["ArrowUp","mac+ArrowUp"],r._translateEmpty,{args:[0,-j],checker:A}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],r._translateEmpty,{args:[0,-G],checker:A}],[["ArrowDown","mac+ArrowDown"],r._translateEmpty,{args:[0,j],checker:A}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],r._translateEmpty,{args:[0,G],checker:A}]]))}static initialize(r,A){Q.AnnotationEditor.initialize(r,A,{strings:["pdfjs-free-text-default-content"]});const j=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(j.getPropertyValue("--freetext-padding"))}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.FREETEXT_SIZE:Rt._defaultFontSize=A;break;case d.AnnotationEditorParamsType.FREETEXT_COLOR:Rt._defaultColor=A;break}}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.FREETEXT_SIZE:b(this,Tt,pr).call(this,A);break;case d.AnnotationEditorParamsType.FREETEXT_COLOR:b(this,Tt,gr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.FREETEXT_SIZE,Rt._defaultFontSize],[d.AnnotationEditorParamsType.FREETEXT_COLOR,Rt._defaultColor||Q.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.FREETEXT_SIZE,t(this,st)],[d.AnnotationEditorParamsType.FREETEXT_COLOR,t(this,C)]]}_translateEmpty(r,A){this._uiManager.translateSelectedEditors(r,A,!0)}getInitialTranslation(){const r=this.parentScale;return[-Rt._internalPadding*r,-(Rt._internalPadding+t(this,st))*r]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(d.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",t(this,k)),this.editorDiv.addEventListener("focus",t(this,B)),this.editorDiv.addEventListener("blur",t(this,Z)),this.editorDiv.addEventListener("input",t(this,K)),this.editorDiv.addEventListener("paste",t(this,O)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",t(this,ht)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",t(this,k)),this.editorDiv.removeEventListener("focus",t(this,B)),this.editorDiv.removeEventListener("blur",t(this,Z)),this.editorDiv.removeEventListener("input",t(this,K)),this.editorDiv.removeEventListener("paste",t(this,O)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(r){this._focusEventsAllowed&&(super.focusin(r),r.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var r;this.width||(this.enableEditMode(),this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.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 r=t(this,P),A=w(this,P,b(this,Tt,fr).call(this).trimEnd());if(r===A)return;const j=G=>{if(w(this,P,G),!G){this.remove();return}b(this,Tt,Js).call(this),this._uiManager.rebuild(this),b(this,Tt,Ks).call(this)};this.addCommands({cmd:()=>{j(A)},undo:()=>{j(r)},mustExec:!1}),b(this,Tt,Ks).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(r){this.enterInEditMode()}keydown(r){r.target===this.div&&r.key==="Enter"&&(this.enterInEditMode(),r.preventDefault())}editorDivKeydown(r){Rt._keyboardManager.exec(this,r)}editorDivFocus(r){this.isEditing=!0}editorDivBlur(r){this.isEditing=!1}editorDivInput(r){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 r,A;this.width&&(r=this.x,A=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",t(this,ht)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Q.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then(G=>{var at;return(at=this.editorDiv)==null?void 0:at.setAttribute("default-content",G)}),this.editorDiv.contentEditable=!0;const{style:j}=this.editorDiv;if(j.fontSize=`calc(${t(this,st)}px * var(--scale-factor))`,j.color=t(this,C),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,H.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[G,at]=this.parentDimensions;if(this.annotationElementId){const{position:Ct}=t(this,bt);let[kt,wt]=this.getInitialTranslation();[kt,wt]=this.pageTranslationToScreen(kt,wt);const[qt,Vt]=this.pageDimensions,[pe,ge]=this.pageTranslation;let me,ve;switch(this.rotation){case 0:me=r+(Ct[0]-pe)/qt,ve=A+this.height-(Ct[1]-ge)/Vt;break;case 90:me=r+(Ct[0]-pe)/qt,ve=A-(Ct[1]-ge)/Vt,[kt,wt]=[wt,-kt];break;case 180:me=r-this.width+(Ct[0]-pe)/qt,ve=A-(Ct[1]-ge)/Vt,[kt,wt]=[-kt,-wt];break;case 270:me=r+(Ct[0]-pe-this.height*Vt)/qt,ve=A+(Ct[1]-ge-this.width*qt)/Vt,[kt,wt]=[-wt,kt];break}this.setAt(me*G,ve*at,kt,wt)}else this.setAt(r*G,A*at,this.width*G,this.height*at);b(this,Tt,Js).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(r){var me,ve,Ie;const A=r.clipboardData||window.clipboardData,{types:j}=A;if(j.length===1&&j[0]==="text/plain")return;r.preventDefault();const G=b(me=Rt,Pt,Mi).call(me,A.getData("text")||"").replaceAll(At,`
`);if(!G)return;const at=window.getSelection();if(!at.rangeCount)return;this.editorDiv.normalize(),at.deleteFromDocument();const Ct=at.getRangeAt(0);if(!G.includes(`
`)){Ct.insertNode(document.createTextNode(G)),this.editorDiv.normalize(),at.collapseToStart();return}const{startContainer:kt,startOffset:wt}=Ct,qt=[],Vt=[];if(kt.nodeType===Node.TEXT_NODE){const Te=kt.parentElement;if(Vt.push(kt.nodeValue.slice(wt).replaceAll(At,"")),Te!==this.editorDiv){let ke=qt;for(const Le of this.editorDiv.childNodes){if(Le===Te){ke=Vt;continue}ke.push(b(ve=Rt,Pt,Ys).call(ve,Le))}}qt.push(kt.nodeValue.slice(0,wt).replaceAll(At,""))}else if(kt===this.editorDiv){let Te=qt,ke=0;for(const Le of this.editorDiv.childNodes)ke++===wt&&(Te=Vt),Te.push(b(Ie=Rt,Pt,Ys).call(Ie,Le))}w(this,P,`${qt.join(`
`)}${G}${Vt.join(`
`)}`),b(this,Tt,Js).call(this);const pe=new Range;let ge=qt.reduce((Te,ke)=>Te+ke.length,0);for(const{firstChild:Te}of this.editorDiv.childNodes)if(Te.nodeType===Node.TEXT_NODE){const ke=Te.nodeValue.length;if(ge<=ke){pe.setStart(Te,ge),pe.setEnd(Te,ge);break}ge-=ke}at.removeAllRanges(),at.addRange(pe)}get contentDiv(){return this.editorDiv}static deserialize(r,A,j){var Ct;let G=null;if(r instanceof J.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:kt,fontColor:wt},rect:qt,rotation:Vt,id:pe},textContent:ge,textPosition:me,parent:{page:{pageNumber:ve}}}=r;if(!ge||ge.length===0)return null;G=r={annotationType:d.AnnotationEditorType.FREETEXT,color:Array.from(wt),fontSize:kt,value:ge.join(`
`),position:me,pageIndex:ve-1,rect:qt.slice(0),rotation:Vt,id:pe,deleted:!1}}const at=super.deserialize(r,A,j);return w(at,st,r.fontSize),w(at,C,d.Util.makeHexColor(...r.color)),w(at,P,b(Ct=Rt,Pt,Mi).call(Ct,r.value)),at.annotationElementId=r.id||null,w(at,bt,G),at}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const A=Rt._internalPadding*this.parentScale,j=this.getRect(A,A),G=Q.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:t(this,C)),at={annotationType:d.AnnotationEditorType.FREETEXT,color:G,fontSize:t(this,st),value:b(this,Tt,mr).call(this),pageIndex:this.pageIndex,rect:j,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return r?at:this.annotationElementId&&!b(this,Tt,Ar).call(this,at)?null:(at.id=this.annotationElementId,at)}renderAnnotationElement(r){const A=super.renderAnnotationElement(r);if(this.deleted)return A;const{style:j}=A;j.fontSize=`calc(${t(this,st)}px * var(--scale-factor))`,j.color=t(this,C),A.replaceChildren();for(const at of t(this,P).split(`
`)){const Ct=document.createElement("div");Ct.append(at?document.createTextNode(at):document.createElement("br")),A.append(Ct)}const G=Rt._internalPadding*this.parentScale;return r.updateEdited({rect:this.getRect(G,G)}),A}resetAnnotationElement(r){super.resetAnnotationElement(r),r.resetEdited()}};Z=new WeakMap,B=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakSet,pr=function(r){const A=G=>{this.editorDiv.style.fontSize=`calc(${G}px * var(--scale-factor))`,this.translate(0,-(G-t(this,st))*this.parentScale),w(this,st,G),b(this,Tt,Ks).call(this)},j=t(this,st);this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},gr=function(r){const A=G=>{w(this,C,this.editorDiv.style.color=G)},j=t(this,C);this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},fr=function(){var A;const r=[];this.editorDiv.normalize();for(const j of this.editorDiv.childNodes)r.push(b(A=Rt,Pt,Ys).call(A,j));return r.join(`
`)},Ks=function(){const[r,A]=this.parentDimensions;let j;if(this.isAttachedToDOM)j=this.div.getBoundingClientRect();else{const{currentLayer:G,div:at}=this,Ct=at.style.display,kt=at.classList.contains("hidden");at.classList.remove("hidden"),at.style.display="hidden",G.div.append(this.div),j=at.getBoundingClientRect(),at.remove(),at.style.display=Ct,at.classList.toggle("hidden",kt)}this.rotation%180===this.parentRotation%180?(this.width=j.width/r,this.height=j.height/A):(this.width=j.height/r,this.height=j.width/A),this.fixAndSetPosition()},Pt=new WeakSet,Ys=function(r){return(r.nodeType===Node.TEXT_NODE?r.nodeValue:r.innerText).replaceAll(At,"")},Js=function(){if(this.editorDiv.replaceChildren(),!!t(this,P))for(const r of t(this,P).split(`
`)){const A=document.createElement("div");A.append(r?document.createTextNode(r):document.createElement("br")),this.editorDiv.append(A)}},mr=function(){return t(this,P).replaceAll("\xA0"," ")},Mi=function(r){return r.replaceAll(" ","\xA0")},Ar=function(r){const{value:A,fontSize:j,color:G,pageIndex:at}=t(this,bt);return this._hasBeenMoved||r.value!==A||r.fontSize!==j||r.color.some((Ct,kt)=>Ct!==G[kt])||r.pageIndex!==at},_(Rt,Pt),he(Rt,"_freeTextDefaultContent",""),he(Rt,"_internalPadding",0),he(Rt,"_defaultColor",null),he(Rt,"_defaultFontSize",10),he(Rt,"_type","freetext"),he(Rt,"_editorType",d.AnnotationEditorType.FREETEXT);let z=Rt;var F=dt(61),I=dt(259),V=dt(419);const lt=class lt extends Q.AnnotationEditor{constructor(r){super({...r,name:"highlightEditor"});_(this,p);_(this,Qt,null);_(this,ue,0);_(this,Ae);_(this,Bt,null);_(this,le,null);_(this,ee,null);_(this,ce,null);_(this,Zt,0);_(this,Nt,null);_(this,mt,null);_(this,pt,null);_(this,S,!1);_(this,n,b(this,p,wr).bind(this));_(this,s,null);_(this,a);_(this,h,null);_(this,l,"");_(this,g);_(this,u,"");this.color=r.color||lt._defaultColor,w(this,g,r.thickness||lt._defaultThickness),w(this,a,r.opacity||lt._defaultOpacity),w(this,Ae,r.boxes||null),w(this,u,r.methodOfCreation||""),w(this,l,r.text||""),this._isDraggable=!1,r.highlightId>-1?(w(this,S,!0),b(this,p,Li).call(this,r),b(this,p,Ls).call(this)):(w(this,Qt,r.anchorNode),w(this,ue,r.anchorOffset),w(this,ce,r.focusNode),w(this,Zt,r.focusOffset),b(this,p,Ri).call(this),b(this,p,Ls).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const r=lt.prototype;return(0,d.shadow)(this,"_keyboardManager",new H.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],r._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],r._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],r._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],r._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:t(this,S)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:t(this,g),methodOfCreation:t(this,u)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(r){return{numberOfColors:r.get("color").size}}static initialize(r,A){var j;Q.AnnotationEditor.initialize(r,A),lt._defaultColor||(lt._defaultColor=((j=A.highlightColors)==null?void 0:j.values().next().value)||"#fff066")}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:lt._defaultColor=A;break;case d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:lt._defaultThickness=A;break}}translateInPage(r,A){}get toolbarPosition(){return t(this,s)}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.HIGHLIGHT_COLOR:b(this,p,br).call(this,A);break;case d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:b(this,p,vr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,lt._defaultColor],[d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,lt._defaultThickness]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||lt._defaultColor],[d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,t(this,g)||lt._defaultThickness],[d.AnnotationEditorParamsType.HIGHLIGHT_FREE,t(this,S)]]}async addEditToolbar(){const r=await super.addEditToolbar();return r?(this._uiManager.highlightColors&&(w(this,le,new I.ColorPicker({editor:this})),r.addColorPicker(t(this,le))),r):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,p,ks).call(this))}getBaseTranslation(){return[0,0]}getRect(r,A){return super.getRect(r,A,b(this,p,ks).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){b(this,p,ki).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,p,Ls).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var j;let A=!1;this.parent&&!r?b(this,p,ki).call(this):r&&(b(this,p,Ls).call(this,r),A=!this.parent&&((j=this.div)==null?void 0:j.classList.contains("selectedEditor"))),super.setParent(r),this.show(this._isVisible),A&&this.select()}rotate(r){var G,at,Ct;const{drawLayer:A}=this.parent;let j;t(this,S)?(r=(r-this.rotation+360)%360,j=b(G=lt,W,vs).call(G,t(this,mt).box,r)):j=b(at=lt,W,vs).call(at,this,r),A.rotate(t(this,pt),r),A.rotate(t(this,h),r),A.updateBox(t(this,pt),j),A.updateBox(t(this,h),b(Ct=lt,W,vs).call(Ct,t(this,ee).box,r))}render(){if(this.div)return this.div;const r=super.render();t(this,l)&&(r.setAttribute("aria-label",t(this,l)),r.setAttribute("role","mark")),t(this,S)?r.classList.add("free"):this.div.addEventListener("keydown",t(this,n));const A=w(this,Nt,document.createElement("div"));r.append(A),A.setAttribute("aria-hidden","true"),A.className="internal",A.style.clipPath=t(this,Bt);const[j,G]=this.parentDimensions;return this.setDims(this.width*j,this.height*G),(0,H.bindEvents)(this,t(this,Nt),["pointerover","pointerleave"]),this.enableEditing(),r}pointerover(){this.parent.drawLayer.addClass(t(this,h),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(t(this,h),"hovered")}_moveCaret(r){switch(this.parent.unselect(this),r){case 0:case 2:b(this,p,Qs).call(this,!0);break;case 1:case 3:b(this,p,Qs).call(this,!1);break}}select(){var r,A;super.select(),t(this,h)&&((r=this.parent)==null||r.drawLayer.removeClass(t(this,h),"hovered"),(A=this.parent)==null||A.drawLayer.addClass(t(this,h),"selected"))}unselect(){var r;super.unselect(),t(this,h)&&((r=this.parent)==null||r.drawLayer.removeClass(t(this,h),"selected"),t(this,S)||b(this,p,Qs).call(this,!1))}get _mustFixPosition(){return!t(this,S)}show(r=this._isVisible){super.show(r),this.parent&&(this.parent.drawLayer.show(t(this,pt),r),this.parent.drawLayer.show(t(this,h),r))}static startHighlighting(r,A,{target:j,x:G,y:at}){const{x:Ct,y:kt,width:wt,height:qt}=j.getBoundingClientRect(),Vt=ve=>{b(this,W,Er).call(this,r,ve)},pe={capture:!0,passive:!1},ge=ve=>{ve.preventDefault(),ve.stopPropagation()},me=ve=>{j.removeEventListener("pointermove",Vt),window.removeEventListener("blur",me),window.removeEventListener("pointerup",me),window.removeEventListener("pointerdown",ge,pe),window.removeEventListener("contextmenu",V.noContextMenu),b(this,W,Sr).call(this,r,ve)};window.addEventListener("blur",me),window.addEventListener("pointerup",me),window.addEventListener("pointerdown",ge,pe),window.addEventListener("contextmenu",V.noContextMenu),j.addEventListener("pointermove",Vt),this._freeHighlight=new F.FreeOutliner({x:G,y:at},[Ct,kt,wt,qt],r.scale,this._defaultThickness/2,A,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=r.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(r,A,j){var ve;const G=super.deserialize(r,A,j),{rect:[at,Ct,kt,wt],color:qt,quadPoints:Vt}=r;G.color=d.Util.makeHexColor(...qt),w(G,a,r.opacity);const[pe,ge]=G.pageDimensions;G.width=(kt-at)/pe,G.height=(wt-Ct)/ge;const me=w(G,Ae,[]);for(let Ie=0;Ie<Vt.length;Ie+=8)me.push({x:(Vt[4]-kt)/pe,y:(wt-(1-Vt[Ie+5]))/ge,width:(Vt[Ie+2]-Vt[Ie])/pe,height:(Vt[Ie+5]-Vt[Ie+1])/ge});return b(ve=G,p,Ri).call(ve),G}serialize(r=!1){if(this.isEmpty()||r)return null;const A=this.getRect(0,0),j=Q.AnnotationEditor._colorManager.convert(this.color);return{annotationType:d.AnnotationEditorType.HIGHLIGHT,color:j,opacity:t(this,a),thickness:t(this,g),quadPoints:b(this,p,_r).call(this),outlines:b(this,p,xr).call(this,A),pageIndex:this.pageIndex,rect:A,rotation:b(this,p,ks).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};Qt=new WeakMap,ue=new WeakMap,Ae=new WeakMap,Bt=new WeakMap,le=new WeakMap,ee=new WeakMap,ce=new WeakMap,Zt=new WeakMap,Nt=new WeakMap,mt=new WeakMap,pt=new WeakMap,S=new WeakMap,n=new WeakMap,s=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,g=new WeakMap,u=new WeakMap,p=new WeakSet,Ri=function(){const r=new F.Outliner(t(this,Ae),.001);w(this,mt,r.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=t(this,mt).box;const A=new F.Outliner(t(this,Ae),.0025,.001,this._uiManager.direction==="ltr");w(this,ee,A.getOutlines());const{lastPoint:j}=t(this,ee).box;w(this,s,[(j[0]-this.x)/this.width,(j[1]-this.y)/this.height])},Li=function({highlightOutlines:r,highlightId:A,clipPathId:j}){var Vt,pe;if(w(this,mt,r),w(this,ee,r.getNewOutline(t(this,g)/2+1.5,.0025)),A>=0)w(this,pt,A),w(this,Bt,j),this.parent.drawLayer.finalizeLine(A,r),w(this,h,this.parent.drawLayer.highlightOutline(t(this,ee)));else if(this.parent){const ge=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(t(this,pt),r),this.parent.drawLayer.updateBox(t(this,pt),b(Vt=lt,W,vs).call(Vt,t(this,mt).box,(ge-this.rotation+360)%360)),this.parent.drawLayer.updateLine(t(this,h),t(this,ee)),this.parent.drawLayer.updateBox(t(this,h),b(pe=lt,W,vs).call(pe,t(this,ee).box,ge))}const{x:at,y:Ct,width:kt,height:wt}=r.box;switch(this.rotation){case 0:this.x=at,this.y=Ct,this.width=kt,this.height=wt;break;case 90:{const[ge,me]=this.parentDimensions;this.x=Ct,this.y=1-at,this.width=kt*me/ge,this.height=wt*ge/me;break}case 180:this.x=1-at,this.y=1-Ct,this.width=kt,this.height=wt;break;case 270:{const[ge,me]=this.parentDimensions;this.x=1-Ct,this.y=at,this.width=kt*me/ge,this.height=wt*ge/me;break}}const{lastPoint:qt}=t(this,ee).box;w(this,s,[(qt[0]-at)/kt,(qt[1]-Ct)/wt])},br=function(r){const A=G=>{var at,Ct;this.color=G,(at=this.parent)==null||at.drawLayer.changeColor(t(this,pt),G),(Ct=t(this,le))==null||Ct.updateColor(G)},j=this.color;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(r)},!0)},vr=function(r){const A=t(this,g),j=G=>{w(this,g,G),b(this,p,yr).call(this,G)};this.addCommands({cmd:j.bind(this,r),undo:j.bind(this,A),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:r},!0)},yr=function(r){if(!t(this,S))return;b(this,p,Li).call(this,{highlightOutlines:t(this,mt).getNewOutline(r/2)}),this.fixAndSetPosition();const[A,j]=this.parentDimensions;this.setDims(this.width*A,this.height*j)},ki=function(){t(this,pt)===null||!this.parent||(this.parent.drawLayer.remove(t(this,pt)),w(this,pt,null),this.parent.drawLayer.remove(t(this,h)),w(this,h,null))},Ls=function(r=this.parent){t(this,pt)===null&&({id:Je(this,pt)._,clipPathId:Je(this,Bt)._}=r.drawLayer.highlight(t(this,mt),this.color,t(this,a)),w(this,h,r.drawLayer.highlightOutline(t(this,ee))),t(this,Nt)&&(t(this,Nt).style.clipPath=t(this,Bt)))},W=new WeakSet,vs=function({x:r,y:A,width:j,height:G},at){switch(at){case 90:return{x:1-A-G,y:r,width:G,height:j};case 180:return{x:1-r-j,y:1-A-G,width:j,height:G};case 270:return{x:A,y:1-r-j,width:G,height:j}}return{x:r,y:A,width:j,height:G}},wr=function(r){lt._keyboardManager.exec(this,r)},Qs=function(r){if(!t(this,Qt))return;const A=window.getSelection();r?A.setPosition(t(this,Qt),t(this,ue)):A.setPosition(t(this,ce),t(this,Zt))},ks=function(){return t(this,S)?this.rotation:0},_r=function(){if(t(this,S))return null;const[r,A]=this.pageDimensions,j=t(this,Ae),G=new Array(j.length*8);let at=0;for(const{x:Ct,y:kt,width:wt,height:qt}of j){const Vt=Ct*r,pe=(1-kt-qt)*A;G[at]=G[at+4]=Vt,G[at+1]=G[at+3]=pe,G[at+2]=G[at+6]=Vt+wt*r,G[at+5]=G[at+7]=pe+qt*A,at+=8}return G},xr=function(r){return t(this,mt).serialize(r,b(this,p,ks).call(this))},Er=function(r,A){this._freeHighlight.add(A)&&r.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Sr=function(r,A){this._freeHighlight.isEmpty()?r.drawLayer.removeFreeHighlight(this._freeHighlightId):r.createAndAddNewEditor(A,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},_(lt,W),he(lt,"_defaultColor",null),he(lt,"_defaultOpacity",1),he(lt,"_defaultThickness",12),he(lt,"_l10nPromise"),he(lt,"_type","highlight"),he(lt,"_editorType",d.AnnotationEditorType.HIGHLIGHT),he(lt,"_freeHighlightId",-1),he(lt,"_freeHighlight",null),he(lt,"_freeHighlightClipId","");let E=lt;const _e=class _e extends Q.AnnotationEditor{constructor(r){super({...r,name:"inkEditor"});_(this,x);_(this,ut,0);_(this,T,0);_(this,X,this.canvasPointermove.bind(this));_(this,Y,this.canvasPointerleave.bind(this));_(this,vt,this.canvasPointerup.bind(this));_(this,Et,this.canvasPointerdown.bind(this));_(this,Lt,null);_(this,Ht,new Path2D);_(this,te,!1);_(this,de,!1);_(this,be,!1);_(this,we,null);_(this,Wt,0);_(this,v,0);_(this,f,null);this.color=r.color||null,this.thickness=r.thickness||null,this.opacity=r.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(r,A){Q.AnnotationEditor.initialize(r,A)}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.INK_THICKNESS:_e._defaultThickness=A;break;case d.AnnotationEditorParamsType.INK_COLOR:_e._defaultColor=A;break;case d.AnnotationEditorParamsType.INK_OPACITY:_e._defaultOpacity=A/100;break}}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.INK_THICKNESS:b(this,x,Cr).call(this,A);break;case d.AnnotationEditorParamsType.INK_COLOR:b(this,x,Tr).call(this,A);break;case d.AnnotationEditorParamsType.INK_OPACITY:b(this,x,Mr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.INK_THICKNESS,_e._defaultThickness],[d.AnnotationEditorParamsType.INK_COLOR,_e._defaultColor||Q.AnnotationEditor._defaultLineColor],[d.AnnotationEditorParamsType.INK_OPACITY,Math.round(_e._defaultOpacity*100)]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||_e._defaultThickness],[d.AnnotationEditorParamsType.INK_COLOR,this.color||_e._defaultColor||Q.AnnotationEditor._defaultLineColor],[d.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??_e._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(b(this,x,Zs).call(this),b(this,x,ti).call(this)),this.isAttachedToDOM||(this.parent.add(this),b(this,x,ys).call(this)),b(this,x,Ps).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,t(this,Lt)&&(clearTimeout(t(this,Lt)),w(this,Lt,null)),t(this,we).disconnect(),w(this,we,null),super.remove())}setParent(r){!this.parent&&r?this._uiManager.removeShouldRescale(this):this.parent&&r===null&&this._uiManager.addShouldRescale(this),super.setParent(r)}onScaleChanging(){const[r,A]=this.parentDimensions,j=this.width*r,G=this.height*A;this.setDimensions(j,G)}enableEditMode(){t(this,te)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",t(this,Et)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",t(this,Et)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){t(this,te)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),w(this,te,!0),this.div.classList.add("disabled"),b(this,x,Ps).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(r){this._focusEventsAllowed&&(super.focusin(r),this.enableEditMode())}canvasPointerdown(r){r.button!==0||!this.isInEditMode()||t(this,te)||(this.setInForeground(),r.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),b(this,x,Lr).call(this,r.offsetX,r.offsetY))}canvasPointermove(r){r.preventDefault(),b(this,x,Ii).call(this,r.offsetX,r.offsetY)}canvasPointerup(r){r.preventDefault(),b(this,x,Di).call(this,r)}canvasPointerleave(r){b(this,x,Di).call(this,r)}get isResizable(){return!this.isEmpty()&&t(this,te)}render(){if(this.div)return this.div;let r,A;this.width&&(r=this.x,A=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[j,G,at,Ct]=b(this,x,Rr).call(this);if(this.setAt(j,G,0,0),this.setDims(at,Ct),b(this,x,Zs).call(this),this.width){const[kt,wt]=this.parentDimensions;this.setAspectRatio(this.width*kt,this.height*wt),this.setAt(r*kt,A*wt,this.width*kt,this.height*wt),w(this,be,!0),b(this,x,ys).call(this),this.setDims(this.width*kt,this.height*wt),b(this,x,ls).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return b(this,x,ti).call(this),this.div}setDimensions(r,A){const j=Math.round(r),G=Math.round(A);if(t(this,Wt)===j&&t(this,v)===G)return;w(this,Wt,j),w(this,v,G),this.canvas.style.visibility="hidden";const[at,Ct]=this.parentDimensions;this.width=r/at,this.height=A/Ct,this.fixAndSetPosition(),t(this,te)&&b(this,x,Fi).call(this,r,A),b(this,x,ys).call(this),b(this,x,ls).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(r,A,j){var Ie,Te,ke;if(r instanceof J.InkAnnotationElement)return null;const G=super.deserialize(r,A,j);G.thickness=r.thickness,G.color=d.Util.makeHexColor(...r.color),G.opacity=r.opacity;const[at,Ct]=G.pageDimensions,kt=G.width*at,wt=G.height*Ct,qt=G.parentScale,Vt=r.thickness/2;w(G,te,!0),w(G,Wt,Math.round(kt)),w(G,v,Math.round(wt));const{paths:pe,rect:ge,rotation:me}=r;for(let{bezier:Le}of pe){Le=b(Ie=_e,De,Or).call(Ie,Le,ge,me);const We=[];G.paths.push(We);let Es=qt*(Le[0]-Vt),Ss=qt*(Le[1]-Vt);for(let Ve=2,gi=Le.length;Ve<gi;Ve+=6){const fi=qt*(Le[Ve]-Vt),zs=qt*(Le[Ve+1]-Vt),Vs=qt*(Le[Ve+2]-Vt),js=qt*(Le[Ve+3]-Vt),Cs=qt*(Le[Ve+4]-Vt),pn=qt*(Le[Ve+5]-Vt);We.push([[Es,Ss],[fi,zs],[Vs,js],[Cs,pn]]),Es=Cs,Ss=pn}const Us=b(this,De,Nr).call(this,We);G.bezierPath2D.push(Us)}const ve=b(Te=G,x,Oi).call(Te);return w(G,T,Math.max(Q.AnnotationEditor.MIN_SIZE,ve[2]-ve[0])),w(G,ut,Math.max(Q.AnnotationEditor.MIN_SIZE,ve[3]-ve[1])),b(ke=G,x,Fi).call(ke,kt,wt),G}serialize(){if(this.isEmpty())return null;const r=this.getRect(0,0),A=Q.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:d.AnnotationEditorType.INK,color:A,thickness:this.thickness,opacity:this.opacity,paths:b(this,x,Hr).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,r),pageIndex:this.pageIndex,rect:r,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};ut=new WeakMap,T=new WeakMap,X=new WeakMap,Y=new WeakMap,vt=new WeakMap,Et=new WeakMap,Lt=new WeakMap,Ht=new WeakMap,te=new WeakMap,de=new WeakMap,be=new WeakMap,we=new WeakMap,Wt=new WeakMap,v=new WeakMap,f=new WeakMap,x=new WeakSet,Cr=function(r){const A=G=>{this.thickness=G,b(this,x,Ps).call(this)},j=this.thickness;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Tr=function(r){const A=G=>{this.color=G,b(this,x,ls).call(this)},j=this.color;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Mr=function(r){const A=G=>{this.opacity=G,b(this,x,ls).call(this)};r/=100;const j=this.opacity;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Rr=function(){const{parentRotation:r,parentDimensions:[A,j]}=this;switch(r){case 90:return[0,j,j,A];case 180:return[A,j,A,j];case 270:return[A,0,j,A];default:return[0,0,A,j]}},Pi=function(){const{ctx:r,color:A,opacity:j,thickness:G,parentScale:at,scaleFactor:Ct}=this;r.lineWidth=G*at/Ct,r.lineCap="round",r.lineJoin="round",r.miterLimit=10,r.strokeStyle=`${A}${(0,H.opacityToHex)(j)}`},Lr=function(r,A){this.canvas.addEventListener("contextmenu",V.noContextMenu),this.canvas.addEventListener("pointerleave",t(this,Y)),this.canvas.addEventListener("pointermove",t(this,X)),this.canvas.addEventListener("pointerup",t(this,vt)),this.canvas.removeEventListener("pointerdown",t(this,Et)),this.isEditing=!0,t(this,be)||(w(this,be,!0),b(this,x,ys).call(this),this.thickness||(this.thickness=_e._defaultThickness),this.color||(this.color=_e._defaultColor||Q.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=_e._defaultOpacity)),this.currentPath.push([r,A]),w(this,de,!1),b(this,x,Pi).call(this),w(this,f,()=>{b(this,x,Ir).call(this),t(this,f)&&window.requestAnimationFrame(t(this,f))}),window.requestAnimationFrame(t(this,f))},Ii=function(r,A){const[j,G]=this.currentPath.at(-1);if(this.currentPath.length>1&&r===j&&A===G)return;const at=this.currentPath;let Ct=t(this,Ht);if(at.push([r,A]),w(this,de,!0),at.length<=2){Ct.moveTo(...at[0]),Ct.lineTo(r,A);return}at.length===3&&(w(this,Ht,Ct=new Path2D),Ct.moveTo(...at[0])),b(this,x,Dr).call(this,Ct,...at.at(-3),...at.at(-2),r,A)},kr=function(){if(this.currentPath.length===0)return;const r=this.currentPath.at(-1);t(this,Ht).lineTo(...r)},Pr=function(r,A){w(this,f,null),r=Math.min(Math.max(r,0),this.canvas.width),A=Math.min(Math.max(A,0),this.canvas.height),b(this,x,Ii).call(this,r,A),b(this,x,kr).call(this);let j;if(this.currentPath.length!==1)j=b(this,x,Fr).call(this);else{const wt=[r,A];j=[[wt,wt.slice(),wt.slice(),wt]]}const G=t(this,Ht),at=this.currentPath;this.currentPath=[],w(this,Ht,new Path2D);const Ct=()=>{this.allRawPaths.push(at),this.paths.push(j),this.bezierPath2D.push(G),this._uiManager.rebuild(this)},kt=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(b(this,x,Zs).call(this),b(this,x,ti).call(this)),b(this,x,Ps).call(this))};this.addCommands({cmd:Ct,undo:kt,mustExec:!0})},Ir=function(){if(!t(this,de))return;w(this,de,!1);const r=Math.ceil(this.thickness*this.parentScale),A=this.currentPath.slice(-3),j=A.map(Ct=>Ct[0]),G=A.map(Ct=>Ct[1]);Math.min(...j)-r,Math.max(...j)+r,Math.min(...G)-r,Math.max(...G)+r;const{ctx:at}=this;at.save(),at.clearRect(0,0,this.canvas.width,this.canvas.height);for(const Ct of this.bezierPath2D)at.stroke(Ct);at.stroke(t(this,Ht)),at.restore()},Dr=function(r,A,j,G,at,Ct,kt){const wt=(A+G)/2,qt=(j+at)/2,Vt=(G+Ct)/2,pe=(at+kt)/2;r.bezierCurveTo(wt+2*(G-wt)/3,qt+2*(at-qt)/3,Vt+2*(G-Vt)/3,pe+2*(at-pe)/3,Vt,pe)},Fr=function(){const r=this.currentPath;if(r.length<=2)return[[r[0],r[0],r.at(-1),r.at(-1)]];const A=[];let j,[G,at]=r[0];for(j=1;j<r.length-2;j++){const[ge,me]=r[j],[ve,Ie]=r[j+1],Te=(ge+ve)/2,ke=(me+Ie)/2,Le=[G+2*(ge-G)/3,at+2*(me-at)/3],We=[Te+2*(ge-Te)/3,ke+2*(me-ke)/3];A.push([[G,at],Le,We,[Te,ke]]),[G,at]=[Te,ke]}const[Ct,kt]=r[j],[wt,qt]=r[j+1],Vt=[G+2*(Ct-G)/3,at+2*(kt-at)/3],pe=[wt+2*(Ct-wt)/3,qt+2*(kt-qt)/3];return A.push([[G,at],Vt,pe,[wt,qt]]),A},ls=function(){if(this.isEmpty()){b(this,x,ei).call(this);return}b(this,x,Pi).call(this);const{canvas:r,ctx:A}=this;A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,r.width,r.height),b(this,x,ei).call(this);for(const j of this.bezierPath2D)A.stroke(j)},Di=function(r){this.canvas.removeEventListener("pointerleave",t(this,Y)),this.canvas.removeEventListener("pointermove",t(this,X)),this.canvas.removeEventListener("pointerup",t(this,vt)),this.canvas.addEventListener("pointerdown",t(this,Et)),t(this,Lt)&&clearTimeout(t(this,Lt)),w(this,Lt,setTimeout(()=>{w(this,Lt,null),this.canvas.removeEventListener("contextmenu",V.noContextMenu)},10)),b(this,x,Pr).call(this,r.offsetX,r.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Zs=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")},ti=function(){w(this,we,new ResizeObserver(r=>{const A=r[0].contentRect;A.width&&A.height&&this.setDimensions(A.width,A.height)})),t(this,we).observe(this.div)},ys=function(){if(!t(this,be))return;const[r,A]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*r),this.canvas.height=Math.ceil(this.height*A),b(this,x,ei).call(this)},Fi=function(r,A){const j=b(this,x,si).call(this),G=(r-j)/t(this,T),at=(A-j)/t(this,ut);this.scaleFactor=Math.min(G,at)},ei=function(){const r=b(this,x,si).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+r,this.translationY*this.scaleFactor+r)},De=new WeakSet,Nr=function(r){const A=new Path2D;for(let j=0,G=r.length;j<G;j++){const[at,Ct,kt,wt]=r[j];j===0&&A.moveTo(...at),A.bezierCurveTo(Ct[0],Ct[1],kt[0],kt[1],wt[0],wt[1])}return A},Ni=function(r,A,j){const[G,at,Ct,kt]=A;switch(j){case 0:for(let wt=0,qt=r.length;wt<qt;wt+=2)r[wt]+=G,r[wt+1]=kt-r[wt+1];break;case 90:for(let wt=0,qt=r.length;wt<qt;wt+=2){const Vt=r[wt];r[wt]=r[wt+1]+G,r[wt+1]=Vt+at}break;case 180:for(let wt=0,qt=r.length;wt<qt;wt+=2)r[wt]=Ct-r[wt],r[wt+1]+=at;break;case 270:for(let wt=0,qt=r.length;wt<qt;wt+=2){const Vt=r[wt];r[wt]=Ct-r[wt+1],r[wt+1]=kt-Vt}break;default:throw new Error("Invalid rotation")}return r},Or=function(r,A,j){const[G,at,Ct,kt]=A;switch(j){case 0:for(let wt=0,qt=r.length;wt<qt;wt+=2)r[wt]-=G,r[wt+1]=kt-r[wt+1];break;case 90:for(let wt=0,qt=r.length;wt<qt;wt+=2){const Vt=r[wt];r[wt]=r[wt+1]-at,r[wt+1]=Vt-G}break;case 180:for(let wt=0,qt=r.length;wt<qt;wt+=2)r[wt]=Ct-r[wt],r[wt+1]-=at;break;case 270:for(let wt=0,qt=r.length;wt<qt;wt+=2){const Vt=r[wt];r[wt]=kt-r[wt+1],r[wt+1]=Ct-Vt}break;default:throw new Error("Invalid rotation")}return r},Hr=function(r,A,j,G){var qt,Vt;const at=[],Ct=this.thickness/2,kt=r*A+Ct,wt=r*j+Ct;for(const pe of this.paths){const ge=[],me=[];for(let ve=0,Ie=pe.length;ve<Ie;ve++){const[Te,ke,Le,We]=pe[ve];if(Te[0]===We[0]&&Te[1]===We[1]&&Ie===1){const js=r*Te[0]+kt,Cs=r*Te[1]+wt;ge.push(js,Cs),me.push(js,Cs);break}const Es=r*Te[0]+kt,Ss=r*Te[1]+wt,Us=r*ke[0]+kt,Ve=r*ke[1]+wt,gi=r*Le[0]+kt,fi=r*Le[1]+wt,zs=r*We[0]+kt,Vs=r*We[1]+wt;ve===0&&(ge.push(Es,Ss),me.push(Es,Ss)),ge.push(Us,Ve,gi,fi,zs,Vs),me.push(Us,Ve),ve===Ie-1&&me.push(zs,Vs)}at.push({bezier:b(qt=_e,De,Ni).call(qt,ge,G,this.rotation),points:b(Vt=_e,De,Ni).call(Vt,me,G,this.rotation)})}return at},Oi=function(){let r=1/0,A=-1/0,j=1/0,G=-1/0;for(const at of this.paths)for(const[Ct,kt,wt,qt]of at){const Vt=d.Util.bezierBoundingBox(...Ct,...kt,...wt,...qt);r=Math.min(r,Vt[0]),j=Math.min(j,Vt[1]),A=Math.max(A,Vt[2]),G=Math.max(G,Vt[3])}return[r,j,A,G]},si=function(){return t(this,te)?Math.ceil(this.thickness*this.parentScale):0},Ps=function(r=!1){if(this.isEmpty())return;if(!t(this,te)){b(this,x,ls).call(this);return}const A=b(this,x,Oi).call(this),j=b(this,x,si).call(this);w(this,T,Math.max(Q.AnnotationEditor.MIN_SIZE,A[2]-A[0])),w(this,ut,Math.max(Q.AnnotationEditor.MIN_SIZE,A[3]-A[1]));const G=Math.ceil(j+t(this,T)*this.scaleFactor),at=Math.ceil(j+t(this,ut)*this.scaleFactor),[Ct,kt]=this.parentDimensions;this.width=G/Ct,this.height=at/kt,this.setAspectRatio(G,at);const wt=this.translationX,qt=this.translationY;this.translationX=-A[0],this.translationY=-A[1],b(this,x,ys).call(this),b(this,x,ls).call(this),w(this,Wt,G),w(this,v,at),this.setDims(G,at);const Vt=r?j/this.scaleFactor/2:0;this.translate(wt-this.translationX-Vt,qt-this.translationY-Vt)},_(_e,De),he(_e,"_defaultColor",null),he(_e,"_defaultOpacity",1),he(_e,"_defaultThickness",1),he(_e,"_type","ink"),he(_e,"_editorType",d.AnnotationEditorType.INK);let y=_e;const xs=class xs extends Q.AnnotationEditor{constructor(r){super({...r,name:"stampEditor"});_(this,ye);_(this,Ce,null);_(this,Pe,null);_(this,Qe,null);_(this,$e,null);_(this,Ze,null);_(this,ds,"");_(this,je,null);_(this,ns,null);_(this,qe,null);_(this,Ue,!1);_(this,_s,!1);w(this,$e,r.bitmapUrl),w(this,Ze,r.bitmapFile)}static initialize(r,A){Q.AnnotationEditor.initialize(r,A)}static get supportedTypes(){const r=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,d.shadow)(this,"supportedTypes",r.map(A=>`image/${A}`))}static get supportedTypesStr(){return(0,d.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(r){return this.supportedTypes.includes(r)}static paste(r,A){A.pasteEditor(d.AnnotationEditorType.STAMP,{bitmapFile:r.getAsFile()})}remove(){var r,A;t(this,Pe)&&(w(this,Ce,null),this._uiManager.imageManager.deleteId(t(this,Pe)),(r=t(this,je))==null||r.remove(),w(this,je,null),(A=t(this,ns))==null||A.disconnect(),w(this,ns,null),t(this,qe)&&(clearTimeout(t(this,qe)),w(this,qe,null))),super.remove()}rebuild(){if(!this.parent){t(this,Pe)&&b(this,ye,ii).call(this);return}super.rebuild(),this.div!==null&&(t(this,Pe)&&t(this,je)===null&&b(this,ye,ii).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(t(this,Qe)||t(this,Ce)||t(this,$e)||t(this,Ze)||t(this,Pe))}get isResizable(){return!0}render(){if(this.div)return this.div;let r,A;if(this.width&&(r=this.x,A=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),t(this,Ce)?b(this,ye,Hi).call(this):b(this,ye,ii).call(this),this.width){const[j,G]=this.parentDimensions;this.setAt(r*j,A*G,this.width*j,this.height*G)}return this.div}getImageForAltText(){return t(this,je)}static deserialize(r,A,j){if(r instanceof J.StampAnnotationElement)return null;const G=super.deserialize(r,A,j),{rect:at,bitmapUrl:Ct,bitmapId:kt,isSvg:wt,accessibilityData:qt}=r;kt&&j.imageManager.isValidId(kt)?w(G,Pe,kt):w(G,$e,Ct),w(G,Ue,wt);const[Vt,pe]=G.pageDimensions;return G.width=(at[2]-at[0])/Vt,G.height=(at[3]-at[1])/pe,qt&&(G.altTextData=qt),G}serialize(r=!1,A=null){if(this.isEmpty())return null;const j={annotationType:d.AnnotationEditorType.STAMP,bitmapId:t(this,Pe),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:t(this,Ue),structTreeParentId:this._structTreeParentId};if(r)return j.bitmapUrl=b(this,ye,ni).call(this,!0),j.accessibilityData=this.altTextData,j;const{decorative:G,altText:at}=this.altTextData;if(!G&&at&&(j.accessibilityData={type:"Figure",alt:at}),A===null)return j;A.stamps||(A.stamps=new Map);const Ct=t(this,Ue)?(j.rect[2]-j.rect[0])*(j.rect[3]-j.rect[1]):null;if(!A.stamps.has(t(this,Pe)))A.stamps.set(t(this,Pe),{area:Ct,serialized:j}),j.bitmap=b(this,ye,ni).call(this,!1);else if(t(this,Ue)){const kt=A.stamps.get(t(this,Pe));Ct>kt.area&&(kt.area=Ct,kt.serialized.bitmap.close(),kt.serialized.bitmap=b(this,ye,ni).call(this,!1))}return j}};Ce=new WeakMap,Pe=new WeakMap,Qe=new WeakMap,$e=new WeakMap,Ze=new WeakMap,ds=new WeakMap,je=new WeakMap,ns=new WeakMap,qe=new WeakMap,Ue=new WeakMap,_s=new WeakMap,ye=new WeakSet,Is=function(r,A=!1){if(!r){this.remove();return}w(this,Ce,r.bitmap),A||(w(this,Pe,r.id),w(this,Ue,r.isSvg)),r.file&&w(this,ds,r.file.name),b(this,ye,Hi).call(this)},Ds=function(){w(this,Qe,null),this._uiManager.enableWaiting(!1),t(this,je)&&this.div.focus()},ii=function(){if(t(this,Pe)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(t(this,Pe)).then(A=>b(this,ye,Is).call(this,A,!0)).finally(()=>b(this,ye,Ds).call(this));return}if(t(this,$e)){const A=t(this,$e);w(this,$e,null),this._uiManager.enableWaiting(!0),w(this,Qe,this._uiManager.imageManager.getFromUrl(A).then(j=>b(this,ye,Is).call(this,j)).finally(()=>b(this,ye,Ds).call(this)));return}if(t(this,Ze)){const A=t(this,Ze);w(this,Ze,null),this._uiManager.enableWaiting(!0),w(this,Qe,this._uiManager.imageManager.getFromFile(A).then(j=>b(this,ye,Is).call(this,j)).finally(()=>b(this,ye,Ds).call(this)));return}const r=document.createElement("input");r.type="file",r.accept=xs.supportedTypesStr,w(this,Qe,new Promise(A=>{r.addEventListener("change",async()=>{if(!r.files||r.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const j=await this._uiManager.imageManager.getFromFile(r.files[0]);b(this,ye,Is).call(this,j)}A()}),r.addEventListener("cancel",()=>{this.remove(),A()})}).finally(()=>b(this,ye,Ds).call(this))),r.click()},Hi=function(){const{div:r}=this;let{width:A,height:j}=t(this,Ce);const[G,at]=this.pageDimensions,Ct=.75;if(this.width)A=this.width*G,j=this.height*at;else if(A>Ct*G||j>Ct*at){const Vt=Math.min(Ct*G/A,Ct*at/j);A*=Vt,j*=Vt}const[kt,wt]=this.parentDimensions;this.setDims(A*kt/G,j*wt/at),this._uiManager.enableWaiting(!1);const qt=w(this,je,document.createElement("canvas"));r.append(qt),r.hidden=!1,b(this,ye,Bi).call(this,A,j),b(this,ye,zr).call(this),t(this,_s)||(this.parent.addUndoableEditor(this),w(this,_s,!0)),this._reportTelemetry({action:"inserted_image"}),t(this,ds)&&qt.setAttribute("aria-label",t(this,ds))},Br=function(r,A){var Ct;const[j,G]=this.parentDimensions;this.width=r/j,this.height=A/G,this.setDims(r,A),(Ct=this._initialOptions)!=null&&Ct.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,t(this,qe)!==null&&clearTimeout(t(this,qe)),w(this,qe,setTimeout(()=>{w(this,qe,null),b(this,ye,Bi).call(this,r,A)},200))},Ur=function(r,A){const{width:j,height:G}=t(this,Ce);let at=j,Ct=G,kt=t(this,Ce);for(;at>2*r||Ct>2*A;){const wt=at,qt=Ct;at>2*r&&(at=at>=16384?Math.floor(at/2)-1:Math.ceil(at/2)),Ct>2*A&&(Ct=Ct>=16384?Math.floor(Ct/2)-1:Math.ceil(Ct/2));const Vt=new OffscreenCanvas(at,Ct);Vt.getContext("2d").drawImage(kt,0,0,wt,qt,0,0,at,Ct),kt=Vt.transferToImageBitmap()}return kt},Bi=function(r,A){r=Math.ceil(r),A=Math.ceil(A);const j=t(this,je);if(!j||j.width===r&&j.height===A)return;j.width=r,j.height=A;const G=t(this,Ue)?t(this,Ce):b(this,ye,Ur).call(this,r,A);if(this._uiManager.hasMLManager&&!this.hasAltText()){const Ct=new OffscreenCanvas(r,A);Ct.getContext("2d").drawImage(G,0,0,G.width,G.height,0,0,r,A),Ct.convertToBlob().then(kt=>{const wt=new FileReader;wt.onload=()=>{const qt=wt.result;this._uiManager.mlGuess({service:"image-to-text",request:{imageData:qt}}).then(Vt=>{const pe=(Vt==null?void 0:Vt.output)||"";this.parent&&pe&&!this.hasAltText()&&(this.altTextData={altText:pe,decorative:!1})})},wt.readAsDataURL(kt)})}const at=j.getContext("2d");at.filter=this._uiManager.hcmFilter,at.drawImage(G,0,0,G.width,G.height,0,0,r,A)},ni=function(r){if(r){if(t(this,Ue)){const j=this._uiManager.imageManager.getSvgUrl(t(this,Pe));if(j)return j}const A=document.createElement("canvas");return{width:A.width,height:A.height}=t(this,Ce),A.getContext("2d").drawImage(t(this,Ce),0,0),A.toDataURL()}if(t(this,Ue)){const[A,j]=this.pageDimensions,G=Math.round(this.width*A*V.PixelsPerInch.PDF_TO_CSS_UNITS),at=Math.round(this.height*j*V.PixelsPerInch.PDF_TO_CSS_UNITS),Ct=new OffscreenCanvas(G,at);return Ct.getContext("2d").drawImage(t(this,Ce),0,0,t(this,Ce).width,t(this,Ce).height,0,0,G,at),Ct.transferToImageBitmap()}return structuredClone(t(this,Ce))},zr=function(){w(this,ns,new ResizeObserver(r=>{const A=r[0].contentRect;A.width&&A.height&&b(this,ye,Br).call(this,A.width,A.height)})),t(this,ns).observe(this.div)},he(xs,"_type","stamp"),he(xs,"_editorType",d.AnnotationEditorType.STAMP);let D=xs;const ze=class ze{constructor({uiManager:rt,pageIndex:r,div:A,accessibilityManager:j,annotationLayer:G,drawLayer:at,textLayer:Ct,viewport:kt,l10n:wt}){_(this,Fe);_(this,rs);_(this,us,!1);_(this,Ge,null);_(this,as,null);_(this,Xe,null);_(this,Ke,null);_(this,Ye,null);_(this,He,new Map);_(this,ts,!1);_(this,ps,!1);_(this,gs,!1);_(this,Ne,null);_(this,ne);const qt=[...t(ze,es).values()];if(!ze._initialized){ze._initialized=!0;for(const Vt of qt)Vt.initialize(wt,rt)}rt.registerEditorTypes(qt),w(this,ne,rt),this.pageIndex=r,this.div=A,w(this,rs,j),w(this,Ge,G),this.viewport=kt,w(this,Ne,Ct),this.drawLayer=at,t(this,ne).addLayer(this)}get isEmpty(){return t(this,He).size===0}get isInvisible(){return this.isEmpty&&t(this,ne).getMode()===d.AnnotationEditorType.NONE}updateToolbar(rt){t(this,ne).updateToolbar(rt)}updateMode(rt=t(this,ne).getMode()){switch(b(this,Fe,ri).call(this),rt){case d.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case d.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case d.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:r}=this.div;for(const A of t(ze,es).values())r.toggle(`${A._type}Editing`,rt===A._editorType);this.div.hidden=!1}hasTextLayer(rt){var r;return rt===((r=t(this,Ne))==null?void 0:r.div)}addInkEditorIfNeeded(rt){if(t(this,ne).getMode()===d.AnnotationEditorType.INK){if(!rt){for(const r of t(this,He).values())if(r.isEmpty()){r.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(rt){t(this,ne).setEditingState(rt)}addCommands(rt){t(this,ne).addCommands(rt)}togglePointerEvents(rt=!1){this.div.classList.toggle("disabled",!rt)}toggleAnnotationLayerPointerEvents(rt=!1){var r;(r=t(this,Ge))==null||r.div.classList.toggle("disabled",!rt)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const rt=new Set;for(const A of t(this,He).values())A.enableEditing(),A.show(!0),A.annotationElementId&&(t(this,ne).removeChangedExistingAnnotation(A),rt.add(A.annotationElementId));if(!t(this,Ge))return;const r=t(this,Ge).getEditableAnnotations();for(const A of r){if(A.hide(),t(this,ne).isDeletedAnnotationElement(A.data.id)||rt.has(A.data.id))continue;const j=this.deserialize(A);j&&(this.addOrRebuild(j),j.enableEditing())}}disable(){var j;w(this,gs,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const rt=new Map,r=new Map;for(const G of t(this,He).values())if(G.disableEditing(),!!G.annotationElementId){if(G.serialize()!==null){rt.set(G.annotationElementId,G);continue}else r.set(G.annotationElementId,G);(j=this.getEditableAnnotation(G.annotationElementId))==null||j.show(),G.remove()}if(t(this,Ge)){const G=t(this,Ge).getEditableAnnotations();for(const at of G){const{id:Ct}=at.data;if(t(this,ne).isDeletedAnnotationElement(Ct))continue;let kt=r.get(Ct);if(kt){kt.resetAnnotationElement(at),kt.show(!1),at.show();continue}kt=rt.get(Ct),kt&&(t(this,ne).addChangedExistingAnnotation(kt),kt.renderAnnotationElement(at),kt.show(!1)),at.show()}}b(this,Fe,ri).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:A}=this.div;for(const G of t(ze,es).values())A.remove(`${G._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),w(this,gs,!1)}getEditableAnnotation(rt){var r;return((r=t(this,Ge))==null?void 0:r.getEditableAnnotation(rt))||null}setActiveEditor(rt){t(this,ne).getActive()!==rt&&t(this,ne).setActiveEditor(rt)}enableTextSelection(){var rt;this.div.tabIndex=-1,(rt=t(this,Ne))!=null&&rt.div&&!t(this,Ke)&&(w(this,Ke,b(this,Fe,Vr).bind(this)),t(this,Ne).div.addEventListener("pointerdown",t(this,Ke)),t(this,Ne).div.classList.add("highlighting"))}disableTextSelection(){var rt;this.div.tabIndex=0,(rt=t(this,Ne))!=null&&rt.div&&t(this,Ke)&&(t(this,Ne).div.removeEventListener("pointerdown",t(this,Ke)),w(this,Ke,null),t(this,Ne).div.classList.remove("highlighting"))}enableClick(){t(this,Xe)||(w(this,Xe,this.pointerdown.bind(this)),w(this,as,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",t(this,Xe)),this.div.addEventListener("pointerup",t(this,as)))}disableClick(){t(this,Xe)&&(this.div.removeEventListener("pointerdown",t(this,Xe)),this.div.removeEventListener("pointerup",t(this,as)),w(this,Xe,null),w(this,as,null))}attach(rt){t(this,He).set(rt.id,rt);const{annotationElementId:r}=rt;r&&t(this,ne).isDeletedAnnotationElement(r)&&t(this,ne).removeDeletedAnnotationElement(rt)}detach(rt){var r;t(this,He).delete(rt.id),(r=t(this,rs))==null||r.removePointerInTextLayer(rt.contentDiv),!t(this,gs)&&rt.annotationElementId&&t(this,ne).addDeletedAnnotationElement(rt)}remove(rt){this.detach(rt),t(this,ne).removeEditor(rt),rt.div.remove(),rt.isAttachedToDOM=!1,t(this,ps)||this.addInkEditorIfNeeded(!1)}changeParent(rt){var r;rt.parent!==this&&(rt.parent&&rt.annotationElementId&&(t(this,ne).addDeletedAnnotationElement(rt.annotationElementId),Q.AnnotationEditor.deleteAnnotationElement(rt),rt.annotationElementId=null),this.attach(rt),(r=rt.parent)==null||r.detach(rt),rt.setParent(this),rt.div&&rt.isAttachedToDOM&&(rt.div.remove(),this.div.append(rt.div)))}add(rt){if(!(rt.parent===this&&rt.isAttachedToDOM)){if(this.changeParent(rt),t(this,ne).addEditor(rt),this.attach(rt),!rt.isAttachedToDOM){const r=rt.render();this.div.append(r),rt.isAttachedToDOM=!0}rt.fixAndSetPosition(),rt.onceAdded(),t(this,ne).addToAnnotationStorage(rt),rt._reportTelemetry(rt.telemetryInitialData)}}moveEditorInDOM(rt){var A;if(!rt.isAttachedToDOM)return;const{activeElement:r}=document;rt.div.contains(r)&&!t(this,Ye)&&(rt._focusEventsAllowed=!1,w(this,Ye,setTimeout(()=>{w(this,Ye,null),rt.div.contains(document.activeElement)?rt._focusEventsAllowed=!0:(rt.div.addEventListener("focusin",()=>{rt._focusEventsAllowed=!0},{once:!0}),r.focus())},0))),rt._structTreeParentId=(A=t(this,rs))==null?void 0:A.moveElementInDOM(this.div,rt.div,rt.contentDiv,!0)}addOrRebuild(rt){rt.needsToBeRebuilt()?(rt.parent||(rt.parent=this),rt.rebuild(),rt.show()):this.add(rt)}addUndoableEditor(rt){const r=()=>rt._uiManager.rebuild(rt),A=()=>{rt.remove()};this.addCommands({cmd:r,undo:A,mustExec:!1})}getNextId(){return t(this,ne).getId()}canCreateNewEmptyEditor(){var rt;return(rt=t(this,Fe,Ui))==null?void 0:rt.canCreateNewEmptyEditor()}pasteEditor(rt,r){t(this,ne).updateToolbar(rt),t(this,ne).updateMode(rt);const{offsetX:A,offsetY:j}=b(this,Fe,Vi).call(this),G=this.getNextId(),at=b(this,Fe,zi).call(this,{parent:this,id:G,x:A,y:j,uiManager:t(this,ne),isCentered:!0,...r});at&&this.add(at)}deserialize(rt){var r;return((r=t(ze,es).get(rt.annotationType??rt.annotationEditorType))==null?void 0:r.deserialize(rt,this,t(this,ne)))||null}createAndAddNewEditor(rt,r,A={}){const j=this.getNextId(),G=b(this,Fe,zi).call(this,{parent:this,id:j,x:rt.offsetX,y:rt.offsetY,uiManager:t(this,ne),isCentered:r,...A});return G&&this.add(G),G}addNewEditor(){this.createAndAddNewEditor(b(this,Fe,Vi).call(this),!0)}setSelected(rt){t(this,ne).setSelected(rt)}toggleSelected(rt){t(this,ne).toggleSelected(rt)}isSelected(rt){return t(this,ne).isSelected(rt)}unselect(rt){t(this,ne).unselect(rt)}pointerup(rt){const{isMac:r}=d.FeatureTest.platform;if(!(rt.button!==0||rt.ctrlKey&&r)&&rt.target===this.div&&t(this,ts)){if(w(this,ts,!1),!t(this,us)){w(this,us,!0);return}if(t(this,ne).getMode()===d.AnnotationEditorType.STAMP){t(this,ne).unselectAll();return}this.createAndAddNewEditor(rt,!1)}}pointerdown(rt){if(t(this,ne).getMode()===d.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),t(this,ts)){w(this,ts,!1);return}const{isMac:r}=d.FeatureTest.platform;if(rt.button!==0||rt.ctrlKey&&r||rt.target!==this.div)return;w(this,ts,!0);const A=t(this,ne).getActive();w(this,us,!A||A.isEmpty())}findNewParent(rt,r,A){const j=t(this,ne).findParent(r,A);return j===null||j===this?!1:(j.changeParent(rt),!0)}destroy(){var rt,r;((rt=t(this,ne).getActive())==null?void 0:rt.parent)===this&&(t(this,ne).commitOrRemove(),t(this,ne).setActiveEditor(null)),t(this,Ye)&&(clearTimeout(t(this,Ye)),w(this,Ye,null));for(const A of t(this,He).values())(r=t(this,rs))==null||r.removePointerInTextLayer(A.contentDiv),A.setParent(null),A.isAttachedToDOM=!1,A.div.remove();this.div=null,t(this,He).clear(),t(this,ne).removeLayer(this)}render({viewport:rt}){this.viewport=rt,(0,V.setLayerDimensions)(this.div,rt);for(const r of t(this,ne).getEditors(this.pageIndex))this.add(r),r.rebuild();this.updateMode()}update({viewport:rt}){t(this,ne).commitOrRemove(),b(this,Fe,ri).call(this);const r=this.viewport.rotation,A=rt.rotation;if(this.viewport=rt,(0,V.setLayerDimensions)(this.div,{rotation:A}),r!==A)for(const j of t(this,He).values())j.rotate(A);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:rt,pageHeight:r}=this.viewport.rawDims;return[rt,r]}get scale(){return t(this,ne).viewParameters.realScale}};rs=new WeakMap,us=new WeakMap,Ge=new WeakMap,as=new WeakMap,Xe=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,He=new WeakMap,ts=new WeakMap,ps=new WeakMap,gs=new WeakMap,Ne=new WeakMap,ne=new WeakMap,es=new WeakMap,Fe=new WeakSet,Vr=function(rt){if(t(this,ne).unselectAll(),rt.target===t(this,Ne).div){const{isMac:r}=d.FeatureTest.platform;if(rt.button!==0||rt.ctrlKey&&r)return;t(this,ne).showAllEditors("highlight",!0,!0),t(this,Ne).div.classList.add("free"),E.startHighlighting(this,t(this,ne).direction==="ltr",rt),t(this,Ne).div.addEventListener("pointerup",()=>{t(this,Ne).div.classList.remove("free")},{once:!0}),rt.preventDefault()}},Ui=function(){return t(ze,es).get(t(this,ne).getMode())},zi=function(rt){const r=t(this,Fe,Ui);return r?new r.prototype.constructor(rt):null},Vi=function(){const{x:rt,y:r,width:A,height:j}=this.div.getBoundingClientRect(),G=Math.max(0,rt),at=Math.max(0,r),Ct=Math.min(window.innerWidth,rt+A),kt=Math.min(window.innerHeight,r+j),wt=(G+Ct)/2-rt,qt=(at+kt)/2-r,[Vt,pe]=this.viewport.rotation%180===0?[wt,qt]:[qt,wt];return{offsetX:Vt,offsetY:pe}},ri=function(){w(this,ps,!0);for(const rt of t(this,He).values())rt.isEmpty()&&rt.remove();w(this,ps,!1)},he(ze,"_initialized",!1),_(ze,es,new Map([z,y,D,E].map(rt=>[rt._editorType,rt])));let L=ze},259:(ie,$t,dt)=>{var At,z,F,I,V,E,y,D,L,Z,B,K,k,ji,qi,jr,cs,qr,ss;dt.d($t,{ColorPicker:()=>J});var d=dt(292),Q=dt(830),H=dt(419);const Tt=class Tt{constructor({editor:nt=null,uiManager:Mt=null}){_(this,k);_(this,At,b(this,k,jr).bind(this));_(this,z,b(this,k,qr).bind(this));_(this,F,null);_(this,I,null);_(this,V);_(this,E,null);_(this,y,!1);_(this,D,!1);_(this,L,null);_(this,Z);_(this,B,null);_(this,K);var It;nt?(w(this,D,!1),w(this,K,d.AnnotationEditorParamsType.HIGHLIGHT_COLOR),w(this,L,nt)):(w(this,D,!0),w(this,K,d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR)),w(this,B,(nt==null?void 0:nt._uiManager)||Mt),w(this,Z,t(this,B)._eventBus),w(this,V,(nt==null?void 0:nt.color)||((It=t(this,B))==null?void 0:It.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return(0,d.shadow)(this,"_keyboardManager",new Q.KeyboardManager([[["Escape","mac+Escape"],Tt.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Tt.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Tt.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Tt.prototype._moveToPrevious],[["Home","mac+Home"],Tt.prototype._moveToBeginning],[["End","mac+End"],Tt.prototype._moveToEnd]]))}renderButton(){const nt=w(this,F,document.createElement("button"));nt.className="colorPicker",nt.tabIndex="0",nt.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),nt.setAttribute("aria-haspopup",!0),nt.addEventListener("click",b(this,k,cs).bind(this)),nt.addEventListener("keydown",t(this,At));const Mt=w(this,I,document.createElement("span"));return Mt.className="swatch",Mt.setAttribute("aria-hidden",!0),Mt.style.backgroundColor=t(this,V),nt.append(Mt),nt}renderMainDropdown(){const nt=w(this,E,b(this,k,ji).call(this));return nt.setAttribute("aria-orientation","horizontal"),nt.setAttribute("aria-labelledby","highlightColorPickerLabel"),nt}_colorSelectFromKeyboard(nt){if(nt.target===t(this,F)){b(this,k,cs).call(this,nt);return}const Mt=nt.target.getAttribute("data-color");Mt&&b(this,k,qi).call(this,Mt,nt)}_moveToNext(nt){var Mt,It;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}if(nt.target===t(this,F)){(Mt=t(this,E).firstChild)==null||Mt.focus();return}(It=nt.target.nextSibling)==null||It.focus()}_moveToPrevious(nt){var Mt,It;if(nt.target===((Mt=t(this,E))==null?void 0:Mt.firstChild)||nt.target===t(this,F)){t(this,k,ss)&&this._hideDropdownFromKeyboard();return}t(this,k,ss)||b(this,k,cs).call(this,nt),(It=nt.target.previousSibling)==null||It.focus()}_moveToBeginning(nt){var Mt;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}(Mt=t(this,E).firstChild)==null||Mt.focus()}_moveToEnd(nt){var Mt;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}(Mt=t(this,E).lastChild)==null||Mt.focus()}hideDropdown(){var nt;(nt=t(this,E))==null||nt.classList.add("hidden"),window.removeEventListener("pointerdown",t(this,z))}_hideDropdownFromKeyboard(){var nt;if(!t(this,D)){if(!t(this,k,ss)){(nt=t(this,L))==null||nt.unselect();return}this.hideDropdown(),t(this,F).focus({preventScroll:!0,focusVisible:t(this,y)})}}updateColor(nt){if(t(this,I)&&(t(this,I).style.backgroundColor=nt),!t(this,E))return;const Mt=t(this,B).highlightColors.values();for(const It of t(this,E).children)It.setAttribute("aria-selected",Mt.next().value===nt)}destroy(){var nt,Mt;(nt=t(this,F))==null||nt.remove(),w(this,F,null),w(this,I,null),(Mt=t(this,E))==null||Mt.remove(),w(this,E,null)}};At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakMap,V=new WeakMap,E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakMap,B=new WeakMap,K=new WeakMap,k=new WeakSet,ji=function(){const nt=document.createElement("div");nt.addEventListener("contextmenu",H.noContextMenu),nt.className="dropdown",nt.role="listbox",nt.setAttribute("aria-multiselectable",!1),nt.setAttribute("aria-orientation","vertical"),nt.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[Mt,It]of t(this,B).highlightColors){const Pt=document.createElement("button");Pt.tabIndex="0",Pt.role="option",Pt.setAttribute("data-color",It),Pt.title=Mt,Pt.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${Mt}`);const Xt=document.createElement("span");Pt.append(Xt),Xt.className="swatch",Xt.style.backgroundColor=It,Pt.setAttribute("aria-selected",It===t(this,V)),Pt.addEventListener("click",b(this,k,qi).bind(this,It)),nt.append(Pt)}return nt.addEventListener("keydown",t(this,At)),nt},qi=function(nt,Mt){Mt.stopPropagation(),t(this,Z).dispatch("switchannotationeditorparams",{source:this,type:t(this,K),value:nt})},jr=function(nt){Tt._keyboardManager.exec(this,nt)},cs=function(nt){if(t(this,k,ss)){this.hideDropdown();return}if(w(this,y,nt.detail===0),window.addEventListener("pointerdown",t(this,z)),t(this,E)){t(this,E).classList.remove("hidden");return}const Mt=w(this,E,b(this,k,ji).call(this));t(this,F).append(Mt)},qr=function(nt){var Mt;(Mt=t(this,E))!=null&&Mt.contains(nt.target)||this.hideDropdown()},ss=function(){return t(this,E)&&!t(this,E).classList.contains("hidden")};let J=Tt},310:(ie,$t,dt)=>{var I,V,E,y,D,L,Z,B,Gi,O,C,P,ht,st,bt,Tt,ot,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,Rt,Qt,ue,Ae,Bt,Wi,ee,$i,Xi,Gr,Wr,Ki,Yi,Ji,$r,Xr,Kr,Yr,Qi,Fs;dt.d($t,{AnnotationEditor:()=>z});var d=dt(830),Q=dt(292),H=dt(419);const k=class k{constructor(e){_(this,B);_(this,I,"");_(this,V,!1);_(this,E,null);_(this,y,null);_(this,D,null);_(this,L,!1);_(this,Z,null);w(this,Z,e)}static initialize(e){k._l10nPromise||(k._l10nPromise=e)}async render(){const e=w(this,E,document.createElement("button"));e.className="altText";const i=await k._l10nPromise.get("pdfjs-editor-alt-text-button-label");e.textContent=i,e.setAttribute("aria-label",i),e.tabIndex="0",e.addEventListener("contextmenu",H.noContextMenu),e.addEventListener("pointerdown",m=>m.stopPropagation());const o=m=>{m.preventDefault(),t(this,Z)._uiManager.editAltText(t(this,Z))};return e.addEventListener("click",o,{capture:!0}),e.addEventListener("keydown",m=>{m.target===e&&m.key==="Enter"&&(w(this,L,!0),o(m))}),await b(this,B,Gi).call(this),e}finish(){t(this,E)&&(t(this,E).focus({focusVisible:t(this,L)}),w(this,L,!1))}isEmpty(){return!t(this,I)&&!t(this,V)}get data(){return{altText:t(this,I),decorative:t(this,V)}}set data({altText:e,decorative:i}){t(this,I)===e&&t(this,V)===i||(w(this,I,e),w(this,V,i),b(this,B,Gi).call(this))}toggle(e=!1){t(this,E)&&(!e&&t(this,D)&&(clearTimeout(t(this,D)),w(this,D,null)),t(this,E).disabled=!e)}destroy(){var e;(e=t(this,E))==null||e.remove(),w(this,E,null),w(this,y,null)}};I=new WeakMap,V=new WeakMap,E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakMap,B=new WeakSet,Gi=async function(){var o,m;const e=t(this,E);if(!e)return;if(!t(this,I)&&!t(this,V)){e.classList.remove("done"),(o=t(this,y))==null||o.remove();return}e.classList.add("done"),k._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(M=>{e.setAttribute("aria-label",M)});let i=t(this,y);if(!i){w(this,y,i=document.createElement("span")),i.className="tooltip",i.setAttribute("role","tooltip");const M=i.id=`alt-text-tooltip-${t(this,Z).id}`;e.setAttribute("aria-describedby",M);const $=100;e.addEventListener("mouseenter",()=>{w(this,D,setTimeout(()=>{w(this,D,null),t(this,y).classList.add("show"),t(this,Z)._reportTelemetry({action:"alt_text_tooltip"})},$))}),e.addEventListener("mouseleave",()=>{var W;t(this,D)&&(clearTimeout(t(this,D)),w(this,D,null)),(W=t(this,y))==null||W.classList.remove("show")})}i.innerText=t(this,V)?await k._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):t(this,I),i.parentNode||e.append(i),(m=t(this,Z).getImageForAltText())==null||m.setAttribute("aria-describedby",i.id)},he(k,"_l10nPromise",null);let J=k;var At=dt(362);const p=class p{constructor(e){_(this,Bt);_(this,O,null);_(this,C,null);_(this,P,!1);_(this,ht,!1);_(this,st,null);_(this,bt,null);_(this,Tt,this.focusin.bind(this));_(this,ot,this.focusout.bind(this));_(this,nt,null);_(this,Mt,"");_(this,It,!1);_(this,Pt,null);_(this,Xt,!1);_(this,ae,!1);_(this,Jt,!1);_(this,re,null);_(this,oe,0);_(this,Rt,0);_(this,Qt,null);he(this,"_initialOptions",Object.create(null));he(this,"_isVisible",!0);he(this,"_uiManager",null);he(this,"_focusEventsAllowed",!0);he(this,"_l10nPromise",null);_(this,ue,!1);_(this,Ae,p._zIndex++);this.constructor===p&&(0,Q.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:i,rawDims:{pageWidth:o,pageHeight:m,pageX:M,pageY:$}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[o,m],this.pageTranslation=[M,$];const[W,tt]=this.parentDimensions;this.x=e.x/W,this.y=e.y/tt,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=p.prototype._resizeWithKeyboard,i=d.AnnotationEditorUIManager.TRANSLATE_SMALL,o=d.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,Q.shadow)(this,"_resizerKeyboardManager",new d.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-o,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[o,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-o]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,o]}],[["Escape","mac+Escape"],p.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,Q.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new F({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});i.annotationElementId=e.annotationElementId,i.deleted=!0,i._uiManager.addToAnnotationStorage(i)}static initialize(e,i,o){if(p._l10nPromise||(p._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(M=>[M,e.get(M.replaceAll(/([A-Z])/g,$=>`-${$.toLowerCase()}`))]))),o==null?void 0:o.strings)for(const M of o.strings)p._l10nPromise.set(M,e.get(M));if(p._borderLineWidth!==-1)return;const m=getComputedStyle(document.documentElement);p._borderLineWidth=parseFloat(m.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){(0,Q.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return t(this,ue)}set _isDraggable(e){var i;w(this,ue,e),(i=this.div)==null||i.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,i]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*i/(e*2),this.y+=this.width*e/(i*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(e*2),this.y-=this.width*e/(i*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=t(this,Ae)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):b(this,Bt,Fs).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(t(this,It)?w(this,It,!1):this.parent.setSelected(this))}focusout(e){var i,o;!this._focusEventsAllowed||!this.isAttachedToDOM||(i=e.relatedTarget)!=null&&i.closest(`#${this.id}`)||(e.preventDefault(),(o=this.parent)!=null&&o.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,o,m){const[M,$]=this.parentDimensions;[o,m]=this.screenToPageTranslation(o,m),this.x=(e+o)/M,this.y=(i+m)/$,this.fixAndSetPosition()}translate(e,i){b(this,Bt,Wi).call(this,this.parentDimensions,e,i)}translateInPage(e,i){t(this,Pt)||w(this,Pt,[this.x,this.y]),b(this,Bt,Wi).call(this,this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}drag(e,i){t(this,Pt)||w(this,Pt,[this.x,this.y]);const[o,m]=this.parentDimensions;if(this.x+=e/o,this.y+=i/m,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:gt,y:it}=this.div.getBoundingClientRect();this.parent.findNewParent(this,gt,it)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:M,y:$}=this;const[W,tt]=this.getBaseTranslation();M+=W,$+=tt,this.div.style.left=`${(100*M).toFixed(2)}%`,this.div.style.top=`${(100*$).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!t(this,Pt)&&(t(this,Pt)[0]!==this.x||t(this,Pt)[1]!==this.y)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:o}=p,m=o/e,M=o/i;switch(this.rotation){case 90:return[-m,M];case 180:return[m,M];case 270:return[m,-M];default:return[-m,-M]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[i,o]=this.pageDimensions;let{x:m,y:M,width:$,height:W}=this;if($*=i,W*=o,m*=i,M*=o,this._mustFixPosition)switch(e){case 0:m=Math.max(0,Math.min(i-$,m)),M=Math.max(0,Math.min(o-W,M));break;case 90:m=Math.max(0,Math.min(i-W,m)),M=Math.min(o,Math.max($,M));break;case 180:m=Math.min(i,Math.max($,m)),M=Math.min(o,Math.max(W,M));break;case 270:m=Math.min(i,Math.max(W,m)),M=Math.max(0,Math.min(o-$,M));break}this.x=m/=i,this.y=M/=o;const[tt,gt]=this.getBaseTranslation();m+=tt,M+=gt;const{style:it}=this.div;it.left=`${(100*m).toFixed(2)}%`,it.top=`${(100*M).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var o;return b(o=p,ee,$i).call(o,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var o;return b(o=p,ee,$i).call(o,e,i,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[i,o]}=this,m=i*e,M=o*e;return Q.FeatureTest.isCSSRoundSupported?[Math.round(m),Math.round(M)]:[m,M]}setDims(e,i){const[o,m]=this.parentDimensions;this.div.style.width=`${(100*e/o).toFixed(2)}%`,t(this,ht)||(this.div.style.height=`${(100*i/m).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:o}=e,m=o.endsWith("%"),M=!t(this,ht)&&i.endsWith("%");if(m&&M)return;const[$,W]=this.parentDimensions;m||(e.width=`${(100*parseFloat(o)/$).toFixed(2)}%`),!t(this,ht)&&!M&&(e.height=`${(100*parseFloat(i)/W).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=t(this,C))==null||e.finish()}async addEditToolbar(){return t(this,nt)||t(this,ae)?t(this,nt):(w(this,nt,new At.EditorToolbar(this)),this.div.append(t(this,nt).render()),t(this,C)&&t(this,nt).addAltTextButton(await t(this,C).render()),t(this,nt))}removeEditToolbar(){var e;t(this,nt)&&(t(this,nt).remove(),w(this,nt,null),(e=t(this,C))==null||e.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){t(this,C)||(J.initialize(p._l10nPromise),w(this,C,new J(this)),await this.addEditToolbar())}get altTextData(){var e;return(e=t(this,C))==null?void 0:e.data}set altTextData(e){t(this,C)&&(t(this,C).data=e)}hasAltText(){var e;return!((e=t(this,C))!=null&&e.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=t(this,P)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",t(this,Tt)),this.div.addEventListener("focusout",t(this,ot));const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[o,m]=this.getInitialTranslation();return this.translate(o,m),(0,d.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:i}=Q.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(w(this,It,!0),this._isDraggable){b(this,Bt,$r).call(this,e);return}b(this,Bt,Ji).call(this,e)}moveInDOM(){t(this,re)&&clearTimeout(t(this,re)),w(this,re,setTimeout(()=>{var e;w(this,re,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,i,o){e.changeParent(this),this.x=i,this.y=o,this.fixAndSetPosition()}getRect(e,i,o=this.rotation){const m=this.parentScale,[M,$]=this.pageDimensions,[W,tt]=this.pageTranslation,gt=e/m,it=i/m,_t=this.x*M,Ot=this.y*$,jt=this.width*M,Gt=this.height*$;switch(o){case 0:return[_t+gt+W,$-Ot-it-Gt+tt,_t+gt+jt+W,$-Ot-it+tt];case 90:return[_t+it+W,$-Ot+gt+tt,_t+it+Gt+W,$-Ot+gt+jt+tt];case 180:return[_t-gt-jt+W,$-Ot+it+tt,_t-gt+W,$-Ot+it+Gt+tt];case 270:return[_t-it-Gt+W,$-Ot-gt-jt+tt,_t-it+W,$-Ot-gt+tt];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[o,m,M,$]=e,W=M-o,tt=$-m;switch(this.rotation){case 0:return[o,i-$,W,tt];case 90:return[o,i-m,tt,W];case 180:return[M,i-m,W,tt];case 270:return[M,i-$,tt,W];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){w(this,ae,!0)}disableEditMode(){w(this,ae,!1)}isInEditMode(){return t(this,ae)}shouldGetKeyboardEvents(){return t(this,Jt)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var e,i;(e=this.div)==null||e.addEventListener("focusin",t(this,Tt)),(i=this.div)==null||i.addEventListener("focusout",t(this,ot))}rotate(e){}serialize(e=!1,i=null){(0,Q.unreachable)("An editor must be serializable")}static deserialize(e,i,o){const m=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:o});m.rotation=e.rotation;const[M,$]=m.pageDimensions,[W,tt,gt,it]=m.getRectInCurrentCoords(e.rect,$);return m.x=W/M,m.y=tt/$,m.width=gt/M,m.height=it/$,m}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",t(this,Tt)),this.div.removeEventListener("focusout",t(this,ot)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),t(this,re)&&(clearTimeout(t(this,re)),w(this,re,null)),b(this,Bt,Fs).call(this),this.removeEditToolbar(),t(this,Qt)){for(const e of t(this,Qt).values())clearTimeout(e);w(this,Qt,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Bt,Gr).call(this),t(this,st).classList.remove("hidden"),(0,d.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),w(this,bt,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=t(this,st).children;if(!t(this,O)){w(this,O,Array.from(i));const $=b(this,Bt,Xr).bind(this),W=b(this,Bt,Kr).bind(this);for(const tt of t(this,O)){const gt=tt.getAttribute("data-resizer-name");tt.setAttribute("role","spinbutton"),tt.addEventListener("keydown",$),tt.addEventListener("blur",W),tt.addEventListener("focus",b(this,Bt,Yr).bind(this,gt)),p._l10nPromise.get(`pdfjs-editor-resizer-label-${gt}`).then(it=>tt.setAttribute("aria-label",it))}}const o=t(this,O)[0];let m=0;for(const $ of i){if($===o)break;m++}const M=(360-this.rotation+this.parentRotation)%360/90*(t(this,O).length/4);if(M!==m){if(M<m)for(let W=0;W<m-M;W++)t(this,st).append(t(this,st).firstChild);else if(M>m)for(let W=0;W<M-m;W++)t(this,st).firstChild.before(t(this,st).lastChild);let $=0;for(const W of i){const tt=t(this,O)[$++].getAttribute("data-resizer-name");p._l10nPromise.get(`pdfjs-editor-resizer-label-${tt}`).then(gt=>W.setAttribute("aria-label",gt))}}b(this,Bt,Qi).call(this,0),w(this,Jt,!0),t(this,st).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,i){t(this,Jt)&&b(this,Bt,Yi).call(this,t(this,Mt),{movementX:e,movementY:i})}_stopResizingWithKeyboard(){b(this,Bt,Fs).call(this),this.div.focus()}select(){var e,i;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!t(this,nt)){this.addEditToolbar().then(()=>{var o,m;(o=this.div)!=null&&o.classList.contains("selectedEditor")&&((m=t(this,nt))==null||m.show())});return}(i=t(this,nt))==null||i.show()}unselect(){var e,i,o,m;(e=t(this,st))==null||e.classList.add("hidden"),(i=this.div)==null||i.classList.remove("selectedEditor"),(o=this.div)!=null&&o.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(m=t(this,nt))==null||m.hide()}updateParams(e,i){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return t(this,Xt)}set isEditing(e){w(this,Xt,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){w(this,ht,!0);const o=e/i,{style:m}=this.div;m.aspectRatio=o,m.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){t(this,Qt)||w(this,Qt,new Map);const{action:o}=e;let m=t(this,Qt).get(o);m&&clearTimeout(m),m=setTimeout(()=>{this._reportTelemetry(e),t(this,Qt).delete(o),t(this,Qt).size===0&&w(this,Qt,null)},p._telemetryTimeout),t(this,Qt).set(o,m);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),w(this,P,!1)}disable(){this.div&&(this.div.tabIndex=-1),w(this,P,!0)}renderAnnotationElement(e){let i=e.container.querySelector(".annotationContent");if(!i)i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),e.container.prepend(i);else if(i.nodeName==="CANVAS"){const o=i;i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),o.before(i)}return i}resetAnnotationElement(e){const{firstChild:i}=e.container;i.nodeName==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}};O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakMap,Qt=new WeakMap,ue=new WeakMap,Ae=new WeakMap,Bt=new WeakSet,Wi=function([e,i],o,m){[o,m]=this.screenToPageTranslation(o,m),this.x+=o/e,this.y+=m/i,this.fixAndSetPosition()},ee=new WeakSet,$i=function(e,i,o){switch(o){case 90:return[i,-e];case 180:return[-e,-i];case 270:return[-i,e];default:return[e,i]}},Xi=function(e){switch(e){case 90:{const[i,o]=this.pageDimensions;return[0,-i/o,o/i,0]}case 180:return[-1,0,0,-1];case 270:{const[i,o]=this.pageDimensions;return[0,i/o,-o/i,0]}default:return[1,0,0,1]}},Gr=function(){if(t(this,st))return;w(this,st,document.createElement("div")),t(this,st).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const i of e){const o=document.createElement("div");t(this,st).append(o),o.classList.add("resizer",i),o.setAttribute("data-resizer-name",i),o.addEventListener("pointerdown",b(this,Bt,Wr).bind(this,i)),o.addEventListener("contextmenu",H.noContextMenu),o.tabIndex=-1}this.div.prepend(t(this,st))},Wr=function(e,i){var Gt;i.preventDefault();const{isMac:o}=Q.FeatureTest.platform;if(i.button!==0||i.ctrlKey&&o)return;(Gt=t(this,C))==null||Gt.toggle(!1);const m=b(this,Bt,Yi).bind(this,e),M=this._isDraggable;this._isDraggable=!1;const $={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",m,$),window.addEventListener("contextmenu",H.noContextMenu);const W=this.x,tt=this.y,gt=this.width,it=this.height,_t=this.parent.div.style.cursor,Ot=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(i.target).cursor;const jt=()=>{var Ut;this.parent.togglePointerEvents(!0),(Ut=t(this,C))==null||Ut.toggle(!0),this._isDraggable=M,window.removeEventListener("pointerup",jt),window.removeEventListener("blur",jt),window.removeEventListener("pointermove",m,$),window.removeEventListener("contextmenu",H.noContextMenu),this.parent.div.style.cursor=_t,this.div.style.cursor=Ot,b(this,Bt,Ki).call(this,W,tt,gt,it)};window.addEventListener("pointerup",jt),window.addEventListener("blur",jt)},Ki=function(e,i,o,m){const M=this.x,$=this.y,W=this.width,tt=this.height;M===e&&$===i&&W===o&&tt===m||this.addCommands({cmd:()=>{this.width=W,this.height=tt,this.x=M,this.y=$;const[gt,it]=this.parentDimensions;this.setDims(gt*W,it*tt),this.fixAndSetPosition()},undo:()=>{this.width=o,this.height=m,this.x=e,this.y=i;const[gt,it]=this.parentDimensions;this.setDims(gt*o,it*m),this.fixAndSetPosition()},mustExec:!0})},Yi=function(e,i){const[o,m]=this.parentDimensions,M=this.x,$=this.y,W=this.width,tt=this.height,gt=p.MIN_SIZE/o,it=p.MIN_SIZE/m,_t=U=>Math.round(U*1e4)/1e4,Ot=b(this,Bt,Xi).call(this,this.rotation),jt=(U,q)=>[Ot[0]*U+Ot[2]*q,Ot[1]*U+Ot[3]*q],Gt=b(this,Bt,Xi).call(this,360-this.rotation),Ut=(U,q)=>[Gt[0]*U+Gt[2]*q,Gt[1]*U+Gt[3]*q];let lt,ut,T=!1,X=!1;switch(e){case"topLeft":T=!0,lt=(U,q)=>[0,0],ut=(U,q)=>[U,q];break;case"topMiddle":lt=(U,q)=>[U/2,0],ut=(U,q)=>[U/2,q];break;case"topRight":T=!0,lt=(U,q)=>[U,0],ut=(U,q)=>[0,q];break;case"middleRight":X=!0,lt=(U,q)=>[U,q/2],ut=(U,q)=>[0,q/2];break;case"bottomRight":T=!0,lt=(U,q)=>[U,q],ut=(U,q)=>[0,0];break;case"bottomMiddle":lt=(U,q)=>[U/2,q],ut=(U,q)=>[U/2,0];break;case"bottomLeft":T=!0,lt=(U,q)=>[0,q],ut=(U,q)=>[U,0];break;case"middleLeft":X=!0,lt=(U,q)=>[0,q/2],ut=(U,q)=>[U,q/2];break}const Y=lt(W,tt),vt=ut(W,tt);let Et=jt(...vt);const Lt=_t(M+Et[0]),Ht=_t($+Et[1]);let te=1,de=1,[be,we]=this.screenToPageTranslation(i.movementX,i.movementY);if([be,we]=Ut(be/o,we/m),T){const U=Math.hypot(W,tt);te=de=Math.max(Math.min(Math.hypot(vt[0]-Y[0]-be,vt[1]-Y[1]-we)/U,1/W,1/tt),gt/W,it/tt)}else X?te=Math.max(gt,Math.min(1,Math.abs(vt[0]-Y[0]-be)))/W:de=Math.max(it,Math.min(1,Math.abs(vt[1]-Y[1]-we)))/tt;const Wt=_t(W*te),v=_t(tt*de);Et=jt(...ut(Wt,v));const f=Lt-Et[0],x=Ht-Et[1];this.width=Wt,this.height=v,this.x=f,this.y=x,this.setDims(o*Wt,m*v),this.fixAndSetPosition()},Ji=function(e){const{isMac:i}=Q.FeatureTest.platform;e.ctrlKey&&!i||e.shiftKey||e.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)},$r=function(e){const i=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let o,m;i&&(this.div.classList.add("moving"),o={passive:!0,capture:!0},w(this,oe,e.clientX),w(this,Rt,e.clientY),m=$=>{const{clientX:W,clientY:tt}=$,[gt,it]=this.screenToPageTranslation(W-t(this,oe),tt-t(this,Rt));w(this,oe,W),w(this,Rt,tt),this._uiManager.dragSelectedEditors(gt,it)},window.addEventListener("pointermove",m,o));const M=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("blur",M),i&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",m,o)),w(this,It,!1),this._uiManager.endDragSession()||b(this,Bt,Ji).call(this,e)};window.addEventListener("pointerup",M),window.addEventListener("blur",M)},Xr=function(e){p._resizerKeyboardManager.exec(this,e)},Kr=function(e){var i;t(this,Jt)&&((i=e.relatedTarget)==null?void 0:i.parentNode)!==t(this,st)&&b(this,Bt,Fs).call(this)},Yr=function(e){w(this,Mt,t(this,Jt)?e:"")},Qi=function(e){if(t(this,O))for(const i of t(this,O))i.tabIndex=e},Fs=function(){if(w(this,Jt,!1),b(this,Bt,Qi).call(this,-1),t(this,bt)){const{savedX:e,savedY:i,savedWidth:o,savedHeight:m}=t(this,bt);b(this,Bt,Ki).call(this,e,i,o,m),w(this,bt,null)}},_(p,ee),he(p,"_borderLineWidth",-1),he(p,"_colorManager",new d.ColorManager),he(p,"_zIndex",1),he(p,"_telemetryTimeout",1e3);let z=p;class F extends z{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},61:(ie,$t,dt)=>{var F,I,V,E,Jr,ai,Qr,Zr,Zi,K,k,O,C,P,ht,st,bt,Tt,ot,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,tn,ue,Ae,Bt,le,ee,ce,Zt,Nt,Ns,Os,ta;dt.d($t,{FreeOutliner:()=>At,Outliner:()=>Q});var d=dt(292);class Q{constructor(s,a=0,h=0,l=!0){_(this,E);_(this,F);_(this,I,[]);_(this,V,[]);let g=1/0,u=-1/0,p=1/0,R=-1/0;const e=10**-4;for(const{x:tt,y:gt,width:it,height:_t}of s){const Ot=Math.floor((tt-a)/e)*e,jt=Math.ceil((tt+it+a)/e)*e,Gt=Math.floor((gt-a)/e)*e,Ut=Math.ceil((gt+_t+a)/e)*e,lt=[Ot,Gt,Ut,!0],ut=[jt,Gt,Ut,!1];t(this,I).push(lt,ut),g=Math.min(g,Ot),u=Math.max(u,jt),p=Math.min(p,Gt),R=Math.max(R,Ut)}const i=u-g+2*h,o=R-p+2*h,m=g-h,M=p-h,$=t(this,I).at(l?-1:-2),W=[$[0],$[2]];for(const tt of t(this,I)){const[gt,it,_t]=tt;tt[0]=(gt-m)/i,tt[1]=(it-M)/o,tt[2]=(_t-M)/o}w(this,F,{x:m,y:M,width:i,height:o,lastPoint:W})}getOutlines(){t(this,I).sort((a,h)=>a[0]-h[0]||a[1]-h[1]||a[2]-h[2]);const s=[];for(const a of t(this,I))a[3]?(s.push(...b(this,E,Zi).call(this,a)),b(this,E,Qr).call(this,a)):(b(this,E,Zr).call(this,a),s.push(...b(this,E,Zi).call(this,a)));return b(this,E,Jr).call(this,s)}}F=new WeakMap,I=new WeakMap,V=new WeakMap,E=new WeakSet,Jr=function(s){const a=[],h=new Set;for(const u of s){const[p,R,e]=u;a.push([p,R,u],[p,e,u])}a.sort((u,p)=>u[1]-p[1]||u[0]-p[0]);for(let u=0,p=a.length;u<p;u+=2){const R=a[u][2],e=a[u+1][2];R.push(e),e.push(R),h.add(R),h.add(e)}const l=[];let g;for(;h.size>0;){const u=h.values().next().value;let[p,R,e,i,o]=u;h.delete(u);let m=p,M=R;for(g=[p,e],l.push(g);;){let $;if(h.has(i))$=i;else if(h.has(o))$=o;else break;h.delete($),[p,R,e,i,o]=$,m!==p&&(g.push(m,M,p,M===R?R:e),m=p),M=M===R?e:R}g.push(m,M)}return new J(l,t(this,F))},ai=function(s){const a=t(this,V);let h=0,l=a.length-1;for(;h<=l;){const g=h+l>>1,u=a[g][0];if(u===s)return g;u<s?h=g+1:l=g-1}return l+1},Qr=function([,s,a]){const h=b(this,E,ai).call(this,s);t(this,V).splice(h,0,[s,a])},Zr=function([,s,a]){const h=b(this,E,ai).call(this,s);for(let l=h;l<t(this,V).length;l++){const[g,u]=t(this,V)[l];if(g!==s)break;if(g===s&&u===a){t(this,V).splice(l,1);return}}for(let l=h-1;l>=0;l--){const[g,u]=t(this,V)[l];if(g!==s)break;if(g===s&&u===a){t(this,V).splice(l,1);return}}},Zi=function(s){const[a,h,l]=s,g=[[a,h,l]],u=b(this,E,ai).call(this,l);for(let p=0;p<u;p++){const[R,e]=t(this,V)[p];for(let i=0,o=g.length;i<o;i++){const[,m,M]=g[i];if(!(e<=m||M<=R)){if(m>=R){if(M>e)g[i][1]=e;else{if(o===1)return[];g.splice(i,1),i--,o--}continue}g[i][2]=R,M>e&&g.push([a,e,M])}}}return g};class H{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(s,a){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof z}}class J extends H{constructor(a,h){super();_(this,K);_(this,k);w(this,k,a),w(this,K,h)}toSVGPath(){const a=[];for(const h of t(this,k)){let[l,g]=h;a.push(`M${l} ${g}`);for(let u=2;u<h.length;u+=2){const p=h[u],R=h[u+1];p===l?(a.push(`V${R}`),g=R):R===g&&(a.push(`H${p}`),l=p)}a.push("Z")}return a.join(" ")}serialize([a,h,l,g],u){const p=[],R=l-a,e=g-h;for(const i of t(this,k)){const o=new Array(i.length);for(let m=0;m<i.length;m+=2)o[m]=a+i[m]*R,o[m+1]=g-i[m+1]*e;p.push(o)}return p}get box(){return t(this,K)}}K=new WeakMap,k=new WeakMap;const Qt=class Qt{constructor({x:s,y:a},h,l,g,u,p=0){_(this,oe);_(this,O);_(this,C,[]);_(this,P);_(this,ht);_(this,st,[]);_(this,bt,new Float64Array(18));_(this,Tt);_(this,ot);_(this,nt);_(this,Mt);_(this,It);_(this,Pt);_(this,Xt,[]);w(this,O,h),w(this,Pt,g*l),w(this,ht,u),t(this,bt).set([NaN,NaN,NaN,NaN,s,a],6),w(this,P,p),w(this,Mt,t(Qt,ae)*l),w(this,nt,t(Qt,re)*l),w(this,It,l),t(this,Xt).push(s,a)}get free(){return!0}isEmpty(){return isNaN(t(this,bt)[8])}add({x:s,y:a}){var lt;w(this,Tt,s),w(this,ot,a);const[h,l,g,u]=t(this,O);let[p,R,e,i]=t(this,bt).subarray(8,12);const o=s-e,m=a-i,M=Math.hypot(o,m);if(M<t(this,nt))return!1;const $=M-t(this,Mt),W=$/M,tt=W*o,gt=W*m;let it=p,_t=R;p=e,R=i,e+=tt,i+=gt,(lt=t(this,Xt))==null||lt.push(s,a);const Ot=-gt/$,jt=tt/$,Gt=Ot*t(this,Pt),Ut=jt*t(this,Pt);return t(this,bt).set(t(this,bt).subarray(2,8),0),t(this,bt).set([e+Gt,i+Ut],4),t(this,bt).set(t(this,bt).subarray(14,18),12),t(this,bt).set([e-Gt,i-Ut],16),isNaN(t(this,bt)[6])?(t(this,st).length===0&&(t(this,bt).set([p+Gt,R+Ut],2),t(this,st).push(NaN,NaN,NaN,NaN,(p+Gt-h)/g,(R+Ut-l)/u),t(this,bt).set([p-Gt,R-Ut],14),t(this,C).push(NaN,NaN,NaN,NaN,(p-Gt-h)/g,(R-Ut-l)/u)),t(this,bt).set([it,_t,p,R,e,i],6),!this.isEmpty()):(t(this,bt).set([it,_t,p,R,e,i],6),Math.abs(Math.atan2(_t-R,it-p)-Math.atan2(gt,tt))<Math.PI/2?([p,R,e,i]=t(this,bt).subarray(2,6),t(this,st).push(NaN,NaN,NaN,NaN,((p+e)/2-h)/g,((R+i)/2-l)/u),[p,R,it,_t]=t(this,bt).subarray(14,18),t(this,C).push(NaN,NaN,NaN,NaN,((it+p)/2-h)/g,((_t+R)/2-l)/u),!0):([it,_t,p,R,e,i]=t(this,bt).subarray(0,6),t(this,st).push(((it+5*p)/6-h)/g,((_t+5*R)/6-l)/u,((5*p+e)/6-h)/g,((5*R+i)/6-l)/u,((p+e)/2-h)/g,((R+i)/2-l)/u),[e,i,p,R,it,_t]=t(this,bt).subarray(12,18),t(this,C).push(((it+5*p)/6-h)/g,((_t+5*R)/6-l)/u,((5*p+e)/6-h)/g,((5*R+i)/6-l)/u,((p+e)/2-h)/g,((R+i)/2-l)/u),!0))}toSVGPath(){if(this.isEmpty())return"";const s=t(this,st),a=t(this,C),h=t(this,bt).subarray(4,6),l=t(this,bt).subarray(16,18),[g,u,p,R]=t(this,O),[e,i,o,m]=b(this,oe,tn).call(this);if(isNaN(t(this,bt)[6])&&!this.isEmpty())return`M${(t(this,bt)[2]-g)/p} ${(t(this,bt)[3]-u)/R} L${(t(this,bt)[4]-g)/p} ${(t(this,bt)[5]-u)/R} L${e} ${i} L${o} ${m} L${(t(this,bt)[16]-g)/p} ${(t(this,bt)[17]-u)/R} L${(t(this,bt)[14]-g)/p} ${(t(this,bt)[15]-u)/R} Z`;const M=[];M.push(`M${s[4]} ${s[5]}`);for(let $=6;$<s.length;$+=6)isNaN(s[$])?M.push(`L${s[$+4]} ${s[$+5]}`):M.push(`C${s[$]} ${s[$+1]} ${s[$+2]} ${s[$+3]} ${s[$+4]} ${s[$+5]}`);M.push(`L${(h[0]-g)/p} ${(h[1]-u)/R} L${e} ${i} L${o} ${m} L${(l[0]-g)/p} ${(l[1]-u)/R}`);for(let $=a.length-6;$>=6;$-=6)isNaN(a[$])?M.push(`L${a[$+4]} ${a[$+5]}`):M.push(`C${a[$]} ${a[$+1]} ${a[$+2]} ${a[$+3]} ${a[$+4]} ${a[$+5]}`);return M.push(`L${a[4]} ${a[5]} Z`),M.join(" ")}getOutlines(){var gt;const s=t(this,st),a=t(this,C),h=t(this,bt),l=h.subarray(4,6),g=h.subarray(16,18),[u,p,R,e]=t(this,O),i=new Float64Array((((gt=t(this,Xt))==null?void 0:gt.length)??0)+2);for(let it=0,_t=i.length-2;it<_t;it+=2)i[it]=(t(this,Xt)[it]-u)/R,i[it+1]=(t(this,Xt)[it+1]-p)/e;i[i.length-2]=(t(this,Tt)-u)/R,i[i.length-1]=(t(this,ot)-p)/e;const[o,m,M,$]=b(this,oe,tn).call(this);if(isNaN(h[6])&&!this.isEmpty()){const it=new Float64Array(36);return it.set([NaN,NaN,NaN,NaN,(h[2]-u)/R,(h[3]-p)/e,NaN,NaN,NaN,NaN,(h[4]-u)/R,(h[5]-p)/e,NaN,NaN,NaN,NaN,o,m,NaN,NaN,NaN,NaN,M,$,NaN,NaN,NaN,NaN,(h[16]-u)/R,(h[17]-p)/e,NaN,NaN,NaN,NaN,(h[14]-u)/R,(h[15]-p)/e],0),new z(it,i,t(this,O),t(this,It),t(this,P),t(this,ht))}const W=new Float64Array(t(this,st).length+24+t(this,C).length);let tt=s.length;for(let it=0;it<tt;it+=2){if(isNaN(s[it])){W[it]=W[it+1]=NaN;continue}W[it]=s[it],W[it+1]=s[it+1]}W.set([NaN,NaN,NaN,NaN,(l[0]-u)/R,(l[1]-p)/e,NaN,NaN,NaN,NaN,o,m,NaN,NaN,NaN,NaN,M,$,NaN,NaN,NaN,NaN,(g[0]-u)/R,(g[1]-p)/e],tt),tt+=24;for(let it=a.length-6;it>=6;it-=6)for(let _t=0;_t<6;_t+=2){if(isNaN(a[it+_t])){W[tt]=W[tt+1]=NaN,tt+=2;continue}W[tt]=a[it+_t],W[tt+1]=a[it+_t+1],tt+=2}return W.set([NaN,NaN,NaN,NaN,a[4],a[5]],tt),new z(W,i,t(this,O),t(this,It),t(this,P),t(this,ht))}};O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakSet,tn=function(){const s=t(this,bt).subarray(4,6),a=t(this,bt).subarray(16,18),[h,l,g,u]=t(this,O);return[(t(this,Tt)+(s[0]-a[0])/2-h)/g,(t(this,ot)+(s[1]-a[1])/2-l)/u,(t(this,Tt)+(a[0]-s[0])/2-h)/g,(t(this,ot)+(a[1]-s[1])/2-l)/u]},_(Qt,ae,8),_(Qt,Jt,2),_(Qt,re,t(Qt,ae)+t(Qt,Jt));let At=Qt;class z extends H{constructor(a,h,l,g,u,p){super();_(this,Nt);_(this,ue);_(this,Ae,null);_(this,Bt);_(this,le);_(this,ee);_(this,ce);_(this,Zt);w(this,Zt,a),w(this,ee,h),w(this,ue,l),w(this,ce,g),w(this,Bt,u),w(this,le,p),b(this,Nt,ta).call(this,p);const{x:R,y:e,width:i,height:o}=t(this,Ae);for(let m=0,M=a.length;m<M;m+=2)a[m]=(a[m]-R)/i,a[m+1]=(a[m+1]-e)/o;for(let m=0,M=h.length;m<M;m+=2)h[m]=(h[m]-R)/i,h[m+1]=(h[m+1]-e)/o}toSVGPath(){const a=[`M${t(this,Zt)[4]} ${t(this,Zt)[5]}`];for(let h=6,l=t(this,Zt).length;h<l;h+=6){if(isNaN(t(this,Zt)[h])){a.push(`L${t(this,Zt)[h+4]} ${t(this,Zt)[h+5]}`);continue}a.push(`C${t(this,Zt)[h]} ${t(this,Zt)[h+1]} ${t(this,Zt)[h+2]} ${t(this,Zt)[h+3]} ${t(this,Zt)[h+4]} ${t(this,Zt)[h+5]}`)}return a.push("Z"),a.join(" ")}serialize([a,h,l,g],u){const p=l-a,R=g-h;let e,i;switch(u){case 0:e=b(this,Nt,Ns).call(this,t(this,Zt),a,g,p,-R),i=b(this,Nt,Ns).call(this,t(this,ee),a,g,p,-R);break;case 90:e=b(this,Nt,Os).call(this,t(this,Zt),a,h,p,R),i=b(this,Nt,Os).call(this,t(this,ee),a,h,p,R);break;case 180:e=b(this,Nt,Ns).call(this,t(this,Zt),l,h,-p,R),i=b(this,Nt,Ns).call(this,t(this,ee),l,h,-p,R);break;case 270:e=b(this,Nt,Os).call(this,t(this,Zt),l,g,-p,-R),i=b(this,Nt,Os).call(this,t(this,ee),l,g,-p,-R);break}return{outline:Array.from(e),points:[Array.from(i)]}}get box(){return t(this,Ae)}getNewOutline(a,h){const{x:l,y:g,width:u,height:p}=t(this,Ae),[R,e,i,o]=t(this,ue),m=u*i,M=p*o,$=l*i+R,W=g*o+e,tt=new At({x:t(this,ee)[0]*m+$,y:t(this,ee)[1]*M+W},t(this,ue),t(this,ce),a,t(this,le),h??t(this,Bt));for(let gt=2;gt<t(this,ee).length;gt+=2)tt.add({x:t(this,ee)[gt]*m+$,y:t(this,ee)[gt+1]*M+W});return tt.getOutlines()}}ue=new WeakMap,Ae=new WeakMap,Bt=new WeakMap,le=new WeakMap,ee=new WeakMap,ce=new WeakMap,Zt=new WeakMap,Nt=new WeakSet,Ns=function(a,h,l,g,u){const p=new Float64Array(a.length);for(let R=0,e=a.length;R<e;R+=2)p[R]=h+a[R]*g,p[R+1]=l+a[R+1]*u;return p},Os=function(a,h,l,g,u){const p=new Float64Array(a.length);for(let R=0,e=a.length;R<e;R+=2)p[R]=h+a[R+1]*g,p[R+1]=l+a[R]*u;return p},ta=function(a){const h=t(this,Zt);let l=h[4],g=h[5],u=l,p=g,R=l,e=g,i=l,o=g;const m=a?Math.max:Math.min;for(let gt=6,it=h.length;gt<it;gt+=6){if(isNaN(h[gt]))u=Math.min(u,h[gt+4]),p=Math.min(p,h[gt+5]),R=Math.max(R,h[gt+4]),e=Math.max(e,h[gt+5]),o<h[gt+5]?(i=h[gt+4],o=h[gt+5]):o===h[gt+5]&&(i=m(i,h[gt+4]));else{const _t=d.Util.bezierBoundingBox(l,g,...h.slice(gt,gt+6));u=Math.min(u,_t[0]),p=Math.min(p,_t[1]),R=Math.max(R,_t[2]),e=Math.max(e,_t[3]),o<_t[3]?(i=_t[2],o=_t[3]):o===_t[3]&&(i=m(i,_t[2]))}l=h[gt+4],g=h[gt+5]}const M=u-t(this,Bt),$=p-t(this,Bt),W=R-u+2*t(this,Bt),tt=e-p+2*t(this,Bt);w(this,Ae,{x:M,y:$,width:W,height:tt,lastPoint:[i,o]})}},362:(ie,$t,dt)=>{var J,At,z,F,I,ea,E,sa,ia,oi,na,en,k,O,C,P,ra,aa,oa;dt.d($t,{EditorToolbar:()=>Q,HighlightToolbar:()=>H});var d=dt(419);const K=class K{constructor(ot){_(this,E);_(this,J,null);_(this,At,null);_(this,z);_(this,F,null);w(this,z,ot)}render(){const ot=w(this,J,document.createElement("div"));ot.className="editToolbar",ot.setAttribute("role","toolbar"),ot.addEventListener("contextmenu",d.noContextMenu),ot.addEventListener("pointerdown",b(K,I,ea));const nt=w(this,F,document.createElement("div"));nt.className="buttons",ot.append(nt);const Mt=t(this,z).toolbarPosition;if(Mt){const{style:It}=ot,Pt=t(this,z)._uiManager.direction==="ltr"?1-Mt[0]:Mt[0];It.insetInlineEnd=`${100*Pt}%`,It.top=`calc(${100*Mt[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,E,na).call(this),ot}hide(){var ot;t(this,J).classList.add("hidden"),(ot=t(this,At))==null||ot.hideDropdown()}show(){t(this,J).classList.remove("hidden")}addAltTextButton(ot){b(this,E,oi).call(this,ot),t(this,F).prepend(ot,t(this,E,en))}addColorPicker(ot){w(this,At,ot);const nt=ot.renderButton();b(this,E,oi).call(this,nt),t(this,F).prepend(nt,t(this,E,en))}remove(){var ot;t(this,J).remove(),(ot=t(this,At))==null||ot.destroy(),w(this,At,null)}};J=new WeakMap,At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakSet,ea=function(ot){ot.stopPropagation()},E=new WeakSet,sa=function(ot){t(this,z)._focusEventsAllowed=!1,ot.preventDefault(),ot.stopPropagation()},ia=function(ot){t(this,z)._focusEventsAllowed=!0,ot.preventDefault(),ot.stopPropagation()},oi=function(ot){ot.addEventListener("focusin",b(this,E,sa).bind(this),{capture:!0}),ot.addEventListener("focusout",b(this,E,ia).bind(this),{capture:!0}),ot.addEventListener("contextmenu",d.noContextMenu)},na=function(){const ot=document.createElement("button");ot.className="delete",ot.tabIndex=0,ot.setAttribute("data-l10n-id",`pdfjs-editor-remove-${t(this,z).editorType}-button`),b(this,E,oi).call(this,ot),ot.addEventListener("click",nt=>{t(this,z)._uiManager.delete()}),t(this,F).append(ot)},en=function(){const ot=document.createElement("div");return ot.className="divider",ot},_(K,I);let Q=K;class H{constructor(ot){_(this,P);_(this,k,null);_(this,O,null);_(this,C);w(this,C,ot)}show(ot,nt,Mt){const[It,Pt]=b(this,P,aa).call(this,nt,Mt),{style:Xt}=t(this,O)||w(this,O,b(this,P,ra).call(this));ot.append(t(this,O)),Xt.insetInlineEnd=`${100*It}%`,Xt.top=`calc(${100*Pt}% + var(--editor-toolbar-vert-offset))`}hide(){t(this,O).remove()}}k=new WeakMap,O=new WeakMap,C=new WeakMap,P=new WeakSet,ra=function(){const ot=w(this,O,document.createElement("div"));ot.className="editToolbar",ot.setAttribute("role","toolbar"),ot.addEventListener("contextmenu",d.noContextMenu);const nt=w(this,k,document.createElement("div"));return nt.className="buttons",ot.append(nt),b(this,P,oa).call(this),ot},aa=function(ot,nt){let Mt=0,It=0;for(const Pt of ot){const Xt=Pt.y+Pt.height;if(Xt<Mt)continue;const ae=Pt.x+(nt?Pt.width:0);if(Xt>Mt){It=ae,Mt=Xt;continue}nt?ae>It&&(It=ae):ae<It&&(It=ae)}return[nt?1-It:It,Mt]},oa=function(){const ot=document.createElement("button");ot.className="highlightButton",ot.tabIndex=0,ot.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const nt=document.createElement("span");ot.append(nt),nt.className="visuallyHidden",nt.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),ot.addEventListener("contextmenu",d.noContextMenu),ot.addEventListener("click",()=>{t(this,C).highlightSelection("floating_button")}),t(this,k).append(ot)}},830:(ie,$t,dt)=>{var D,L,Z,B,K,sn,C,P,ht,st,bt,ha,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,Rt,Qt,ue,Ae,Bt,le,ee,ce,Zt,Nt,mt,pt,S,n,s,a,h,l,g,u,p,R,e,i,o,m,M,$,W,tt,gt,it,_t,Ot,jt,Gt,Ut,lt,hi,la,ca,li,da,ua,pa,nn,rn,an,on,hn,Oe,is,ga,fa,ln,ma,Hs,cn;dt.d($t,{AnnotationEditorUIManager:()=>y,ColorManager:()=>E,KeyboardManager:()=>V,bindEvents:()=>J,opacityToHex:()=>At});var d=dt(292),Q=dt(419),H=dt(362);function J(Ft,c,N){for(const et of N)c.addEventListener(et,Ft[et].bind(Ft))}function At(Ft){return Math.round(Math.min(255,Math.max(1,255*Ft))).toString(16).padStart(2,"0")}class z{constructor(){_(this,D,0)}get id(){return`${d.AnnotationEditorPrefix}${Je(this,D)._++}`}}D=new WeakMap;const O=class O{constructor(){_(this,K);_(this,L,(0,d.getUuid)());_(this,Z,0);_(this,B,null)}static get _isSVGFittingCanvas(){const c='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>',N=new OffscreenCanvas(1,3).getContext("2d"),et=new Image;et.src=c;const ct=et.decode().then(()=>(N.drawImage(et,0,0,1,1,0,0,1,3),new Uint32Array(N.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,d.shadow)(this,"_isSVGFittingCanvas",ct)}async getFromFile(c){const{lastModified:N,name:et,size:ct,type:St}=c;return b(this,K,sn).call(this,`${N}_${et}_${ct}_${St}`,c)}async getFromUrl(c){return b(this,K,sn).call(this,c,c)}async getFromId(c){t(this,B)||w(this,B,new Map);const N=t(this,B).get(c);return N?N.bitmap?(N.refCounter+=1,N):N.file?this.getFromFile(N.file):this.getFromUrl(N.url):null}getSvgUrl(c){const N=t(this,B).get(c);return N!=null&&N.isSvg?N.svgUrl:null}deleteId(c){t(this,B)||w(this,B,new Map);const N=t(this,B).get(c);N&&(N.refCounter-=1,N.refCounter===0&&(N.bitmap=null))}isValidId(c){return c.startsWith(`image_${t(this,L)}_`)}};L=new WeakMap,Z=new WeakMap,B=new WeakMap,K=new WeakSet,sn=async function(c,N){t(this,B)||w(this,B,new Map);let et=t(this,B).get(c);if(et===null)return null;if(et!=null&&et.bitmap)return et.refCounter+=1,et;try{et||(et={bitmap:null,id:`image_${t(this,L)}_${Je(this,Z)._++}`,refCounter:0,isSvg:!1});let ct;if(typeof N=="string"?(et.url=N,ct=await(0,Q.fetchData)(N,"blob")):ct=et.file=N,ct.type==="image/svg+xml"){const St=O._isSVGFittingCanvas,xt=new FileReader,Dt=new Image,Kt=new Promise((Yt,fe)=>{Dt.onload=()=>{et.bitmap=Dt,et.isSvg=!0,Yt()},xt.onload=async()=>{const Me=et.svgUrl=xt.result;Dt.src=await St?`${Me}#svgView(preserveAspectRatio(none))`:Me},Dt.onerror=xt.onerror=fe});xt.readAsDataURL(ct),await Kt}else et.bitmap=await createImageBitmap(ct);et.refCounter=1}catch(ct){console.error(ct),et=null}return t(this,B).set(c,et),et&&t(this,B).set(et.id,et),et};let F=O;class I{constructor(c=128){_(this,C,[]);_(this,P,!1);_(this,ht);_(this,st,-1);w(this,ht,c)}add({cmd:c,undo:N,post:et,mustExec:ct,type:St=NaN,overwriteIfSameType:xt=!1,keepUndo:Dt=!1}){if(ct&&c(),t(this,P))return;const Kt={cmd:c,undo:N,post:et,type:St};if(t(this,st)===-1){t(this,C).length>0&&(t(this,C).length=0),w(this,st,0),t(this,C).push(Kt);return}if(xt&&t(this,C)[t(this,st)].type===St){Dt&&(Kt.undo=t(this,C)[t(this,st)].undo),t(this,C)[t(this,st)]=Kt;return}const Yt=t(this,st)+1;Yt===t(this,ht)?t(this,C).splice(0,1):(w(this,st,Yt),Yt<t(this,C).length&&t(this,C).splice(Yt)),t(this,C).push(Kt)}undo(){if(t(this,st)===-1)return;w(this,P,!0);const{undo:c,post:N}=t(this,C)[t(this,st)];c(),N==null||N(),w(this,P,!1),w(this,st,t(this,st)-1)}redo(){if(t(this,st)<t(this,C).length-1){w(this,st,t(this,st)+1),w(this,P,!0);const{cmd:c,post:N}=t(this,C)[t(this,st)];c(),N==null||N(),w(this,P,!1)}}hasSomethingToUndo(){return t(this,st)!==-1}hasSomethingToRedo(){return t(this,st)<t(this,C).length-1}destroy(){w(this,C,null)}}C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap;class V{constructor(c){_(this,bt);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:N}=d.FeatureTest.platform;for(const[et,ct,St={}]of c)for(const xt of et){const Dt=xt.startsWith("mac+");N&&Dt?(this.callbacks.set(xt.slice(4),{callback:ct,options:St}),this.allKeys.add(xt.split("+").at(-1))):!N&&!Dt&&(this.callbacks.set(xt,{callback:ct,options:St}),this.allKeys.add(xt.split("+").at(-1)))}}exec(c,N){if(!this.allKeys.has(N.key))return;const et=this.callbacks.get(b(this,bt,ha).call(this,N));if(!et)return;const{callback:ct,options:{bubbles:St=!1,args:xt=[],checker:Dt=null}}=et;Dt&&!Dt(c,N)||(ct.bind(c,...xt,N)(),St||(N.stopPropagation(),N.preventDefault()))}}bt=new WeakSet,ha=function(c){c.altKey&&this.buffer.push("alt"),c.ctrlKey&&this.buffer.push("ctrl"),c.metaKey&&this.buffer.push("meta"),c.shiftKey&&this.buffer.push("shift"),this.buffer.push(c.key);const N=this.buffer.join("+");return this.buffer.length=0,N};const ot=class ot{get _colors(){const c=new Map([["CanvasText",null],["Canvas",null]]);return(0,Q.getColorValues)(c),(0,d.shadow)(this,"_colors",c)}convert(c){const N=(0,Q.getRGB)(c);if(!window.matchMedia("(forced-colors: active)").matches)return N;for(const[et,ct]of this._colors)if(ct.every((St,xt)=>St===N[xt]))return ot._colorsMapping.get(et);return N}getHexCode(c){const N=this._colors.get(c);return N?d.Util.makeHexColor(...N):c}};he(ot,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let E=ot;const zt=class zt{constructor(c,N,et,ct,St,xt,Dt,Kt,Yt){_(this,lt);_(this,nt,null);_(this,Mt,new Map);_(this,It,new Map);_(this,Pt,null);_(this,Xt,null);_(this,ae,null);_(this,Jt,new I);_(this,re,0);_(this,oe,new Set);_(this,Rt,null);_(this,Qt,null);_(this,ue,new Set);_(this,Ae,!1);_(this,Bt,null);_(this,le,null);_(this,ee,null);_(this,ce,!1);_(this,Zt,null);_(this,Nt,new z);_(this,mt,!1);_(this,pt,!1);_(this,S,null);_(this,n,null);_(this,s,null);_(this,a,d.AnnotationEditorType.NONE);_(this,h,new Set);_(this,l,null);_(this,g,null);_(this,u,null);_(this,p,this.blur.bind(this));_(this,R,this.focus.bind(this));_(this,e,this.copy.bind(this));_(this,i,this.cut.bind(this));_(this,o,this.paste.bind(this));_(this,m,this.keydown.bind(this));_(this,M,this.keyup.bind(this));_(this,$,this.onEditingAction.bind(this));_(this,W,this.onPageChanging.bind(this));_(this,tt,this.onScaleChanging.bind(this));_(this,gt,b(this,lt,ca).bind(this));_(this,it,this.onRotationChanging.bind(this));_(this,_t,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});_(this,Ot,[0,0]);_(this,jt,null);_(this,Gt,null);_(this,Ut,null);w(this,Gt,c),w(this,Ut,N),w(this,Pt,et),this._eventBus=ct,this._eventBus._on("editingaction",t(this,$)),this._eventBus._on("pagechanging",t(this,W)),this._eventBus._on("scalechanging",t(this,tt)),this._eventBus._on("rotationchanging",t(this,it)),b(this,lt,da).call(this),b(this,lt,rn).call(this),w(this,Xt,St.annotationStorage),w(this,Bt,St.filterFactory),w(this,g,xt),w(this,ee,Dt||null),w(this,Ae,Kt),w(this,s,Yt||null),this.viewParameters={realScale:Q.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const c=zt.prototype,N=xt=>t(xt,Gt).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&xt.hasSomethingToControl(),et=(xt,{target:Dt})=>{if(Dt instanceof HTMLInputElement){const{type:Kt}=Dt;return Kt!=="text"&&Kt!=="number"}return!0},ct=this.TRANSLATE_SMALL,St=this.TRANSLATE_BIG;return(0,d.shadow)(this,"_keyboardManager",new V([[["ctrl+a","mac+meta+a"],c.selectAll,{checker:et}],[["ctrl+z","mac+meta+z"],c.undo,{checker:et}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],c.redo,{checker:et}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],c.delete,{checker:et}],[["Enter","mac+Enter"],c.addNewEditorFromKeyboard,{checker:(xt,{target:Dt})=>!(Dt instanceof HTMLButtonElement)&&t(xt,Gt).contains(Dt)&&!xt.isEnterHandled}],[[" ","mac+ "],c.addNewEditorFromKeyboard,{checker:(xt,{target:Dt})=>!(Dt instanceof HTMLButtonElement)&&t(xt,Gt).contains(document.activeElement)}],[["Escape","mac+Escape"],c.unselectAll],[["ArrowLeft","mac+ArrowLeft"],c.translateSelectedEditors,{args:[-ct,0],checker:N}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],c.translateSelectedEditors,{args:[-St,0],checker:N}],[["ArrowRight","mac+ArrowRight"],c.translateSelectedEditors,{args:[ct,0],checker:N}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],c.translateSelectedEditors,{args:[St,0],checker:N}],[["ArrowUp","mac+ArrowUp"],c.translateSelectedEditors,{args:[0,-ct],checker:N}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],c.translateSelectedEditors,{args:[0,-St],checker:N}],[["ArrowDown","mac+ArrowDown"],c.translateSelectedEditors,{args:[0,ct],checker:N}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],c.translateSelectedEditors,{args:[0,St],checker:N}]]))}destroy(){var c,N;b(this,lt,an).call(this),b(this,lt,nn).call(this),this._eventBus._off("editingaction",t(this,$)),this._eventBus._off("pagechanging",t(this,W)),this._eventBus._off("scalechanging",t(this,tt)),this._eventBus._off("rotationchanging",t(this,it));for(const et of t(this,It).values())et.destroy();t(this,It).clear(),t(this,Mt).clear(),t(this,ue).clear(),w(this,nt,null),t(this,h).clear(),t(this,Jt).destroy(),(c=t(this,Pt))==null||c.destroy(),(N=t(this,Zt))==null||N.hide(),w(this,Zt,null),t(this,le)&&(clearTimeout(t(this,le)),w(this,le,null)),t(this,jt)&&(clearTimeout(t(this,jt)),w(this,jt,null)),b(this,lt,ua).call(this)}async mlGuess(c){var N;return((N=t(this,s))==null?void 0:N.guess(c))||null}get hasMLManager(){return!!t(this,s)}get hcmFilter(){return(0,d.shadow)(this,"hcmFilter",t(this,g)?t(this,Bt).addHCMFilter(t(this,g).foreground,t(this,g).background):"none")}get direction(){return(0,d.shadow)(this,"direction",getComputedStyle(t(this,Gt)).direction)}get highlightColors(){return(0,d.shadow)(this,"highlightColors",t(this,ee)?new Map(t(this,ee).split(",").map(c=>c.split("=").map(N=>N.trim()))):null)}get highlightColorNames(){return(0,d.shadow)(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,c=>c.reverse())):null)}setMainHighlightColorPicker(c){w(this,n,c)}editAltText(c){var N;(N=t(this,Pt))==null||N.editAltText(this,c)}onPageChanging({pageNumber:c}){w(this,re,c-1)}focusMainContainer(){t(this,Gt).focus()}findParent(c,N){for(const et of t(this,It).values()){const{x:ct,y:St,width:xt,height:Dt}=et.div.getBoundingClientRect();if(c>=ct&&c<=ct+xt&&N>=St&&N<=St+Dt)return et}return null}disableUserSelect(c=!1){t(this,Ut).classList.toggle("noUserSelect",c)}addShouldRescale(c){t(this,ue).add(c)}removeShouldRescale(c){t(this,ue).delete(c)}onScaleChanging({scale:c}){this.commitOrRemove(),this.viewParameters.realScale=c*Q.PixelsPerInch.PDF_TO_CSS_UNITS;for(const N of t(this,ue))N.onScaleChanging()}onRotationChanging({pagesRotation:c}){this.commitOrRemove(),this.viewParameters.rotation=c}highlightSelection(c=""){const N=document.getSelection();if(!N||N.isCollapsed)return;const{anchorNode:et,anchorOffset:ct,focusNode:St,focusOffset:xt}=N,Dt=N.toString(),Kt=b(this,lt,hi).call(this,N).closest(".textLayer"),Yt=this.getSelectionBoxes(Kt);if(Yt){N.empty(),t(this,a)===d.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:d.AnnotationEditorType.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const fe of t(this,It).values())if(fe.hasTextLayer(Kt)){fe.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:c,boxes:Yt,anchorNode:et,anchorOffset:ct,focusNode:St,focusOffset:xt,text:Dt});break}}}addToAnnotationStorage(c){!c.isEmpty()&&t(this,Xt)&&!t(this,Xt).has(c.id)&&t(this,Xt).setValue(c.id,c)}blur(){if(this.isShiftKeyDown=!1,t(this,ce)&&(w(this,ce,!1),b(this,lt,li).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:c}=document;for(const N of t(this,h))if(N.div.contains(c)){w(this,S,[N,c]),N._focusEventsAllowed=!1;break}}focus(){if(!t(this,S))return;const[c,N]=t(this,S);w(this,S,null),N.addEventListener("focusin",()=>{c._focusEventsAllowed=!0},{once:!0}),N.focus()}addEditListeners(){b(this,lt,rn).call(this),b(this,lt,on).call(this)}removeEditListeners(){b(this,lt,an).call(this),b(this,lt,hn).call(this)}copy(c){var et;if(c.preventDefault(),(et=t(this,nt))==null||et.commitOrRemove(),!this.hasSelection)return;const N=[];for(const ct of t(this,h)){const St=ct.serialize(!0);St&&N.push(St)}N.length!==0&&c.clipboardData.setData("application/pdfjs",JSON.stringify(N))}cut(c){this.copy(c),this.delete()}paste(c){c.preventDefault();const{clipboardData:N}=c;for(const St of N.items)for(const xt of t(this,Qt))if(xt.isHandlingMimeForPasting(St.type)){xt.paste(St,this.currentLayer);return}let et=N.getData("application/pdfjs");if(!et)return;try{et=JSON.parse(et)}catch(St){(0,d.warn)(`paste: "${St.message}".`);return}if(!Array.isArray(et))return;this.unselectAll();const ct=this.currentLayer;try{const St=[];for(const Kt of et){const Yt=ct.deserialize(Kt);if(!Yt)return;St.push(Yt)}const xt=()=>{for(const Kt of St)b(this,lt,ln).call(this,Kt);b(this,lt,cn).call(this,St)},Dt=()=>{for(const Kt of St)Kt.remove()};this.addCommands({cmd:xt,undo:Dt,mustExec:!0})}catch(St){(0,d.warn)(`paste: "${St.message}".`)}}keydown(c){!this.isShiftKeyDown&&c.key==="Shift"&&(this.isShiftKeyDown=!0),t(this,a)!==d.AnnotationEditorType.NONE&&!this.isEditorHandlingKeyboard&&zt._keyboardManager.exec(this,c)}keyup(c){this.isShiftKeyDown&&c.key==="Shift"&&(this.isShiftKeyDown=!1,t(this,ce)&&(w(this,ce,!1),b(this,lt,li).call(this,"main_toolbar")))}onEditingAction({name:c}){switch(c){case"undo":case"redo":case"delete":case"selectAll":this[c]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(c){c?(b(this,lt,pa).call(this),b(this,lt,on).call(this),b(this,lt,Oe).call(this,{isEditing:t(this,a)!==d.AnnotationEditorType.NONE,isEmpty:b(this,lt,Hs).call(this),hasSomethingToUndo:t(this,Jt).hasSomethingToUndo(),hasSomethingToRedo:t(this,Jt).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,lt,nn).call(this),b(this,lt,hn).call(this),b(this,lt,Oe).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(c){if(!t(this,Qt)){w(this,Qt,c);for(const N of t(this,Qt))b(this,lt,is).call(this,N.defaultPropertiesToUpdate)}}getId(){return t(this,Nt).id}get currentLayer(){return t(this,It).get(t(this,re))}getLayer(c){return t(this,It).get(c)}get currentPageIndex(){return t(this,re)}addLayer(c){t(this,It).set(c.pageIndex,c),t(this,mt)?c.enable():c.disable()}removeLayer(c){t(this,It).delete(c.pageIndex)}updateMode(c,N=null,et=!1){if(t(this,a)!==c){if(w(this,a,c),c===d.AnnotationEditorType.NONE){this.setEditingState(!1),b(this,lt,fa).call(this);return}this.setEditingState(!0),b(this,lt,ga).call(this),this.unselectAll();for(const ct of t(this,It).values())ct.updateMode(c);if(!N&&et){this.addNewEditorFromKeyboard();return}if(N){for(const ct of t(this,Mt).values())if(ct.annotationElementId===N){this.setSelected(ct),ct.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(c){c!==t(this,a)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:c})}updateParams(c,N){var et;if(t(this,Qt)){switch(c){case d.AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor();return;case d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:(et=t(this,n))==null||et.updateColor(N);break;case d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(t(this,u)||w(this,u,new Map)).set(c,N),this.showAllEditors("highlight",N);break}for(const ct of t(this,h))ct.updateParams(c,N);for(const ct of t(this,Qt))ct.updateDefaultParams(c,N)}}showAllEditors(c,N,et=!1){var ct;for(const St of t(this,Mt).values())St.editorType===c&&St.show(N);(((ct=t(this,u))==null?void 0:ct.get(d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL))??!0)!==N&&b(this,lt,is).call(this,[[d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,N]])}enableWaiting(c=!1){if(t(this,pt)!==c){w(this,pt,c);for(const N of t(this,It).values())c?N.disableClick():N.enableClick(),N.div.classList.toggle("waiting",c)}}getEditors(c){const N=[];for(const et of t(this,Mt).values())et.pageIndex===c&&N.push(et);return N}getEditor(c){return t(this,Mt).get(c)}addEditor(c){t(this,Mt).set(c.id,c)}removeEditor(c){var N;c.div.contains(document.activeElement)&&(t(this,le)&&clearTimeout(t(this,le)),w(this,le,setTimeout(()=>{this.focusMainContainer(),w(this,le,null)},0))),t(this,Mt).delete(c.id),this.unselect(c),(!c.annotationElementId||!t(this,oe).has(c.annotationElementId))&&((N=t(this,Xt))==null||N.remove(c.id))}addDeletedAnnotationElement(c){t(this,oe).add(c.annotationElementId),this.addChangedExistingAnnotation(c),c.deleted=!0}isDeletedAnnotationElement(c){return t(this,oe).has(c)}removeDeletedAnnotationElement(c){t(this,oe).delete(c.annotationElementId),this.removeChangedExistingAnnotation(c),c.deleted=!1}setActiveEditor(c){t(this,nt)!==c&&(w(this,nt,c),c&&b(this,lt,is).call(this,c.propertiesToUpdate))}updateUI(c){t(this,lt,ma)===c&&b(this,lt,is).call(this,c.propertiesToUpdate)}toggleSelected(c){if(t(this,h).has(c)){t(this,h).delete(c),c.unselect(),b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection});return}t(this,h).add(c),c.select(),b(this,lt,is).call(this,c.propertiesToUpdate),b(this,lt,Oe).call(this,{hasSelectedEditor:!0})}setSelected(c){for(const N of t(this,h))N!==c&&N.unselect();t(this,h).clear(),t(this,h).add(c),c.select(),b(this,lt,is).call(this,c.propertiesToUpdate),b(this,lt,Oe).call(this,{hasSelectedEditor:!0})}isSelected(c){return t(this,h).has(c)}get firstSelectedEditor(){return t(this,h).values().next().value}unselect(c){c.unselect(),t(this,h).delete(c),b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return t(this,h).size!==0}get isEnterHandled(){return t(this,h).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){t(this,Jt).undo(),b(this,lt,Oe).call(this,{hasSomethingToUndo:t(this,Jt).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,lt,Hs).call(this)})}redo(){t(this,Jt).redo(),b(this,lt,Oe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:t(this,Jt).hasSomethingToRedo(),isEmpty:b(this,lt,Hs).call(this)})}addCommands(c){t(this,Jt).add(c),b(this,lt,Oe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,lt,Hs).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const c=[...t(this,h)],N=()=>{for(const ct of c)ct.remove()},et=()=>{for(const ct of c)b(this,lt,ln).call(this,ct)};this.addCommands({cmd:N,undo:et,mustExec:!0})}commitOrRemove(){var c;(c=t(this,nt))==null||c.commitOrRemove()}hasSomethingToControl(){return t(this,nt)||this.hasSelection}selectAll(){for(const c of t(this,h))c.commit();b(this,lt,cn).call(this,t(this,Mt).values())}unselectAll(){if(!(t(this,nt)&&(t(this,nt).commitOrRemove(),t(this,a)!==d.AnnotationEditorType.NONE))&&this.hasSelection){for(const c of t(this,h))c.unselect();t(this,h).clear(),b(this,lt,Oe).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(c,N,et=!1){if(et||this.commitOrRemove(),!this.hasSelection)return;t(this,Ot)[0]+=c,t(this,Ot)[1]+=N;const[ct,St]=t(this,Ot),xt=[...t(this,h)];t(this,jt)&&clearTimeout(t(this,jt)),w(this,jt,setTimeout(()=>{w(this,jt,null),t(this,Ot)[0]=t(this,Ot)[1]=0,this.addCommands({cmd:()=>{for(const Kt of xt)t(this,Mt).has(Kt.id)&&Kt.translateInPage(ct,St)},undo:()=>{for(const Kt of xt)t(this,Mt).has(Kt.id)&&Kt.translateInPage(-ct,-St)},mustExec:!1})},1e3));for(const Kt of xt)Kt.translateInPage(c,N)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),w(this,Rt,new Map);for(const c of t(this,h))t(this,Rt).set(c,{savedX:c.x,savedY:c.y,savedPageIndex:c.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!t(this,Rt))return!1;this.disableUserSelect(!1);const c=t(this,Rt);w(this,Rt,null);let N=!1;for(const[{x:ct,y:St,pageIndex:xt},Dt]of c)Dt.newX=ct,Dt.newY=St,Dt.newPageIndex=xt,N||(N=ct!==Dt.savedX||St!==Dt.savedY||xt!==Dt.savedPageIndex);if(!N)return!1;const et=(ct,St,xt,Dt)=>{if(t(this,Mt).has(ct.id)){const Kt=t(this,It).get(Dt);Kt?ct._setParentAndPosition(Kt,St,xt):(ct.pageIndex=Dt,ct.x=St,ct.y=xt)}};return this.addCommands({cmd:()=>{for(const[ct,{newX:St,newY:xt,newPageIndex:Dt}]of c)et(ct,St,xt,Dt)},undo:()=>{for(const[ct,{savedX:St,savedY:xt,savedPageIndex:Dt}]of c)et(ct,St,xt,Dt)},mustExec:!0}),!0}dragSelectedEditors(c,N){if(t(this,Rt))for(const et of t(this,Rt).keys())et.drag(c,N)}rebuild(c){if(c.parent===null){const N=this.getLayer(c.pageIndex);N?(N.changeParent(c),N.addOrRebuild(c)):(this.addEditor(c),this.addToAnnotationStorage(c),c.rebuild())}else c.parent.addOrRebuild(c)}get isEditorHandlingKeyboard(){var c;return((c=this.getActive())==null?void 0:c.shouldGetKeyboardEvents())||t(this,h).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(c){return t(this,nt)===c}getActive(){return t(this,nt)}getMode(){return t(this,a)}get imageManager(){return(0,d.shadow)(this,"imageManager",new F)}getSelectionBoxes(c){if(!c)return null;const N=document.getSelection();for(let Yt=0,fe=N.rangeCount;Yt<fe;Yt++)if(!c.contains(N.getRangeAt(Yt).commonAncestorContainer))return null;const{x:et,y:ct,width:St,height:xt}=c.getBoundingClientRect();let Dt;switch(c.getAttribute("data-main-rotation")){case"90":Dt=(Yt,fe,Me,Re)=>({x:(fe-ct)/xt,y:1-(Yt+Me-et)/St,width:Re/xt,height:Me/St});break;case"180":Dt=(Yt,fe,Me,Re)=>({x:1-(Yt+Me-et)/St,y:1-(fe+Re-ct)/xt,width:Me/St,height:Re/xt});break;case"270":Dt=(Yt,fe,Me,Re)=>({x:1-(fe+Re-ct)/xt,y:(Yt-et)/St,width:Re/xt,height:Me/St});break;default:Dt=(Yt,fe,Me,Re)=>({x:(Yt-et)/St,y:(fe-ct)/xt,width:Me/St,height:Re/xt});break}const Kt=[];for(let Yt=0,fe=N.rangeCount;Yt<fe;Yt++){const Me=N.getRangeAt(Yt);if(!Me.collapsed)for(const{x:Re,y:Be,width:De,height:Bs}of Me.getClientRects())De===0||Bs===0||Kt.push(Dt(Re,Be,De,Bs))}return Kt.length===0?null:Kt}addChangedExistingAnnotation({annotationElementId:c,id:N}){(t(this,ae)||w(this,ae,new Map)).set(c,N)}removeChangedExistingAnnotation({annotationElementId:c}){var N;(N=t(this,ae))==null||N.delete(c)}renderAnnotationElement(c){var ct;const N=(ct=t(this,ae))==null?void 0:ct.get(c.data.id);if(!N)return;const et=t(this,Xt).getRawValue(N);et&&(t(this,a)===d.AnnotationEditorType.NONE&&!et.hasBeenModified||et.renderAnnotationElement(c))}};nt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakMap,Qt=new WeakMap,ue=new WeakMap,Ae=new WeakMap,Bt=new WeakMap,le=new WeakMap,ee=new WeakMap,ce=new WeakMap,Zt=new WeakMap,Nt=new WeakMap,mt=new WeakMap,pt=new WeakMap,S=new WeakMap,n=new WeakMap,s=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,g=new WeakMap,u=new WeakMap,p=new WeakMap,R=new WeakMap,e=new WeakMap,i=new WeakMap,o=new WeakMap,m=new WeakMap,M=new WeakMap,$=new WeakMap,W=new WeakMap,tt=new WeakMap,gt=new WeakMap,it=new WeakMap,_t=new WeakMap,Ot=new WeakMap,jt=new WeakMap,Gt=new WeakMap,Ut=new WeakMap,lt=new WeakSet,hi=function({anchorNode:c}){return c.nodeType===Node.TEXT_NODE?c.parentElement:c},la=function(){const c=document.getSelection();if(!c||c.isCollapsed)return;const N=b(this,lt,hi).call(this,c).closest(".textLayer"),et=this.getSelectionBoxes(N);et&&(t(this,Zt)||w(this,Zt,new H.HighlightToolbar(this)),t(this,Zt).show(N,et,this.direction==="ltr"))},ca=function(){var et,ct,St;const c=document.getSelection();if(!c||c.isCollapsed){t(this,l)&&((et=t(this,Zt))==null||et.hide(),w(this,l,null),b(this,lt,Oe).call(this,{hasSelectedText:!1}));return}const{anchorNode:N}=c;if(N!==t(this,l)){if(!b(this,lt,hi).call(this,c).closest(".textLayer")){t(this,l)&&((ct=t(this,Zt))==null||ct.hide(),w(this,l,null),b(this,lt,Oe).call(this,{hasSelectedText:!1}));return}if((St=t(this,Zt))==null||St.hide(),w(this,l,N),b(this,lt,Oe).call(this,{hasSelectedText:!0}),!(t(this,a)!==d.AnnotationEditorType.HIGHLIGHT&&t(this,a)!==d.AnnotationEditorType.NONE)&&(t(this,a)===d.AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),w(this,ce,this.isShiftKeyDown),!this.isShiftKeyDown)){const xt=Dt=>{Dt.type==="pointerup"&&Dt.button!==0||(window.removeEventListener("pointerup",xt),window.removeEventListener("blur",xt),Dt.type==="pointerup"&&b(this,lt,li).call(this,"main_toolbar"))};window.addEventListener("pointerup",xt),window.addEventListener("blur",xt)}}},li=function(c=""){t(this,a)===d.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(c):t(this,Ae)&&b(this,lt,la).call(this)},da=function(){document.addEventListener("selectionchange",t(this,gt))},ua=function(){document.removeEventListener("selectionchange",t(this,gt))},pa=function(){window.addEventListener("focus",t(this,R)),window.addEventListener("blur",t(this,p))},nn=function(){window.removeEventListener("focus",t(this,R)),window.removeEventListener("blur",t(this,p))},rn=function(){window.addEventListener("keydown",t(this,m)),window.addEventListener("keyup",t(this,M))},an=function(){window.removeEventListener("keydown",t(this,m)),window.removeEventListener("keyup",t(this,M))},on=function(){document.addEventListener("copy",t(this,e)),document.addEventListener("cut",t(this,i)),document.addEventListener("paste",t(this,o))},hn=function(){document.removeEventListener("copy",t(this,e)),document.removeEventListener("cut",t(this,i)),document.removeEventListener("paste",t(this,o))},Oe=function(c){Object.entries(c).some(([N,et])=>t(this,_t)[N]!==et)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(t(this,_t),c)}),t(this,a)===d.AnnotationEditorType.HIGHLIGHT&&c.hasSelectedEditor===!1&&b(this,lt,is).call(this,[[d.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))},is=function(c){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:c})},ga=function(){if(!t(this,mt)){w(this,mt,!0);for(const c of t(this,It).values())c.enable();for(const c of t(this,Mt).values())c.enable()}},fa=function(){if(this.unselectAll(),t(this,mt)){w(this,mt,!1);for(const c of t(this,It).values())c.disable();for(const c of t(this,Mt).values())c.disable()}},ln=function(c){const N=t(this,It).get(c.pageIndex);N?N.addOrRebuild(c):(this.addEditor(c),this.addToAnnotationStorage(c))},ma=function(){let c=null;for(c of t(this,h));return c},Hs=function(){if(t(this,Mt).size===0)return!0;if(t(this,Mt).size===1)for(const c of t(this,Mt).values())return c.isEmpty();return!1},cn=function(c){for(const N of t(this,h))N.unselect();t(this,h).clear();for(const N of c)N.isEmpty()||(t(this,h).add(N),N.select());b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection})},he(zt,"TRANSLATE_SMALL",1),he(zt,"TRANSLATE_BIG",10);let y=zt},94:(ie,$t,dt)=>{dt.d($t,{PDFFetchStream:()=>z});var d=dt(292),Q=dt(490);function H(V,E,y){return{method:"GET",headers:V,signal:y.signal,mode:"cors",credentials:E?"include":"same-origin",redirect:"follow"}}function J(V){const E=new Headers;for(const y in V){const D=V[y];D!==void 0&&E.append(y,D)}return E}function At(V){return V instanceof Uint8Array?V.buffer:V instanceof ArrayBuffer?V:((0,d.warn)(`getArrayBuffer - unexpected data format: ${V}`),new Uint8Array(V).buffer)}class z{constructor(E){this.source=E,this.isHttp=/^https?:/i.test(E.url),this.httpHeaders=this.isHttp&&E.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var E;return((E=this._fullRequestReader)==null?void 0:E._loaded)??0}getFullReader(){return(0,d.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new F(this),this._fullRequestReader}getRangeReader(E,y){if(y<=this._progressiveDataLength)return null;const D=new I(this,E,y);return this._rangeRequestReaders.push(D),D}cancelAllRequests(E){var y;(y=this._fullRequestReader)==null||y.cancel(E);for(const D of this._rangeRequestReaders.slice(0))D.cancel(E)}}class F{constructor(E){this._stream=E,this._reader=null,this._loaded=0,this._filename=null;const y=E.source;this._withCredentials=y.withCredentials||!1,this._contentLength=y.length,this._headersCapability=Promise.withResolvers(),this._disableRange=y.disableRange||!1,this._rangeChunkSize=y.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!y.disableStream,this._isRangeSupported=!y.disableRange,this._headers=J(this._stream.httpHeaders);const D=y.url;fetch(D,H(this._headers,this._withCredentials,this._abortController)).then(L=>{if(!(0,Q.validateResponseStatus)(L.status))throw(0,Q.createResponseStatusError)(L.status,D);this._reader=L.body.getReader(),this._headersCapability.resolve();const Z=k=>L.headers.get(k),{allowRangeRequests:B,suggestedLength:K}=(0,Q.validateRangeRequestCapabilities)({getResponseHeader:Z,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=B,this._contentLength=K||this._contentLength,this._filename=(0,Q.extractFilenameFromHeader)(Z),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new d.AbortException("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 D;await this._headersCapability.promise;const{value:E,done:y}=await this._reader.read();return y?{value:E,done:y}:(this._loaded+=E.byteLength,(D=this.onProgress)==null||D.call(this,{loaded:this._loaded,total:this._contentLength}),{value:At(E),done:!1})}cancel(E){var y;(y=this._reader)==null||y.cancel(E),this._abortController.abort()}}class I{constructor(E,y,D){this._stream=E,this._reader=null,this._loaded=0;const L=E.source;this._withCredentials=L.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!L.disableStream,this._abortController=new AbortController,this._headers=J(this._stream.httpHeaders),this._headers.append("Range",`bytes=${y}-${D-1}`);const Z=L.url;fetch(Z,H(this._headers,this._withCredentials,this._abortController)).then(B=>{if(!(0,Q.validateResponseStatus)(B.status))throw(0,Q.createResponseStatusError)(B.status,Z);this._readCapability.resolve(),this._reader=B.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var D;await this._readCapability.promise;const{value:E,done:y}=await this._reader.read();return y?{value:E,done:y}:(this._loaded+=E.byteLength,(D=this.onProgress)==null||D.call(this,{loaded:this._loaded}),{value:At(E),done:!1})}cancel(E){var y;(y=this._reader)==null||y.cancel(E),this._abortController.abort()}}},10:(ie,$t,dt)=>{var J;dt.d($t,{FontFaceObject:()=>H,FontLoader:()=>Q});var d=dt(292);class Q{constructor({ownerDocument:z=globalThis.document,styleElement:F=null}){_(this,J,new Set);this._document=z,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(z){this.nativeFontFaces.add(z),this._document.fonts.add(z)}removeNativeFontFace(z){this.nativeFontFaces.delete(z),this._document.fonts.delete(z)}insertRule(z){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const F=this.styleElement.sheet;F.insertRule(z,F.cssRules.length)}clear(){for(const z of this.nativeFontFaces)this._document.fonts.delete(z);this.nativeFontFaces.clear(),t(this,J).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:z,_inspectFont:F}){if(!(!z||t(this,J).has(z.loadedName))){if((0,d.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:I,src:V,style:E}=z,y=new FontFace(I,V,E);this.addNativeFontFace(y);try{await y.load(),t(this,J).add(I),F==null||F(z)}catch{(0,d.warn)(`Cannot load system font: ${z.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(y)}return}(0,d.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(z){if(z.attached||z.missingFile&&!z.systemFontInfo)return;if(z.attached=!0,z.systemFontInfo){await this.loadSystemFont(z);return}if(this.isFontLoadingAPISupported){const I=z.createNativeFontFace();if(I){this.addNativeFontFace(I);try{await I.loaded}catch(V){throw(0,d.warn)(`Failed to load font '${I.family}': '${V}'.`),z.disableFontFace=!0,V}}return}const F=z.createFontFaceRule();if(F){if(this.insertRule(F),this.isSyncFontLoadingSupported)return;await new Promise(I=>{const V=this._queueLoadingCallback(I);this._prepareFontLoadEvent(z,V)})}}get isFontLoadingAPISupported(){var F;const z=!!((F=this._document)!=null&&F.fonts);return(0,d.shadow)(this,"isFontLoadingAPISupported",z)}get isSyncFontLoadingSupported(){let z=!1;return(d.isNodeJS||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(z=!0),(0,d.shadow)(this,"isSyncFontLoadingSupported",z)}_queueLoadingCallback(z){function F(){for((0,d.assert)(!V.done,"completeRequest() cannot be called twice."),V.done=!0;I.length>0&&I[0].done;){const E=I.shift();setTimeout(E.callback,0)}}const{loadingRequests:I}=this,V={done:!1,complete:F,callback:z};return I.push(V),V}get _loadTestFont(){const z=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,d.shadow)(this,"_loadTestFont",z)}_prepareFontLoadEvent(z,F){function I(Tt,ot){return Tt.charCodeAt(ot)<<24|Tt.charCodeAt(ot+1)<<16|Tt.charCodeAt(ot+2)<<8|Tt.charCodeAt(ot+3)&255}function V(Tt,ot,nt,Mt){const It=Tt.substring(0,ot),Pt=Tt.substring(ot+nt);return It+Mt+Pt}let E,y;const D=this._document.createElement("canvas");D.width=1,D.height=1;const L=D.getContext("2d");let Z=0;function B(Tt,ot){if(++Z>30){(0,d.warn)("Load test font never loaded."),ot();return}if(L.font="30px "+Tt,L.fillText(".",0,20),L.getImageData(0,0,1,1).data[3]>0){ot();return}setTimeout(B.bind(null,Tt,ot))}const K=`lt${Date.now()}${this.loadTestFontId++}`;let k=this._loadTestFont;k=V(k,976,K.length,K);const O=16,C=1482184792;let P=I(k,O);for(E=0,y=K.length-3;E<y;E+=4)P=P-C+I(K,E)|0;E<K.length&&(P=P-C+I(K+"XXX",E)|0),k=V(k,O,4,(0,d.string32)(P));const ht=`url(data:font/opentype;base64,${btoa(k)});`,st=`@font-face {font-family:"${K}";src:${ht}}`;this.insertRule(st);const bt=this._document.createElement("div");bt.style.visibility="hidden",bt.style.width=bt.style.height="10px",bt.style.position="absolute",bt.style.top=bt.style.left="0px";for(const Tt of[z.loadedName,K]){const ot=this._document.createElement("span");ot.textContent="Hi",ot.style.fontFamily=Tt,bt.append(ot)}this._document.body.append(bt),B(K,()=>{bt.remove(),F.complete()})}}J=new WeakMap;class H{constructor(z,{disableFontFace:F=!1,ignoreErrors:I=!1,inspectFont:V=null}){this.compiledGlyphs=Object.create(null);for(const E in z)this[E]=z[E];this.disableFontFace=F===!0,this.ignoreErrors=I===!0,this._inspectFont=V}createNativeFontFace(){var F;if(!this.data||this.disableFontFace)return null;let z;if(!this.cssFontInfo)z=new FontFace(this.loadedName,this.data,{});else{const I={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(I.style=`oblique ${this.cssFontInfo.italicAngle}deg`),z=new FontFace(this.cssFontInfo.fontFamily,this.data,I)}return(F=this._inspectFont)==null||F.call(this,this),z}createFontFaceRule(){var V;if(!this.data||this.disableFontFace)return null;const z=(0,d.bytesToString)(this.data),F=`url(data:${this.mimetype};base64,${btoa(z)});`;let I;if(!this.cssFontInfo)I=`@font-face {font-family:"${this.loadedName}";src:${F}}`;else{let E=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(E+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),I=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${E}src:${F}}`}return(V=this._inspectFont)==null||V.call(this,this,F),I}getPathGenerator(z,F){if(this.compiledGlyphs[F]!==void 0)return this.compiledGlyphs[F];let I;try{I=z.get(this.loadedName+"_path_"+F)}catch(E){if(!this.ignoreErrors)throw E;(0,d.warn)(`getPathGenerator - ignoring character: "${E}".`)}if(!Array.isArray(I)||I.length===0)return this.compiledGlyphs[F]=function(E,y){};const V=[];for(let E=0,y=I.length;E<y;)switch(I[E++]){case d.FontRenderOps.BEZIER_CURVE_TO:{const[D,L,Z,B,K,k]=I.slice(E,E+6);V.push(O=>O.bezierCurveTo(D,L,Z,B,K,k)),E+=6}break;case d.FontRenderOps.MOVE_TO:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.moveTo(D,L)),E+=2}break;case d.FontRenderOps.LINE_TO:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.lineTo(D,L)),E+=2}break;case d.FontRenderOps.QUADRATIC_CURVE_TO:{const[D,L,Z,B]=I.slice(E,E+4);V.push(K=>K.quadraticCurveTo(D,L,Z,B)),E+=4}break;case d.FontRenderOps.RESTORE:V.push(D=>D.restore());break;case d.FontRenderOps.SAVE:V.push(D=>D.save());break;case d.FontRenderOps.SCALE:(0,d.assert)(V.length===2,"Scale command is only valid at the third position.");break;case d.FontRenderOps.TRANSFORM:{const[D,L,Z,B,K,k]=I.slice(E,E+6);V.push(O=>O.transform(D,L,Z,B,K,k)),E+=6}break;case d.FontRenderOps.TRANSLATE:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.translate(D,L)),E+=2}break}return this.compiledGlyphs[F]=function(E,y){V[0](E),V[1](E),E.scale(y,-y);for(let D=2,L=V.length;D<L;D++)V[D](E)}}}},62:(ie,$t,dt)=>{var H,J;dt.d($t,{Metadata:()=>Q});var d=dt(292);class Q{constructor({parsedData:z,rawData:F}){_(this,H);_(this,J);w(this,H,z),w(this,J,F)}getRaw(){return t(this,J)}get(z){return t(this,H).get(z)??null}getAll(){return(0,d.objectFromMap)(t(this,H))}has(z){return t(this,H).has(z)}}H=new WeakMap,J=new WeakMap},457:(ie,$t,dt)=>{dt.d($t,{PDFNetworkStream:()=>F});var d=dt(292),Q=dt(490);const H=200,J=206;function At(E){const y=E.response;return typeof y!="string"?y:(0,d.stringToBytes)(y).buffer}class z{constructor(y,D={}){this.url=y,this.isHttp=/^https?:/i.test(y),this.httpHeaders=this.isHttp&&D.httpHeaders||Object.create(null),this.withCredentials=D.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(y,D,L){const Z={begin:y,end:D};for(const B in L)Z[B]=L[B];return this.request(Z)}requestFull(y){return this.request(y)}request(y){const D=new XMLHttpRequest,L=this.currXhrId++,Z=this.pendingRequests[L]={xhr:D};D.open("GET",this.url),D.withCredentials=this.withCredentials;for(const B in this.httpHeaders){const K=this.httpHeaders[B];K!==void 0&&D.setRequestHeader(B,K)}return this.isHttp&&"begin"in y&&"end"in y?(D.setRequestHeader("Range",`bytes=${y.begin}-${y.end-1}`),Z.expectedStatus=J):Z.expectedStatus=H,D.responseType="arraybuffer",y.onError&&(D.onerror=function(B){y.onError(D.status)}),D.onreadystatechange=this.onStateChange.bind(this,L),D.onprogress=this.onProgress.bind(this,L),Z.onHeadersReceived=y.onHeadersReceived,Z.onDone=y.onDone,Z.onError=y.onError,Z.onProgress=y.onProgress,D.send(null),L}onProgress(y,D){var Z;const L=this.pendingRequests[y];L&&((Z=L.onProgress)==null||Z.call(L,D))}onStateChange(y,D){var k,O,C;const L=this.pendingRequests[y];if(!L)return;const Z=L.xhr;if(Z.readyState>=2&&L.onHeadersReceived&&(L.onHeadersReceived(),delete L.onHeadersReceived),Z.readyState!==4||!(y in this.pendingRequests))return;if(delete this.pendingRequests[y],Z.status===0&&this.isHttp){(k=L.onError)==null||k.call(L,Z.status);return}const B=Z.status||H;if(!(B===H&&L.expectedStatus===J)&&B!==L.expectedStatus){(O=L.onError)==null||O.call(L,Z.status);return}const K=At(Z);if(B===J){const P=Z.getResponseHeader("Content-Range"),ht=/bytes (\d+)-(\d+)\/(\d+)/.exec(P);L.onDone({begin:parseInt(ht[1],10),chunk:K})}else K?L.onDone({begin:0,chunk:K}):(C=L.onError)==null||C.call(L,Z.status)}getRequestXhr(y){return this.pendingRequests[y].xhr}isPendingRequest(y){return y in this.pendingRequests}abortRequest(y){const D=this.pendingRequests[y].xhr;delete this.pendingRequests[y],D.abort()}}class F{constructor(y){this._source=y,this._manager=new z(y.url,{httpHeaders:y.httpHeaders,withCredentials:y.withCredentials}),this._rangeChunkSize=y.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(y){const D=this._rangeRequestReaders.indexOf(y);D>=0&&this._rangeRequestReaders.splice(D,1)}getFullReader(){return(0,d.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new I(this._manager,this._source),this._fullRequestReader}getRangeReader(y,D){const L=new V(this._manager,y,D);return L.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(L),L}cancelAllRequests(y){var D;(D=this._fullRequestReader)==null||D.cancel(y);for(const L of this._rangeRequestReaders.slice(0))L.cancel(y)}}class I{constructor(y,D){this._manager=y;const L={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=D.url,this._fullRequestId=y.requestFull(L),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=D.disableRange||!1,this._contentLength=D.length,this._rangeChunkSize=D.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 y=this._fullRequestId,D=this._manager.getRequestXhr(y),L=K=>D.getResponseHeader(K),{allowRangeRequests:Z,suggestedLength:B}=(0,Q.validateRangeRequestCapabilities)({getResponseHeader:L,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});Z&&(this._isRangeSupported=!0),this._contentLength=B||this._contentLength,this._filename=(0,Q.extractFilenameFromHeader)(L),this._isRangeSupported&&this._manager.abortRequest(y),this._headersReceivedCapability.resolve()}_onDone(y){if(y&&(this._requests.length>0?this._requests.shift().resolve({value:y.chunk,done:!1}):this._cachedChunks.push(y.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(y){this._storedError=(0,Q.createResponseStatusError)(y,this._url),this._headersReceivedCapability.reject(this._storedError);for(const D of this._requests)D.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(y){var D;(D=this.onProgress)==null||D.call(this,{loaded:y.loaded,total:y.lengthComputable?y.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 y=Promise.withResolvers();return this._requests.push(y),y.promise}cancel(y){this._done=!0,this._headersReceivedCapability.reject(y);for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class V{constructor(y,D,L){this._manager=y;const Z={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=y.url,this._requestId=y.requestRange(D,L,Z),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var y;(y=this.onClosed)==null||y.call(this,this)}_onDone(y){const D=y.chunk;this._requests.length>0?this._requests.shift().resolve({value:D,done:!1}):this._queuedChunk=D,this._done=!0;for(const L of this._requests)L.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(y){this._storedError=(0,Q.createResponseStatusError)(y,this._url);for(const D of this._requests)D.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(y){var D;this.isStreamingSupported||((D=this.onProgress)==null||D.call(this,{loaded:y.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const D=this._queuedChunk;return this._queuedChunk=null,{value:D,done:!1}}if(this._done)return{value:void 0,done:!0};const y=Promise.withResolvers();return this._requests.push(y),y.promise}cancel(y){this._done=!0;for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},490:(ie,$t,dt)=>{dt.d($t,{createResponseStatusError:()=>z,extractFilenameFromHeader:()=>At,validateRangeRequestCapabilities:()=>J,validateResponseStatus:()=>F});var d=dt(292);function Q(I){let V=!0,E=y("filename\\*","i").exec(I);if(E){E=E[1];let O=B(E);return O=unescape(O),O=K(O),O=k(O),L(O)}if(E=Z(I),E){const O=k(E);return L(O)}if(E=y("filename","i").exec(I),E){E=E[1];let O=B(E);return O=k(O),L(O)}function y(O,C){return new RegExp("(?:^|;)\\s*"+O+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',C)}function D(O,C){if(O){if(!/^[\x00-\xFF]+$/.test(C))return C;try{const P=new TextDecoder(O,{fatal:!0}),ht=(0,d.stringToBytes)(C);C=P.decode(ht),V=!1}catch{}}return C}function L(O){return V&&/[\x80-\xff]/.test(O)&&(O=D("utf-8",O),V&&(O=D("iso-8859-1",O))),O}function Z(O){const C=[];let P;const ht=y("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(P=ht.exec(O))!==null;){let[,bt,Tt,ot]=P;if(bt=parseInt(bt,10),bt in C){if(bt===0)break;continue}C[bt]=[Tt,ot]}const st=[];for(let bt=0;bt<C.length&&bt in C;++bt){let[Tt,ot]=C[bt];ot=B(ot),Tt&&(ot=unescape(ot),bt===0&&(ot=K(ot))),st.push(ot)}return st.join("")}function B(O){if(O.startsWith('"')){const C=O.slice(1).split('\\"');for(let P=0;P<C.length;++P){const ht=C[P].indexOf('"');ht!==-1&&(C[P]=C[P].slice(0,ht),C.length=P+1),C[P]=C[P].replaceAll(/\\(.)/g,"$1")}O=C.join('"')}return O}function K(O){const C=O.indexOf("'");if(C===-1)return O;const P=O.slice(0,C),ht=O.slice(C+1).replace(/^[^']*'/,"");return D(P,ht)}function k(O){return!O.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(O)?O:O.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(C,P,ht,st){if(ht==="q"||ht==="Q")return st=st.replaceAll("_"," "),st=st.replaceAll(/=([0-9a-fA-F]{2})/g,function(bt,Tt){return String.fromCharCode(parseInt(Tt,16))}),D(P,st);try{st=atob(st)}catch{}return D(P,st)})}return""}var H=dt(419);function J({getResponseHeader:I,isHttp:V,rangeChunkSize:E,disableRange:y}){const D={allowRangeRequests:!1,suggestedLength:void 0},L=parseInt(I("Content-Length"),10);return!Number.isInteger(L)||(D.suggestedLength=L,L<=2*E)||y||!V||I("Accept-Ranges")!=="bytes"||(I("Content-Encoding")||"identity")!=="identity"||(D.allowRangeRequests=!0),D}function At(I){const V=I("Content-Disposition");if(V){let E=Q(V);if(E.includes("%"))try{E=decodeURIComponent(E)}catch{}if((0,H.isPdfFile)(E))return E}return null}function z(I,V){return I===404||I===0&&V.startsWith("file:")?new d.MissingPDFException('Missing PDF "'+V+'".'):new d.UnexpectedResponseException(`Unexpected server response (${I}) while retrieving PDF "${V}".`,I)}function F(I){return I===200||I===206}},786:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{try{let At=function(C){const P=E.parse(C);return P.protocol==="file:"||P.host?P:/^[a-z]:[/\\]/i.test(C)?E.parse(`file:///${C}`):(P.host||(P.protocol="file:"),P)},z=function(C,P){return{protocol:C.protocol,auth:C.auth,host:C.hostname,port:C.port,path:C.path,method:"GET",headers:P}};dt.d($t,{PDFNodeStream:()=>D});var H=dt(292),J=dt(490);let F,I,V,E;H.isNodeJS&&(F=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),I=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),V=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),E=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])));const y=/^file:\/\/\/[a-zA-Z]:\//;class D{constructor(P){this.source=P,this.url=At(P.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&P.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var P;return((P=this._fullRequestReader)==null?void 0:P._loaded)??0}getFullReader(){return(0,H.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new k(this):new B(this),this._fullRequestReader}getRangeReader(P,ht){if(ht<=this._progressiveDataLength)return null;const st=this.isFsUrl?new O(this,P,ht):new K(this,P,ht);return this._rangeRequestReaders.push(st),st}cancelAllRequests(P){var ht;(ht=this._fullRequestReader)==null||ht.cancel(P);for(const st of this._rangeRequestReaders.slice(0))st.cancel(P)}}class L{constructor(P){this._url=P.url,this._done=!1,this._storedError=null,this.onProgress=null;const ht=P.source;this._contentLength=ht.length,this._loaded=0,this._filename=null,this._disableRange=ht.disableRange||!1,this._rangeChunkSize=ht.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!ht.disableStream,this._isRangeSupported=!ht.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 ht;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const P=this._readableStream.read();return P===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=P.length,(ht=this.onProgress)==null||ht.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){if(!this._readableStream){this._error(P);return}this._readableStream.destroy(P)}_error(P){this._storedError=P,this._readCapability.resolve()}_setReadableStream(P){this._readableStream=P,P.on("readable",()=>{this._readCapability.resolve()}),P.on("end",()=>{P.destroy(),this._done=!0,this._readCapability.resolve()}),P.on("error",ht=>{this._error(ht)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new H.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Z{constructor(P){this._url=P.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const ht=P.source;this._isStreamingSupported=!ht.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var ht;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const P=this._readableStream.read();return P===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=P.length,(ht=this.onProgress)==null||ht.call(this,{loaded:this._loaded}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){if(!this._readableStream){this._error(P);return}this._readableStream.destroy(P)}_error(P){this._storedError=P,this._readCapability.resolve()}_setReadableStream(P){this._readableStream=P,P.on("readable",()=>{this._readCapability.resolve()}),P.on("end",()=>{P.destroy(),this._done=!0,this._readCapability.resolve()}),P.on("error",ht=>{this._error(ht)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class B extends L{constructor(P){super(P);const ht=st=>{if(st.statusCode===404){const nt=new H.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=nt,this._headersCapability.reject(nt);return}this._headersCapability.resolve(),this._setReadableStream(st);const bt=nt=>this._readableStream.headers[nt.toLowerCase()],{allowRangeRequests:Tt,suggestedLength:ot}=(0,J.validateRangeRequestCapabilities)({getResponseHeader:bt,isHttp:P.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=Tt,this._contentLength=ot||this._contentLength,this._filename=(0,J.extractFilenameFromHeader)(bt)};this._request=null,this._url.protocol==="http:"?this._request=I.request(z(this._url,P.httpHeaders),ht):this._request=V.request(z(this._url,P.httpHeaders),ht),this._request.on("error",st=>{this._storedError=st,this._headersCapability.reject(st)}),this._request.end()}}class K extends Z{constructor(P,ht,st){super(P),this._httpHeaders={};for(const Tt in P.httpHeaders){const ot=P.httpHeaders[Tt];ot!==void 0&&(this._httpHeaders[Tt]=ot)}this._httpHeaders.Range=`bytes=${ht}-${st-1}`;const bt=Tt=>{if(Tt.statusCode===404){const ot=new H.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=ot;return}this._setReadableStream(Tt)};this._request=null,this._url.protocol==="http:"?this._request=I.request(z(this._url,this._httpHeaders),bt):this._request=V.request(z(this._url,this._httpHeaders),bt),this._request.on("error",Tt=>{this._storedError=Tt}),this._request.end()}}class k extends L{constructor(P){super(P);let ht=decodeURIComponent(this._url.path);y.test(this._url.href)&&(ht=ht.replace(/^\//,"")),F.promises.lstat(ht).then(st=>{this._contentLength=st.size,this._setReadableStream(F.createReadStream(ht)),this._headersCapability.resolve()},st=>{st.code==="ENOENT"&&(st=new H.MissingPDFException(`Missing PDF "${ht}".`)),this._storedError=st,this._headersCapability.reject(st)})}}class O extends Z{constructor(P,ht,st){super(P);let bt=decodeURIComponent(this._url.path);y.test(this._url.href)&&(bt=bt.replace(/^\//,"")),this._setReadableStream(F.createReadStream(bt,{start:ht,end:st-1}))}}Q()}catch(At){Q(At)}},1)},573:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{try{dt.d($t,{NodeCMapReaderFactory:()=>y,NodeCanvasFactory:()=>E,NodeFilterFactory:()=>V,NodeStandardFontDataFactory:()=>D});var H=dt(583),J=dt(292);let At,z,F;if(J.isNodeJS){At=await os(()=>import("./index-71ZZmCGz.js").then(async L=>(await L.__tla,L)).then(L=>L.a0),__vite__mapDeps([0,1]));try{z=await os(()=>import("./index-71ZZmCGz.js").then(async L=>(await L.__tla,L)).then(L=>L.a0),__vite__mapDeps([0,1]))}catch{}try{F=await os(()=>import("./index-B9fWrEk-.js"),[])}catch{}}const I=function(L){return At.promises.readFile(L).then(Z=>new Uint8Array(Z))};class V extends H.BaseFilterFactory{}class E extends H.BaseCanvasFactory{_createCanvas(Z,B){return z.createCanvas(Z,B)}}class y extends H.BaseCMapReaderFactory{_fetchData(Z,B){return I(Z).then(K=>({cMapData:K,compressionType:B}))}}class D extends H.BaseStandardFontDataFactory{_fetchData(Z){return I(Z)}}Q()}catch(At){Q(At)}},1)},626:(ie,$t,dt)=>{var z,F,I,V,E,y,D,L,Z,dn;dt.d($t,{OptionalContentConfig:()=>At});var d=dt(292),Q=dt(651);const H=Symbol("INTERNAL");class J{constructor(k,{name:O,intent:C,usage:P}){_(this,z,!1);_(this,F,!1);_(this,I,!1);_(this,V,!0);w(this,z,!!(k&d.RenderingIntentFlag.DISPLAY)),w(this,F,!!(k&d.RenderingIntentFlag.PRINT)),this.name=O,this.intent=C,this.usage=P}get visible(){if(t(this,I))return t(this,V);if(!t(this,V))return!1;const{print:k,view:O}=this.usage;return t(this,z)?(O==null?void 0:O.viewState)!=="OFF":t(this,F)?(k==null?void 0:k.printState)!=="OFF":!0}_setVisible(k,O,C=!1){k!==H&&(0,d.unreachable)("Internal method `_setVisible` called."),w(this,I,C),w(this,V,O)}}z=new WeakMap,F=new WeakMap,I=new WeakMap,V=new WeakMap;class At{constructor(k,O=d.RenderingIntentFlag.DISPLAY){_(this,Z);_(this,E,null);_(this,y,new Map);_(this,D,null);_(this,L,null);if(this.renderingIntent=O,this.name=null,this.creator=null,k!==null){this.name=k.name,this.creator=k.creator,w(this,L,k.order);for(const C of k.groups)t(this,y).set(C.id,new J(O,C));if(k.baseState==="OFF")for(const C of t(this,y).values())C._setVisible(H,!1);for(const C of k.on)t(this,y).get(C)._setVisible(H,!0);for(const C of k.off)t(this,y).get(C)._setVisible(H,!1);w(this,D,this.getHash())}}isVisible(k){if(t(this,y).size===0)return!0;if(!k)return(0,d.info)("Optional content group not defined."),!0;if(k.type==="OCG")return t(this,y).has(k.id)?t(this,y).get(k.id).visible:((0,d.warn)(`Optional content group not found: ${k.id}`),!0);if(k.type==="OCMD"){if(k.expression)return b(this,Z,dn).call(this,k.expression);if(!k.policy||k.policy==="AnyOn"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(t(this,y).get(O).visible)return!0}return!1}else if(k.policy==="AllOn"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(!t(this,y).get(O).visible)return!1}return!0}else if(k.policy==="AnyOff"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(!t(this,y).get(O).visible)return!0}return!1}else if(k.policy==="AllOff"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(t(this,y).get(O).visible)return!1}return!0}return(0,d.warn)(`Unknown optional content policy ${k.policy}.`),!0}return(0,d.warn)(`Unknown group type ${k.type}.`),!0}setVisibility(k,O=!0){const C=t(this,y).get(k);if(!C){(0,d.warn)(`Optional content group not found: ${k}`);return}C._setVisible(H,!!O,!0),w(this,E,null)}setOCGState({state:k,preserveRB:O}){let C;for(const P of k){switch(P){case"ON":case"OFF":case"Toggle":C=P;continue}const ht=t(this,y).get(P);if(ht)switch(C){case"ON":ht._setVisible(H,!0);break;case"OFF":ht._setVisible(H,!1);break;case"Toggle":ht._setVisible(H,!ht.visible);break}}w(this,E,null)}get hasInitialVisibility(){return t(this,D)===null||this.getHash()===t(this,D)}getOrder(){return t(this,y).size?t(this,L)?t(this,L).slice():[...t(this,y).keys()]:null}getGroups(){return t(this,y).size>0?(0,d.objectFromMap)(t(this,y)):null}getGroup(k){return t(this,y).get(k)||null}getHash(){if(t(this,E)!==null)return t(this,E);const k=new Q.MurmurHash3_64;for(const[O,C]of t(this,y))k.update(`${O}:${C.visible}`);return w(this,E,k.hexdigest())}}E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakSet,dn=function(k){const O=k.length;if(O<2)return!0;const C=k[0];for(let P=1;P<O;P++){const ht=k[P];let st;if(Array.isArray(ht))st=b(this,Z,dn).call(this,ht);else if(t(this,y).has(ht))st=t(this,y).get(ht).visible;else return(0,d.warn)(`Optional content group not found: ${ht}`),!0;switch(C){case"And":if(!st)return!1;break;case"Or":if(st)return!0;break;case"Not":return!st;default:return!0}}return C==="And"}},814:(ie,$t,dt)=>{dt.d($t,{cleanupTextLayer:()=>V,renderTextLayer:()=>B,updateTextLayer:()=>K});var d=dt(292),Q=dt(419);const H=1e5,J=30,At=.8,z=new Map;let F=null;function I(){if(!F){const k=document.createElement("canvas");k.className="hiddenCanvasElement",document.body.append(k),F=k.getContext("2d",{alpha:!1})}return F}function V(){F==null||F.canvas.remove(),F=null}function E(k){const O=z.get(k);if(O)return O;const C=I(),P=C.font;C.canvas.width=C.canvas.height=J,C.font=`${J}px ${k}`;const ht=C.measureText("");let st=ht.fontBoundingBoxAscent,bt=Math.abs(ht.fontBoundingBoxDescent);if(st){const ot=st/(st+bt);return z.set(k,ot),C.canvas.width=C.canvas.height=0,C.font=P,ot}C.strokeStyle="red",C.clearRect(0,0,J,J),C.strokeText("g",0,0);let Tt=C.getImageData(0,0,J,J).data;bt=0;for(let ot=Tt.length-1-3;ot>=0;ot-=4)if(Tt[ot]>0){bt=Math.ceil(ot/4/J);break}C.clearRect(0,0,J,J),C.strokeText("A",0,J),Tt=C.getImageData(0,0,J,J).data,st=0;for(let ot=0,nt=Tt.length;ot<nt;ot+=4)if(Tt[ot]>0){st=J-Math.floor(ot/4/J);break}if(C.canvas.width=C.canvas.height=0,C.font=P,st){const ot=st/(st+bt);return z.set(k,ot),ot}return z.set(k,At),At}function y(k,O,C){const P=document.createElement("span"),ht={angle:0,canvasWidth:0,hasText:O.str!=="",hasEOL:O.hasEOL,fontSize:0};k._textDivs.push(P);const st=d.Util.transform(k._transform,O.transform);let bt=Math.atan2(st[1],st[0]);const Tt=C[O.fontName];Tt.vertical&&(bt+=Math.PI/2);const ot=k._fontInspectorEnabled&&Tt.fontSubstitution||Tt.fontFamily,nt=Math.hypot(st[2],st[3]),Mt=nt*E(ot);let It,Pt;bt===0?(It=st[4],Pt=st[5]-Mt):(It=st[4]+Mt*Math.sin(bt),Pt=st[5]-Mt*Math.cos(bt));const Xt="calc(var(--scale-factor)*",ae=P.style;k._container===k._rootContainer?(ae.left=`${(100*It/k._pageWidth).toFixed(2)}%`,ae.top=`${(100*Pt/k._pageHeight).toFixed(2)}%`):(ae.left=`${Xt}${It.toFixed(2)}px)`,ae.top=`${Xt}${Pt.toFixed(2)}px)`),ae.fontSize=`${Xt}${nt.toFixed(2)}px)`,ae.fontFamily=ot,ht.fontSize=nt,P.setAttribute("role","presentation"),P.textContent=O.str,P.dir=O.dir,k._fontInspectorEnabled&&(P.dataset.fontName=Tt.fontSubstitutionLoadedName||O.fontName),bt!==0&&(ht.angle=bt*(180/Math.PI));let Jt=!1;if(O.str.length>1)Jt=!0;else if(O.str!==" "&&O.transform[0]!==O.transform[3]){const re=Math.abs(O.transform[0]),oe=Math.abs(O.transform[3]);re!==oe&&Math.max(re,oe)/Math.min(re,oe)>1.5&&(Jt=!0)}Jt&&(ht.canvasWidth=Tt.vertical?O.height:O.width),k._textDivProperties.set(P,ht),k._isReadableStream&&k._layoutText(P)}function D(k){const{div:O,scale:C,properties:P,ctx:ht,prevFontSize:st,prevFontFamily:bt}=k,{style:Tt}=O;let ot="";if(P.canvasWidth!==0&&P.hasText){const{fontFamily:nt}=Tt,{canvasWidth:Mt,fontSize:It}=P;(st!==It||bt!==nt)&&(ht.font=`${It*C}px ${nt}`,k.prevFontSize=It,k.prevFontFamily=nt);const{width:Pt}=ht.measureText(O.textContent);Pt>0&&(ot=`scaleX(${Mt*C/Pt})`)}P.angle!==0&&(ot=`rotate(${P.angle}deg) ${ot}`),ot.length>0&&(Tt.transform=ot)}function L(k){if(k._canceled)return;const O=k._textDivs,C=k._capability;if(O.length>H){C.resolve();return}if(!k._isReadableStream)for(const P of O)k._layoutText(P);C.resolve()}class Z{constructor({textContentSource:O,container:C,viewport:P,textDivs:ht,textDivProperties:st,textContentItemsStr:bt}){var It;this._textContentSource=O,this._isReadableStream=O instanceof ReadableStream,this._container=this._rootContainer=C,this._textDivs=ht||[],this._textContentItemsStr=bt||[],this._fontInspectorEnabled=!!((It=globalThis.FontInspector)!=null&&It.enabled),this._reader=null,this._textDivProperties=st||new WeakMap,this._canceled=!1,this._capability=Promise.withResolvers(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:P.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:I()};const{pageWidth:Tt,pageHeight:ot,pageX:nt,pageY:Mt}=P.rawDims;this._transform=[1,0,0,-1,-nt,Mt+ot],this._pageWidth=Tt,this._pageHeight=ot,(0,Q.setLayerDimensions)(C,P),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new d.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new d.AbortException("TextLayer task cancelled."))}_processItems(O,C){for(const P of O){if(P.str===void 0){if(P.type==="beginMarkedContentProps"||P.type==="beginMarkedContent"){const ht=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),P.id!==null&&this._container.setAttribute("id",`${P.id}`),ht.append(this._container)}else P.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(P.str),y(this,P,C)}}_layoutText(O){const C=this._layoutTextParams.properties=this._textDivProperties.get(O);if(this._layoutTextParams.div=O,D(this._layoutTextParams),C.hasText&&this._container.append(O),C.hasEOL){const P=document.createElement("br");P.setAttribute("role","presentation"),this._container.append(P)}}_render(){const{promise:O,resolve:C,reject:P}=Promise.withResolvers();let ht=Object.create(null);if(this._isReadableStream){const st=()=>{this._reader.read().then(({value:bt,done:Tt})=>{if(Tt){C();return}Object.assign(ht,bt.styles),this._processItems(bt.items,ht),st()},P)};this._reader=this._textContentSource.getReader(),st()}else if(this._textContentSource){const{items:st,styles:bt}=this._textContentSource;this._processItems(st,bt),C()}else throw new Error('No "textContentSource" parameter specified.');O.then(()=>{ht=null,L(this)},this._capability.reject)}}function B(k){const O=new Z(k);return O._render(),O}function K({container:k,viewport:O,textDivs:C,textDivProperties:P,mustRotate:ht=!0,mustRescale:st=!0}){if(ht&&(0,Q.setLayerDimensions)(k,{rotation:O.rotation}),st){const bt=I(),Tt={prevFontSize:null,prevFontFamily:null,div:null,scale:O.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:bt};for(const ot of C)Tt.properties=P.get(ot),Tt.div=ot,D(Tt)}}},585:(ie,$t,dt)=>{dt.d($t,{PDFDataTransportStream:()=>H});var d=dt(292),Q=dt(419);class H{constructor(F,{disableRange:I=!1,disableStream:V=!1}){(0,d.assert)(F,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:E,initialData:y,progressiveDone:D,contentDispositionFilename:L}=F;if(this._queuedChunks=[],this._progressiveDone=D,this._contentDispositionFilename=L,(y==null?void 0:y.length)>0){const Z=y instanceof Uint8Array&&y.byteLength===y.buffer.byteLength?y.buffer:new Uint8Array(y).buffer;this._queuedChunks.push(Z)}this._pdfDataRangeTransport=F,this._isStreamingSupported=!V,this._isRangeSupported=!I,this._contentLength=E,this._fullRequestReader=null,this._rangeReaders=[],F.addRangeListener((Z,B)=>{this._onReceiveData({begin:Z,chunk:B})}),F.addProgressListener((Z,B)=>{this._onProgress({loaded:Z,total:B})}),F.addProgressiveReadListener(Z=>{this._onReceiveData({chunk:Z})}),F.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),F.transportReady()}_onReceiveData({begin:F,chunk:I}){const V=I instanceof Uint8Array&&I.byteLength===I.buffer.byteLength?I.buffer:new Uint8Array(I).buffer;if(F===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(V):this._queuedChunks.push(V);else{const E=this._rangeReaders.some(function(y){return y._begin!==F?!1:(y._enqueue(V),!0)});(0,d.assert)(E,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var F;return((F=this._fullRequestReader)==null?void 0:F._loaded)??0}_onProgress(F){var I,V,E,y;F.total===void 0?(V=(I=this._rangeReaders[0])==null?void 0:I.onProgress)==null||V.call(I,{loaded:F.loaded}):(y=(E=this._fullRequestReader)==null?void 0:E.onProgress)==null||y.call(E,{loaded:F.loaded,total:F.total})}_onProgressiveDone(){var F;(F=this._fullRequestReader)==null||F.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(F){const I=this._rangeReaders.indexOf(F);I>=0&&this._rangeReaders.splice(I,1)}getFullReader(){(0,d.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const F=this._queuedChunks;return this._queuedChunks=null,new J(this,F,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(F,I){if(I<=this._progressiveDataLength)return null;const V=new At(this,F,I);return this._pdfDataRangeTransport.requestDataRange(F,I),this._rangeReaders.push(V),V}cancelAllRequests(F){var I;(I=this._fullRequestReader)==null||I.cancel(F);for(const V of this._rangeReaders.slice(0))V.cancel(F);this._pdfDataRangeTransport.abort()}}class J{constructor(F,I,V=!1,E=null){this._stream=F,this._done=V||!1,this._filename=(0,Q.isPdfFile)(E)?E:null,this._queuedChunks=I||[],this._loaded=0;for(const y of this._queuedChunks)this._loaded+=y.byteLength;this._requests=[],this._headersReady=Promise.resolve(),F._fullRequestReader=this,this.onProgress=null}_enqueue(F){this._done||(this._requests.length>0?this._requests.shift().resolve({value:F,done:!1}):this._queuedChunks.push(F),this._loaded+=F.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 F=Promise.withResolvers();return this._requests.push(F),F.promise}cancel(F){this._done=!0;for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class At{constructor(F,I,V){this._stream=F,this._begin=I,this._end=V,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(F){if(!this._done){if(this._requests.length===0)this._queuedChunk=F;else{this._requests.shift().resolve({value:F,done:!1});for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const I=this._queuedChunk;return this._queuedChunk=null,{value:I,done:!1}}if(this._done)return{value:void 0,done:!0};const F=Promise.withResolvers();return this._requests.push(F),F.promise}cancel(F){this._done=!0;for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},164:(ie,$t,dt)=>{var Q,H;dt.d($t,{GlobalWorkerOptions:()=>d});class d{static get workerPort(){return t(this,Q)}static set workerPort(At){if(!(typeof Worker<"u"&&At instanceof Worker)&&At!==null)throw new Error("Invalid `workerPort` type.");w(this,Q,At)}static get workerSrc(){return t(this,H)}static set workerSrc(At){if(typeof At!="string")throw new Error("Invalid `workerSrc` type.");w(this,H,At)}}Q=new WeakMap,H=new WeakMap,_(d,Q,null),_(d,H,"")},284:(ie,$t,dt)=>{dt.d($t,{XfaLayer:()=>Q});var d=dt(50);class Q{static setupStorage(J,At,z,F,I){const V=F.getValue(At,{value:null});switch(z.name){case"textarea":if(V.value!==null&&(J.textContent=V.value),I==="print")break;J.addEventListener("input",E=>{F.setValue(At,{value:E.target.value})});break;case"input":if(z.attributes.type==="radio"||z.attributes.type==="checkbox"){if(V.value===z.attributes.xfaOn?J.setAttribute("checked",!0):V.value===z.attributes.xfaOff&&J.removeAttribute("checked"),I==="print")break;J.addEventListener("change",E=>{F.setValue(At,{value:E.target.checked?E.target.getAttribute("xfaOn"):E.target.getAttribute("xfaOff")})})}else{if(V.value!==null&&J.setAttribute("value",V.value),I==="print")break;J.addEventListener("input",E=>{F.setValue(At,{value:E.target.value})})}break;case"select":if(V.value!==null){J.setAttribute("value",V.value);for(const E of z.children)E.attributes.value===V.value?E.attributes.selected=!0:E.attributes.hasOwnProperty("selected")&&delete E.attributes.selected}J.addEventListener("input",E=>{const y=E.target.options,D=y.selectedIndex===-1?"":y[y.selectedIndex].value;F.setValue(At,{value:D})});break}}static setAttributes({html:J,element:At,storage:z=null,intent:F,linkService:I}){const{attributes:V}=At,E=J instanceof HTMLAnchorElement;V.type==="radio"&&(V.name=`${V.name}-${F}`);for(const[y,D]of Object.entries(V))if(D!=null)switch(y){case"class":D.length&&J.setAttribute(y,D.join(" "));break;case"dataId":break;case"id":J.setAttribute("data-element-id",D);break;case"style":Object.assign(J.style,D);break;case"textContent":J.textContent=D;break;default:(!E||y!=="href"&&y!=="newWindow")&&J.setAttribute(y,D)}E&&I.addLinkAttributes(J,V.href,V.newWindow),z&&V.dataId&&this.setupStorage(J,V.dataId,At,z)}static render(J){var Z,B;const At=J.annotationStorage,z=J.linkService,F=J.xfaHtml,I=J.intent||"display",V=document.createElement(F.name);F.attributes&&this.setAttributes({html:V,element:F,intent:I,linkService:z});const E=I!=="richText",y=J.div;if(y.append(V),J.viewport){const K=`matrix(${J.viewport.transform.join(",")})`;y.style.transform=K}E&&y.setAttribute("class","xfaLayer xfaFont");const D=[];if(F.children.length===0){if(F.value){const K=document.createTextNode(F.value);V.append(K),E&&d.XfaText.shouldBuildText(F.name)&&D.push(K)}return{textDivs:D}}const L=[[F,-1,V]];for(;L.length>0;){const[K,k,O]=L.at(-1);if(k+1===K.children.length){L.pop();continue}const C=K.children[++L.at(-1)[1]];if(C===null)continue;const{name:P}=C;if(P==="#text"){const st=document.createTextNode(C.value);D.push(st),O.append(st);continue}const ht=(Z=C==null?void 0:C.attributes)!=null&&Z.xmlns?document.createElementNS(C.attributes.xmlns,P):document.createElement(P);if(O.append(ht),C.attributes&&this.setAttributes({html:ht,element:C,storage:At,intent:I,linkService:z}),((B=C.children)==null?void 0:B.length)>0)L.push([C,-1,ht]);else if(C.value){const st=document.createTextNode(C.value);E&&d.XfaText.shouldBuildText(P)&&D.push(st),ht.append(st)}}for(const K of y.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))K.setAttribute("readOnly",!0);return{textDivs:D}}static update(J){const At=`matrix(${J.viewport.transform.join(",")})`;J.div.style.transform=At,J.div.hidden=!1}}},50:(ie,$t,dt)=>{dt.d($t,{XfaText:()=>d});class d{static textContent(H){const J=[],At={items:J,styles:Object.create(null)};function z(F){var E;if(!F)return;let I=null;const V=F.name;if(V==="#text")I=F.value;else if(d.shouldBuildText(V))(E=F==null?void 0:F.attributes)!=null&&E.textContent?I=F.attributes.textContent:F.value&&(I=F.value);else return;if(I!==null&&J.push({str:I}),!!F.children)for(const y of F.children)z(y)}return z(H),At}static shouldBuildText(H){return!(H==="textarea"||H==="input"||H==="option"||H==="select")}}},228:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{try{dt.d($t,{AbortException:()=>H.AbortException,AnnotationEditorLayer:()=>F.AnnotationEditorLayer,AnnotationEditorParamsType:()=>H.AnnotationEditorParamsType,AnnotationEditorType:()=>H.AnnotationEditorType,AnnotationEditorUIManager:()=>I.AnnotationEditorUIManager,AnnotationLayer:()=>V.AnnotationLayer,AnnotationMode:()=>H.AnnotationMode,CMapCompressionType:()=>H.CMapCompressionType,ColorPicker:()=>E.ColorPicker,DOMSVGFactory:()=>At.DOMSVGFactory,DrawLayer:()=>y.DrawLayer,FeatureTest:()=>H.FeatureTest,GlobalWorkerOptions:()=>D.GlobalWorkerOptions,ImageKind:()=>H.ImageKind,InvalidPDFException:()=>H.InvalidPDFException,MissingPDFException:()=>H.MissingPDFException,OPS:()=>H.OPS,Outliner:()=>L.Outliner,PDFDataRangeTransport:()=>J.PDFDataRangeTransport,PDFDateString:()=>At.PDFDateString,PDFWorker:()=>J.PDFWorker,PasswordResponses:()=>H.PasswordResponses,PermissionFlag:()=>H.PermissionFlag,PixelsPerInch:()=>At.PixelsPerInch,RenderingCancelledException:()=>At.RenderingCancelledException,UnexpectedResponseException:()=>H.UnexpectedResponseException,Util:()=>H.Util,VerbosityLevel:()=>H.VerbosityLevel,XfaLayer:()=>Z.XfaLayer,build:()=>J.build,createValidAbsoluteUrl:()=>H.createValidAbsoluteUrl,fetchData:()=>At.fetchData,getDocument:()=>J.getDocument,getFilenameFromUrl:()=>At.getFilenameFromUrl,getPdfFilenameFromUrl:()=>At.getPdfFilenameFromUrl,getXfaPageViewport:()=>At.getXfaPageViewport,isDataScheme:()=>At.isDataScheme,isPdfFile:()=>At.isPdfFile,noContextMenu:()=>At.noContextMenu,normalizeUnicode:()=>H.normalizeUnicode,renderTextLayer:()=>z.renderTextLayer,setLayerDimensions:()=>At.setLayerDimensions,shadow:()=>H.shadow,updateTextLayer:()=>z.updateTextLayer,version:()=>J.version});var H=dt(292),J=dt(831),At=dt(419),z=dt(814),F=dt(731),I=dt(830),V=dt(976),E=dt(259),y=dt(47),D=dt(164),L=dt(61),Z=dt(284),B=d([J]);J=(B.then?(await B)():B)[0];const K="4.2.67",k="49b388101";Q()}catch(K){Q(K)}})},178:(ie,$t,dt)=>{var z,Aa,ba,ci;dt.d($t,{MessageHandler:()=>At});var d=dt(292);const Q={UNKNOWN:0,DATA:1,ERROR:2},H={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function J(E){switch(E instanceof Error||typeof E=="object"&&E!==null||(0,d.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),E.name){case"AbortException":return new d.AbortException(E.message);case"MissingPDFException":return new d.MissingPDFException(E.message);case"PasswordException":return new d.PasswordException(E.message,E.code);case"UnexpectedResponseException":return new d.UnexpectedResponseException(E.message,E.status);case"UnknownErrorException":return new d.UnknownErrorException(E.message,E.details);default:return new d.UnknownErrorException(E.message,E.toString())}}class At{constructor(y,D,L){_(this,z);this.sourceName=y,this.targetName=D,this.comObj=L,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=Z=>{const B=Z.data;if(B.targetName!==this.sourceName)return;if(B.stream){b(this,z,ba).call(this,B);return}if(B.callback){const k=B.callbackId,O=this.callbackCapabilities[k];if(!O)throw new Error(`Cannot resolve callback ${k}`);if(delete this.callbackCapabilities[k],B.callback===Q.DATA)O.resolve(B.data);else if(B.callback===Q.ERROR)O.reject(J(B.reason));else throw new Error("Unexpected callback case");return}const K=this.actionHandler[B.action];if(!K)throw new Error(`Unknown action from worker: ${B.action}`);if(B.callbackId){const k=this.sourceName,O=B.sourceName;new Promise(function(C){C(K(B.data))}).then(function(C){L.postMessage({sourceName:k,targetName:O,callback:Q.DATA,callbackId:B.callbackId,data:C})},function(C){L.postMessage({sourceName:k,targetName:O,callback:Q.ERROR,callbackId:B.callbackId,reason:J(C)})});return}if(B.streamId){b(this,z,Aa).call(this,B);return}K(B.data)},L.addEventListener("message",this._onComObjOnMessage)}on(y,D){const L=this.actionHandler;if(L[y])throw new Error(`There is already an actionName called "${y}"`);L[y]=D}send(y,D,L){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:y,data:D},L)}sendWithPromise(y,D,L){const Z=this.callbackId++,B=Promise.withResolvers();this.callbackCapabilities[Z]=B;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:y,callbackId:Z,data:D},L)}catch(K){B.reject(K)}return B.promise}sendWithStream(y,D,L,Z){const B=this.streamId++,K=this.sourceName,k=this.targetName,O=this.comObj;return new ReadableStream({start:C=>{const P=Promise.withResolvers();return this.streamControllers[B]={controller:C,startCall:P,pullCall:null,cancelCall:null,isClosed:!1},O.postMessage({sourceName:K,targetName:k,action:y,streamId:B,data:D,desiredSize:C.desiredSize},Z),P.promise},pull:C=>{const P=Promise.withResolvers();return this.streamControllers[B].pullCall=P,O.postMessage({sourceName:K,targetName:k,stream:H.PULL,streamId:B,desiredSize:C.desiredSize}),P.promise},cancel:C=>{(0,d.assert)(C instanceof Error,"cancel must have a valid reason");const P=Promise.withResolvers();return this.streamControllers[B].cancelCall=P,this.streamControllers[B].isClosed=!0,O.postMessage({sourceName:K,targetName:k,stream:H.CANCEL,streamId:B,reason:J(C)}),P.promise}},L)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}z=new WeakSet,Aa=function(y){const D=y.streamId,L=this.sourceName,Z=y.sourceName,B=this.comObj,K=this,k=this.actionHandler[y.action],O={enqueue(C,P=1,ht){if(this.isCancelled)return;const st=this.desiredSize;this.desiredSize-=P,st>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),B.postMessage({sourceName:L,targetName:Z,stream:H.ENQUEUE,streamId:D,chunk:C},ht)},close(){this.isCancelled||(this.isCancelled=!0,B.postMessage({sourceName:L,targetName:Z,stream:H.CLOSE,streamId:D}),delete K.streamSinks[D])},error(C){(0,d.assert)(C instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,B.postMessage({sourceName:L,targetName:Z,stream:H.ERROR,streamId:D,reason:J(C)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:y.desiredSize,ready:null};O.sinkCapability.resolve(),O.ready=O.sinkCapability.promise,this.streamSinks[D]=O,new Promise(function(C){C(k(y.data,O))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.START_COMPLETE,streamId:D,success:!0})},function(C){B.postMessage({sourceName:L,targetName:Z,stream:H.START_COMPLETE,streamId:D,reason:J(C)})})},ba=function(y){const D=y.streamId,L=this.sourceName,Z=y.sourceName,B=this.comObj,K=this.streamControllers[D],k=this.streamSinks[D];switch(y.stream){case H.START_COMPLETE:y.success?K.startCall.resolve():K.startCall.reject(J(y.reason));break;case H.PULL_COMPLETE:y.success?K.pullCall.resolve():K.pullCall.reject(J(y.reason));break;case H.PULL:if(!k){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,success:!0});break}k.desiredSize<=0&&y.desiredSize>0&&k.sinkCapability.resolve(),k.desiredSize=y.desiredSize,new Promise(function(O){var C;O((C=k.onPull)==null?void 0:C.call(k))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,success:!0})},function(O){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,reason:J(O)})});break;case H.ENQUEUE:if((0,d.assert)(K,"enqueue should have stream controller"),K.isClosed)break;K.controller.enqueue(y.chunk);break;case H.CLOSE:if((0,d.assert)(K,"close should have stream controller"),K.isClosed)break;K.isClosed=!0,K.controller.close(),b(this,z,ci).call(this,K,D);break;case H.ERROR:(0,d.assert)(K,"error should have stream controller"),K.controller.error(J(y.reason)),b(this,z,ci).call(this,K,D);break;case H.CANCEL_COMPLETE:y.success?K.cancelCall.resolve():K.cancelCall.reject(J(y.reason)),b(this,z,ci).call(this,K,D);break;case H.CANCEL:if(!k)break;new Promise(function(O){var C;O((C=k.onCancel)==null?void 0:C.call(k,J(y.reason)))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.CANCEL_COMPLETE,streamId:D,success:!0})},function(O){B.postMessage({sourceName:L,targetName:Z,stream:H.CANCEL_COMPLETE,streamId:D,reason:J(O)})}),k.sinkCapability.reject(J(y.reason)),k.isCancelled=!0,delete this.streamSinks[D];break;default:throw new Error("Unexpected stream case")}},ci=async function(y,D){var L,Z,B;await Promise.allSettled([(L=y.startCall)==null?void 0:L.promise,(Z=y.pullCall)==null?void 0:Z.promise,(B=y.cancelCall)==null?void 0:B.promise]),delete this.streamControllers[D]}},651:(ie,$t,dt)=>{dt.d($t,{MurmurHash3_64:()=>J});const d=3285377520,Q=4294901760,H=65535;class J{constructor(z){this.h1=z?z&4294967295:d,this.h2=z?z&4294967295:d}update(z){let F,I;if(typeof z=="string"){F=new Uint8Array(z.length*2),I=0;for(let P=0,ht=z.length;P<ht;P++){const st=z.charCodeAt(P);st<=255?F[I++]=st:(F[I++]=st>>>8,F[I++]=st&255)}}else if(ArrayBuffer.isView(z))F=z.slice(),I=F.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const V=I>>2,E=I-V*4,y=new Uint32Array(F.buffer,0,V);let D=0,L=0,Z=this.h1,B=this.h2;const K=3432918353,k=461845907,O=K&H,C=k&H;for(let P=0;P<V;P++)P&1?(D=y[P],D=D*K&Q|D*O&H,D=D<<15|D>>>17,D=D*k&Q|D*C&H,Z^=D,Z=Z<<13|Z>>>19,Z=Z*5+3864292196):(L=y[P],L=L*K&Q|L*O&H,L=L<<15|L>>>17,L=L*k&Q|L*C&H,B^=L,B=B<<13|B>>>19,B=B*5+3864292196);switch(D=0,E){case 3:D^=F[V*4+2]<<16;case 2:D^=F[V*4+1]<<8;case 1:D^=F[V*4],D=D*K&Q|D*O&H,D=D<<15|D>>>17,D=D*k&Q|D*C&H,V&1?Z^=D:B^=D}this.h1=Z,this.h2=B}hexdigest(){let z=this.h1,F=this.h2;return z^=F>>>1,z=z*3981806797&Q|z*36045&H,F=F*4283543511&Q|((F<<16|z>>>16)*2950163797&Q)>>>16,z^=F>>>1,z=z*444984403&Q|z*60499&H,F=F*3301882366&Q|((F<<16|z>>>16)*3120437893&Q)>>>16,z^=F>>>1,(z>>>0).toString(16).padStart(8,"0")+(F>>>0).toString(16).padStart(8,"0")}}},292:(ie,$t,dt)=>{var u,di,un;dt.d($t,{AbortException:()=>ue,AnnotationBorderStyleType:()=>B,AnnotationEditorParamsType:()=>E,AnnotationEditorPrefix:()=>I,AnnotationEditorType:()=>V,AnnotationMode:()=>F,AnnotationPrefix:()=>l,AnnotationType:()=>Z,BaseException:()=>Xt,CMapCompressionType:()=>k,FONT_IDENTITY_MATRIX:()=>H,FeatureTest:()=>Nt,FontRenderOps:()=>g,FormatError:()=>Qt,IDENTITY_MATRIX:()=>Q,ImageKind:()=>L,InvalidPDFException:()=>re,LINE_FACTOR:()=>At,MAX_IMAGE_SIZE_TO_CACHE:()=>J,MissingPDFException:()=>oe,OPS:()=>O,PasswordException:()=>ae,PasswordResponses:()=>C,PermissionFlag:()=>y,RenderingIntentFlag:()=>z,TextRenderingMode:()=>D,UnexpectedResponseException:()=>Rt,UnknownErrorException:()=>Jt,Util:()=>pt,VerbosityLevel:()=>K,assert:()=>nt,bytesToString:()=>Ae,createValidAbsoluteUrl:()=>It,getUuid:()=>h,getVerbosityLevel:()=>st,info:()=>bt,isNodeJS:()=>d,normalizeUnicode:()=>a,objectFromMap:()=>ee,setVerbosityLevel:()=>ht,shadow:()=>Pt,string32:()=>le,stringToBytes:()=>Bt,unreachable:()=>ot,warn:()=>Tt});const d=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Q=[1,0,0,1,0,0],H=[.001,0,0,.001,0,0],J=1e7,At=1.35,z={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},F={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},I="pdfjs_internal_editor_",V={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},E={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},y={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},D={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},L={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Z={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},B={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},K={ERRORS:0,WARNINGS:1,INFOS:5},k={NONE:0,BINARY:1},O={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},C={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let P=K.WARNINGS;function ht(e){Number.isInteger(e)&&(P=e)}function st(){return P}function bt(e){P>=K.INFOS&&console.log(`Info: ${e}`)}function Tt(e){P>=K.WARNINGS&&console.log(`Warning: ${e}`)}function ot(e){throw new Error(e)}function nt(e,i){e||ot(i)}function Mt(e){switch(e==null?void 0:e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function It(e,i=null,o=null){var m;if(!e)return null;try{if(o&&typeof e=="string"&&(o.addDefaultProtocol&&e.startsWith("www.")&&((m=e.match(/\./g))==null?void 0:m.length)>=2&&(e=`http://${e}`),o.tryConvertEncoding))try{e=S(e)}catch{}const M=i?new URL(e,i):new URL(e);if(Mt(M))return M}catch{}return null}function Pt(e,i,o,m=!1){return Object.defineProperty(e,i,{value:o,enumerable:!m,configurable:!0,writable:!1}),o}const Xt=function(){function e(i,o){this.constructor===e&&ot("Cannot initialize BaseException."),this.message=i,this.name=o}return e.prototype=new Error,e.constructor=e,e}();class ae extends Xt{constructor(i,o){super(i,"PasswordException"),this.code=o}}class Jt extends Xt{constructor(i,o){super(i,"UnknownErrorException"),this.details=o}}class re extends Xt{constructor(i){super(i,"InvalidPDFException")}}class oe extends Xt{constructor(i){super(i,"MissingPDFException")}}class Rt extends Xt{constructor(i,o){super(i,"UnexpectedResponseException"),this.status=o}}class Qt extends Xt{constructor(i){super(i,"FormatError")}}class ue extends Xt{constructor(i){super(i,"AbortException")}}function Ae(e){(typeof e!="object"||(e==null?void 0:e.length)===void 0)&&ot("Invalid argument for bytesToString");const i=e.length,o=8192;if(i<o)return String.fromCharCode.apply(null,e);const m=[];for(let M=0;M<i;M+=o){const $=Math.min(M+o,i),W=e.subarray(M,$);m.push(String.fromCharCode.apply(null,W))}return m.join("")}function Bt(e){typeof e!="string"&&ot("Invalid argument for stringToBytes");const i=e.length,o=new Uint8Array(i);for(let m=0;m<i;++m)o[m]=e.charCodeAt(m)&255;return o}function le(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function ee(e){const i=Object.create(null);for(const[o,m]of e)i[o]=m;return i}function ce(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function Zt(){try{return new Function(""),!0}catch{return!1}}class Nt{static get isLittleEndian(){return Pt(this,"isLittleEndian",ce())}static get isEvalSupported(){return Pt(this,"isEvalSupported",Zt())}static get isOffscreenCanvasSupported(){return Pt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?Pt(this,"platform",{isMac:navigator.platform.includes("Mac")}):Pt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var i,o;return Pt(this,"isCSSRoundSupported",(o=(i=globalThis.CSS)==null?void 0:i.supports)==null?void 0:o.call(i,"width: round(1.5px, 1px)"))}}const mt=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class pt{static makeHexColor(i,o,m){return`#${mt[i]}${mt[o]}${mt[m]}`}static scaleMinMax(i,o){let m;i[0]?(i[0]<0&&(m=o[0],o[0]=o[2],o[2]=m),o[0]*=i[0],o[2]*=i[0],i[3]<0&&(m=o[1],o[1]=o[3],o[3]=m),o[1]*=i[3],o[3]*=i[3]):(m=o[0],o[0]=o[1],o[1]=m,m=o[2],o[2]=o[3],o[3]=m,i[1]<0&&(m=o[1],o[1]=o[3],o[3]=m),o[1]*=i[1],o[3]*=i[1],i[2]<0&&(m=o[0],o[0]=o[2],o[2]=m),o[0]*=i[2],o[2]*=i[2]),o[0]+=i[4],o[1]+=i[5],o[2]+=i[4],o[3]+=i[5]}static transform(i,o){return[i[0]*o[0]+i[2]*o[1],i[1]*o[0]+i[3]*o[1],i[0]*o[2]+i[2]*o[3],i[1]*o[2]+i[3]*o[3],i[0]*o[4]+i[2]*o[5]+i[4],i[1]*o[4]+i[3]*o[5]+i[5]]}static applyTransform(i,o){const m=i[0]*o[0]+i[1]*o[2]+o[4],M=i[0]*o[1]+i[1]*o[3]+o[5];return[m,M]}static applyInverseTransform(i,o){const m=o[0]*o[3]-o[1]*o[2],M=(i[0]*o[3]-i[1]*o[2]+o[2]*o[5]-o[4]*o[3])/m,$=(-i[0]*o[1]+i[1]*o[0]+o[4]*o[1]-o[5]*o[0])/m;return[M,$]}static getAxialAlignedBoundingBox(i,o){const m=this.applyTransform(i,o),M=this.applyTransform(i.slice(2,4),o),$=this.applyTransform([i[0],i[3]],o),W=this.applyTransform([i[2],i[1]],o);return[Math.min(m[0],M[0],$[0],W[0]),Math.min(m[1],M[1],$[1],W[1]),Math.max(m[0],M[0],$[0],W[0]),Math.max(m[1],M[1],$[1],W[1])]}static inverseTransform(i){const o=i[0]*i[3]-i[1]*i[2];return[i[3]/o,-i[1]/o,-i[2]/o,i[0]/o,(i[2]*i[5]-i[4]*i[3])/o,(i[4]*i[1]-i[5]*i[0])/o]}static singularValueDecompose2dScale(i){const o=[i[0],i[2],i[1],i[3]],m=i[0]*o[0]+i[1]*o[2],M=i[0]*o[1]+i[1]*o[3],$=i[2]*o[0]+i[3]*o[2],W=i[2]*o[1]+i[3]*o[3],tt=(m+W)/2,gt=Math.sqrt((m+W)**2-4*(m*W-$*M))/2,it=tt+gt||1,_t=tt-gt||1;return[Math.sqrt(it),Math.sqrt(_t)]}static normalizeRect(i){const o=i.slice(0);return i[0]>i[2]&&(o[0]=i[2],o[2]=i[0]),i[1]>i[3]&&(o[1]=i[3],o[3]=i[1]),o}static intersect(i,o){const m=Math.max(Math.min(i[0],i[2]),Math.min(o[0],o[2])),M=Math.min(Math.max(i[0],i[2]),Math.max(o[0],o[2]));if(m>M)return null;const $=Math.max(Math.min(i[1],i[3]),Math.min(o[1],o[3])),W=Math.min(Math.max(i[1],i[3]),Math.max(o[1],o[3]));return $>W?null:[m,$,M,W]}static bezierBoundingBox(i,o,m,M,$,W,tt,gt,it){return it?(it[0]=Math.min(it[0],i,tt),it[1]=Math.min(it[1],o,gt),it[2]=Math.max(it[2],i,tt),it[3]=Math.max(it[3],o,gt)):it=[Math.min(i,tt),Math.min(o,gt),Math.max(i,tt),Math.max(o,gt)],b(this,u,un).call(this,i,m,$,tt,o,M,W,gt,3*(-i+3*(m-$)+tt),6*(i-2*m+$),3*(m-i),it),b(this,u,un).call(this,i,m,$,tt,o,M,W,gt,3*(-o+3*(M-W)+gt),6*(o-2*M+W),3*(M-o),it),it}}u=new WeakSet,di=function(i,o,m,M,$,W,tt,gt,it,_t){if(it<=0||it>=1)return;const Ot=1-it,jt=it*it,Gt=jt*it,Ut=Ot*(Ot*(Ot*i+3*it*o)+3*jt*m)+Gt*M,lt=Ot*(Ot*(Ot*$+3*it*W)+3*jt*tt)+Gt*gt;_t[0]=Math.min(_t[0],Ut),_t[1]=Math.min(_t[1],lt),_t[2]=Math.max(_t[2],Ut),_t[3]=Math.max(_t[3],lt)},un=function(i,o,m,M,$,W,tt,gt,it,_t,Ot,jt){if(Math.abs(it)<1e-12){Math.abs(_t)>=1e-12&&b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,-Ot/_t,jt);return}const Gt=_t**2-4*Ot*it;if(Gt<0)return;const Ut=Math.sqrt(Gt),lt=2*it;b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,(-_t+Ut)/lt,jt),b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,(-_t-Ut)/lt,jt)},_(pt,u);function S(e){return decodeURIComponent(escape(e))}let n=null,s=null;function a(e){return n||(n=/([\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,s=new Map([["\uFB05","\u017Ft"]])),e.replaceAll(n,(i,o,m)=>o?o.normalize("NFKC"):s.get(m))}function h(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const e=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(e);else for(let i=0;i<32;i++)e[i]=Math.floor(Math.random()*255);return Ae(e)}const l="pdfjs_internal_id_",g={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8}}},Ee={};function Se(ie){var $t=Ee[ie];if($t!==void 0)return $t.exports;var dt=Ee[ie]={exports:{}};return xe[ie](dt,dt.exports,Se),dt.exports}(()=>{var ie=typeof Symbol=="function"?Symbol("webpack queues"):"__webpack_queues__",$t=typeof Symbol=="function"?Symbol("webpack exports"):"__webpack_exports__",dt=typeof Symbol=="function"?Symbol("webpack error"):"__webpack_error__",d=H=>{H&&H.d<1&&(H.d=1,H.forEach(J=>J.r--),H.forEach(J=>J.r--?J.r++:J()))},Q=H=>H.map(J=>{if(J!==null&&typeof J=="object"){if(J[ie])return J;if(J.then){var At=[];At.d=0,J.then(I=>{z[$t]=I,d(At)},I=>{z[dt]=I,d(At)});var z={};return z[ie]=I=>I(At),z}}var F={};return F[ie]=I=>{},F[$t]=J,F});Se.a=(H,J,At)=>{var z;At&&((z=[]).d=-1);var F=new Set,I=H.exports,V,E,y,D=new Promise((L,Z)=>{y=Z,E=L});D[$t]=I,D[ie]=L=>(z&&L(z),F.forEach(L),D.catch(Z=>{})),H.exports=D,J(L=>{V=Q(L);var Z,B=()=>V.map(k=>{if(k[dt])throw k[dt];return k[$t]}),K=new Promise(k=>{Z=()=>k(B),Z.r=0;var O=C=>C!==z&&!F.has(C)&&(F.add(C),C&&!C.d&&(Z.r++,C.push(Z)));V.map(C=>C[ie](O))});return Z.r?K:B()},L=>(L?y(D[dt]=L):E(I),d(z))),z&&z.d<0&&(z.d=0)}})(),Se.d=(ie,$t)=>{for(var dt in $t)Se.o($t,dt)&&!Se.o(ie,dt)&&Object.defineProperty(ie,dt,{enumerable:!0,get:$t[dt]})},Se.o=(ie,$t)=>Object.prototype.hasOwnProperty.call(ie,$t);var se=Se(228);se=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=se),mn=se.AbortException,An=se.AnnotationEditorLayer,bn=se.AnnotationEditorParamsType,vn=se.AnnotationEditorType,yn=se.AnnotationEditorUIManager,wn=se.AnnotationLayer,_n=se.AnnotationMode,xn=se.CMapCompressionType,En=se.ColorPicker,Sn=se.DOMSVGFactory,Cn=se.DrawLayer,Tn=se.FeatureTest,Mn=se.GlobalWorkerOptions,Rn=se.ImageKind,Ln=se.InvalidPDFException,kn=se.MissingPDFException,Pn=se.OPS,In=se.Outliner,Dn=se.PDFDataRangeTransport,Fn=se.PDFDateString,Nn=se.PDFWorker,On=se.PasswordResponses,Hn=se.PermissionFlag,Bn=se.PixelsPerInch,Un=se.RenderingCancelledException,zn=se.UnexpectedResponseException,Vn=se.Util,jn=se.VerbosityLevel,qn=se.XfaLayer,Gn=se.build,Wn=se.createValidAbsoluteUrl,$n=se.fetchData,Xn=se.getDocument,Kn=se.getFilenameFromUrl,Yn=se.getPdfFilenameFromUrl,Jn=se.getXfaPageViewport,Qn=se.isDataScheme,Zn=se.isPdfFile,tr=se.noContextMenu,er=se.normalizeUnicode,sr=se.renderTextLayer,ir=se.setLayerDimensions,nr=se.shadow,rr=se.updateTextLayer,ar=se.version});export{mn as AbortException,An as AnnotationEditorLayer,bn as AnnotationEditorParamsType,vn as AnnotationEditorType,yn as AnnotationEditorUIManager,wn as AnnotationLayer,_n as AnnotationMode,xn as CMapCompressionType,En as ColorPicker,Sn as DOMSVGFactory,Cn as DrawLayer,Tn as FeatureTest,Mn as GlobalWorkerOptions,Rn as ImageKind,Ln as InvalidPDFException,kn as MissingPDFException,Pn as OPS,In as Outliner,Dn as PDFDataRangeTransport,Fn as PDFDateString,Nn as PDFWorker,On as PasswordResponses,Hn as PermissionFlag,Bn as PixelsPerInch,Un as RenderingCancelledException,zn as UnexpectedResponseException,Vn as Util,jn as VerbosityLevel,qn as XfaLayer,Sa as __tla,Gn as build,Wn as createValidAbsoluteUrl,$n as fetchData,Xn as getDocument,Kn as getFilenameFromUrl,Yn as getPdfFilenameFromUrl,Jn as getXfaPageViewport,Qn as isDataScheme,Zn as isPdfFile,tr as noContextMenu,er as normalizeUnicode,sr as renderTextLayer,ir as setLayerDimensions,nr as shadow,rr as updateTextLayer,ar as version};