@flarehr/apollo-workplace-policies 0.1.239 → 0.1.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -50,7 +50,7 @@ Documentation available at: https://thoth-org.github.io/Thoth.Json/documentation
|
|
|
50
50
|
`)},Ne=new WeakSet,qn=function(){const[_e,Me]=this.parentDimensions;let We;if(this.isAttachedToDOM)We=this.div.getBoundingClientRect();else{const{currentLayer:ze,div:Qe}=this,ct=Qe.style.display;Qe.style.display="hidden",ze.div.append(this.div),We=Qe.getBoundingClientRect(),Qe.remove(),Qe.style.display=ct}this.width=We.width/_e,this.height=We.height/Me},Lt(ae,"_freeTextDefaultContent",""),Lt(ae,"_l10nPromise"),Lt(ae,"_internalPadding",0),Lt(ae,"_defaultColor",null),Lt(ae,"_defaultFontSize",10),Lt(ae,"_keyboardManager",new se.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],ae.prototype.commitOrRemove]])),Lt(ae,"_type","freetext");let oe=ae;ee.FreeTextEditor=oe},(te,ee,ne)=>{var he,ue,de,Ae,Se,ce,fe,ye,ve,Pe,we,Te,Le,Ne,ke,mr,ge,_r,_e,yr,We,br,Qe,zn,it,Sr,at,vr,dt,Ar,mt,qt,Ee,Xn,Oe,$n,Ve,kn,je,Jt,Be,Kn,be,Mn,Fe,Yn,Xe,wr,Ze,Tr,ot,Er,nt,Zn,pt,Fn,At,Qt,Ye,Jn;Object.defineProperty(ee,"__esModule",{value:!0}),ee.InkEditor=void 0,Object.defineProperty(ee,"fitCurve",{enumerable:!0,get:function(){return ie.fitCurve}});var re=ne(1),se=ne(4),ie=ne(30),oe=ne(5);const me=16,vt=class vt extends se.AnnotationEditor{constructor(De){super({...De,name:"inkEditor"});Je(this,ke);Je(this,ge);Je(this,_e);Je(this,We);Je(this,Qe);Je(this,it);Je(this,at);Je(this,dt);Je(this,mt);Je(this,Ee);Je(this,Oe);Je(this,Ve);Je(this,je);Je(this,Be);Je(this,be);Je(this,Xe);Je(this,Ze);Je(this,ot);Je(this,nt);Je(this,pt);Je(this,At);Je(this,Ye);Je(this,he,0);Je(this,ue,0);Je(this,de,0);Je(this,Ae,this.canvasPointermove.bind(this));Je(this,Se,this.canvasPointerleave.bind(this));Je(this,ce,this.canvasPointerup.bind(this));Je(this,fe,this.canvasPointerdown.bind(this));Je(this,ye,!1);Je(this,ve,!1);Je(this,Pe,null);Je(this,we,null);Je(this,Te,0);Je(this,Le,0);Je(this,Ne,null);this.color=De.color||null,this.thickness=De.thickness||null,this.opacity=De.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(De){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map(He=>[He,De.get(He)]))}static updateDefaultParams(De,He){switch(De){case re.AnnotationEditorParamsType.INK_THICKNESS:vt._defaultThickness=He;break;case re.AnnotationEditorParamsType.INK_COLOR:vt._defaultColor=He;break;case re.AnnotationEditorParamsType.INK_OPACITY:vt._defaultOpacity=He/100;break}}updateParams(De,He){switch(De){case re.AnnotationEditorParamsType.INK_THICKNESS:rt(this,ke,mr).call(this,He);break;case re.AnnotationEditorParamsType.INK_COLOR:rt(this,ge,_r).call(this,He);break;case re.AnnotationEditorParamsType.INK_OPACITY:rt(this,_e,yr).call(this,He);break}}static get defaultPropertiesToUpdate(){return[[re.AnnotationEditorParamsType.INK_THICKNESS,vt._defaultThickness],[re.AnnotationEditorParamsType.INK_COLOR,vt._defaultColor||se.AnnotationEditor._defaultLineColor],[re.AnnotationEditorParamsType.INK_OPACITY,Math.round(vt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[re.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||vt._defaultThickness],[re.AnnotationEditorParamsType.INK_COLOR,this.color||vt._defaultColor||se.AnnotationEditor._defaultLineColor],[re.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??vt._defaultOpacity))]]}rebuild(){super.rebuild(),this.div!==null&&(this.canvas||(rt(this,Oe,$n).call(this),rt(this,Ve,kn).call(this)),this.isAttachedToDOM||(this.parent.add(this),rt(this,je,Jt).call(this)),rt(this,At,Qt).call(this))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,Re(this,we).disconnect(),_t(this,we,null),super.remove())}setParent(De){!this.parent&&De?this._uiManager.removeShouldRescale(this):this.parent&&De===null&&this._uiManager.addShouldRescale(this),super.setParent(De)}onScaleChanging(){const[De,He]=this.parentDimensions,lt=this.width*De,bt=this.height*He;this.setDimensions(lt,bt)}enableEditMode(){Re(this,ye)||this.canvas===null||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",Re(this,fe)),this.canvas.addEventListener("pointerup",Re(this,ce)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",Re(this,fe)),this.canvas.removeEventListener("pointerup",Re(this,ce)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){Re(this,ye)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),_t(this,ye,!0),this.div.classList.add("disabled"),rt(this,At,Qt).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus({preventScroll:!0}))}focusin(De){super.focusin(De),this.enableEditMode()}canvasPointerdown(De){De.button!==0||!this.isInEditMode()||Re(this,ye)||(this.setInForeground(),De.type!=="mouse"&&this.div.focus(),De.stopPropagation(),this.canvas.addEventListener("pointerleave",Re(this,Se)),this.canvas.addEventListener("pointermove",Re(this,Ae)),rt(this,it,Sr).call(this,De.offsetX,De.offsetY))}canvasPointermove(De){De.stopPropagation(),rt(this,at,vr).call(this,De.offsetX,De.offsetY)}canvasPointerup(De){De.button===0&&this.isInEditMode()&&this.currentPath.length!==0&&(De.stopPropagation(),rt(this,Ee,Xn).call(this,De),this.setInBackground())}canvasPointerleave(De){rt(this,Ee,Xn).call(this,De),this.setInBackground()}render(){if(this.div)return this.div;let De,He;this.width&&(De=this.x,He=this.y),super.render(),vt._l10nPromise.get("editor_ink2_aria_label").then(Rt=>{var Pt;return(Pt=this.div)==null?void 0:Pt.setAttribute("aria-label",Rt)});const[lt,bt,Et,xt]=rt(this,We,br).call(this);if(this.setAt(lt,bt,0,0),this.setDims(Et,xt),rt(this,Oe,$n).call(this),this.width){const[Rt,Pt]=this.parentDimensions;this.setAt(De*Rt,He*Pt,this.width*Rt,this.height*Pt),_t(this,ve,!0),rt(this,je,Jt).call(this),this.setDims(this.width*Rt,this.height*Pt),rt(this,mt,qt).call(this),rt(this,Ye,Jn).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return rt(this,Ve,kn).call(this),this.div}setDimensions(De,He){const lt=Math.round(De),bt=Math.round(He);if(Re(this,Te)===lt&&Re(this,Le)===bt)return;_t(this,Te,lt),_t(this,Le,bt),this.canvas.style.visibility="hidden",Re(this,he)&&Math.abs(Re(this,he)-De/He)>.01&&(He=Math.ceil(De/Re(this,he)),this.setDims(De,He));const[Et,xt]=this.parentDimensions;this.width=De/Et,this.height=He/xt,Re(this,ye)&&rt(this,Be,Kn).call(this,De,He),rt(this,je,Jt).call(this),rt(this,mt,qt).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(De,He,lt){var Ft,Ot;const bt=super.deserialize(De,He,lt);bt.thickness=De.thickness,bt.color=re.Util.makeHexColor(...De.color),bt.opacity=De.opacity;const[Et,xt]=bt.pageDimensions,Rt=bt.width*Et,Pt=bt.height*xt,Mt=bt.parentScale,Ct=De.thickness/2;_t(bt,he,Rt/Pt),_t(bt,ye,!0),_t(bt,Te,Math.round(Rt)),_t(bt,Le,Math.round(Pt));for(const{bezier:kt}of De.paths){const jt=[];bt.paths.push(jt);let Bt=Mt*(kt[0]-Ct),Ut=Mt*(Pt-kt[1]-Ct);for(let Dt=2,Nt=kt.length;Dt<Nt;Dt+=6){const Vt=Mt*(kt[Dt]-Ct),zt=Mt*(Pt-kt[Dt+1]-Ct),Tn=Mt*(kt[Dt+2]-Ct),En=Mt*(Pt-kt[Dt+3]-Ct),tr=Mt*(kt[Dt+4]-Ct),nr=Mt*(Pt-kt[Dt+5]-Ct);jt.push([[Bt,Ut],[Vt,zt],[Tn,En],[tr,nr]]),Bt=tr,Ut=nr}const Wt=rt(this,Fe,Yn).call(this,jt);bt.bezierPath2D.push(Wt)}const It=rt(Ft=bt,nt,Zn).call(Ft);return _t(bt,de,Math.max(me,It[2]-It[0])),_t(bt,ue,Math.max(me,It[3]-It[1])),rt(Ot=bt,Be,Kn).call(Ot,Rt,Pt),bt}serialize(){if(this.isEmpty())return null;const De=this.getRect(0,0),He=this.rotation%180===0?De[3]-De[1]:De[2]-De[0],lt=se.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:re.AnnotationEditorType.INK,color:lt,thickness:this.thickness,opacity:this.opacity,paths:rt(this,Xe,wr).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,He),pageIndex:this.pageIndex,rect:De,rotation:this.rotation}}};he=new WeakMap,ue=new WeakMap,de=new WeakMap,Ae=new WeakMap,Se=new WeakMap,ce=new WeakMap,fe=new WeakMap,ye=new WeakMap,ve=new WeakMap,Pe=new WeakMap,we=new WeakMap,Te=new WeakMap,Le=new WeakMap,Ne=new WeakMap,ke=new WeakSet,mr=function(De){const He=this.thickness;this.addCommands({cmd:()=>{this.thickness=De,rt(this,At,Qt).call(this)},undo:()=>{this.thickness=He,rt(this,At,Qt).call(this)},mustExec:!0,type:re.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},ge=new WeakSet,_r=function(De){const He=this.color;this.addCommands({cmd:()=>{this.color=De,rt(this,mt,qt).call(this)},undo:()=>{this.color=He,rt(this,mt,qt).call(this)},mustExec:!0,type:re.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_e=new WeakSet,yr=function(De){De/=100;const He=this.opacity;this.addCommands({cmd:()=>{this.opacity=De,rt(this,mt,qt).call(this)},undo:()=>{this.opacity=He,rt(this,mt,qt).call(this)},mustExec:!0,type:re.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},We=new WeakSet,br=function(){const{parentRotation:De,parentDimensions:[He,lt]}=this;switch(De){case 90:return[0,lt,lt,He];case 180:return[He,lt,He,lt];case 270:return[He,0,lt,He];default:return[0,0,He,lt]}},Qe=new WeakSet,zn=function(){const{ctx:De,color:He,opacity:lt,thickness:bt,parentScale:Et,scaleFactor:xt}=this;De.lineWidth=bt*Et/xt,De.lineCap="round",De.lineJoin="round",De.miterLimit=10,De.strokeStyle=`${He}${(0,oe.opacityToHex)(lt)}`},it=new WeakSet,Sr=function(De,He){this.isEditing=!0,Re(this,ve)||(_t(this,ve,!0),rt(this,je,Jt).call(this),this.thickness||(this.thickness=vt._defaultThickness),this.color||(this.color=vt._defaultColor||se.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=vt._defaultOpacity)),this.currentPath.push([De,He]),_t(this,Pe,null),rt(this,Qe,zn).call(this),this.ctx.beginPath(),this.ctx.moveTo(De,He),_t(this,Ne,()=>{Re(this,Ne)&&(Re(this,Pe)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):rt(this,mt,qt).call(this),this.ctx.lineTo(...Re(this,Pe)),_t(this,Pe,null),this.ctx.stroke()),window.requestAnimationFrame(Re(this,Ne)))}),window.requestAnimationFrame(Re(this,Ne))},at=new WeakSet,vr=function(De,He){const[lt,bt]=this.currentPath.at(-1);De===lt&&He===bt||(this.currentPath.push([De,He]),_t(this,Pe,[De,He]))},dt=new WeakSet,Ar=function(De,He){var Mt;this.ctx.closePath(),_t(this,Ne,null),De=Math.min(Math.max(De,0),this.canvas.width),He=Math.min(Math.max(He,0),this.canvas.height);const[lt,bt]=this.currentPath.at(-1);(De!==lt||He!==bt)&&this.currentPath.push([De,He]);let Et;if(this.currentPath.length!==1)Et=(0,ie.fitCurve)(this.currentPath,30,null);else{const Ct=[De,He];Et=[[Ct,Ct.slice(),Ct.slice(),Ct]]}const xt=rt(Mt=vt,Fe,Yn).call(Mt,Et);this.currentPath.length=0;const Rt=()=>{this.paths.push(Et),this.bezierPath2D.push(xt),this.rebuild()},Pt=()=>{this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(rt(this,Oe,$n).call(this),rt(this,Ve,kn).call(this)),rt(this,At,Qt).call(this))};this.addCommands({cmd:Rt,undo:Pt,mustExec:!0})},mt=new WeakSet,qt=function(){if(this.isEmpty()){rt(this,be,Mn).call(this);return}rt(this,Qe,zn).call(this);const{canvas:De,ctx:He}=this;He.setTransform(1,0,0,1,0,0),He.clearRect(0,0,De.width,De.height),rt(this,be,Mn).call(this);for(const lt of this.bezierPath2D)He.stroke(lt)},Ee=new WeakSet,Xn=function(De){rt(this,dt,Ar).call(this,De.offsetX,De.offsetY),this.canvas.removeEventListener("pointerleave",Re(this,Se)),this.canvas.removeEventListener("pointermove",Re(this,Ae)),this.addToAnnotationStorage()},Oe=new WeakSet,$n=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",vt._l10nPromise.get("editor_ink_canvas_aria_label").then(De=>{var He;return(He=this.canvas)==null?void 0:He.setAttribute("aria-label",De)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Ve=new WeakSet,kn=function(){_t(this,we,new ResizeObserver(De=>{const He=De[0].contentRect;He.width&&He.height&&this.setDimensions(He.width,He.height)})),Re(this,we).observe(this.div)},je=new WeakSet,Jt=function(){if(!Re(this,ve))return;const[De,He]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*De),this.canvas.height=Math.ceil(this.height*He),rt(this,be,Mn).call(this)},Be=new WeakSet,Kn=function(De,He){const lt=rt(this,pt,Fn).call(this),bt=(De-lt)/Re(this,de),Et=(He-lt)/Re(this,ue);this.scaleFactor=Math.min(bt,Et)},be=new WeakSet,Mn=function(){const De=rt(this,pt,Fn).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+De,this.translationY*this.scaleFactor+De)},Fe=new WeakSet,Yn=function(De){const He=new Path2D;for(let lt=0,bt=De.length;lt<bt;lt++){const[Et,xt,Rt,Pt]=De[lt];lt===0&&He.moveTo(...Et),He.bezierCurveTo(xt[0],xt[1],Rt[0],Rt[1],Pt[0],Pt[1])}return He},Xe=new WeakSet,wr=function(De,He,lt,bt){const xt=[],Rt=this.thickness/2;let Pt,Mt;for(const Ct of this.paths){Pt=[],Mt=[];for(let It=0,Ft=Ct.length;It<Ft;It++){const[Ot,kt,jt,Bt]=Ct[It],Ut=De*(Ot[0]+He)+Rt,Wt=bt-De*(Ot[1]+lt)-Rt,Dt=De*(kt[0]+He)+Rt,Nt=bt-De*(kt[1]+lt)-Rt,Vt=De*(jt[0]+He)+Rt,zt=bt-De*(jt[1]+lt)-Rt,Tn=De*(Bt[0]+He)+Rt,En=bt-De*(Bt[1]+lt)-Rt;It===0&&(Pt.push(Ut,Wt),Mt.push(Ut,Wt)),Pt.push(Dt,Nt,Vt,zt,Tn,En),rt(this,Ze,Tr).call(this,Ut,Wt,Dt,Nt,Vt,zt,Tn,En,4,Mt)}xt.push({bezier:Pt,points:Mt})}return xt},Ze=new WeakSet,Tr=function(De,He,lt,bt,Et,xt,Rt,Pt,Mt,Ct){if(rt(this,ot,Er).call(this,De,He,lt,bt,Et,xt,Rt,Pt)){Ct.push(Rt,Pt);return}for(let It=1;It<Mt-1;It++){const Ft=It/Mt,Ot=1-Ft;let kt=Ft*De+Ot*lt,jt=Ft*He+Ot*bt,Bt=Ft*lt+Ot*Et,Ut=Ft*bt+Ot*xt;const Wt=Ft*Et+Ot*Rt,Dt=Ft*xt+Ot*Pt;kt=Ft*kt+Ot*Bt,jt=Ft*jt+Ot*Ut,Bt=Ft*Bt+Ot*Wt,Ut=Ft*Ut+Ot*Dt,kt=Ft*kt+Ot*Bt,jt=Ft*jt+Ot*Ut,Ct.push(kt,jt)}Ct.push(Rt,Pt)},ot=new WeakSet,Er=function(De,He,lt,bt,Et,xt,Rt,Pt){const Ct=(3*lt-2*De-Rt)**2,It=(3*bt-2*He-Pt)**2,Ft=(3*Et-De-2*Rt)**2,Ot=(3*xt-He-2*Pt)**2;return Math.max(Ct,Ft)+Math.max(It,Ot)<=10},nt=new WeakSet,Zn=function(){let De=1/0,He=-1/0,lt=1/0,bt=-1/0;for(const Et of this.paths)for(const[xt,Rt,Pt,Mt]of Et){const Ct=re.Util.bezierBoundingBox(...xt,...Rt,...Pt,...Mt);De=Math.min(De,Ct[0]),lt=Math.min(lt,Ct[1]),He=Math.max(He,Ct[2]),bt=Math.max(bt,Ct[3])}return[De,lt,He,bt]},pt=new WeakSet,Fn=function(){return Re(this,ye)?Math.ceil(this.thickness*this.parentScale):0},At=new WeakSet,Qt=function(De=!1){if(this.isEmpty())return;if(!Re(this,ye)){rt(this,mt,qt).call(this);return}const He=rt(this,nt,Zn).call(this),lt=rt(this,pt,Fn).call(this);_t(this,de,Math.max(me,He[2]-He[0])),_t(this,ue,Math.max(me,He[3]-He[1]));const bt=Math.ceil(lt+Re(this,de)*this.scaleFactor),Et=Math.ceil(lt+Re(this,ue)*this.scaleFactor),[xt,Rt]=this.parentDimensions;this.width=bt/xt,this.height=Et/Rt,_t(this,he,bt/Et),rt(this,Ye,Jn).call(this);const Pt=this.translationX,Mt=this.translationY;this.translationX=-He[0],this.translationY=-He[1],rt(this,je,Jt).call(this),rt(this,mt,qt).call(this),_t(this,Te,bt),_t(this,Le,Et),this.setDims(bt,Et);const Ct=De?lt/this.scaleFactor/2:0;this.translate(Pt-this.translationX-Ct,Mt-this.translationY-Ct)},Ye=new WeakSet,Jn=function(){const{style:De}=this.div;Re(this,he)>=1?(De.minHeight=`${me}px`,De.minWidth=`${Math.round(Re(this,he)*me)}px`):(De.minWidth=`${me}px`,De.minHeight=`${Math.round(me/Re(this,he))}px`)},Je(vt,Fe),Lt(vt,"_defaultColor",null),Lt(vt,"_defaultOpacity",1),Lt(vt,"_defaultThickness",1),Lt(vt,"_l10nPromise"),Lt(vt,"_type","ink");let pe=vt;ee.InkEditor=pe},(te,ee,ne)=>{Object.defineProperty(ee,"__esModule",{value:!0}),ee.fitCurve=void 0;const re=ne(31);ee.fitCurve=re},te=>{function ee(ce,fe,ye){if(!Array.isArray(ce))throw new TypeError("First argument should be an array");if(ce.forEach(Te=>{if(!Array.isArray(Te)||Te.some(Le=>typeof Le!="number")||Te.length!==ce[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}),ce=ce.filter((Te,Le)=>Le===0||!Te.every((Ne,ke)=>Ne===ce[Le-1][ke])),ce.length<2)return[];const ve=ce.length,Pe=de(ce[1],ce[0]),we=de(ce[ve-2],ce[ve-1]);return ne(ce,Pe,we,fe,ye)}function ne(ce,fe,ye,ve,Pe){var Te,Le,Ne,ke,ae,ge,$e,_e,Me,We,ze,Qe,ct;if(ce.length===2)return Qe=Ae.vectorLen(Ae.subtract(ce[0],ce[1]))/3,Te=[ce[0],Ae.addArrays(ce[0],Ae.mulItems(fe,Qe)),Ae.addArrays(ce[1],Ae.mulItems(ye,Qe)),ce[1]],[Te];if(Le=me(ce),[Te,ke,ge]=re(ce,Le,Le,fe,ye,Pe),ke===0||ke<ve)return[Te];if(ke<ve*ve)for(Ne=Le,ae=ke,$e=ge,ct=0;ct<20;ct++){if(Ne=ie(Te,ce,Ne),[Te,ke,ge]=re(ce,Le,Ne,fe,ye,Pe),ke<ve)return[Te];if(ge===$e){let it=ke/ae;if(it>.9999&&it<1.0001)break}ae=ke,$e=ge}return ze=[],_e=Ae.subtract(ce[ge-1],ce[ge+1]),_e.every(it=>it===0)&&(_e=Ae.subtract(ce[ge-1],ce[ge]),[_e[0],_e[1]]=[-_e[1],_e[0]]),Me=Ae.normalize(_e),We=Ae.mulItems(Me,-1),ze=ze.concat(ne(ce.slice(0,ge+1),fe,Me,ve,Pe)),ze=ze.concat(ne(ce.slice(ge),We,ye,ve,Pe)),ze}function re(ce,fe,ye,ve,Pe,we){var Te,Le,Ne;return Te=se(ce,ye,ve,Pe),[Le,Ne]=pe(ce,Te,fe),we&&we({bez:Te,points:ce,params:fe,maxErr:Le,maxPoint:Ne}),[Te,Le,Ne]}function se(ce,fe,ye,ve){var Pe,we,Te,Le,Ne,ke,ae,ge,$e,_e,Me,We,ze,Qe,ct,it,ht,at=ce[0],gt=ce[ce.length-1];for(Pe=[at,null,null,gt],we=Ae.zeros_Xx2x2(fe.length),ze=0,Qe=fe.length;ze<Qe;ze++)it=fe[ze],ht=1-it,Te=we[ze],Te[0]=Ae.mulItems(ye,3*it*(ht*ht)),Te[1]=Ae.mulItems(ve,3*ht*(it*it));for(Le=[[0,0],[0,0]],Ne=[0,0],ze=0,Qe=ce.length;ze<Qe;ze++)it=fe[ze],Te=we[ze],Le[0][0]+=Ae.dot(Te[0],Te[0]),Le[0][1]+=Ae.dot(Te[0],Te[1]),Le[1][0]+=Ae.dot(Te[0],Te[1]),Le[1][1]+=Ae.dot(Te[1],Te[1]),ct=Ae.subtract(ce[ze],Se.q([at,at,gt,gt],it)),Ne[0]+=Ae.dot(Te[0],ct),Ne[1]+=Ae.dot(Te[1],ct);return ke=Le[0][0]*Le[1][1]-Le[1][0]*Le[0][1],ae=Le[0][0]*Ne[1]-Le[1][0]*Ne[0],ge=Ne[0]*Le[1][1]-Ne[1]*Le[0][1],$e=ke===0?0:ge/ke,_e=ke===0?0:ae/ke,We=Ae.vectorLen(Ae.subtract(at,gt)),Me=1e-6*We,$e<Me||_e<Me?(Pe[1]=Ae.addArrays(at,Ae.mulItems(ye,We/3)),Pe[2]=Ae.addArrays(gt,Ae.mulItems(ve,We/3))):(Pe[1]=Ae.addArrays(at,Ae.mulItems(ye,$e)),Pe[2]=Ae.addArrays(gt,Ae.mulItems(ve,_e))),Pe}function ie(ce,fe,ye){return ye.map((ve,Pe)=>oe(ce,fe[Pe],ve))}function oe(ce,fe,ye){var ve=Ae.subtract(Se.q(ce,ye),fe),Pe=Se.qprime(ce,ye),we=Ae.mulMatrix(ve,Pe),Te=Ae.sum(Ae.squareItems(Pe))+2*Ae.mulMatrix(ve,Se.qprimeprime(ce,ye));return Te===0?ye:ye-we/Te}function me(ce){var fe=[],ye,ve,Pe;return ce.forEach((we,Te)=>{ye=Te?ve+Ae.vectorLen(Ae.subtract(we,Pe)):0,fe.push(ye),ve=ye,Pe=we}),fe=fe.map(we=>we/ve),fe}function pe(ce,fe,ye){var ve,Pe,we,Te,Le,Ne,ke,ae;Pe=0,we=Math.floor(ce.length/2);const ge=he(fe,10);for(Le=0,Ne=ce.length;Le<Ne;Le++)ke=ce[Le],ae=ue(fe,ye[Le],ge,10),Te=Ae.subtract(Se.q(fe,ae),ke),ve=Te[0]*Te[0]+Te[1]*Te[1],ve>Pe&&(Pe=ve,we=Le);return[Pe,we]}var he=function(ce,fe){for(var ye,ve=[0],Pe=ce[0],we=0,Te=1;Te<=fe;Te++)ye=Se.q(ce,Te/fe),we+=Ae.vectorLen(Ae.subtract(ye,Pe)),ve.push(we),Pe=ye;return ve=ve.map(Le=>Le/we),ve};function ue(ce,fe,ye,ve){if(fe<0)return 0;if(fe>1)return 1;for(var Pe,we,Te,Le,Ne,ke=1;ke<=ve;ke++)if(fe<=ye[ke]){Le=(ke-1)/ve,Te=ke/ve,we=ye[ke-1],Pe=ye[ke],Ne=(fe-we)/(Pe-we)*(Te-Le)+Le;break}return Ne}function de(ce,fe){return Ae.normalize(Ae.subtract(ce,fe))}class Ae{static zeros_Xx2x2(fe){for(var ye=[];fe--;)ye.push([0,0]);return ye}static mulItems(fe,ye){return fe.map(ve=>ve*ye)}static mulMatrix(fe,ye){return fe.reduce((ve,Pe,we)=>ve+Pe*ye[we],0)}static subtract(fe,ye){return fe.map((ve,Pe)=>ve-ye[Pe])}static addArrays(fe,ye){return fe.map((ve,Pe)=>ve+ye[Pe])}static addItems(fe,ye){return fe.map(ve=>ve+ye)}static sum(fe){return fe.reduce((ye,ve)=>ye+ve)}static dot(fe,ye){return Ae.mulMatrix(fe,ye)}static vectorLen(fe){return Math.hypot(...fe)}static divItems(fe,ye){return fe.map(ve=>ve/ye)}static squareItems(fe){return fe.map(ye=>ye*ye)}static normalize(fe){return this.divItems(fe,this.vectorLen(fe))}}class Se{static q(fe,ye){var ve=1-ye,Pe=Ae.mulItems(fe[0],ve*ve*ve),we=Ae.mulItems(fe[1],3*ve*ve*ye),Te=Ae.mulItems(fe[2],3*ve*ye*ye),Le=Ae.mulItems(fe[3],ye*ye*ye);return Ae.addArrays(Ae.addArrays(Pe,we),Ae.addArrays(Te,Le))}static qprime(fe,ye){var ve=1-ye,Pe=Ae.mulItems(Ae.subtract(fe[1],fe[0]),3*ve*ve),we=Ae.mulItems(Ae.subtract(fe[2],fe[1]),6*ve*ye),Te=Ae.mulItems(Ae.subtract(fe[3],fe[2]),3*ye*ye);return Ae.addArrays(Ae.addArrays(Pe,we),Te)}static qprimeprime(fe,ye){return Ae.addArrays(Ae.mulItems(Ae.addArrays(Ae.subtract(fe[2],Ae.mulItems(fe[1],2)),fe[0]),6*(1-ye)),Ae.mulItems(Ae.addArrays(Ae.subtract(fe[3],Ae.mulItems(fe[2],2)),fe[1]),6*ye))}}te.exports=ee,te.exports.fitCubic=ne,te.exports.createTangent=de},(te,ee,ne)=>{var mt,Kt,Ee,Cr,Ge,Qn,Ke,er;Object.defineProperty(ee,"__esModule",{value:!0}),ee.AnnotationLayer=void 0;var re=ne(1),se=ne(6),ie=ne(3),oe=ne(33),me=ne(34);const pe=1e3,he=9,ue=new WeakSet;function de(Be){return{width:Be[2]-Be[0],height:Be[3]-Be[1]}}class Ae{static create(le){switch(le.data.annotationType){case re.AnnotationType.LINK:return new ce(le);case re.AnnotationType.TEXT:return new fe(le);case re.AnnotationType.WIDGET:switch(le.data.fieldType){case"Tx":return new ve(le);case"Btn":return le.data.radioButton?new we(le):le.data.checkBox?new Pe(le):new Te(le);case"Ch":return new Le(le)}return new ye(le);case re.AnnotationType.POPUP:return new Ne(le);case re.AnnotationType.FREETEXT:return new ae(le);case re.AnnotationType.LINE:return new ge(le);case re.AnnotationType.SQUARE:return new $e(le);case re.AnnotationType.CIRCLE:return new _e(le);case re.AnnotationType.POLYLINE:return new Me(le);case re.AnnotationType.CARET:return new ze(le);case re.AnnotationType.INK:return new Qe(le);case re.AnnotationType.POLYGON:return new We(le);case re.AnnotationType.HIGHLIGHT:return new ct(le);case re.AnnotationType.UNDERLINE:return new it(le);case re.AnnotationType.SQUIGGLY:return new ht(le);case re.AnnotationType.STRIKEOUT:return new at(le);case re.AnnotationType.STAMP:return new gt(le);case re.AnnotationType.FILEATTACHMENT:return new dt(le);default:return new Se(le)}}}class Se{constructor(le,{isRenderable:be=!1,ignoreBorder:Ce=!1,createQuadrilaterals:Fe=!1}={}){this.isRenderable=be,this.data=le.data,this.layer=le.layer,this.page=le.page,this.viewport=le.viewport,this.linkService=le.linkService,this.downloadManager=le.downloadManager,this.imageResourcesPath=le.imageResourcesPath,this.renderForms=le.renderForms,this.svgFactory=le.svgFactory,this.annotationStorage=le.annotationStorage,this.enableScripting=le.enableScripting,this.hasJSActions=le.hasJSActions,this._fieldObjects=le.fieldObjects,be&&(this.container=this._createContainer(Ce)),Fe&&(this.quadrilaterals=this._createQuadrilaterals(Ce))}_createContainer(le=!1){const{data:be,page:Ce,viewport:Fe}=this,Ie=document.createElement("section");Ie.setAttribute("data-annotation-id",be.id),be.noRotate&&Ie.classList.add("norotate");const{pageWidth:Xe,pageHeight:tt,pageX:Ze,pageY:st}=Fe.rawDims,{width:ot,height:et}=de(be.rect),nt=re.Util.normalizeRect([be.rect[0],Ce.view[3]-be.rect[1]+Ce.view[1],be.rect[2],Ce.view[3]-be.rect[3]+Ce.view[1]]);if(!le&&be.borderStyle.width>0){Ie.style.borderWidth=`${be.borderStyle.width}px`;const pt=be.borderStyle.horizontalCornerRadius,wt=be.borderStyle.verticalCornerRadius;if(pt>0||wt>0){const Tt=`calc(${pt}px * var(--scale-factor)) / calc(${wt}px * var(--scale-factor))`;Ie.style.borderRadius=Tt}else if(this instanceof we){const Tt=`calc(${ot}px * var(--scale-factor)) / calc(${et}px * var(--scale-factor))`;Ie.style.borderRadius=Tt}switch(be.borderStyle.style){case re.AnnotationBorderStyleType.SOLID:Ie.style.borderStyle="solid";break;case re.AnnotationBorderStyleType.DASHED:Ie.style.borderStyle="dashed";break;case re.AnnotationBorderStyleType.BEVELED:(0,re.warn)("Unimplemented border style: beveled");break;case re.AnnotationBorderStyleType.INSET:(0,re.warn)("Unimplemented border style: inset");break;case re.AnnotationBorderStyleType.UNDERLINE:Ie.style.borderBottomStyle="solid";break}const At=be.borderColor||null;At?Ie.style.borderColor=re.Util.makeHexColor(At[0]|0,At[1]|0,At[2]|0):Ie.style.borderWidth=0}Ie.style.left=`${100*(nt[0]-Ze)/Xe}%`,Ie.style.top=`${100*(nt[1]-st)/tt}%`;const{rotation:ft}=be;return be.hasOwnCanvas||ft===0?(Ie.style.width=`${100*ot/Xe}%`,Ie.style.height=`${100*et/tt}%`):this.setRotation(ft,Ie),Ie}setRotation(le,be=this.container){const{pageWidth:Ce,pageHeight:Fe}=this.viewport.rawDims,{width:Ie,height:Xe}=de(this.data.rect);let tt,Ze;le%180===0?(tt=100*Ie/Ce,Ze=100*Xe/Fe):(tt=100*Xe/Ce,Ze=100*Ie/Fe),be.style.width=`${tt}%`,be.style.height=`${Ze}%`,be.setAttribute("data-main-rotation",(360-le)%360)}get _commonActions(){const le=(be,Ce,Fe)=>{const Ie=Fe.detail[be];Fe.target.style[Ce]=oe.ColorConverters[`${Ie[0]}_HTML`](Ie.slice(1))};return(0,re.shadow)(this,"_commonActions",{display:be=>{const Ce=be.detail.display%2===1;this.container.style.visibility=Ce?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:Ce,print:be.detail.display===0||be.detail.display===3})},print:be=>{this.annotationStorage.setValue(this.data.id,{print:be.detail.print})},hidden:be=>{this.container.style.visibility=be.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:be.detail.hidden})},focus:be=>{setTimeout(()=>be.target.focus({preventScroll:!1}),0)},userName:be=>{be.target.title=be.detail.userName},readonly:be=>{be.detail.readonly?be.target.setAttribute("readonly",""):be.target.removeAttribute("readonly")},required:be=>{this._setRequired(be.target,be.detail.required)},bgColor:be=>{le("bgColor","backgroundColor",be)},fillColor:be=>{le("fillColor","backgroundColor",be)},fgColor:be=>{le("fgColor","color",be)},textColor:be=>{le("textColor","color",be)},borderColor:be=>{le("borderColor","borderColor",be)},strokeColor:be=>{le("strokeColor","borderColor",be)},rotation:be=>{const Ce=be.detail.rotation;this.setRotation(Ce),this.annotationStorage.setValue(this.data.id,{rotation:Ce})}})}_dispatchEventFromSandbox(le,be){const Ce=this._commonActions;for(const Fe of Object.keys(be.detail)){const Ie=le[Fe]||Ce[Fe];Ie==null||Ie(be)}}_setDefaultPropertiesFromJS(le){if(!this.enableScripting)return;const be=this.annotationStorage.getRawValue(this.data.id);if(!be)return;const Ce=this._commonActions;for(const[Fe,Ie]of Object.entries(be)){const Xe=Ce[Fe];if(Xe){const tt={detail:{[Fe]:Ie},target:le};Xe(tt),delete be[Fe]}}}_createQuadrilaterals(le=!1){if(!this.data.quadPoints)return null;const be=[],Ce=this.data.rect;for(const Fe of this.data.quadPoints)this.data.rect=[Fe[2].x,Fe[2].y,Fe[1].x,Fe[1].y],be.push(this._createContainer(le));return this.data.rect=Ce,be}_createPopup(le,be){let Ce=this.container;this.quadrilaterals&&(le||(le=this.quadrilaterals),Ce=this.quadrilaterals[0]),le||(le=document.createElement("div"),le.classList.add("popupTriggerArea"),Ce.append(le));const Ie=new ke({container:Ce,trigger:le,color:be.color,titleObj:be.titleObj,modificationDate:be.modificationDate,contentsObj:be.contentsObj,richText:be.richText,hideWrapper:!0}).render();Ie.style.left="100%",Ce.append(Ie)}_renderQuadrilaterals(le){for(const be of this.quadrilaterals)be.classList.add(le);return this.quadrilaterals}render(){(0,re.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(le,be=null){const Ce=[];if(this._fieldObjects){const Fe=this._fieldObjects[le];if(Fe)for(const{page:Ie,id:Xe,exportValues:tt}of Fe){if(Ie===-1||Xe===be)continue;const Ze=typeof tt=="string"?tt:null,st=document.querySelector(`[data-element-id="${Xe}"]`);if(st&&!ue.has(st)){(0,re.warn)(`_getElementsByName - element not allowed: ${Xe}`);continue}Ce.push({id:Xe,exportValue:Ze,domElement:st})}return Ce}for(const Fe of document.getElementsByName(le)){const{exportValue:Ie}=Fe,Xe=Fe.getAttribute("data-element-id");Xe!==be&&ue.has(Fe)&&Ce.push({id:Xe,exportValue:Ie,domElement:Fe})}return Ce}}class ce extends Se{constructor(be,Ce=null){super(be,{isRenderable:!0,ignoreBorder:!!(Ce!=null&&Ce.ignoreBorder),createQuadrilaterals:!0});Je(this,mt);Je(this,Ee);this.isTooltipOnly=be.data.isTooltipOnly}render(){const{data:be,linkService:Ce}=this,Fe=document.createElement("a");Fe.setAttribute("data-element-id",be.id);let Ie=!1;return be.url?(Ce.addLinkAttributes(Fe,be.url,be.newWindow),Ie=!0):be.action?(this._bindNamedAction(Fe,be.action),Ie=!0):be.attachment?(this._bindAttachment(Fe,be.attachment),Ie=!0):be.setOCGState?(rt(this,Ee,Cr).call(this,Fe,be.setOCGState),Ie=!0):be.dest?(this._bindLink(Fe,be.dest),Ie=!0):(be.actions&&(be.actions.Action||be.actions["Mouse Up"]||be.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(Fe,be),Ie=!0),be.resetForm?(this._bindResetFormAction(Fe,be.resetForm),Ie=!0):this.isTooltipOnly&&!Ie&&(this._bindLink(Fe,""),Ie=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((Xe,tt)=>{const Ze=tt===0?Fe:Fe.cloneNode();return Xe.append(Ze),Xe}):(this.container.classList.add("linkAnnotation"),Ie&&this.container.append(Fe),this.container)}_bindLink(be,Ce){be.href=this.linkService.getDestinationHash(Ce),be.onclick=()=>(Ce&&this.linkService.goToDestination(Ce),!1),(Ce||Ce==="")&&rt(this,mt,Kt).call(this)}_bindNamedAction(be,Ce){be.href=this.linkService.getAnchorUrl(""),be.onclick=()=>(this.linkService.executeNamedAction(Ce),!1),rt(this,mt,Kt).call(this)}_bindAttachment(be,Ce){be.href=this.linkService.getAnchorUrl(""),be.onclick=()=>{var Fe;return(Fe=this.downloadManager)==null||Fe.openOrDownloadData(this.container,Ce.content,Ce.filename),!1},rt(this,mt,Kt).call(this)}_bindJSAction(be,Ce){be.href=this.linkService.getAnchorUrl("");const Fe=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const Ie of Object.keys(Ce.actions)){const Xe=Fe.get(Ie);Xe&&(be[Xe]=()=>{var tt;return(tt=this.linkService.eventBus)==null||tt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:Ce.id,name:Ie}}),!1})}be.onclick||(be.onclick=()=>!1),rt(this,mt,Kt).call(this)}_bindResetFormAction(be,Ce){const Fe=be.onclick;if(Fe||(be.href=this.linkService.getAnchorUrl("")),rt(this,mt,Kt).call(this),!this._fieldObjects){(0,re.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),Fe||(be.onclick=()=>!1);return}be.onclick=()=>{var et;Fe==null||Fe();const{fields:Ie,refs:Xe,include:tt}=Ce,Ze=[];if(Ie.length!==0||Xe.length!==0){const nt=new Set(Xe);for(const ft of Ie){const pt=this._fieldObjects[ft]||[];for(const{id:wt}of pt)nt.add(wt)}for(const ft of Object.values(this._fieldObjects))for(const pt of ft)nt.has(pt.id)===tt&&Ze.push(pt)}else for(const nt of Object.values(this._fieldObjects))Ze.push(...nt);const st=this.annotationStorage,ot=[];for(const nt of Ze){const{id:ft}=nt;switch(ot.push(ft),nt.type){case"text":{const wt=nt.defaultValue||"";st.setValue(ft,{value:wt});break}case"checkbox":case"radiobutton":{const wt=nt.defaultValue===nt.exportValues;st.setValue(ft,{value:wt});break}case"combobox":case"listbox":{const wt=nt.defaultValue||"";st.setValue(ft,{value:wt});break}default:continue}const pt=document.querySelector(`[data-element-id="${ft}"]`);if(pt){if(!ue.has(pt)){(0,re.warn)(`_bindResetFormAction - element not allowed: ${ft}`);continue}}else continue;pt.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((et=this.linkService.eventBus)==null||et.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:ot,name:"ResetForm"}})),!1}}}mt=new WeakSet,Kt=function(){this.container.setAttribute("data-internal-link","")},Ee=new WeakSet,Cr=function(be,Ce){be.href=this.linkService.getAnchorUrl(""),be.onclick=()=>(this.linkService.executeSetOCGState(Ce),!1),rt(this,mt,Kt).call(this)};class fe extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be})}render(){this.container.classList.add("textAnnotation");const le=document.createElement("img");return le.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",le.alt="[{{type}} Annotation]",le.dataset.l10nId="text_annotation_type",le.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(le,this.data),this.container.append(le),this.container}}class ye extends Se{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(le){var be;this.data.hasOwnCanvas&&(((be=le.previousSibling)==null?void 0:be.nodeName)==="CANVAS"&&(le.previousSibling.hidden=!0),le.hidden=!1)}_getKeyModifier(le){const{isWin:be,isMac:Ce}=re.FeatureTest.platform;return be&&le.ctrlKey||Ce&&le.metaKey}_setEventListener(le,be,Ce,Fe){be.includes("mouse")?le.addEventListener(be,Ie=>{var Xe;(Xe=this.linkService.eventBus)==null||Xe.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:Ce,value:Fe(Ie),shift:Ie.shiftKey,modifier:this._getKeyModifier(Ie)}})}):le.addEventListener(be,Ie=>{var Xe;(Xe=this.linkService.eventBus)==null||Xe.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:Ce,value:Fe(Ie)}})})}_setEventListeners(le,be,Ce){var Fe;for(const[Ie,Xe]of be)(Xe==="Action"||(Fe=this.data.actions)!=null&&Fe[Xe])&&this._setEventListener(le,Ie,Xe,Ce)}_setBackgroundColor(le){const be=this.data.backgroundColor||null;le.style.backgroundColor=be===null?"transparent":re.Util.makeHexColor(be[0],be[1],be[2])}_setTextStyle(le){const be=["left","center","right"],{fontColor:Ce}=this.data.defaultAppearanceData,Fe=this.data.defaultAppearanceData.fontSize||he,Ie=le.style;let Xe;const tt=2,Ze=st=>Math.round(10*st)/10;if(this.data.multiLine){const st=Math.abs(this.data.rect[3]-this.data.rect[1]-tt),ot=Math.round(st/(re.LINE_FACTOR*Fe))||1,et=st/ot;Xe=Math.min(Fe,Ze(et/re.LINE_FACTOR))}else{const st=Math.abs(this.data.rect[3]-this.data.rect[1]-tt);Xe=Math.min(Fe,Ze(st/re.LINE_FACTOR))}Ie.fontSize=`calc(${Xe}px * var(--scale-factor))`,Ie.color=re.Util.makeHexColor(Ce[0],Ce[1],Ce[2]),this.data.textAlignment!==null&&(Ie.textAlign=be[this.data.textAlignment])}_setRequired(le,be){be?le.setAttribute("required",!0):le.removeAttribute("required"),le.setAttribute("aria-required",be)}}class ve extends ye{constructor(le){const be=le.renderForms||!le.data.hasAppearance&&!!le.data.fieldValue;super(le,{isRenderable:be})}setPropertyOnSiblings(le,be,Ce,Fe){const Ie=this.annotationStorage;for(const Xe of this._getElementsByName(le.name,le.id))Xe.domElement&&(Xe.domElement[be]=Ce),Ie.setValue(Xe.id,{[Fe]:Ce})}render(){var Fe;const le=this.annotationStorage,be=this.data.id;this.container.classList.add("textWidgetAnnotation");let Ce=null;if(this.renderForms){const Ie=le.getValue(be,{value:this.data.fieldValue});let Xe=Ie.formattedValue||Ie.value||"";const tt=le.getValue(be,{charLimit:this.data.maxLen}).charLimit;tt&&Xe.length>tt&&(Xe=Xe.slice(0,tt));const Ze={userValue:Xe,formattedValue:null,lastCommittedValue:null,commitKey:1};this.data.multiLine?(Ce=document.createElement("textarea"),Ce.textContent=Xe,this.data.doNotScroll&&(Ce.style.overflowY="hidden")):(Ce=document.createElement("input"),Ce.type="text",Ce.setAttribute("value",Xe),this.data.doNotScroll&&(Ce.style.overflowX="hidden")),this.data.hasOwnCanvas&&(Ce.hidden=!0),ue.add(Ce),Ce.setAttribute("data-element-id",be),Ce.disabled=this.data.readOnly,Ce.name=this.data.fieldName,Ce.tabIndex=pe,this._setRequired(Ce,this.data.required),tt&&(Ce.maxLength=tt),Ce.addEventListener("input",ot=>{le.setValue(be,{value:ot.target.value}),this.setPropertyOnSiblings(Ce,"value",ot.target.value,"value")}),Ce.addEventListener("resetform",ot=>{const et=this.data.defaultFieldValue??"";Ce.value=Ze.userValue=et,Ze.formattedValue=null});let st=ot=>{const{formattedValue:et}=Ze;et!=null&&(ot.target.value=et),ot.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){Ce.addEventListener("focus",et=>{const{target:nt}=et;Ze.userValue&&(nt.value=Ze.userValue),Ze.lastCommittedValue=nt.value,Ze.commitKey=1}),Ce.addEventListener("updatefromsandbox",et=>{this.showElementAndHideCanvas(et.target);const nt={value(ft){Ze.userValue=ft.detail.value??"",le.setValue(be,{value:Ze.userValue.toString()}),ft.target.value=Ze.userValue},formattedValue(ft){const{formattedValue:pt}=ft.detail;Ze.formattedValue=pt,pt!=null&&ft.target!==document.activeElement&&(ft.target.value=pt),le.setValue(be,{formattedValue:pt})},selRange(ft){ft.target.setSelectionRange(...ft.detail.selRange)},charLimit:ft=>{var Tt;const{charLimit:pt}=ft.detail,{target:wt}=ft;if(pt===0){wt.removeAttribute("maxLength");return}wt.setAttribute("maxLength",pt);let At=Ze.userValue;!At||At.length<=pt||(At=At.slice(0,pt),wt.value=Ze.userValue=At,le.setValue(be,{value:At}),(Tt=this.linkService.eventBus)==null||Tt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:be,name:"Keystroke",value:At,willCommit:!0,commitKey:1,selStart:wt.selectionStart,selEnd:wt.selectionEnd}}))}};this._dispatchEventFromSandbox(nt,et)}),Ce.addEventListener("keydown",et=>{var pt;Ze.commitKey=1;let nt=-1;if(et.key==="Escape"?nt=0:et.key==="Enter"&&!this.data.multiLine?nt=2:et.key==="Tab"&&(Ze.commitKey=3),nt===-1)return;const{value:ft}=et.target;Ze.lastCommittedValue!==ft&&(Ze.lastCommittedValue=ft,Ze.userValue=ft,(pt=this.linkService.eventBus)==null||pt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:be,name:"Keystroke",value:ft,willCommit:!0,commitKey:nt,selStart:et.target.selectionStart,selEnd:et.target.selectionEnd}}))});const ot=st;st=null,Ce.addEventListener("blur",et=>{var ft;if(!et.relatedTarget)return;const{value:nt}=et.target;Ze.userValue=nt,Ze.lastCommittedValue!==nt&&((ft=this.linkService.eventBus)==null||ft.dispatch("dispatcheventinsandbox",{source:this,detail:{id:be,name:"Keystroke",value:nt,willCommit:!0,commitKey:Ze.commitKey,selStart:et.target.selectionStart,selEnd:et.target.selectionEnd}})),ot(et)}),(Fe=this.data.actions)!=null&&Fe.Keystroke&&Ce.addEventListener("beforeinput",et=>{var St;Ze.lastCommittedValue=null;const{data:nt,target:ft}=et,{value:pt,selectionStart:wt,selectionEnd:At}=ft;let Tt=wt,Ye=At;switch(et.inputType){case"deleteWordBackward":{const vt=pt.substring(0,wt).match(/\w*[^\w]*$/);vt&&(Tt-=vt[0].length);break}case"deleteWordForward":{const vt=pt.substring(wt).match(/^[^\w]*\w*/);vt&&(Ye+=vt[0].length);break}case"deleteContentBackward":wt===At&&(Tt-=1);break;case"deleteContentForward":wt===At&&(Ye+=1);break}et.preventDefault(),(St=this.linkService.eventBus)==null||St.dispatch("dispatcheventinsandbox",{source:this,detail:{id:be,name:"Keystroke",value:pt,change:nt||"",willCommit:!1,selStart:Tt,selEnd:Ye}})}),this._setEventListeners(Ce,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],et=>et.target.value)}if(st&&Ce.addEventListener("blur",st),this.data.comb){const et=(this.data.rect[2]-this.data.rect[0])/tt;Ce.classList.add("comb"),Ce.style.letterSpacing=`calc(${et}px * var(--scale-factor) - 1ch)`}}else Ce=document.createElement("div"),Ce.textContent=this.data.fieldValue,Ce.style.verticalAlign="middle",Ce.style.display="table-cell";return this._setTextStyle(Ce),this._setBackgroundColor(Ce),this._setDefaultPropertiesFromJS(Ce),this.container.append(Ce),this.container}}class Pe extends ye{constructor(le){super(le,{isRenderable:le.renderForms})}render(){const le=this.annotationStorage,be=this.data,Ce=be.id;let Fe=le.getValue(Ce,{value:be.exportValue===be.fieldValue}).value;typeof Fe=="string"&&(Fe=Fe!=="Off",le.setValue(Ce,{value:Fe})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const Ie=document.createElement("input");return ue.add(Ie),Ie.setAttribute("data-element-id",Ce),Ie.disabled=be.readOnly,this._setRequired(Ie,this.data.required),Ie.type="checkbox",Ie.name=be.fieldName,Fe&&Ie.setAttribute("checked",!0),Ie.setAttribute("exportValue",be.exportValue),Ie.tabIndex=pe,Ie.addEventListener("change",Xe=>{const{name:tt,checked:Ze}=Xe.target;for(const st of this._getElementsByName(tt,Ce)){const ot=Ze&&st.exportValue===be.exportValue;st.domElement&&(st.domElement.checked=ot),le.setValue(st.id,{value:ot})}le.setValue(Ce,{value:Ze})}),Ie.addEventListener("resetform",Xe=>{const tt=be.defaultFieldValue||"Off";Xe.target.checked=tt===be.exportValue}),this.enableScripting&&this.hasJSActions&&(Ie.addEventListener("updatefromsandbox",Xe=>{const tt={value(Ze){Ze.target.checked=Ze.detail.value!=="Off",le.setValue(Ce,{value:Ze.target.checked})}};this._dispatchEventFromSandbox(tt,Xe)}),this._setEventListeners(Ie,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Xe=>Xe.target.checked)),this._setBackgroundColor(Ie),this._setDefaultPropertiesFromJS(Ie),this.container.append(Ie),this.container}}class we extends ye{constructor(le){super(le,{isRenderable:le.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const le=this.annotationStorage,be=this.data,Ce=be.id;let Fe=le.getValue(Ce,{value:be.fieldValue===be.buttonValue}).value;typeof Fe=="string"&&(Fe=Fe!==be.buttonValue,le.setValue(Ce,{value:Fe}));const Ie=document.createElement("input");if(ue.add(Ie),Ie.setAttribute("data-element-id",Ce),Ie.disabled=be.readOnly,this._setRequired(Ie,this.data.required),Ie.type="radio",Ie.name=be.fieldName,Fe&&Ie.setAttribute("checked",!0),Ie.tabIndex=pe,Ie.addEventListener("change",Xe=>{const{name:tt,checked:Ze}=Xe.target;for(const st of this._getElementsByName(tt,Ce))le.setValue(st.id,{value:!1});le.setValue(Ce,{value:Ze})}),Ie.addEventListener("resetform",Xe=>{const tt=be.defaultFieldValue;Xe.target.checked=tt!=null&&tt===be.buttonValue}),this.enableScripting&&this.hasJSActions){const Xe=be.buttonValue;Ie.addEventListener("updatefromsandbox",tt=>{const Ze={value:st=>{const ot=Xe===st.detail.value;for(const et of this._getElementsByName(st.target.name)){const nt=ot&&et.id===Ce;et.domElement&&(et.domElement.checked=nt),le.setValue(et.id,{value:nt})}}};this._dispatchEventFromSandbox(Ze,tt)}),this._setEventListeners(Ie,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],tt=>tt.target.checked)}return this._setBackgroundColor(Ie),this._setDefaultPropertiesFromJS(Ie),this.container.append(Ie),this.container}}class Te extends ce{constructor(le){super(le,{ignoreBorder:le.data.hasAppearance})}render(){const le=super.render();le.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(le.title=this.data.alternativeText);const be=le.lastChild;return this.enableScripting&&this.hasJSActions&&be&&(this._setDefaultPropertiesFromJS(be),be.addEventListener("updatefromsandbox",Ce=>{this._dispatchEventFromSandbox({},Ce)})),le}}class Le extends ye{constructor(le){super(le,{isRenderable:le.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const le=this.annotationStorage,be=this.data.id,Ce=le.getValue(be,{value:this.data.fieldValue}),Fe=document.createElement("select");ue.add(Fe),Fe.setAttribute("data-element-id",be),Fe.disabled=this.data.readOnly,this._setRequired(Fe,this.data.required),Fe.name=this.data.fieldName,Fe.tabIndex=pe;let Ie=this.data.combo&&this.data.options.length>0;this.data.combo||(Fe.size=this.data.options.length,this.data.multiSelect&&(Fe.multiple=!0)),Fe.addEventListener("resetform",ot=>{const et=this.data.defaultFieldValue;for(const nt of Fe.options)nt.selected=nt.value===et});for(const ot of this.data.options){const et=document.createElement("option");et.textContent=ot.displayValue,et.value=ot.exportValue,Ce.value.includes(ot.exportValue)&&(et.setAttribute("selected",!0),Ie=!1),Fe.append(et)}let Xe=null;if(Ie){const ot=document.createElement("option");ot.value=" ",ot.setAttribute("hidden",!0),ot.setAttribute("selected",!0),Fe.prepend(ot),Xe=()=>{ot.remove(),Fe.removeEventListener("input",Xe),Xe=null},Fe.addEventListener("input",Xe)}const tt=ot=>{const et=ot?"value":"textContent",{options:nt,multiple:ft}=Fe;return ft?Array.prototype.filter.call(nt,pt=>pt.selected).map(pt=>pt[et]):nt.selectedIndex===-1?null:nt[nt.selectedIndex][et]};let Ze=tt(!1);const st=ot=>{const et=ot.target.options;return Array.prototype.map.call(et,nt=>({displayValue:nt.textContent,exportValue:nt.value}))};return this.enableScripting&&this.hasJSActions?(Fe.addEventListener("updatefromsandbox",ot=>{const et={value(nt){Xe==null||Xe();const ft=nt.detail.value,pt=new Set(Array.isArray(ft)?ft:[ft]);for(const wt of Fe.options)wt.selected=pt.has(wt.value);le.setValue(be,{value:tt(!0)}),Ze=tt(!1)},multipleSelection(nt){Fe.multiple=!0},remove(nt){const ft=Fe.options,pt=nt.detail.remove;ft[pt].selected=!1,Fe.remove(pt),ft.length>0&&Array.prototype.findIndex.call(ft,At=>At.selected)===-1&&(ft[0].selected=!0),le.setValue(be,{value:tt(!0),items:st(nt)}),Ze=tt(!1)},clear(nt){for(;Fe.length!==0;)Fe.remove(0);le.setValue(be,{value:null,items:[]}),Ze=tt(!1)},insert(nt){const{index:ft,displayValue:pt,exportValue:wt}=nt.detail.insert,At=Fe.children[ft],Tt=document.createElement("option");Tt.textContent=pt,Tt.value=wt,At?At.before(Tt):Fe.append(Tt),le.setValue(be,{value:tt(!0),items:st(nt)}),Ze=tt(!1)},items(nt){const{items:ft}=nt.detail;for(;Fe.length!==0;)Fe.remove(0);for(const pt of ft){const{displayValue:wt,exportValue:At}=pt,Tt=document.createElement("option");Tt.textContent=wt,Tt.value=At,Fe.append(Tt)}Fe.options.length>0&&(Fe.options[0].selected=!0),le.setValue(be,{value:tt(!0),items:st(nt)}),Ze=tt(!1)},indices(nt){const ft=new Set(nt.detail.indices);for(const pt of nt.target.options)pt.selected=ft.has(pt.index);le.setValue(be,{value:tt(!0)}),Ze=tt(!1)},editable(nt){nt.target.disabled=!nt.detail.editable}};this._dispatchEventFromSandbox(et,ot)}),Fe.addEventListener("input",ot=>{var nt;const et=tt(!0);le.setValue(be,{value:et}),ot.preventDefault(),(nt=this.linkService.eventBus)==null||nt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:be,name:"Keystroke",value:Ze,changeEx:et,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(Fe,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],ot=>ot.target.value)):Fe.addEventListener("input",function(ot){le.setValue(be,{value:tt(!0)})}),this.data.combo&&this._setTextStyle(Fe),this._setBackgroundColor(Fe),this._setDefaultPropertiesFromJS(Fe),this.container.append(Fe),this.container}}const Oe=class Oe extends Se{constructor(le){var Fe,Ie,Xe;const{data:be}=le,Ce=!Oe.IGNORE_TYPES.has(be.parentType)&&!!((Fe=be.titleObj)!=null&&Fe.str||(Ie=be.contentsObj)!=null&&Ie.str||(Xe=be.richText)!=null&&Xe.str);super(le,{isRenderable:Ce})}render(){this.container.classList.add("popupAnnotation");const le=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(le.length===0)return this.container;const be=new ke({container:this.container,trigger:Array.from(le),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),Ce=this.page,Fe=re.Util.normalizeRect([this.data.parentRect[0],Ce.view[3]-this.data.parentRect[1]+Ce.view[1],this.data.parentRect[2],Ce.view[3]-this.data.parentRect[3]+Ce.view[1]]),Ie=Fe[0]+this.data.parentRect[2]-this.data.parentRect[0],Xe=Fe[1],{pageWidth:tt,pageHeight:Ze,pageX:st,pageY:ot}=this.viewport.rawDims;return this.container.style.left=`${100*(Ie-st)/tt}%`,this.container.style.top=`${100*(Xe-ot)/Ze}%`,this.container.append(be.render()),this.container}};Lt(Oe,"IGNORE_TYPES",new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]));let Ne=Oe;class ke{constructor(le){this.container=le.container,this.trigger=le.trigger,this.color=le.color,this.titleObj=le.titleObj,this.modificationDate=le.modificationDate,this.contentsObj=le.contentsObj,this.richText=le.richText,this.hideWrapper=le.hideWrapper||!1,this.pinned=!1}render(){var tt,Ze;const be=document.createElement("div");be.classList.add("popupWrapper"),this.hideElement=this.hideWrapper?be:this.container,this.hideElement.hidden=!0;const Ce=document.createElement("div");Ce.classList.add("popup");const Fe=this.color;if(Fe){const st=.7*(255-Fe[0])+Fe[0],ot=.7*(255-Fe[1])+Fe[1],et=.7*(255-Fe[2])+Fe[2];Ce.style.backgroundColor=re.Util.makeHexColor(st|0,ot|0,et|0)}const Ie=document.createElement("h1");Ie.dir=this.titleObj.dir,Ie.textContent=this.titleObj.str,Ce.append(Ie);const Xe=se.PDFDateString.toDateObject(this.modificationDate);if(Xe){const st=document.createElement("span");st.classList.add("popupDate"),st.textContent="{{date}}, {{time}}",st.dataset.l10nId="annotation_date_string",st.dataset.l10nArgs=JSON.stringify({date:Xe.toLocaleDateString(),time:Xe.toLocaleTimeString()}),Ce.append(st)}if((tt=this.richText)!=null&&tt.str&&(!((Ze=this.contentsObj)!=null&&Ze.str)||this.contentsObj.str===this.richText.str))me.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:Ce}),Ce.lastChild.classList.add("richText","popupContent");else{const st=this._formatContents(this.contentsObj);Ce.append(st)}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const st of this.trigger)st.addEventListener("click",this._toggle.bind(this)),st.addEventListener("mouseover",this._show.bind(this,!1)),st.addEventListener("mouseout",this._hide.bind(this,!1));return Ce.addEventListener("click",this._hide.bind(this,!0)),be.append(Ce),be}_formatContents({str:le,dir:be}){const Ce=document.createElement("p");Ce.classList.add("popupContent"),Ce.dir=be;const Fe=le.split(/(?:\r\n?|\n)/);for(let Ie=0,Xe=Fe.length;Ie<Xe;++Ie){const tt=Fe[Ie];Ce.append(document.createTextNode(tt)),Ie<Xe-1&&Ce.append(document.createElement("br"))}return Ce}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(le=!1){le&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(le=!0){le&&(this.pinned=!1),!this.hideElement.hidden&&!this.pinned&&(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class ae extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0}),this.textContent=le.data.textContent}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const le=document.createElement("div");le.classList.add("annotationTextContent"),le.setAttribute("role","comment");for(const be of this.textContent){const Ce=document.createElement("span");Ce.textContent=be,le.append(Ce)}this.container.append(le)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class ge extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const le=this.data,{width:be,height:Ce}=de(le.rect),Fe=this.svgFactory.create(be,Ce,!0),Ie=this.svgFactory.createElement("svg:line");return Ie.setAttribute("x1",le.rect[2]-le.lineCoordinates[0]),Ie.setAttribute("y1",le.rect[3]-le.lineCoordinates[1]),Ie.setAttribute("x2",le.rect[2]-le.lineCoordinates[2]),Ie.setAttribute("y2",le.rect[3]-le.lineCoordinates[3]),Ie.setAttribute("stroke-width",le.borderStyle.width||1),Ie.setAttribute("stroke","transparent"),Ie.setAttribute("fill","transparent"),Fe.append(Ie),this.container.append(Fe),this._createPopup(Ie,le),this.container}}class $e extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const le=this.data,{width:be,height:Ce}=de(le.rect),Fe=this.svgFactory.create(be,Ce,!0),Ie=le.borderStyle.width,Xe=this.svgFactory.createElement("svg:rect");return Xe.setAttribute("x",Ie/2),Xe.setAttribute("y",Ie/2),Xe.setAttribute("width",be-Ie),Xe.setAttribute("height",Ce-Ie),Xe.setAttribute("stroke-width",Ie||1),Xe.setAttribute("stroke","transparent"),Xe.setAttribute("fill","transparent"),Fe.append(Xe),this.container.append(Fe),this._createPopup(Xe,le),this.container}}class _e extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const le=this.data,{width:be,height:Ce}=de(le.rect),Fe=this.svgFactory.create(be,Ce,!0),Ie=le.borderStyle.width,Xe=this.svgFactory.createElement("svg:ellipse");return Xe.setAttribute("cx",be/2),Xe.setAttribute("cy",Ce/2),Xe.setAttribute("rx",be/2-Ie/2),Xe.setAttribute("ry",Ce/2-Ie/2),Xe.setAttribute("stroke-width",Ie||1),Xe.setAttribute("stroke","transparent"),Xe.setAttribute("fill","transparent"),Fe.append(Xe),this.container.append(Fe),this._createPopup(Xe,le),this.container}}class Me extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const le=this.data,{width:be,height:Ce}=de(le.rect),Fe=this.svgFactory.create(be,Ce,!0);let Ie=[];for(const tt of le.vertices){const Ze=tt.x-le.rect[0],st=le.rect[3]-tt.y;Ie.push(Ze+","+st)}Ie=Ie.join(" ");const Xe=this.svgFactory.createElement(this.svgElementName);return Xe.setAttribute("points",Ie),Xe.setAttribute("stroke-width",le.borderStyle.width||1),Xe.setAttribute("stroke","transparent"),Xe.setAttribute("fill","transparent"),Fe.append(Xe),this.container.append(Fe),this._createPopup(Xe,le),this.container}}class We extends Me{constructor(le){super(le),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ze extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class Qe extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const le=this.data,{width:be,height:Ce}=de(le.rect),Fe=this.svgFactory.create(be,Ce,!0);for(const Ie of le.inkLists){let Xe=[];for(const Ze of Ie){const st=Ze.x-le.rect[0],ot=le.rect[3]-Ze.y;Xe.push(`${st},${ot}`)}Xe=Xe.join(" ");const tt=this.svgFactory.createElement(this.svgElementName);tt.setAttribute("points",Xe),tt.setAttribute("stroke-width",le.borderStyle.width||1),tt.setAttribute("stroke","transparent"),tt.setAttribute("fill","transparent"),this._createPopup(tt,le),Fe.append(tt)}return this.container.append(Fe),this.container}}class ct extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.classList.add("highlightAnnotation"),this.container)}}class it extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.classList.add("underlineAnnotation"),this.container)}}class ht extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.classList.add("squigglyAnnotation"),this.container)}}class at extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.classList.add("strikeoutAnnotation"),this.container)}}class gt extends Se{constructor(le){var Ce,Fe,Ie;const be=!!(le.data.hasPopup||(Ce=le.data.titleObj)!=null&&Ce.str||(Fe=le.data.contentsObj)!=null&&Fe.str||(Ie=le.data.richText)!=null&&Ie.str);super(le,{isRenderable:be,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class dt extends Se{constructor(le){var Fe;super(le,{isRenderable:!0});const{filename:be,content:Ce}=this.data.file;this.filename=(0,se.getFilenameFromUrl)(be,!0),this.content=Ce,(Fe=this.linkService.eventBus)==null||Fe.dispatch("fileattachmentannotation",{source:this,filename:be,content:Ce})}render(){var be,Ce;this.container.classList.add("fileAttachmentAnnotation");let le;return this.data.hasAppearance?le=document.createElement("div"):(le=document.createElement("img"),le.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`),le.classList.add("popupTriggerArea"),le.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&((be=this.data.titleObj)!=null&&be.str||(Ce=this.data.contentsObj)!=null&&Ce.str||this.data.richText)&&this._createPopup(le,this.data),this.container.append(le),this.container}_download(){var le;(le=this.downloadManager)==null||le.openOrDownloadData(this.container,this.content,this.filename)}}const Ue=class Ue{static render(le){var Ze,st;const{annotations:be,div:Ce,viewport:Fe,accessibilityManager:Ie}=le;(0,se.setLayerDimensions)(Ce,Fe);const Xe={data:null,layer:Ce,page:le.page,viewport:Fe,linkService:le.linkService,downloadManager:le.downloadManager,imageResourcesPath:le.imageResourcesPath||"",renderForms:le.renderForms!==!1,svgFactory:new se.DOMSVGFactory,annotationStorage:le.annotationStorage||new ie.AnnotationStorage,enableScripting:le.enableScripting===!0,hasJSActions:le.hasJSActions,fieldObjects:le.fieldObjects};let tt=0;for(const ot of be){if(ot.noHTML)continue;if(ot.annotationType!==re.AnnotationType.POPUP){const{width:ft,height:pt}=de(ot.rect);if(ft<=0||pt<=0)continue}Xe.data=ot;const et=Ae.create(Xe);if(!et.isRenderable)continue;const nt=et.render();if(ot.hidden&&(nt.style.visibility="hidden"),Array.isArray(nt))for(const ft of nt)ft.style.zIndex=tt++,rt(Ze=Ue,Ge,Qn).call(Ze,ft,ot.id,Ce,Ie);else nt.style.zIndex=tt++,et instanceof Ne?Ce.prepend(nt):rt(st=Ue,Ge,Qn).call(st,nt,ot.id,Ce,Ie)}rt(this,Ke,er).call(this,Ce,le.annotationCanvasMap)}static update(le){const{annotationCanvasMap:be,div:Ce,viewport:Fe}=le;(0,se.setLayerDimensions)(Ce,{rotation:Fe.rotation}),rt(this,Ke,er).call(this,Ce,be),Ce.hidden=!1}};Ge=new WeakSet,Qn=function(le,be,Ce,Fe){const Ie=le.firstChild||le;Ie.id=`${se.AnnotationPrefix}${be}`,Ce.append(le),Fe==null||Fe.moveElementInDOM(Ce,le,Ie,!1)},Ke=new WeakSet,er=function(le,be){if(be){for(const[Ce,Fe]of be){const Ie=le.querySelector(`[data-annotation-id="${Ce}"]`);if(!Ie)continue;const{firstChild:Xe}=Ie;Xe?Xe.nodeName==="CANVAS"?Xe.replaceWith(Fe):Xe.before(Fe):Ie.append(Fe)}be.clear()}},Je(Ue,Ge),Je(Ue,Ke);let yt=Ue;ee.AnnotationLayer=yt},(te,ee)=>{Object.defineProperty(ee,"__esModule",{value:!0}),ee.ColorConverters=void 0;function ne(se){return Math.floor(Math.max(0,Math.min(1,se))*255).toString(16).padStart(2,"0")}class re{static CMYK_G([ie,oe,me,pe]){return["G",1-Math.min(1,.3*ie+.59*me+.11*oe+pe)]}static G_CMYK([ie]){return["CMYK",0,0,0,1-ie]}static G_RGB([ie]){return["RGB",ie,ie,ie]}static G_HTML([ie]){const oe=ne(ie);return`#${oe}${oe}${oe}`}static RGB_G([ie,oe,me]){return["G",.3*ie+.59*oe+.11*me]}static RGB_HTML([ie,oe,me]){const pe=ne(ie),he=ne(oe),ue=ne(me);return`#${pe}${he}${ue}`}static T_HTML(){return"#00000000"}static CMYK_RGB([ie,oe,me,pe]){return["RGB",1-Math.min(1,ie+pe),1-Math.min(1,me+pe),1-Math.min(1,oe+pe)]}static CMYK_HTML(ie){const oe=this.CMYK_RGB(ie).slice(1);return this.RGB_HTML(oe)}static RGB_CMYK([ie,oe,me]){const pe=1-ie,he=1-oe,ue=1-me,de=Math.min(pe,he,ue);return["CMYK",pe,he,ue,de]}}ee.ColorConverters=re},(te,ee,ne)=>{Object.defineProperty(ee,"__esModule",{value:!0}),ee.XfaLayer=void 0;var re=ne(19);class se{static setupStorage(oe,me,pe,he,ue){const de=he.getValue(me,{value:null});switch(pe.name){case"textarea":if(de.value!==null&&(oe.textContent=de.value),ue==="print")break;oe.addEventListener("input",Ae=>{he.setValue(me,{value:Ae.target.value})});break;case"input":if(pe.attributes.type==="radio"||pe.attributes.type==="checkbox"){if(de.value===pe.attributes.xfaOn?oe.setAttribute("checked",!0):de.value===pe.attributes.xfaOff&&oe.removeAttribute("checked"),ue==="print")break;oe.addEventListener("change",Ae=>{he.setValue(me,{value:Ae.target.checked?Ae.target.getAttribute("xfaOn"):Ae.target.getAttribute("xfaOff")})})}else{if(de.value!==null&&oe.setAttribute("value",de.value),ue==="print")break;oe.addEventListener("input",Ae=>{he.setValue(me,{value:Ae.target.value})})}break;case"select":if(de.value!==null)for(const Ae of pe.children)Ae.attributes.value===de.value&&(Ae.attributes.selected=!0);oe.addEventListener("input",Ae=>{const Se=Ae.target.options,ce=Se.selectedIndex===-1?"":Se[Se.selectedIndex].value;he.setValue(me,{value:ce})});break}}static setAttributes({html:oe,element:me,storage:pe=null,intent:he,linkService:ue}){const{attributes:de}=me,Ae=oe instanceof HTMLAnchorElement;de.type==="radio"&&(de.name=`${de.name}-${he}`);for(const[Se,ce]of Object.entries(de))if(ce!=null)switch(Se){case"class":ce.length&&oe.setAttribute(Se,ce.join(" "));break;case"dataId":break;case"id":oe.setAttribute("data-element-id",ce);break;case"style":Object.assign(oe.style,ce);break;case"textContent":oe.textContent=ce;break;default:(!Ae||Se!=="href"&&Se!=="newWindow")&&oe.setAttribute(Se,ce)}Ae&&ue.addLinkAttributes(oe,de.href,de.newWindow),pe&&de.dataId&&this.setupStorage(oe,de.dataId,me,pe)}static render(oe){var fe;const me=oe.annotationStorage,pe=oe.linkService,he=oe.xfaHtml,ue=oe.intent||"display",de=document.createElement(he.name);he.attributes&&this.setAttributes({html:de,element:he,intent:ue,linkService:pe});const Ae=[[he,-1,de]],Se=oe.div;if(Se.append(de),oe.viewport){const ye=`matrix(${oe.viewport.transform.join(",")})`;Se.style.transform=ye}ue!=="richText"&&Se.setAttribute("class","xfaLayer xfaFont");const ce=[];for(;Ae.length>0;){const[ye,ve,Pe]=Ae.at(-1);if(ve+1===ye.children.length){Ae.pop();continue}const we=ye.children[++Ae.at(-1)[1]];if(we===null)continue;const{name:Te}=we;if(Te==="#text"){const Ne=document.createTextNode(we.value);ce.push(Ne),Pe.append(Ne);continue}let Le;if((fe=we==null?void 0:we.attributes)!=null&&fe.xmlns?Le=document.createElementNS(we.attributes.xmlns,Te):Le=document.createElement(Te),Pe.append(Le),we.attributes&&this.setAttributes({html:Le,element:we,storage:me,intent:ue,linkService:pe}),we.children&&we.children.length>0)Ae.push([we,-1,Le]);else if(we.value){const Ne=document.createTextNode(we.value);re.XfaText.shouldBuildText(Te)&&ce.push(Ne),Le.append(Ne)}}for(const ye of Se.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))ye.setAttribute("readOnly",!0);return{textDivs:ce}}static update(oe){const me=`matrix(${oe.viewport.transform.join(",")})`;oe.div.style.transform=me,oe.div.hidden=!1}}ee.XfaLayer=se},(te,ee,ne)=>{Object.defineProperty(ee,"__esModule",{value:!0}),ee.SVGGraphics=void 0;var re=ne(6),se=ne(1),ie=ne(10);let oe=class{constructor(){(0,se.unreachable)("Not implemented: SVGGraphics")}};ee.SVGGraphics=oe;{let Pe=function(ae){let ge=[];const $e=[];for(const _e of ae){if(_e.fn==="save"){ge.push({fnId:92,fn:"group",items:[]}),$e.push(ge),ge=ge.at(-1).items;continue}_e.fn==="restore"?ge=$e.pop():ge.push(_e)}return ge},we=function(ae){if(Number.isInteger(ae))return ae.toString();const ge=ae.toFixed(10);let $e=ge.length-1;if(ge[$e]!=="0")return ge;do $e--;while(ge[$e]==="0");return ge.substring(0,ge[$e]==="."?$e:$e+1)},Te=function(ae){if(ae[4]===0&&ae[5]===0){if(ae[1]===0&&ae[2]===0)return ae[0]===1&&ae[3]===1?"":`scale(${we(ae[0])} ${we(ae[3])})`;if(ae[0]===ae[3]&&ae[1]===-ae[2]){const ge=Math.acos(ae[0])*180/Math.PI;return`rotate(${we(ge)})`}}else if(ae[0]===1&&ae[1]===0&&ae[2]===0&&ae[3]===1)return`translate(${we(ae[4])} ${we(ae[5])})`;return`matrix(${we(ae[0])} ${we(ae[1])} ${we(ae[2])} ${we(ae[3])} ${we(ae[4])} ${we(ae[5])})`};var me=Pe,pe=we,he=Te;const ue={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},de="http://www.w3.org/XML/1998/namespace",Ae="http://www.w3.org/1999/xlink",Se=["butt","round","square"],ce=["miter","round","bevel"],fe=function(ae,ge="",$e=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!$e)return URL.createObjectURL(new Blob([ae],{type:ge}));const _e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let Me=`data:${ge};base64,`;for(let We=0,ze=ae.length;We<ze;We+=3){const Qe=ae[We]&255,ct=ae[We+1]&255,it=ae[We+2]&255,ht=Qe>>2,at=(Qe&3)<<4|ct>>4,gt=We+1<ze?(ct&15)<<2|it>>6:64,dt=We+2<ze?it&63:64;Me+=_e[ht]+_e[at]+_e[gt]+_e[dt]}return Me},ye=function(){const ae=new Uint8Array([137,80,78,71,13,10,26,10]),ge=12,$e=new Int32Array(256);for(let it=0;it<256;it++){let ht=it;for(let at=0;at<8;at++)ht&1?ht=3988292384^ht>>1&2147483647:ht=ht>>1&2147483647;$e[it]=ht}function _e(it,ht,at){let gt=-1;for(let dt=ht;dt<at;dt++){const yt=(gt^it[dt])&255,mt=$e[yt];gt=gt>>>8^mt}return gt^-1}function Me(it,ht,at,gt){let dt=gt;const yt=ht.length;at[dt]=yt>>24&255,at[dt+1]=yt>>16&255,at[dt+2]=yt>>8&255,at[dt+3]=yt&255,dt+=4,at[dt]=it.charCodeAt(0)&255,at[dt+1]=it.charCodeAt(1)&255,at[dt+2]=it.charCodeAt(2)&255,at[dt+3]=it.charCodeAt(3)&255,dt+=4,at.set(ht,dt),dt+=ht.length;const mt=_e(at,gt+4,dt);at[dt]=mt>>24&255,at[dt+1]=mt>>16&255,at[dt+2]=mt>>8&255,at[dt+3]=mt&255}function We(it,ht,at){let gt=1,dt=0;for(let yt=ht;yt<at;++yt)gt=(gt+(it[yt]&255))%65521,dt=(dt+gt)%65521;return dt<<16|gt}function ze(it){if(!ie.isNodeJS)return Qe(it);try{let ht;parseInt(process.versions.node)>=8?ht=it:ht=Buffer.from(it);const at=require$$5.deflateSync(ht,{level:9});return at instanceof Uint8Array?at:new Uint8Array(at)}catch(ht){(0,se.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+ht)}return Qe(it)}function Qe(it){let ht=it.length;const at=65535,gt=Math.ceil(ht/at),dt=new Uint8Array(2+ht+gt*5+4);let yt=0;dt[yt++]=120,dt[yt++]=156;let mt=0;for(;ht>at;)dt[yt++]=0,dt[yt++]=255,dt[yt++]=255,dt[yt++]=0,dt[yt++]=0,dt.set(it.subarray(mt,mt+at),yt),yt+=at,mt+=at,ht-=at;dt[yt++]=1,dt[yt++]=ht&255,dt[yt++]=ht>>8&255,dt[yt++]=~ht&65535&255,dt[yt++]=(~ht&65535)>>8&255,dt.set(it.subarray(mt),yt),yt+=it.length-mt;const qe=We(it,0,it.length);return dt[yt++]=qe>>24&255,dt[yt++]=qe>>16&255,dt[yt++]=qe>>8&255,dt[yt++]=qe&255,dt}function ct(it,ht,at,gt){const dt=it.width,yt=it.height;let mt,qe,Ee;const xe=it.data;switch(ht){case se.ImageKind.GRAYSCALE_1BPP:qe=0,mt=1,Ee=dt+7>>3;break;case se.ImageKind.RGB_24BPP:qe=2,mt=8,Ee=dt*3;break;case se.ImageKind.RGBA_32BPP:qe=6,mt=8,Ee=dt*4;break;default:throw new Error("invalid format")}const Oe=new Uint8Array((1+Ee)*yt);let Ge=0,Ve=0;for(let be=0;be<yt;++be)Oe[Ge++]=0,Oe.set(xe.subarray(Ve,Ve+Ee),Ge),Ve+=Ee,Ge+=Ee;if(ht===se.ImageKind.GRAYSCALE_1BPP&>){Ge=0;for(let be=0;be<yt;be++){Ge++;for(let Ce=0;Ce<Ee;Ce++)Oe[Ge++]^=255}}const Ke=new Uint8Array([dt>>24&255,dt>>16&255,dt>>8&255,dt&255,yt>>24&255,yt>>16&255,yt>>8&255,yt&255,mt,qe,0,0,0]),je=ze(Oe),Ue=ae.length+ge*3+Ke.length+je.length,Be=new Uint8Array(Ue);let le=0;return Be.set(ae,le),le+=ae.length,Me("IHDR",Ke,Be,le),le+=ge+Ke.length,Me("IDATA",je,Be,le),le+=ge+je.length,Me("IEND",new Uint8Array(0),Be,le),fe(Be,"image/png",at)}return function(ht,at,gt){const dt=ht.kind===void 0?se.ImageKind.GRAYSCALE_1BPP:ht.kind;return ct(ht,dt,at,gt)}}();class ve{constructor(){this.fontSizeScale=1,this.fontWeight=ue.fontWeight,this.fontSize=0,this.textMatrix=se.IDENTITY_MATRIX,this.fontMatrix=se.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=se.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=ue.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(ge,$e){this.x=ge,this.y=$e}}let Le=0,Ne=0,ke=0;ee.SVGGraphics=oe=class{constructor(ae,ge,$e=!1){(0,re.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new re.DOMSVGFactory,this.current=new ve,this.transformMatrix=se.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=ae,this.objs=ge,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!$e,this._operatorIdMapping=[];for(const _e in se.OPS)this._operatorIdMapping[se.OPS[_e]]=_e}getObject(ae,ge=null){return typeof ae=="string"?ae.startsWith("g_")?this.commonObjs.get(ae):this.objs.get(ae):ge}save(){this.transformStack.push(this.transformMatrix);const ae=this.current;this.extraStack.push(ae),this.current=ae.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(ae){this.save(),this.executeOpTree(ae),this.restore()}loadDependencies(ae){const ge=ae.fnArray,$e=ae.argsArray;for(let _e=0,Me=ge.length;_e<Me;_e++)if(ge[_e]===se.OPS.dependency)for(const We of $e[_e]){const ze=We.startsWith("g_")?this.commonObjs:this.objs,Qe=new Promise(ct=>{ze.get(We,ct)});this.current.dependencies.push(Qe)}return Promise.all(this.current.dependencies)}transform(ae,ge,$e,_e,Me,We){const ze=[ae,ge,$e,_e,Me,We];this.transformMatrix=se.Util.transform(this.transformMatrix,ze),this.tgrp=null}getSVG(ae,ge){this.viewport=ge;const $e=this._initialize(ge);return this.loadDependencies(ae).then(()=>(this.transformMatrix=se.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(ae)),$e))}convertOpList(ae){const ge=this._operatorIdMapping,$e=ae.argsArray,_e=ae.fnArray,Me=[];for(let We=0,ze=_e.length;We<ze;We++){const Qe=_e[We];Me.push({fnId:Qe,fn:ge[Qe],args:$e[We]})}return Pe(Me)}executeOpTree(ae){for(const ge of ae){const $e=ge.fn,_e=ge.fnId,Me=ge.args;switch(_e|0){case se.OPS.beginText:this.beginText();break;case se.OPS.dependency:break;case se.OPS.setLeading:this.setLeading(Me);break;case se.OPS.setLeadingMoveText:this.setLeadingMoveText(Me[0],Me[1]);break;case se.OPS.setFont:this.setFont(Me);break;case se.OPS.showText:this.showText(Me[0]);break;case se.OPS.showSpacedText:this.showText(Me[0]);break;case se.OPS.endText:this.endText();break;case se.OPS.moveText:this.moveText(Me[0],Me[1]);break;case se.OPS.setCharSpacing:this.setCharSpacing(Me[0]);break;case se.OPS.setWordSpacing:this.setWordSpacing(Me[0]);break;case se.OPS.setHScale:this.setHScale(Me[0]);break;case se.OPS.setTextMatrix:this.setTextMatrix(Me[0],Me[1],Me[2],Me[3],Me[4],Me[5]);break;case se.OPS.setTextRise:this.setTextRise(Me[0]);break;case se.OPS.setTextRenderingMode:this.setTextRenderingMode(Me[0]);break;case se.OPS.setLineWidth:this.setLineWidth(Me[0]);break;case se.OPS.setLineJoin:this.setLineJoin(Me[0]);break;case se.OPS.setLineCap:this.setLineCap(Me[0]);break;case se.OPS.setMiterLimit:this.setMiterLimit(Me[0]);break;case se.OPS.setFillRGBColor:this.setFillRGBColor(Me[0],Me[1],Me[2]);break;case se.OPS.setStrokeRGBColor:this.setStrokeRGBColor(Me[0],Me[1],Me[2]);break;case se.OPS.setStrokeColorN:this.setStrokeColorN(Me);break;case se.OPS.setFillColorN:this.setFillColorN(Me);break;case se.OPS.shadingFill:this.shadingFill(Me[0]);break;case se.OPS.setDash:this.setDash(Me[0],Me[1]);break;case se.OPS.setRenderingIntent:this.setRenderingIntent(Me[0]);break;case se.OPS.setFlatness:this.setFlatness(Me[0]);break;case se.OPS.setGState:this.setGState(Me[0]);break;case se.OPS.fill:this.fill();break;case se.OPS.eoFill:this.eoFill();break;case se.OPS.stroke:this.stroke();break;case se.OPS.fillStroke:this.fillStroke();break;case se.OPS.eoFillStroke:this.eoFillStroke();break;case se.OPS.clip:this.clip("nonzero");break;case se.OPS.eoClip:this.clip("evenodd");break;case se.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case se.OPS.paintImageXObject:this.paintImageXObject(Me[0]);break;case se.OPS.paintInlineImageXObject:this.paintInlineImageXObject(Me[0]);break;case se.OPS.paintImageMaskXObject:this.paintImageMaskXObject(Me[0]);break;case se.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(Me[0],Me[1]);break;case se.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case se.OPS.closePath:this.closePath();break;case se.OPS.closeStroke:this.closeStroke();break;case se.OPS.closeFillStroke:this.closeFillStroke();break;case se.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case se.OPS.nextLine:this.nextLine();break;case se.OPS.transform:this.transform(Me[0],Me[1],Me[2],Me[3],Me[4],Me[5]);break;case se.OPS.constructPath:this.constructPath(Me[0],Me[1]);break;case se.OPS.endPath:this.endPath();break;case 92:this.group(ge.items);break;default:(0,se.warn)(`Unimplemented operator ${$e}`);break}}}setWordSpacing(ae){this.current.wordSpacing=ae}setCharSpacing(ae){this.current.charSpacing=ae}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(ae,ge,$e,_e,Me,We){const ze=this.current;ze.textMatrix=ze.lineMatrix=[ae,ge,$e,_e,Me,We],ze.textMatrixScale=Math.hypot(ae,ge),ze.x=ze.lineX=0,ze.y=ze.lineY=0,ze.xcoords=[],ze.ycoords=[],ze.tspan=this.svgFactory.createElement("svg:tspan"),ze.tspan.setAttributeNS(null,"font-family",ze.fontFamily),ze.tspan.setAttributeNS(null,"font-size",`${we(ze.fontSize)}px`),ze.tspan.setAttributeNS(null,"y",we(-ze.y)),ze.txtElement=this.svgFactory.createElement("svg:text"),ze.txtElement.append(ze.tspan)}beginText(){const ae=this.current;ae.x=ae.lineX=0,ae.y=ae.lineY=0,ae.textMatrix=se.IDENTITY_MATRIX,ae.lineMatrix=se.IDENTITY_MATRIX,ae.textMatrixScale=1,ae.tspan=this.svgFactory.createElement("svg:tspan"),ae.txtElement=this.svgFactory.createElement("svg:text"),ae.txtgrp=this.svgFactory.createElement("svg:g"),ae.xcoords=[],ae.ycoords=[]}moveText(ae,ge){const $e=this.current;$e.x=$e.lineX+=ae,$e.y=$e.lineY+=ge,$e.xcoords=[],$e.ycoords=[],$e.tspan=this.svgFactory.createElement("svg:tspan"),$e.tspan.setAttributeNS(null,"font-family",$e.fontFamily),$e.tspan.setAttributeNS(null,"font-size",`${we($e.fontSize)}px`),$e.tspan.setAttributeNS(null,"y",we(-$e.y))}showText(ae){const ge=this.current,$e=ge.font,_e=ge.fontSize;if(_e===0)return;const Me=ge.fontSizeScale,We=ge.charSpacing,ze=ge.wordSpacing,Qe=ge.fontDirection,ct=ge.textHScale*Qe,it=$e.vertical,ht=it?1:-1,at=$e.defaultVMetrics,gt=_e*ge.fontMatrix[0];let dt=0;for(const qe of ae){if(qe===null){dt+=Qe*ze;continue}else if(typeof qe=="number"){dt+=ht*qe*_e/1e3;continue}const Ee=(qe.isSpace?ze:0)+We,xe=qe.fontChar;let Oe,Ge,Ve=qe.width;if(it){let je;const Ue=qe.vmetric||at;je=qe.vmetric?Ue[1]:Ve*.5,je=-je*gt;const Be=Ue[2]*gt;Ve=Ue?-Ue[0]:Ve,Oe=je/Me,Ge=(dt+Be)/Me}else Oe=dt/Me,Ge=0;(qe.isInFont||$e.missingFile)&&(ge.xcoords.push(ge.x+Oe),it&&ge.ycoords.push(-ge.y+Ge),ge.tspan.textContent+=xe);let Ke;it?Ke=Ve*gt-Ee*Qe:Ke=Ve*gt+Ee*Qe,dt+=Ke}ge.tspan.setAttributeNS(null,"x",ge.xcoords.map(we).join(" ")),it?ge.tspan.setAttributeNS(null,"y",ge.ycoords.map(we).join(" ")):ge.tspan.setAttributeNS(null,"y",we(-ge.y)),it?ge.y-=dt:ge.x+=dt*ct,ge.tspan.setAttributeNS(null,"font-family",ge.fontFamily),ge.tspan.setAttributeNS(null,"font-size",`${we(ge.fontSize)}px`),ge.fontStyle!==ue.fontStyle&&ge.tspan.setAttributeNS(null,"font-style",ge.fontStyle),ge.fontWeight!==ue.fontWeight&&ge.tspan.setAttributeNS(null,"font-weight",ge.fontWeight);const yt=ge.textRenderingMode&se.TextRenderingMode.FILL_STROKE_MASK;if(yt===se.TextRenderingMode.FILL||yt===se.TextRenderingMode.FILL_STROKE?(ge.fillColor!==ue.fillColor&&ge.tspan.setAttributeNS(null,"fill",ge.fillColor),ge.fillAlpha<1&&ge.tspan.setAttributeNS(null,"fill-opacity",ge.fillAlpha)):ge.textRenderingMode===se.TextRenderingMode.ADD_TO_PATH?ge.tspan.setAttributeNS(null,"fill","transparent"):ge.tspan.setAttributeNS(null,"fill","none"),yt===se.TextRenderingMode.STROKE||yt===se.TextRenderingMode.FILL_STROKE){const qe=1/(ge.textMatrixScale||1);this._setStrokeAttributes(ge.tspan,qe)}let mt=ge.textMatrix;ge.textRise!==0&&(mt=mt.slice(),mt[5]+=ge.textRise),ge.txtElement.setAttributeNS(null,"transform",`${Te(mt)} scale(${we(ct)}, -1)`),ge.txtElement.setAttributeNS(de,"xml:space","preserve"),ge.txtElement.append(ge.tspan),ge.txtgrp.append(ge.txtElement),this._ensureTransformGroup().append(ge.txtElement)}setLeadingMoveText(ae,ge){this.setLeading(-ge),this.moveText(ae,ge)}addFontStyle(ae){if(!ae.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const ge=fe(ae.data,ae.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${ae.loadedName}"; src: url(${ge}); }
|
|
51
51
|
`}setFont(ae){const ge=this.current,$e=this.commonObjs.get(ae[0]);let _e=ae[1];ge.font=$e,this.embedFonts&&!$e.missingFile&&!this.embeddedFonts[$e.loadedName]&&(this.addFontStyle($e),this.embeddedFonts[$e.loadedName]=$e),ge.fontMatrix=$e.fontMatrix||se.FONT_IDENTITY_MATRIX;let Me="normal";$e.black?Me="900":$e.bold&&(Me="bold");const We=$e.italic?"italic":"normal";_e<0?(_e=-_e,ge.fontDirection=-1):ge.fontDirection=1,ge.fontSize=_e,ge.fontFamily=$e.loadedName,ge.fontWeight=Me,ge.fontStyle=We,ge.tspan=this.svgFactory.createElement("svg:tspan"),ge.tspan.setAttributeNS(null,"y",we(-ge.y)),ge.xcoords=[],ge.ycoords=[]}endText(){var ge;const ae=this.current;ae.textRenderingMode&se.TextRenderingMode.ADD_TO_PATH_FLAG&&((ge=ae.txtElement)!=null&&ge.hasChildNodes())&&(ae.element=ae.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(ae){ae>0&&(this.current.lineWidth=ae)}setLineCap(ae){this.current.lineCap=Se[ae]}setLineJoin(ae){this.current.lineJoin=ce[ae]}setMiterLimit(ae){this.current.miterLimit=ae}setStrokeAlpha(ae){this.current.strokeAlpha=ae}setStrokeRGBColor(ae,ge,$e){this.current.strokeColor=se.Util.makeHexColor(ae,ge,$e)}setFillAlpha(ae){this.current.fillAlpha=ae}setFillRGBColor(ae,ge,$e){this.current.fillColor=se.Util.makeHexColor(ae,ge,$e),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(ae){this.current.strokeColor=this._makeColorN_Pattern(ae)}setFillColorN(ae){this.current.fillColor=this._makeColorN_Pattern(ae)}shadingFill(ae){const ge=this.viewport.width,$e=this.viewport.height,_e=se.Util.inverseTransform(this.transformMatrix),Me=se.Util.applyTransform([0,0],_e),We=se.Util.applyTransform([0,$e],_e),ze=se.Util.applyTransform([ge,0],_e),Qe=se.Util.applyTransform([ge,$e],_e),ct=Math.min(Me[0],We[0],ze[0],Qe[0]),it=Math.min(Me[1],We[1],ze[1],Qe[1]),ht=Math.max(Me[0],We[0],ze[0],Qe[0]),at=Math.max(Me[1],We[1],ze[1],Qe[1]),gt=this.svgFactory.createElement("svg:rect");gt.setAttributeNS(null,"x",ct),gt.setAttributeNS(null,"y",it),gt.setAttributeNS(null,"width",ht-ct),gt.setAttributeNS(null,"height",at-it),gt.setAttributeNS(null,"fill",this._makeShadingPattern(ae)),this.current.fillAlpha<1&>.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(gt)}_makeColorN_Pattern(ae){return ae[0]==="TilingPattern"?this._makeTilingPattern(ae):this._makeShadingPattern(ae)}_makeTilingPattern(ae){const ge=ae[1],$e=ae[2],_e=ae[3]||se.IDENTITY_MATRIX,[Me,We,ze,Qe]=ae[4],ct=ae[5],it=ae[6],ht=ae[7],at=`shading${ke++}`,[gt,dt,yt,mt]=se.Util.normalizeRect([...se.Util.applyTransform([Me,We],_e),...se.Util.applyTransform([ze,Qe],_e)]),[qe,Ee]=se.Util.singularValueDecompose2dScale(_e),xe=ct*qe,Oe=it*Ee,Ge=this.svgFactory.createElement("svg:pattern");Ge.setAttributeNS(null,"id",at),Ge.setAttributeNS(null,"patternUnits","userSpaceOnUse"),Ge.setAttributeNS(null,"width",xe),Ge.setAttributeNS(null,"height",Oe),Ge.setAttributeNS(null,"x",`${gt}`),Ge.setAttributeNS(null,"y",`${dt}`);const Ve=this.svg,Ke=this.transformMatrix,je=this.current.fillColor,Ue=this.current.strokeColor,Be=this.svgFactory.create(yt-gt,mt-dt);if(this.svg=Be,this.transformMatrix=_e,ht===2){const le=se.Util.makeHexColor(...ge);this.current.fillColor=le,this.current.strokeColor=le}return this.executeOpTree(this.convertOpList($e)),this.svg=Ve,this.transformMatrix=Ke,this.current.fillColor=je,this.current.strokeColor=Ue,Ge.append(Be.childNodes[0]),this.defs.append(Ge),`url(#${at})`}_makeShadingPattern(ae){switch(typeof ae=="string"&&(ae=this.objs.get(ae)),ae[0]){case"RadialAxial":const ge=`shading${ke++}`,$e=ae[3];let _e;switch(ae[1]){case"axial":const Me=ae[4],We=ae[5];_e=this.svgFactory.createElement("svg:linearGradient"),_e.setAttributeNS(null,"id",ge),_e.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),_e.setAttributeNS(null,"x1",Me[0]),_e.setAttributeNS(null,"y1",Me[1]),_e.setAttributeNS(null,"x2",We[0]),_e.setAttributeNS(null,"y2",We[1]);break;case"radial":const ze=ae[4],Qe=ae[5],ct=ae[6],it=ae[7];_e=this.svgFactory.createElement("svg:radialGradient"),_e.setAttributeNS(null,"id",ge),_e.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),_e.setAttributeNS(null,"cx",Qe[0]),_e.setAttributeNS(null,"cy",Qe[1]),_e.setAttributeNS(null,"r",it),_e.setAttributeNS(null,"fx",ze[0]),_e.setAttributeNS(null,"fy",ze[1]),_e.setAttributeNS(null,"fr",ct);break;default:throw new Error(`Unknown RadialAxial type: ${ae[1]}`)}for(const Me of $e){const We=this.svgFactory.createElement("svg:stop");We.setAttributeNS(null,"offset",Me[0]),We.setAttributeNS(null,"stop-color",Me[1]),_e.append(We)}return this.defs.append(_e),`url(#${ge})`;case"Mesh":return(0,se.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${ae[0]}`)}}setDash(ae,ge){this.current.dashArray=ae,this.current.dashPhase=ge}constructPath(ae,ge){const $e=this.current;let _e=$e.x,Me=$e.y,We=[],ze=0;for(const Qe of ae)switch(Qe|0){case se.OPS.rectangle:_e=ge[ze++],Me=ge[ze++];const ct=ge[ze++],it=ge[ze++],ht=_e+ct,at=Me+it;We.push("M",we(_e),we(Me),"L",we(ht),we(Me),"L",we(ht),we(at),"L",we(_e),we(at),"Z");break;case se.OPS.moveTo:_e=ge[ze++],Me=ge[ze++],We.push("M",we(_e),we(Me));break;case se.OPS.lineTo:_e=ge[ze++],Me=ge[ze++],We.push("L",we(_e),we(Me));break;case se.OPS.curveTo:_e=ge[ze+4],Me=ge[ze+5],We.push("C",we(ge[ze]),we(ge[ze+1]),we(ge[ze+2]),we(ge[ze+3]),we(_e),we(Me)),ze+=6;break;case se.OPS.curveTo2:We.push("C",we(_e),we(Me),we(ge[ze]),we(ge[ze+1]),we(ge[ze+2]),we(ge[ze+3])),_e=ge[ze+2],Me=ge[ze+3],ze+=4;break;case se.OPS.curveTo3:_e=ge[ze+2],Me=ge[ze+3],We.push("C",we(ge[ze]),we(ge[ze+1]),we(_e),we(Me),we(_e),we(Me)),ze+=4;break;case se.OPS.closePath:We.push("Z");break}We=We.join(" "),$e.path&&ae.length>0&&ae[0]!==se.OPS.rectangle&&ae[0]!==se.OPS.moveTo?We=$e.path.getAttributeNS(null,"d")+We:($e.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append($e.path)),$e.path.setAttributeNS(null,"d",We),$e.path.setAttributeNS(null,"fill","none"),$e.element=$e.path,$e.setCurrentPoint(_e,Me)}endPath(){const ae=this.current;if(ae.path=null,!this.pendingClip)return;if(!ae.element){this.pendingClip=null;return}const ge=`clippath${Le++}`,$e=this.svgFactory.createElement("svg:clipPath");$e.setAttributeNS(null,"id",ge),$e.setAttributeNS(null,"transform",Te(this.transformMatrix));const _e=ae.element.cloneNode(!0);if(this.pendingClip==="evenodd"?_e.setAttributeNS(null,"clip-rule","evenodd"):_e.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,$e.append(_e),this.defs.append($e),ae.activeClipUrl){ae.clipGroup=null;for(const Me of this.extraStack)Me.clipGroup=null;$e.setAttributeNS(null,"clip-path",ae.activeClipUrl)}ae.activeClipUrl=`url(#${ge})`,this.tgrp=null}clip(ae){this.pendingClip=ae}closePath(){const ae=this.current;if(ae.path){const ge=`${ae.path.getAttributeNS(null,"d")}Z`;ae.path.setAttributeNS(null,"d",ge)}}setLeading(ae){this.current.leading=-ae}setTextRise(ae){this.current.textRise=ae}setTextRenderingMode(ae){this.current.textRenderingMode=ae}setHScale(ae){this.current.textHScale=ae/100}setRenderingIntent(ae){}setFlatness(ae){}setGState(ae){for(const[ge,$e]of ae)switch(ge){case"LW":this.setLineWidth($e);break;case"LC":this.setLineCap($e);break;case"LJ":this.setLineJoin($e);break;case"ML":this.setMiterLimit($e);break;case"D":this.setDash($e[0],$e[1]);break;case"RI":this.setRenderingIntent($e);break;case"FL":this.setFlatness($e);break;case"Font":this.setFont($e);break;case"CA":this.setStrokeAlpha($e);break;case"ca":this.setFillAlpha($e);break;default:(0,se.warn)(`Unimplemented graphic state operator ${ge}`);break}}fill(){const ae=this.current;ae.element&&(ae.element.setAttributeNS(null,"fill",ae.fillColor),ae.element.setAttributeNS(null,"fill-opacity",ae.fillAlpha),this.endPath())}stroke(){const ae=this.current;ae.element&&(this._setStrokeAttributes(ae.element),ae.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(ae,ge=1){const $e=this.current;let _e=$e.dashArray;ge!==1&&_e.length>0&&(_e=_e.map(function(Me){return ge*Me})),ae.setAttributeNS(null,"stroke",$e.strokeColor),ae.setAttributeNS(null,"stroke-opacity",$e.strokeAlpha),ae.setAttributeNS(null,"stroke-miterlimit",we($e.miterLimit)),ae.setAttributeNS(null,"stroke-linecap",$e.lineCap),ae.setAttributeNS(null,"stroke-linejoin",$e.lineJoin),ae.setAttributeNS(null,"stroke-width",we(ge*$e.lineWidth)+"px"),ae.setAttributeNS(null,"stroke-dasharray",_e.map(we).join(" ")),ae.setAttributeNS(null,"stroke-dashoffset",we(ge*$e.dashPhase)+"px")}eoFill(){var ae;(ae=this.current.element)==null||ae.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){var ae;(ae=this.current.element)==null||ae.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const ae=this.svgFactory.createElement("svg:rect");ae.setAttributeNS(null,"x","0"),ae.setAttributeNS(null,"y","0"),ae.setAttributeNS(null,"width","1px"),ae.setAttributeNS(null,"height","1px"),ae.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(ae)}paintImageXObject(ae){const ge=this.getObject(ae);if(!ge){(0,se.warn)(`Dependent image with object ID ${ae} is not ready yet`);return}this.paintInlineImageXObject(ge)}paintInlineImageXObject(ae,ge){const $e=ae.width,_e=ae.height,Me=ye(ae,this.forceDataSchema,!!ge),We=this.svgFactory.createElement("svg:rect");We.setAttributeNS(null,"x","0"),We.setAttributeNS(null,"y","0"),We.setAttributeNS(null,"width",we($e)),We.setAttributeNS(null,"height",we(_e)),this.current.element=We,this.clip("nonzero");const ze=this.svgFactory.createElement("svg:image");ze.setAttributeNS(Ae,"xlink:href",Me),ze.setAttributeNS(null,"x","0"),ze.setAttributeNS(null,"y",we(-_e)),ze.setAttributeNS(null,"width",we($e)+"px"),ze.setAttributeNS(null,"height",we(_e)+"px"),ze.setAttributeNS(null,"transform",`scale(${we(1/$e)} ${we(-1/_e)})`),ge?ge.append(ze):this._ensureTransformGroup().append(ze)}paintImageMaskXObject(ae){const ge=this.getObject(ae.data,ae);if(ge.bitmap){(0,se.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const $e=this.current,_e=ge.width,Me=ge.height,We=$e.fillColor;$e.maskId=`mask${Ne++}`;const ze=this.svgFactory.createElement("svg:mask");ze.setAttributeNS(null,"id",$e.maskId);const Qe=this.svgFactory.createElement("svg:rect");Qe.setAttributeNS(null,"x","0"),Qe.setAttributeNS(null,"y","0"),Qe.setAttributeNS(null,"width",we(_e)),Qe.setAttributeNS(null,"height",we(Me)),Qe.setAttributeNS(null,"fill",We),Qe.setAttributeNS(null,"mask",`url(#${$e.maskId})`),this.defs.append(ze),this._ensureTransformGroup().append(Qe),this.paintInlineImageXObject(ge,ze)}paintFormXObjectBegin(ae,ge){if(Array.isArray(ae)&&ae.length===6&&this.transform(ae[0],ae[1],ae[2],ae[3],ae[4],ae[5]),ge){const $e=ge[2]-ge[0],_e=ge[3]-ge[1],Me=this.svgFactory.createElement("svg:rect");Me.setAttributeNS(null,"x",ge[0]),Me.setAttributeNS(null,"y",ge[1]),Me.setAttributeNS(null,"width",we($e)),Me.setAttributeNS(null,"height",we(_e)),this.current.element=Me,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(ae){const ge=this.svgFactory.create(ae.width,ae.height),$e=this.svgFactory.createElement("svg:defs");ge.append($e),this.defs=$e;const _e=this.svgFactory.createElement("svg:g");return _e.setAttributeNS(null,"transform",Te(ae.transform)),ge.append(_e),this.svg=_e,ge}_ensureClipGroup(){if(!this.current.clipGroup){const ae=this.svgFactory.createElement("svg:g");ae.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(ae),this.current.clipGroup=ae}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",Te(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}],__webpack_module_cache__={};function __w_pdfjs_require__(te){var ee=__webpack_module_cache__[te];if(ee!==void 0)return ee.exports;var ne=__webpack_module_cache__[te]={exports:{}};return __webpack_modules__[te](ne,ne.exports,__w_pdfjs_require__),ne.exports}var __webpack_exports__={};return(()=>{var te=__webpack_exports__;Object.defineProperty(te,"__esModule",{value:!0}),Object.defineProperty(te,"AbortException",{enumerable:!0,get:function(){return ee.AbortException}}),Object.defineProperty(te,"AnnotationEditorLayer",{enumerable:!0,get:function(){return ie.AnnotationEditorLayer}}),Object.defineProperty(te,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return ee.AnnotationEditorParamsType}}),Object.defineProperty(te,"AnnotationEditorType",{enumerable:!0,get:function(){return ee.AnnotationEditorType}}),Object.defineProperty(te,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return oe.AnnotationEditorUIManager}}),Object.defineProperty(te,"AnnotationLayer",{enumerable:!0,get:function(){return me.AnnotationLayer}}),Object.defineProperty(te,"AnnotationMode",{enumerable:!0,get:function(){return ee.AnnotationMode}}),Object.defineProperty(te,"CMapCompressionType",{enumerable:!0,get:function(){return ee.CMapCompressionType}}),Object.defineProperty(te,"FeatureTest",{enumerable:!0,get:function(){return ee.FeatureTest}}),Object.defineProperty(te,"GlobalWorkerOptions",{enumerable:!0,get:function(){return pe.GlobalWorkerOptions}}),Object.defineProperty(te,"InvalidPDFException",{enumerable:!0,get:function(){return ee.InvalidPDFException}}),Object.defineProperty(te,"MissingPDFException",{enumerable:!0,get:function(){return ee.MissingPDFException}}),Object.defineProperty(te,"OPS",{enumerable:!0,get:function(){return ee.OPS}}),Object.defineProperty(te,"PDFDataRangeTransport",{enumerable:!0,get:function(){return ne.PDFDataRangeTransport}}),Object.defineProperty(te,"PDFDateString",{enumerable:!0,get:function(){return re.PDFDateString}}),Object.defineProperty(te,"PDFWorker",{enumerable:!0,get:function(){return ne.PDFWorker}}),Object.defineProperty(te,"PasswordResponses",{enumerable:!0,get:function(){return ee.PasswordResponses}}),Object.defineProperty(te,"PermissionFlag",{enumerable:!0,get:function(){return ee.PermissionFlag}}),Object.defineProperty(te,"PixelsPerInch",{enumerable:!0,get:function(){return re.PixelsPerInch}}),Object.defineProperty(te,"PromiseCapability",{enumerable:!0,get:function(){return ee.PromiseCapability}}),Object.defineProperty(te,"RenderingCancelledException",{enumerable:!0,get:function(){return re.RenderingCancelledException}}),Object.defineProperty(te,"SVGGraphics",{enumerable:!0,get:function(){return he.SVGGraphics}}),Object.defineProperty(te,"UnexpectedResponseException",{enumerable:!0,get:function(){return ee.UnexpectedResponseException}}),Object.defineProperty(te,"Util",{enumerable:!0,get:function(){return ee.Util}}),Object.defineProperty(te,"VerbosityLevel",{enumerable:!0,get:function(){return ee.VerbosityLevel}}),Object.defineProperty(te,"XfaLayer",{enumerable:!0,get:function(){return ue.XfaLayer}}),Object.defineProperty(te,"build",{enumerable:!0,get:function(){return ne.build}}),Object.defineProperty(te,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return ee.createValidAbsoluteUrl}}),Object.defineProperty(te,"getDocument",{enumerable:!0,get:function(){return ne.getDocument}}),Object.defineProperty(te,"getFilenameFromUrl",{enumerable:!0,get:function(){return re.getFilenameFromUrl}}),Object.defineProperty(te,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return re.getPdfFilenameFromUrl}}),Object.defineProperty(te,"getXfaPageViewport",{enumerable:!0,get:function(){return re.getXfaPageViewport}}),Object.defineProperty(te,"isDataScheme",{enumerable:!0,get:function(){return re.isDataScheme}}),Object.defineProperty(te,"isPdfFile",{enumerable:!0,get:function(){return re.isPdfFile}}),Object.defineProperty(te,"loadScript",{enumerable:!0,get:function(){return re.loadScript}}),Object.defineProperty(te,"normalizeUnicode",{enumerable:!0,get:function(){return ee.normalizeUnicode}}),Object.defineProperty(te,"renderTextLayer",{enumerable:!0,get:function(){return se.renderTextLayer}}),Object.defineProperty(te,"setLayerDimensions",{enumerable:!0,get:function(){return re.setLayerDimensions}}),Object.defineProperty(te,"shadow",{enumerable:!0,get:function(){return ee.shadow}}),Object.defineProperty(te,"updateTextLayer",{enumerable:!0,get:function(){return se.updateTextLayer}}),Object.defineProperty(te,"version",{enumerable:!0,get:function(){return ne.version}});var ee=__w_pdfjs_require__(1),ne=__w_pdfjs_require__(2),re=__w_pdfjs_require__(6),se=__w_pdfjs_require__(26),ie=__w_pdfjs_require__(27),oe=__w_pdfjs_require__(5),me=__w_pdfjs_require__(32),pe=__w_pdfjs_require__(14),he=__w_pdfjs_require__(35),ue=__w_pdfjs_require__(34)})(),__webpack_exports__})())})(pdf$1);var pdfExports=pdf$1.exports;const pdf=getDefaultExportFromCjs(pdfExports),pdfjsModule=_mergeNamespaces({__proto__:null,default:pdf},[pdfExports]),pdfjs="default"in pdfjsModule?pdf:pdfjsModule,pdfjs$1=pdfjs;var propTypes={exports:{}},ReactPropTypesSecret$1="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",ReactPropTypesSecret_1=ReactPropTypesSecret$1,ReactPropTypesSecret=ReactPropTypesSecret_1;function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction;var factoryWithThrowingShims=function(){function te(re,se,ie,oe,me,pe){if(pe!==ReactPropTypesSecret){var he=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw he.name="Invariant Violation",he}}te.isRequired=te;function ee(){return te}var ne={array:te,bigint:te,bool:te,func:te,number:te,object:te,string:te,symbol:te,any:te,arrayOf:ee,element:te,elementType:te,instanceOf:ee,node:te,objectOf:ee,oneOf:ee,oneOfType:ee,shape:ee,exact:ee,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return ne.PropTypes=ne,ne};propTypes.exports=factoryWithThrowingShims();var propTypesExports=propTypes.exports;const PropTypes=getDefaultExportFromCjs(propTypesExports);var __spreadArray=globalThis&&globalThis.__spreadArray||function(te,ee,ne){if(ne||arguments.length===2)for(var re=0,se=ee.length,ie;re<se;re++)(ie||!(re in ee))&&(ie||(ie=Array.prototype.slice.call(ee,0,re)),ie[re]=ee[re]);return te.concat(ie||Array.prototype.slice.call(ee))},clipboardEvents=["onCopy","onCut","onPaste"],compositionEvents=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],focusEvents=["onFocus","onBlur"],formEvents=["onInput","onInvalid","onReset","onSubmit"],imageEvents=["onLoad","onError"],keyboardEvents=["onKeyDown","onKeyPress","onKeyUp"],mediaEvents=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],mouseEvents=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],dragEvents=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],selectionEvents=["onSelect"],touchEvents=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],pointerEvents=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],uiEvents=["onScroll"],wheelEvents=["onWheel"],animationEvents=["onAnimationStart","onAnimationEnd","onAnimationIteration"],transitionEvents=["onTransitionEnd"],otherEvents=["onToggle"],changeEvents=["onChange"],allEvents=__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([],clipboardEvents,!0),compositionEvents,!0),focusEvents,!0),formEvents,!0),imageEvents,!0),keyboardEvents,!0),mediaEvents,!0),mouseEvents,!0),dragEvents,!0),selectionEvents,!0),touchEvents,!0),pointerEvents,!0),uiEvents,!0),wheelEvents,!0),animationEvents,!0),transitionEvents,!0),changeEvents,!0),otherEvents,!0);function makeEventProps(te,ee){var ne={};return allEvents.forEach(function(re){var se=te[re];se&&(ee?ne[re]=function(ie){return se(ie,ee(re))}:ne[re]=se)}),ne}function makeCancellablePromise(te){var ee=!1,ne=new Promise(function(re,se){te.then(function(ie){return!ee&&re(ie)}).catch(function(ie){return!ee&&se(ie)})});return{promise:ne,cancel:function(){ee=!0}}}function r$1(te){var ee,ne,re="";if(typeof te=="string"||typeof te=="number")re+=te;else if(typeof te=="object")if(Array.isArray(te))for(ee=0;ee<te.length;ee++)te[ee]&&(ne=r$1(te[ee]))&&(re&&(re+=" "),re+=ne);else for(ee in te)te[ee]&&(re&&(re+=" "),re+=ee);return re}function clsx(){for(var te,ee,ne=0,re="";ne<arguments.length;)(te=arguments[ne++])&&(ee=r$1(te))&&(re&&(re+=" "),re+=ee);return re}var isProduction=!0,prefix="Invariant failed";function invariant(te,ee){if(!te){if(isProduction)throw new Error(prefix);var ne=typeof ee=="function"?ee():ee,re=ne?"".concat(prefix,": ").concat(ne):prefix;throw new Error(re)}}function warning(te,ee){}const DocumentContext=G$1(null);function Message({children:te,type:ee}){return Cn.createElement("div",{className:`react-pdf__message react-pdf__message--${ee}`},te)}const DEFAULT_LINK_REL="noopener noreferrer nofollow";class LinkService{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(ee){this.pdfDocument=ee}setViewer(ee){this.pdfViewer=ee}setExternalLinkRel(ee){this.externalLinkRel=ee}setExternalLinkTarget(ee){this.externalLinkTarget=ee}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return invariant(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(ee){invariant(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=ee}get rotation(){return 0}set rotation(ee){}goToDestination(ee){return new Promise(ne=>{invariant(this.pdfDocument,"PDF document not loaded."),invariant(ee,"Destination is not specified."),typeof ee=="string"?this.pdfDocument.getDestination(ee).then(ne):Array.isArray(ee)?ne(ee):ee.then(ne)}).then(ne=>{invariant(Array.isArray(ne),`"${ne}" is not a valid destination array.`);const re=ne[0];new Promise(se=>{invariant(this.pdfDocument,"PDF document not loaded."),re instanceof Object?this.pdfDocument.getPageIndex(re).then(ie=>{se(ie)}).catch(()=>{invariant(!1,`"${re}" is not a valid page reference.`)}):typeof re=="number"?se(re):invariant(!1,`"${re}" is not a valid destination reference.`)}).then(se=>{const ie=se+1;invariant(this.pdfViewer,"PDF viewer is not initialized."),invariant(ie>=1&&ie<=this.pagesCount,`"${ie}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:ne,pageIndex:se,pageNumber:ie})})})}navigateTo(ee){this.goToDestination(ee)}goToPage(ee){const ne=ee-1;invariant(this.pdfViewer,"PDF viewer is not initialized."),invariant(ee>=1&&ee<=this.pagesCount,`"${ee}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:ne,pageNumber:ee})}addLinkAttributes(ee,ne,re){ee.href=ne,ee.rel=this.externalLinkRel||DEFAULT_LINK_REL,ee.target=re?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},PasswordResponses$1=PasswordResponses,isBrowser=typeof document<"u",isLocalFileSystem=isBrowser&&window.location.protocol==="file:";function isDefined(te){return typeof te<"u"}function isProvided(te){return isDefined(te)&&te!==null}function isString(te){return typeof te=="string"}function isArrayBuffer(te){return te instanceof ArrayBuffer}function isBlob(te){return invariant(isBrowser,"isBlob can only be used in a browser environment"),te instanceof Blob}function isDataURI(te){return isString(te)&&/^data:/.test(te)}function dataURItoByteString(te){invariant(isDataURI(te),"Invalid data URI.");const[ee="",ne=""]=te.split(",");return ee.split(";").indexOf("base64")!==-1?atob(ne):unescape(ne)}function getDevicePixelRatio(){return isBrowser&&window.devicePixelRatio||1}function displayWorkerWarning(){}function cancelRunningTask(te){te&&te.cancel&&te.cancel()}function makePageCallback(te,ee){return Object.defineProperty(te,"width",{get(){return this.view[2]*ee},configurable:!0}),Object.defineProperty(te,"height",{get(){return this.view[3]*ee},configurable:!0}),Object.defineProperty(te,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(te,"originalHeight",{get(){return this.view[3]},configurable:!0}),te}function isCancelException(te){return te.name==="RenderingCancelledException"}function loadFromFile(te){return new Promise((ee,ne)=>{const re=new FileReader;re.onload=()=>{if(!re.result)return ne(new Error("Error while reading a file."));ee(re.result)},re.onerror=se=>{if(!se.target)return ne(new Error("Error while reading a file."));const{error:ie}=se.target;if(!ie)return ne(new Error("Error while reading a file."));switch(ie.code){case ie.NOT_FOUND_ERR:return ne(new Error("Error while reading a file: File not found."));case ie.SECURITY_ERR:return ne(new Error("Error while reading a file: Security error."));case ie.ABORT_ERR:return ne(new Error("Error while reading a file: Aborted."));default:return ne(new Error("Error while reading a file."))}},re.readAsArrayBuffer(te)})}function reducer(te,ee){switch(ee.type){case"RESOLVE":return{value:ee.value,error:void 0};case"REJECT":return{value:!1,error:ee.error};case"RESET":return{value:void 0,error:void 0};default:return te}}function useResolver(){return s$1(reducer,{value:void 0,error:void 0})}const{PDFDataRangeTransport:PDFDataRangeTransport$1}=pdfjs$1,eventProps=(()=>{const te={};return allEvents.forEach(ee=>{te[ee]=PropTypes.func}),te})(),isTypedArray=PropTypes.oneOfType([PropTypes.instanceOf(Int8Array),PropTypes.instanceOf(Uint8Array),PropTypes.instanceOf(Uint8ClampedArray),PropTypes.instanceOf(Int16Array),PropTypes.instanceOf(Uint16Array),PropTypes.instanceOf(Int32Array),PropTypes.instanceOf(Uint32Array),PropTypes.instanceOf(Float32Array),PropTypes.instanceOf(Float64Array)]),fileTypes=[PropTypes.string,PropTypes.instanceOf(ArrayBuffer),PropTypes.shape({data:PropTypes.oneOfType([PropTypes.string,PropTypes.instanceOf(ArrayBuffer),PropTypes.arrayOf(PropTypes.number.isRequired),isTypedArray]).isRequired}),PropTypes.shape({range:PropTypes.instanceOf(PDFDataRangeTransport$1).isRequired}),PropTypes.shape({url:PropTypes.string.isRequired})];typeof Blob<"u"&&fileTypes.push(PropTypes.instanceOf(Blob));const isClassName=PropTypes.oneOfType([PropTypes.string,PropTypes.arrayOf(PropTypes.string)]),isFile=PropTypes.oneOfType(fileTypes);PropTypes.instanceOf(LinkService);PropTypes.oneOf(["_self","_blank","_parent","_top"]);PropTypes.shape({commonObjs:PropTypes.shape({}).isRequired,getAnnotations:PropTypes.func.isRequired,getTextContent:PropTypes.func.isRequired,getViewport:PropTypes.func.isRequired,render:PropTypes.func.isRequired});const isPageIndex=function te(ee,ne,re){const{[ne]:se,pageNumber:ie,pdf:oe}=ee;if(!isDefined(oe))return null;if(isDefined(se)){if(typeof se!="number")return new Error(`\`${ne}\` of type \`${typeof se}\` supplied to \`${re}\`, expected \`number\`.`);if(se<0)return new Error(`Expected \`${ne}\` to be greater or equal to 0.`);const{numPages:me}=oe;if(se+1>me)return new Error(`Expected \`${ne}\` to be less or equal to ${me-1}.`)}else if(!isDefined(ie))return new Error(`\`${ne}\` not supplied. Either pageIndex or pageNumber must be supplied to \`${re}\`.`);return null},isPageNumber=function te(ee,ne,re){const{[ne]:se,pageIndex:ie,pdf:oe}=ee;if(!isDefined(oe))return null;if(isDefined(se)){if(typeof se!="number")return new Error(`\`${ne}\` of type \`${typeof se}\` supplied to \`${re}\`, expected \`number\`.`);if(se<1)return new Error(`Expected \`${ne}\` to be greater or equal to 1.`);const{numPages:me}=oe;if(se>me)return new Error(`Expected \`${ne}\` to be less or equal to ${me}.`)}else if(!isDefined(ie))return new Error(`\`${ne}\` not supplied. Either pageIndex or pageNumber must be supplied to \`${re}\`.`);return null},isPdf=PropTypes.oneOfType([PropTypes.any,PropTypes.oneOf([!1])]),isRef=PropTypes.oneOfType([PropTypes.func,PropTypes.exact({current:PropTypes.any})]),isRenderMode=PropTypes.oneOf(["canvas","custom","none","svg"]),isRotate=PropTypes.oneOf([0,90,180,270]);var __awaiter=globalThis&&globalThis.__awaiter||function(te,ee,ne,re){function se(ie){return ie instanceof ne?ie:new ne(function(oe){oe(ie)})}return new(ne||(ne=Promise))(function(ie,oe){function me(ue){try{he(re.next(ue))}catch(de){oe(de)}}function pe(ue){try{he(re.throw(ue))}catch(de){oe(de)}}function he(ue){ue.done?ie(ue.value):se(ue.value).then(me,pe)}he((re=re.apply(te,ee||[])).next())})},__rest$2=globalThis&&globalThis.__rest||function(te,ee){var ne={};for(var re in te)Object.prototype.hasOwnProperty.call(te,re)&&ee.indexOf(re)<0&&(ne[re]=te[re]);if(te!=null&&typeof Object.getOwnPropertySymbols=="function")for(var se=0,re=Object.getOwnPropertySymbols(te);se<re.length;se++)ee.indexOf(re[se])<0&&Object.prototype.propertyIsEnumerable.call(te,re[se])&&(ne[re[se]]=te[re[se]]);return ne};const{PDFDataRangeTransport}=pdfjs$1,defaultOnPassword=(te,ee)=>{switch(ee){case PasswordResponses$1.NEED_PASSWORD:{const ne=prompt("Enter the password to open this PDF file.");te(ne);break}case PasswordResponses$1.INCORRECT_PASSWORD:{const ne=prompt("Invalid password. Please try again.");te(ne);break}}},Document=k$1(function te(ee,ne){var{children:re,className:se,error:ie="Failed to load PDF file.",externalLinkRel:oe,externalLinkTarget:me,file:pe,inputRef:he,imageResourcesPath:ue,loading:de="Loading PDF…",noData:Ae="No PDF file specified.",onItemClick:Se,onLoadError:ce,onLoadProgress:fe,onLoadSuccess:ye,onPassword:ve=defaultOnPassword,onSourceError:Pe,onSourceSuccess:we,options:Te,renderMode:Le,rotate:Ne}=ee,ke=__rest$2(ee,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[ae,ge]=useResolver(),{value:$e,error:_e}=ae,[Me,We]=useResolver(),{value:ze,error:Qe}=Me,ct=_(new LinkService),it=_([]),ht=_({scrollPageIntoView:le=>{const{dest:be,pageNumber:Ce,pageIndex:Fe=Ce-1}=le;if(Se){Se({dest:be,pageIndex:Fe,pageNumber:Ce});return}const Ie=it.current[Fe];if(Ie){Ie.scrollIntoView();return}}});A$1(ne,()=>({linkService:ct,pages:it,viewer:ht}),[]);function at(){we&&we()}function gt(){_e&&(_e.toString(),Pe&&Pe(_e))}function dt(){ge({type:"RESET"})}p$1(dt,[pe,ge]);const yt=T$1(()=>__awaiter(this,void 0,void 0,function*(){if(!pe)return null;if(typeof pe=="string")return isDataURI(pe)?{data:dataURItoByteString(pe)}:{url:pe};if(pe instanceof PDFDataRangeTransport)return{range:pe};if(isArrayBuffer(pe))return{data:pe};if(isBrowser&&isBlob(pe))return{data:yield loadFromFile(pe)};if(invariant(typeof pe=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),invariant("data"in pe||"range"in pe||"url"in pe,"Invalid parameter object: need either .data, .range or .url"),"url"in pe&&typeof pe.url=="string"&&isDataURI(pe.url)){const{url:le}=pe,be=__rest$2(pe,["url"]),Ce=dataURItoByteString(le);return Object.assign({data:Ce},be)}return pe}),[pe]);p$1(()=>{const le=makeCancellablePromise(yt());return le.promise.then(be=>{ge({type:"RESOLVE",value:be})}).catch(be=>{ge({type:"REJECT",error:be})}),()=>{cancelRunningTask(le)}},[yt,ge]),p$1(()=>{if(!(typeof $e>"u")){if($e===!1){gt();return}at()}},[$e]);function mt(){ze&&(ye&&ye(ze),it.current=new Array(ze.numPages),ct.current.setDocument(ze))}function qe(){Qe&&(Qe.toString(),ce&&ce(Qe))}function Ee(){We({type:"RESET"})}p$1(Ee,[We,$e]);function xe(){if(!$e)return;const le=Te?Object.assign(Object.assign({},$e),Te):$e,be=pdfjs$1.getDocument(le);fe&&(be.onProgress=fe),ve&&(be.onPassword=ve);const Ce=be;return Ce.promise.then(Fe=>{We({type:"RESOLVE",value:Fe})}).catch(Fe=>{Ce.destroyed||We({type:"REJECT",error:Fe})}),()=>{Ce.destroy()}}p$1(xe,[Te,We,$e]),p$1(()=>{if(!(typeof ze>"u")){if(ze===!1){qe();return}mt()}},[ze]);function Oe(){ct.current.setViewer(ht.current),ct.current.setExternalLinkRel(oe),ct.current.setExternalLinkTarget(me)}p$1(Oe,[oe,me]);function Ge(le,be){it.current[le]=be}function Ve(le){delete it.current[le]}const Ke=F$1(()=>({imageResourcesPath:ue,linkService:ct.current,onItemClick:Se,pdf:ze,registerPage:Ge,renderMode:Le,rotate:Ne,unregisterPage:Ve}),[ue,Se,ze,Le,Ne]),je=F$1(()=>makeEventProps(ke,()=>ze),[ke,ze]);function Ue(){return Cn.createElement(DocumentContext.Provider,{value:Ke},re)}function Be(){return pe?ze==null?Cn.createElement(Message,{type:"loading"},typeof de=="function"?de():de):ze===!1?Cn.createElement(Message,{type:"error"},typeof ie=="function"?ie():ie):Ue():Cn.createElement(Message,{type:"no-data"},typeof Ae=="function"?Ae():Ae)}return Cn.createElement("div",Object.assign({className:clsx("react-pdf__Document",se),ref:he,style:{"--scale-factor":"1"}},je),Be())}),isFunctionOrNode$1=PropTypes.oneOfType([PropTypes.func,PropTypes.node]);Document.propTypes=Object.assign(Object.assign({},eventProps),{children:PropTypes.node,className:isClassName,error:isFunctionOrNode$1,externalLinkRel:PropTypes.string,externalLinkTarget:PropTypes.oneOf(["_self","_blank","_parent","_top"]),file:isFile,imageResourcesPath:PropTypes.string,inputRef:isRef,loading:isFunctionOrNode$1,noData:isFunctionOrNode$1,onItemClick:PropTypes.func,onLoadError:PropTypes.func,onLoadProgress:PropTypes.func,onLoadSuccess:PropTypes.func,onPassword:PropTypes.func,onSourceError:PropTypes.func,onSourceSuccess:PropTypes.func,options:PropTypes.shape({canvasFactory:PropTypes.any,canvasMaxAreaInBytes:PropTypes.number,cMapPacked:PropTypes.bool,CMapReaderFactory:PropTypes.any,cMapUrl:PropTypes.string,disableAutoFetch:PropTypes.bool,disableFontFace:PropTypes.bool,disableRange:PropTypes.bool,disableStream:PropTypes.bool,docBaseUrl:PropTypes.string,enableXfa:PropTypes.bool,filterFactory:PropTypes.any,fontExtraProperties:PropTypes.bool,httpHeaders:PropTypes.object,isEvalSupported:PropTypes.bool,isOffscreenCanvasSupported:PropTypes.bool,length:PropTypes.number,maxImageSize:PropTypes.number,ownerDocument:PropTypes.any,password:PropTypes.string,pdfBug:PropTypes.bool,rangeChunkSize:PropTypes.number,StandardFontDataFactory:PropTypes.any,standardFontDataUrl:PropTypes.string,stopAtErrors:PropTypes.bool,useSystemFonts:PropTypes.bool,useWorkerFetch:PropTypes.bool,verbosity:PropTypes.number,withCredentials:PropTypes.bool,worker:PropTypes.any}),rotate:PropTypes.number});const Document$=Document;function useDocumentContext(){return q$2(DocumentContext)}function mergeRefs(){for(var te=[],ee=0;ee<arguments.length;ee++)te[ee]=arguments[ee];var ne=te.filter(Boolean);if(ne.length<=1){var re=ne[0];return re||null}return function(ie){ne.forEach(function(oe){typeof oe=="function"?oe(ie):oe&&(oe.current=ie)})}}const PageContext=G$1(null),PDF_ROLE_TO_HTML_ROLE={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},HEADING_PATTERN=/^H(\d+)$/;function isPdfRole(te){return te in PDF_ROLE_TO_HTML_ROLE}function isStructTreeNode(te){return"children"in te}function isStructTreeNodeWithOnlyContentChild(te){return isStructTreeNode(te)?te.children.length===1&&0 in te.children&&"id"in te.children[0]:!1}function getRoleAttributes(te){const ee={};if(isStructTreeNode(te)){const{role:ne}=te,re=ne.match(HEADING_PATTERN);if(re)ee.role="heading",ee["aria-level"]=Number(re[1]);else if(isPdfRole(ne)){const se=PDF_ROLE_TO_HTML_ROLE[ne];se&&(ee.role=se)}}return ee}function getBaseAttributes(te){const ee={};if(isStructTreeNode(te)){if(te.alt!==void 0&&(ee["aria-label"]=te.alt),te.lang!==void 0&&(ee.lang=te.lang),isStructTreeNodeWithOnlyContentChild(te)){const[ne]=te.children;if(ne){const re=getBaseAttributes(ne);return Object.assign(Object.assign({},ee),re)}}}else"id"in te&&(ee["aria-owns"]=te.id);return ee}function getAttributes(te){return te?Object.assign(Object.assign({},getRoleAttributes(te)),getBaseAttributes(te)):null}function StructTreeItem({className:te,node:ee}){const ne=F$1(()=>getAttributes(ee),[ee]),re=F$1(()=>!isStructTreeNode(ee)||isStructTreeNodeWithOnlyContentChild(ee)?null:ee.children.map((se,ie)=>Cn.createElement(StructTreeItem,{key:ie,node:se})),[ee]);return Cn.createElement("span",Object.assign({className:te},ne),re)}function usePageContext(){return q$2(PageContext)}function StructTree(){const te=usePageContext();invariant(te,"Unable to find Page context.");const{onGetStructTreeError:ee,onGetStructTreeSuccess:ne}=te,[re,se]=useResolver(),{value:ie,error:oe}=re,{customTextRenderer:me,page:pe}=te;function he(){ie&&ne&&ne(ie)}function ue(){oe&&(oe.toString(),ee&&ee(oe))}function de(){se({type:"RESET"})}p$1(de,[se,pe]);function Ae(){if(me||!pe)return;const Se=makeCancellablePromise(pe.getStructTree()),ce=Se;return Se.promise.then(fe=>{se({type:"RESOLVE",value:fe})}).catch(fe=>{se({type:"REJECT",error:fe})}),()=>cancelRunningTask(ce)}return p$1(Ae,[me,pe,se]),p$1(()=>{if(ie!==void 0){if(ie===!1){ue();return}he()}},[ie]),ie?Cn.createElement(StructTreeItem,{className:"react-pdf__Page__structTree structTree",node:ie}):null}const ANNOTATION_MODE=pdfjs$1.AnnotationMode;function PageCanvas(te){const ee=usePageContext();invariant(ee,"Unable to find Page context.");const ne=Object.assign(Object.assign({},ee),te),{_className:re,canvasBackground:se,devicePixelRatio:ie=getDevicePixelRatio(),onRenderError:oe,onRenderSuccess:me,page:pe,renderForms:he,renderTextLayer:ue,rotate:de,scale:Ae}=ne,{canvasRef:Se}=te;invariant(pe,"Attempted to render page canvas, but no page was specified.");const ce=_(null);function fe(){pe&&me&&me(makePageCallback(pe,Ae))}function ye(Le){isCancelException(Le)||(Le.toString(),oe&&oe(Le))}const ve=F$1(()=>pe.getViewport({scale:Ae*ie,rotation:de}),[ie,pe,de,Ae]),Pe=F$1(()=>pe.getViewport({scale:Ae,rotation:de}),[pe,de,Ae]);function we(){if(!pe)return;pe.cleanup();const{current:Le}=ce;if(!Le)return;Le.width=ve.width,Le.height=ve.height,Le.style.width=`${Math.floor(Pe.width)}px`,Le.style.height=`${Math.floor(Pe.height)}px`,Le.style.visibility="hidden";const Ne={annotationMode:he?ANNOTATION_MODE.ENABLE_FORMS:ANNOTATION_MODE.ENABLE,canvasContext:Le.getContext("2d",{alpha:!1}),viewport:ve};se&&(Ne.background=se);const ke=pe.render(Ne),ae=ke;return ke.promise.then(()=>{Le.style.visibility="",fe()}).catch(ye),()=>cancelRunningTask(ae)}p$1(we,[se,ce,ie,pe,he,ve,Pe]);const Te=T$1(()=>{const{current:Le}=ce;Le&&(Le.width=0,Le.height=0)},[ce]);return p$1(()=>Te,[Te]),Cn.createElement("canvas",{className:`${re}__canvas`,dir:"ltr",ref:mergeRefs(Se,ce),style:{display:"block",userSelect:"none"}},ue?Cn.createElement(StructTree,null):null)}function PageSVG(){const te=usePageContext();invariant(te,"Unable to find Page context.");const{_className:ee,onRenderSuccess:ne,onRenderError:re,page:se,rotate:ie,scale:oe}=te;invariant(se,"Attempted to render page SVG, but no page was specified.");const[me,pe]=useResolver(),{value:he,error:ue}=me;function de(){se&&ne&&ne(makePageCallback(se,oe))}function Ae(){ue&&(isCancelException(ue)||(ue.toString(),re&&re(ue)))}const Se=F$1(()=>se.getViewport({scale:oe,rotation:ie}),[se,ie,oe]);function ce(){pe({type:"RESET"})}p$1(ce,[se,pe,Se]);function fe(){if(!se)return;const we=makeCancellablePromise(se.getOperatorList());return we.promise.then(Te=>{new pdfjs$1.SVGGraphics(se.commonObjs,se.objs).getSVG(Te,Se).then(Ne=>{pe({type:"RESOLVE",value:Ne})}).catch(Ne=>{pe({type:"REJECT",error:Ne})})}).catch(Te=>{pe({type:"REJECT",error:Te})}),()=>cancelRunningTask(we)}p$1(fe,[se,pe,Se]),p$1(()=>{if(he!==void 0){if(he===!1){Ae();return}de()}},[he]);function ye(we){if(!we||!he)return;we.firstElementChild||we.appendChild(he);const{width:Te,height:Le}=Se;he.setAttribute("width",`${Te}`),he.setAttribute("height",`${Le}`)}const{width:ve,height:Pe}=Se;return Cn.createElement("div",{className:`${ee}__svg`,ref:we=>ye(we),style:{display:"block",backgroundColor:"white",overflow:"hidden",width:ve,height:Pe,userSelect:"none"}})}function isTextItem(te){return"str"in te}function TextLayer$1(){const te=usePageContext();invariant(te,"Unable to find Page context.");const{customTextRenderer:ee,onGetTextError:ne,onGetTextSuccess:re,onRenderTextLayerError:se,onRenderTextLayerSuccess:ie,page:oe,pageIndex:me,pageNumber:pe,rotate:he,scale:ue}=te;invariant(oe,"Attempted to load page text content, but no page was specified.");const[de,Ae]=useResolver(),{value:Se,error:ce}=de,fe=_(null),ye=_();parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10);function ve(){Se&&re&&re(Se)}function Pe(){ce&&(ce.toString(),ne&&ne(ce))}function we(){Ae({type:"RESET"})}p$1(we,[oe,Ae]);function Te(){if(!oe)return;const _e=makeCancellablePromise(oe.getTextContent()),Me=_e;return _e.promise.then(We=>{Ae({type:"RESOLVE",value:We})}).catch(We=>{Ae({type:"REJECT",error:We})}),()=>cancelRunningTask(Me)}p$1(Te,[oe,Ae]),p$1(()=>{if(Se!==void 0){if(Se===!1){Pe();return}ve()}},[Se]);const Le=T$1(()=>{ie&&ie()},[ie]),Ne=T$1(_e=>{_e.toString(),se&&se(_e)},[se]);function ke(){const _e=ye.current;_e&&_e.classList.add("active")}function ae(){const _e=ye.current;_e&&_e.classList.remove("active")}const ge=F$1(()=>oe.getViewport({scale:ue,rotation:he}),[oe,he,ue]);function $e(){if(!oe||!Se)return;const{current:_e}=fe;if(!_e)return;_e.innerHTML="";const Me=oe.streamTextContent({includeMarkedContent:!0}),We={container:_e,textContentSource:Me,viewport:ge},ze=pdfjs$1.renderTextLayer(We),Qe=ze;return ze.promise.then(()=>{const ct=document.createElement("div");ct.className="endOfContent",_e.append(ct),ye.current=ct;const ht=!!_e.querySelector(".markedContent")?_e.querySelectorAll(".markedContent > *:not(.markedContent"):_e.children;if(ee){let at=0;Se.items.forEach((gt,dt)=>{if(!isTextItem(gt))return;const yt=ht[at];if(!yt)return;const mt=ee(Object.assign({pageIndex:me,pageNumber:pe,itemIndex:dt},gt));yt.innerHTML=mt,at+=gt.str&>.hasEOL?2:1})}Le()}).catch(Ne),()=>cancelRunningTask(Qe)}return y($e,[ee,Ne,Le,oe,me,pe,Se,ge]),Cn.createElement("div",{className:clsx("react-pdf__Page__textContent","textLayer"),onMouseUp:ae,onMouseDown:ke,ref:fe})}function AnnotationLayer$1(){const te=useDocumentContext();invariant(te,"Unable to find Document context. Did you wrap <Page /> in <Document />?");const ee=usePageContext();invariant(ee,"Unable to find Page context.");const ne=Object.assign(Object.assign({},te),ee),{imageResourcesPath:re,linkService:se,onGetAnnotationsError:ie,onGetAnnotationsSuccess:oe,onRenderAnnotationLayerError:me,onRenderAnnotationLayerSuccess:pe,page:he,pdf:ue,renderForms:de,rotate:Ae,scale:Se=1}=ne;invariant(he,"Attempted to load page annotations, but no page was specified.");const[ce,fe]=useResolver(),{value:ye,error:ve}=ce,Pe=_(null);parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10);function we(){ye&&oe&&oe(ye)}function Te(){ve&&(ve.toString(),ie&&ie(ve))}function Le(){fe({type:"RESET"})}p$1(Le,[fe,he]);function Ne(){if(!he)return;const _e=makeCancellablePromise(he.getAnnotations()),Me=_e;return _e.promise.then(We=>{fe({type:"RESOLVE",value:We})}).catch(We=>{fe({type:"REJECT",error:We})}),()=>{cancelRunningTask(Me)}}p$1(Ne,[fe,he,de]),p$1(()=>{if(ye!==void 0){if(ye===!1){Te();return}we()}},[ye]);function ke(){pe&&pe()}function ae(_e){me&&me(_e)}const ge=F$1(()=>he.getViewport({scale:Se,rotation:Ae}),[he,Ae,Se]);function $e(){if(!ue||!he||!ye)return;const{current:_e}=Pe;if(!_e)return;const Me=ge.clone({dontFlip:!0}),We={annotations:ye,annotationStorage:ue.annotationStorage,div:_e,downloadManager:null,imageResourcesPath:re,linkService:se,page:he,renderForms:de,viewport:Me};_e.innerHTML="";try{pdfjs$1.AnnotationLayer.render(We),ke()}catch(ze){ae(ze)}return()=>{}}return p$1($e,[ye,re,se,he,de,ge]),Cn.createElement("div",{className:clsx("react-pdf__Page__annotations","annotationLayer"),ref:Pe})}var __rest$1=globalThis&&globalThis.__rest||function(te,ee){var ne={};for(var re in te)Object.prototype.hasOwnProperty.call(te,re)&&ee.indexOf(re)<0&&(ne[re]=te[re]);if(te!=null&&typeof Object.getOwnPropertySymbols=="function")for(var se=0,re=Object.getOwnPropertySymbols(te);se<re.length;se++)ee.indexOf(re[se])<0&&Object.prototype.propertyIsEnumerable.call(te,re[se])&&(ne[re[se]]=te[re[se]]);return ne};const defaultScale=1,Page=function te(ee){const ne=useDocumentContext();invariant(ne,"Unable to find Document context. Did you wrap <Page /> in <Document />?");const re=Object.assign(Object.assign({},ne),ee),{_className:se="react-pdf__Page",_enableRegisterUnregisterPage:ie=!0,canvasBackground:oe,canvasRef:me,children:pe,className:he,customRenderer:ue,customTextRenderer:de,devicePixelRatio:Ae,error:Se="Failed to load the page.",height:ce,inputRef:fe,loading:ye="Loading page…",noData:ve="No page specified.",onGetAnnotationsError:Pe,onGetAnnotationsSuccess:we,onGetStructTreeError:Te,onGetStructTreeSuccess:Le,onGetTextError:Ne,onGetTextSuccess:ke,onLoadError:ae,onLoadSuccess:ge,onRenderAnnotationLayerError:$e,onRenderAnnotationLayerSuccess:_e,onRenderError:Me,onRenderSuccess:We,onRenderTextLayerError:ze,onRenderTextLayerSuccess:Qe,pageIndex:ct,pageNumber:it,pdf:ht,registerPage:at,renderAnnotationLayer:gt=!0,renderForms:dt=!1,renderMode:yt="canvas",renderTextLayer:mt=!0,rotate:qe,scale:Ee=defaultScale,unregisterPage:xe,width:Oe}=re,Ge=__rest$1(re,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[Ve,Ke]=useResolver(),{value:je,error:Ue}=Ve,Be=_(null);invariant(ht,"Attempted to load a page, but no document was specified.");const le=isProvided(it)?it-1:ct??null,be=it??(isProvided(ct)?ct+1:null),Ce=qe??(je?je.rotate:null),Fe=F$1(()=>{if(!je)return null;let St=1;const vt=Ee??defaultScale;if(Oe||ce){const $t=je.getViewport({scale:1,rotation:Ce});Oe?St=Oe/$t.width:ce&&(St=ce/$t.height)}return vt*St},[ce,je,Ce,Ee,Oe]);function Ie(){return()=>{isProvided(le)&&ie&&xe&&xe(le)}}p$1(Ie,[ie,ht,le,xe]);function Xe(){if(ge){if(!je||!Fe)return;ge(makePageCallback(je,Fe))}if(ie&&at){if(!isProvided(le)||!Be.current)return;at(le,Be.current)}}function tt(){Ue&&(Ue.toString(),ae&&ae(Ue))}function Ze(){Ke({type:"RESET"})}p$1(Ze,[Ke,ht,le]);function st(){if(!ht||!be)return;const St=makeCancellablePromise(ht.getPage(be)),vt=St;return St.promise.then($t=>{Ke({type:"RESOLVE",value:$t})}).catch($t=>{Ke({type:"REJECT",error:$t})}),()=>cancelRunningTask(vt)}p$1(st,[Ke,ht,le,be,at]),p$1(()=>{if(je!==void 0){if(je===!1){tt();return}Xe()}},[je,Fe]);const ot=F$1(()=>je&&isProvided(le)&&be&&isProvided(Ce)&&isProvided(Fe)?{_className:se,canvasBackground:oe,customTextRenderer:de,devicePixelRatio:Ae,onGetAnnotationsError:Pe,onGetAnnotationsSuccess:we,onGetStructTreeError:Te,onGetStructTreeSuccess:Le,onGetTextError:Ne,onGetTextSuccess:ke,onRenderAnnotationLayerError:$e,onRenderAnnotationLayerSuccess:_e,onRenderError:Me,onRenderSuccess:We,onRenderTextLayerError:ze,onRenderTextLayerSuccess:Qe,page:je,pageIndex:le,pageNumber:be,renderForms:dt,renderTextLayer:mt,rotate:Ce,scale:Fe}:null,[se,oe,de,Ae,Pe,we,Te,Le,Ne,ke,$e,_e,Me,We,ze,Qe,je,le,be,dt,mt,Ce,Fe]),et=F$1(()=>makeEventProps(Ge,()=>je&&(Fe?makePageCallback(je,Fe):void 0)),[Ge,je,Fe]),nt=`${le}@${Fe}/${Ce}`,ft=`${le}/${Ce}`;function pt(){switch(yt){case"custom":return invariant(ue,'renderMode was set to "custom", but no customRenderer was passed.'),Cn.createElement(ue,{key:`${nt}_custom`});case"none":return null;case"svg":return Cn.createElement(PageSVG,{key:`${ft}_svg`});case"canvas":default:return Cn.createElement(PageCanvas,{key:`${nt}_canvas`,canvasRef:me})}}function wt(){return mt?Cn.createElement(TextLayer$1,{key:`${nt}_text`}):null}function At(){return gt?Cn.createElement(AnnotationLayer$1,{key:`${nt}_annotations`}):null}function Tt(){return Cn.createElement(PageContext.Provider,{value:ot},pt(),wt(),At(),pe)}function Ye(){return be?ht===null||je===void 0||je===null?Cn.createElement(Message,{type:"loading"},typeof ye=="function"?ye():ye):ht===!1||je===!1?Cn.createElement(Message,{type:"error"},typeof Se=="function"?Se():Se):Tt():Cn.createElement(Message,{type:"no-data"},typeof ve=="function"?ve():ve)}return Cn.createElement("div",Object.assign({className:clsx(se,he),"data-page-number":be,ref:mergeRefs(fe,Be),style:{"--scale-factor":`${Fe}`,backgroundColor:oe||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},et),Ye())},isFunctionOrNode=PropTypes.oneOfType([PropTypes.func,PropTypes.node]);Page.propTypes=Object.assign(Object.assign({},eventProps),{canvasBackground:PropTypes.string,canvasRef:isRef,children:PropTypes.node,className:isClassName,customRenderer:PropTypes.func,customTextRenderer:PropTypes.func,devicePixelRatio:PropTypes.number,error:isFunctionOrNode,height:PropTypes.number,imageResourcesPath:PropTypes.string,inputRef:isRef,loading:isFunctionOrNode,noData:isFunctionOrNode,onGetTextError:PropTypes.func,onGetTextSuccess:PropTypes.func,onLoadError:PropTypes.func,onLoadSuccess:PropTypes.func,onRenderError:PropTypes.func,onRenderSuccess:PropTypes.func,onRenderTextLayerError:PropTypes.func,onRenderTextLayerSuccess:PropTypes.func,pageIndex:isPageIndex,pageNumber:isPageNumber,pdf:isPdf,renderAnnotationLayer:PropTypes.bool,renderForms:PropTypes.bool,renderMode:isRenderMode,renderTextLayer:PropTypes.bool,rotate:isRotate,scale:PropTypes.number,width:PropTypes.number});const Page$1=Page;var __rest=globalThis&&globalThis.__rest||function(te,ee){var ne={};for(var re in te)Object.prototype.hasOwnProperty.call(te,re)&&ee.indexOf(re)<0&&(ne[re]=te[re]);if(te!=null&&typeof Object.getOwnPropertySymbols=="function")for(var se=0,re=Object.getOwnPropertySymbols(te);se<re.length;se++)ee.indexOf(re[se])<0&&Object.prototype.propertyIsEnumerable.call(te,re[se])&&(ne[re[se]]=te[re[se]]);return ne};const Thumbnail=function te(ee){const ne=useDocumentContext();invariant(ne,"Unable to find Document context. Did you wrap <Page /> in <Document />?");const re=Object.assign(Object.assign({},ne),ee),{className:se,linkService:ie,onItemClick:oe,pageIndex:me,pageNumber:pe}=re,he=isProvided(pe)?pe-1:me??null,ue=pe??(isProvided(me)?me+1:null);function de(Se){Se.preventDefault(),!(!isProvided(he)||!ue)&&(oe?oe({pageIndex:he,pageNumber:ue}):ie.goToPage(ue))}const Ae=__rest(ee,["className","onItemClick"]);return Cn.createElement("a",{className:clsx("react-pdf__Thumbnail",se),href:ue?"#":void 0,onClick:de},Cn.createElement(Page$1,Object.assign({},Ae,{_className:"react-pdf__Thumbnail__page",_enableRegisterUnregisterPage:!1,renderAnnotationLayer:!1,renderTextLayer:!1})))},Thumbnail$1=Thumbnail;displayWorkerWarning();pdfjs$1.GlobalWorkerOptions.workerSrc="pdf.worker.js";const TextLayer=`:root{--react-pdf-text-layer: 1;--highlight-bg-color: rgba(180, 0, 170, 1);--highlight-selected-bg-color: rgba(0, 100, 0, 1)}@media screen and (forced-colors: active){:root{--highlight-bg-color: Highlight;--highlight-selected-bg-color: ButtonText}}[data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[data-main-rotation="270"]{transform:rotate(270deg) translate(-100%)}.textLayer{position:absolute;text-align:initial;top:0;right:0;bottom:0;left:0;overflow:hidden;line-height:1;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0;z-index:2}.textLayer :is(span,br){color:transparent;position:absolute;white-space:pre;cursor:text;margin:0;transform-origin:0 0}.textLayer span.markedContent{top:0;height:0}.textLayer .highlight{margin:-1px;padding:1px;background-color:var(--highlight-bg-color);border-radius:4px}.textLayer .highlight.appended{position:initial}.textLayer .highlight.begin{border-radius:4px 0 0 4px}.textLayer .highlight.end{border-radius:0 4px 4px 0}.textLayer .highlight.middle{border-radius:0}.textLayer .highlight.selected{background-color:var(--highlight-selected-bg-color)}.textLayer br::-moz-selection{background:transparent}.textLayer br::selection{background:transparent}.textLayer .endOfContent{display:block;position:absolute;top:100%;right:0;bottom:0;left:0;z-index:-1;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer .endOfContent.active{top:0}
|
|
52
52
|
`,AnnotationLayer=`:root{--react-pdf-annotation-layer: 1;--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");--input-focus-border-color: Highlight;--input-focus-outline: 1px solid Canvas;--input-unfocused-border-color: transparent;--input-disabled-border-color: transparent;--input-hover-border-color: black;--link-outline: none}@media screen and (forced-colors: active){:root{--input-focus-border-color: CanvasText;--input-unfocused-border-color: ActiveText;--input-disabled-border-color: GrayText;--input-hover-border-color: Highlight;--link-outline: 1.5px solid LinkText}.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{outline:1.5px solid selectedItem}.annotationLayer .linkAnnotation:hover{-webkit-backdrop-filter:invert(100%);backdrop-filter:invert(100%)}}.annotationLayer{position:absolute;top:0;left:0;pointer-events:none;transform-origin:0 0;z-index:3}.annotationLayer[data-main-rotation="90"] .norotate{transform:rotate(270deg) translate(-100%)}.annotationLayer[data-main-rotation="180"] .norotate{transform:rotate(180deg) translate(-100%,-100%)}.annotationLayer[data-main-rotation="270"] .norotate{transform:rotate(90deg) translateY(-100%)}.annotationLayer canvas{position:absolute;width:100%;height:100%}.annotationLayer section{position:absolute;text-align:initial;pointer-events:auto;box-sizing:border-box;margin:0;transform-origin:0 0}.annotationLayer .linkAnnotation{outline:var(--link-outline)}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a{position:absolute;font-size:1em;top:0;left:0;width:100%;height:100%}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a:hover{opacity:.2;background:rgba(255,255,0,1);box-shadow:0 2px 10px #ff0}.annotationLayer .textAnnotation img{position:absolute;cursor:pointer;width:100%;height:100%;top:0;left:0}.annotationLayer .textWidgetAnnotation :is(input,textarea),.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{background-image:var(--annotation-unfocused-field-background);border:2px solid var(--input-unfocused-border-color);box-sizing:border-box;font:calc(9px * var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{outline:1.5px solid red}.annotationLayer .choiceWidgetAnnotation select option{padding:0}.annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}.annotationLayer .textWidgetAnnotation textarea{resize:none}.annotationLayer .textWidgetAnnotation :is(input,textarea)[disabled],.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled]{background:none;border:2px solid var(--input-disabled-border-color);cursor:not-allowed}.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover{border:2px solid var(--input-hover-border-color)}.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation.checkBox input:hover{border-radius:2px}.annotationLayer .textWidgetAnnotation :is(input,textarea):focus,.annotationLayer .choiceWidgetAnnotation select:focus{background:none;border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{background-image:none;background-color:transparent}.annotationLayer .buttonWidgetAnnotation.checkBox :focus{border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.radioButton :focus{border:2px solid var(--input-focus-border-color);outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{height:80%;left:45%;width:1px}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:30%;top:20%;width:50%}.annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}.annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none}.annotationLayer .popupTriggerArea{height:100%;width:100%}.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{position:absolute}.annotationLayer .popupWrapper{position:absolute;font-size:calc(9px * var(--scale-factor));width:100%;min-width:calc(180px * var(--scale-factor));pointer-events:none}.annotationLayer .popup{position:absolute;max-width:calc(180px * var(--scale-factor));background-color:#ff9;box-shadow:0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) #888;border-radius:calc(2px * var(--scale-factor));padding:calc(6px * var(--scale-factor));margin-left:calc(5px * var(--scale-factor));cursor:pointer;font:message-box;white-space:normal;word-wrap:break-word;pointer-events:auto}.annotationLayer .popup>*{font-size:calc(9px * var(--scale-factor))}.annotationLayer .popup h1{display:inline-block}.annotationLayer .popupDate{display:inline-block;margin-left:calc(5px * var(--scale-factor))}.annotationLayer .popupContent{border-top:1px solid rgba(51,51,51,1);margin-top:calc(2px * var(--scale-factor));padding-top:calc(2px * var(--scale-factor))}.annotationLayer .richText>*{white-space:pre-wrap;font-size:calc(9px * var(--scale-factor))}.annotationLayer .highlightAnnotation,.annotationLayer .underlineAnnotation,.annotationLayer .squigglyAnnotation,.annotationLayer .strikeoutAnnotation,.annotationLayer .freeTextAnnotation,.annotationLayer .lineAnnotation svg line,.annotationLayer .squareAnnotation svg rect,.annotationLayer .circleAnnotation svg ellipse,.annotationLayer .polylineAnnotation svg polyline,.annotationLayer .polygonAnnotation svg polygon,.annotationLayer .caretAnnotation,.annotationLayer .inkAnnotation svg polyline,.annotationLayer .stampAnnotation,.annotationLayer .fileAttachmentAnnotation{cursor:pointer}.annotationLayer section svg{position:absolute;width:100%;height:100%;top:0;left:0}.annotationLayer .annotationTextContent{position:absolute;width:100%;height:100%;opacity:0;color:transparent;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none}.annotationLayer .annotationTextContent span{width:100%;display:inline-block}
|
|
53
|
-
`;function setUpWorker(){pdfjs$1.GlobalWorkerOptions.workerSrc=new URL(""+document.currentScript.src.replace(workplace-policies.js,"")+"assets/pdf.worker.min-bc10fb5c.js",self.location).toString()}const PdfCss_textLayer=(()=>toString$3(TextLayer))(),PdfCss_annotationLayer=(()=>toString$3(AnnotationLayer))(),PdfCss_all=PdfCss_textLayer+PdfCss_annotationLayer;class Document_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["File","OnLoadSuccess","ClassName","OnItemClick","Children"]}}function Document_Component(te){return Interop_reactApi.createElement(Document$,keyValueList(te,1))}class Page_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["PageNumber","Width"]}}function Page_Component(te){return Interop_reactApi.createElement(Page$1,keyValueList(te,1))}class Thumbnail_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["Key","PageNumber","Width"]}}function Thumbnail_Component(te){return Interop_reactApi.createElement(Thumbnail$1,keyValueList(te,1))}function Component$4(te){let ee,ne;const re=useFeliz_React__React_useState_Static_1505(!1),se=re[0],ie=useFeliz_React__React_useState_Static_1505(1),oe=ie[0]|0,me=useFeliz_React__React_useState_Static_1505(1),pe=me[1],he=me[0]|0,ue=useReact_useRef_1505(void 0);let de;const Ae=te.Path;if(Ae.tag===1)throw new Error("FilePath: Unused");return de=Ae.fields[0],y$1("div",createObj(ofArray$2([["ref",ue],["className","flex flex-col justify-center items-center"],(ee=[y$1("style",{children:[PdfCss_all]}),y$1("div",createObj(ofArray$2([["className","flex justify-center items-center space-x-4 mb-2"],(ne=[y$1("button",{className:"hidden lg:block py-1 px-2 bg-primary-base rounded-md text-white",type:"button",onClick:Se=>{re[1](!se)},children:"📄"}),y$1("div",{children:[`Page ${he} of ${oe}`]}),y$1("button",{className:"py-1 px-2 bg-primary-base rounded-md text-white",type:"button",disabled:he<=1,onClick:Se=>{pe(he-1)},children:"◀"}),y$1("button",{className:"py-1 px-2 bg-primary-base rounded-md text-white",type:"button",disabled:he>=oe,onClick:Se=>{pe(he+1)},children:"▶"}),y$1("a",{className:"py-1 px-2 bg-primary-base rounded-md text-white",href:de,download:te.Name,children:"💾"})],["children",Interop_reactApi.Children.toArray(Array.from(ne))])]))),Document_Component(ofArray$2([new Document_Prop(0,[de]),new Document_Prop(1,[Se=>{ie[1](Se.numPages),pe(1)}]),new Document_Prop(3,[Se=>{pe(Se.pageNumber)}]),new Document_Prop(2,["flex"]),new Document_Prop(4,[[y$1("div",createObj(toList(delay(()=>se?append(singleton(["className","flex flex-col space-y-4 p-4 bg-gray-100"]),delay(()=>{let Se;return singleton((Se=toList(delay(()=>map$2(ce=>{const fe=ofArray$2([y$1("div",createObj(toList(delay(()=>append(he===ce?singleton(["className","border-4 border-primary-base rounded"]):empty$2(),delay(()=>{let ye;return singleton((ye=[Thumbnail_Component(ofArray$2([new Thumbnail_Prop(0,[`thumbnail-${ce}`]),new Thumbnail_Prop(1,[ce]),new Thumbnail_Prop(2,[100])]))],["children",Interop_reactApi.Children.toArray(Array.from(ye))]))})))))),y$1("div",{className:"mt-1 text-center text-xs text-gray-600",children:ce})]);return y$1("div",{children:Interop_reactApi.Children.toArray(Array.from(fe))})},rangeDouble(1,1,oe)))),["children",Interop_reactApi.Children.toArray(Array.from(Se))]))})):empty$2())))),Page_Component(toList(delay(()=>append(singleton(new Page_Prop(0,[he])),delay(()=>ue.current!=null?singleton(new Page_Prop(1,[min(value(ue.current).clientWidth-20,768)])):empty$2())))))]])]))],["children",Interop_reactApi.Children.toArray(Array.from(ee))])])))}function Component$3(te){let ee,ne,re,se;const ie=te.dispatch,oe=te.acceptPolicyStatus,me=te.policyReviewItem,pe=useFeliz_React__React_useState_Static_1505(!1),he=pe[0];return y$1("div",createObj(ofArray$2([["className","w-full p-1 sm:p-5"],(ee=[y$1("div",createObj(ofArray$2([["className","flex justify-between items-center"],(ne=toList(delay(()=>{let ue,de;return append(singleton(y$1("div",createObj(ofArray$2([["className","flex items-center"],(ue=[y$1("div",createObj(ofArray$2([["onClick",Ae=>{ie(new Msg(1,[new Page$2(0,[])]))}],(de=[chevronLeft(singleton$1(new Prop(2,["cursor-pointer text-gray-900 hover:text-primary-base"])))],["children",Interop_reactApi.Children.toArray(Array.from(de))])]))),y$1("div",{className:"ml-1 mr-4 text-base sm:text-lg leading-6 sm:leading-7 font-semibold text-gray-900",children:me.Policy.Title})],["children",Interop_reactApi.Children.toArray(Array.from(ue))])])))),delay(()=>{let Ae,Se,ce;return me.Status.tag===2?singleton(y$1("div",createObj(ofArray$2([["className","flex items-center flex-col-reverse sm:flex-row"],(Ae=[y$1("span",{className:"mt-1 sm:mt-0 sm:mr-2.5 text-sm leading-5 font-medium text-gray-500",children:"Accepted"}),check(singleton$1(new Prop(2,["text-primary-base"])))],["children",Interop_reactApi.Children.toArray(Array.from(Ae))])])))):singleton(y$1("button",createObj(ofArray$2([["type","button"],["disabled",Deferred_inProgress(oe)],(Se=`
|
|
53
|
+
`;function setUpWorker(){pdfjs$1.GlobalWorkerOptions.workerSrc=new URL(""+document.currentScript.src.replace("workplace-policies.js","")+"assets/pdf.worker.min-bc10fb5c.js",self.location).toString()}const PdfCss_textLayer=(()=>toString$3(TextLayer))(),PdfCss_annotationLayer=(()=>toString$3(AnnotationLayer))(),PdfCss_all=PdfCss_textLayer+PdfCss_annotationLayer;class Document_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["File","OnLoadSuccess","ClassName","OnItemClick","Children"]}}function Document_Component(te){return Interop_reactApi.createElement(Document$,keyValueList(te,1))}class Page_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["PageNumber","Width"]}}function Page_Component(te){return Interop_reactApi.createElement(Page$1,keyValueList(te,1))}class Thumbnail_Prop extends Union{constructor(ee,ne){super(),this.tag=ee,this.fields=ne}cases(){return["Key","PageNumber","Width"]}}function Thumbnail_Component(te){return Interop_reactApi.createElement(Thumbnail$1,keyValueList(te,1))}function Component$4(te){let ee,ne;const re=useFeliz_React__React_useState_Static_1505(!1),se=re[0],ie=useFeliz_React__React_useState_Static_1505(1),oe=ie[0]|0,me=useFeliz_React__React_useState_Static_1505(1),pe=me[1],he=me[0]|0,ue=useReact_useRef_1505(void 0);let de;const Ae=te.Path;if(Ae.tag===1)throw new Error("FilePath: Unused");return de=Ae.fields[0],y$1("div",createObj(ofArray$2([["ref",ue],["className","flex flex-col justify-center items-center"],(ee=[y$1("style",{children:[PdfCss_all]}),y$1("div",createObj(ofArray$2([["className","flex justify-center items-center space-x-4 mb-2"],(ne=[y$1("button",{className:"hidden lg:block py-1 px-2 bg-primary-base rounded-md text-white",type:"button",onClick:Se=>{re[1](!se)},children:"📄"}),y$1("div",{children:[`Page ${he} of ${oe}`]}),y$1("button",{className:"py-1 px-2 bg-primary-base rounded-md text-white",type:"button",disabled:he<=1,onClick:Se=>{pe(he-1)},children:"◀"}),y$1("button",{className:"py-1 px-2 bg-primary-base rounded-md text-white",type:"button",disabled:he>=oe,onClick:Se=>{pe(he+1)},children:"▶"}),y$1("a",{className:"py-1 px-2 bg-primary-base rounded-md text-white",href:de,download:te.Name,children:"💾"})],["children",Interop_reactApi.Children.toArray(Array.from(ne))])]))),Document_Component(ofArray$2([new Document_Prop(0,[de]),new Document_Prop(1,[Se=>{ie[1](Se.numPages),pe(1)}]),new Document_Prop(3,[Se=>{pe(Se.pageNumber)}]),new Document_Prop(2,["flex"]),new Document_Prop(4,[[y$1("div",createObj(toList(delay(()=>se?append(singleton(["className","flex flex-col space-y-4 p-4 bg-gray-100"]),delay(()=>{let Se;return singleton((Se=toList(delay(()=>map$2(ce=>{const fe=ofArray$2([y$1("div",createObj(toList(delay(()=>append(he===ce?singleton(["className","border-4 border-primary-base rounded"]):empty$2(),delay(()=>{let ye;return singleton((ye=[Thumbnail_Component(ofArray$2([new Thumbnail_Prop(0,[`thumbnail-${ce}`]),new Thumbnail_Prop(1,[ce]),new Thumbnail_Prop(2,[100])]))],["children",Interop_reactApi.Children.toArray(Array.from(ye))]))})))))),y$1("div",{className:"mt-1 text-center text-xs text-gray-600",children:ce})]);return y$1("div",{children:Interop_reactApi.Children.toArray(Array.from(fe))})},rangeDouble(1,1,oe)))),["children",Interop_reactApi.Children.toArray(Array.from(Se))]))})):empty$2())))),Page_Component(toList(delay(()=>append(singleton(new Page_Prop(0,[he])),delay(()=>ue.current!=null?singleton(new Page_Prop(1,[min(value(ue.current).clientWidth-20,768)])):empty$2())))))]])]))],["children",Interop_reactApi.Children.toArray(Array.from(ee))])])))}function Component$3(te){let ee,ne,re,se;const ie=te.dispatch,oe=te.acceptPolicyStatus,me=te.policyReviewItem,pe=useFeliz_React__React_useState_Static_1505(!1),he=pe[0];return y$1("div",createObj(ofArray$2([["className","w-full p-1 sm:p-5"],(ee=[y$1("div",createObj(ofArray$2([["className","flex justify-between items-center"],(ne=toList(delay(()=>{let ue,de;return append(singleton(y$1("div",createObj(ofArray$2([["className","flex items-center"],(ue=[y$1("div",createObj(ofArray$2([["onClick",Ae=>{ie(new Msg(1,[new Page$2(0,[])]))}],(de=[chevronLeft(singleton$1(new Prop(2,["cursor-pointer text-gray-900 hover:text-primary-base"])))],["children",Interop_reactApi.Children.toArray(Array.from(de))])]))),y$1("div",{className:"ml-1 mr-4 text-base sm:text-lg leading-6 sm:leading-7 font-semibold text-gray-900",children:me.Policy.Title})],["children",Interop_reactApi.Children.toArray(Array.from(ue))])])))),delay(()=>{let Ae,Se,ce;return me.Status.tag===2?singleton(y$1("div",createObj(ofArray$2([["className","flex items-center flex-col-reverse sm:flex-row"],(Ae=[y$1("span",{className:"mt-1 sm:mt-0 sm:mr-2.5 text-sm leading-5 font-medium text-gray-500",children:"Accepted"}),check(singleton$1(new Prop(2,["text-primary-base"])))],["children",Interop_reactApi.Children.toArray(Array.from(Ae))])])))):singleton(y$1("button",createObj(ofArray$2([["type","button"],["disabled",Deferred_inProgress(oe)],(Se=`
|
|
54
54
|
shadow-sm w-[4.75rem] h-10 px-3 py-2 rounded-md flex justify-center items-center text-white
|
|
55
55
|
text-sm font-semibold leading-5 cursor-pointer disabled:cursor-progress bg-primary-base
|
|
56
56
|
focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-base
|