From 87cbe8f7ed8d398d5ba4512c2b7763ad99de09f3 Mon Sep 17 00:00:00 2001 From: Jinsu Bae Date: Tue, 15 Oct 2024 12:13:00 +0900 Subject: [PATCH] [beginner group] Fix some path config --- groups/beginner/.nojekyll | 0 groups/beginner/_astro/.nojekyll | 1 - .../AnnotationLayer.BpazIcXQ.css | 0 .../PDFViewer.CKrkA-Gp.js} | 2 +- .../{_astro => astro}/TextLayer.Ct0_y4Em.css | 0 .../__vite-browser-external.BIHI7g3E.js | 0 .../{_astro => astro}/client.E677JtKR.js | 0 .../{_astro => astro}/hoisted.IxFg9jpS.js | 0 .../{_astro => astro}/index.CSkeIq9P.css | 0 .../{_astro => astro}/index.CZlPm10g.js | 0 .../meetup.BrD4ROEp_Z1zQnEO.svg} | 0 .../pdf.worker.min.BVPM1tzH.mjs | 0 .../presentation.BSltd4Vl.pdf | Bin .../presentation.Bblywtee.pdf | Bin .../presentation.BcyISGVS.pdf | Bin .../presentation.BgGtsm1L.pdf | Bin .../presentation.C7hL0CRe.pdf | Bin .../presentation.CdE4nefP.pdf | Bin .../presentation.CgZ60pEK.pdf | Bin .../presentation.D9EqK9vr.pdf | Bin .../presentation.DBfQK_eX.pdf | Bin .../presentation.DGkAQ7bx.pdf | Bin .../presentation.TwMEPJXq.pdf | Bin .../presentation.sJThXCKJ.pdf | Bin .../slack.B-p126JW_Z1MwKGX.svg} | 0 groups/beginner/browserconfig.xml | 2 +- groups/beginner/index.html | 4 +- groups/beginner/manifest.json | 80 +++++++++--------- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- .../index.html" | 4 +- 40 files changed, 68 insertions(+), 69 deletions(-) create mode 100644 groups/beginner/.nojekyll delete mode 100644 groups/beginner/_astro/.nojekyll rename groups/beginner/{_astro => astro}/AnnotationLayer.BpazIcXQ.css (100%) rename groups/beginner/{_astro/PDFViewer.DKKJkZsP.js => astro/PDFViewer.CKrkA-Gp.js} (99%) rename groups/beginner/{_astro => astro}/TextLayer.Ct0_y4Em.css (100%) rename groups/beginner/{_astro => astro}/__vite-browser-external.BIHI7g3E.js (100%) rename groups/beginner/{_astro => astro}/client.E677JtKR.js (100%) rename groups/beginner/{_astro => astro}/hoisted.IxFg9jpS.js (100%) rename groups/beginner/{_astro => astro}/index.CSkeIq9P.css (100%) rename groups/beginner/{_astro => astro}/index.CZlPm10g.js (100%) rename groups/beginner/{_astro/meetup.BrD4ROEp_10888r.svg => astro/meetup.BrD4ROEp_Z1zQnEO.svg} (100%) rename groups/beginner/{_astro => astro}/pdf.worker.min.BVPM1tzH.mjs (100%) rename groups/beginner/{_astro => astro}/presentation.BSltd4Vl.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.Bblywtee.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.BcyISGVS.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.BgGtsm1L.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.C7hL0CRe.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.CdE4nefP.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.CgZ60pEK.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.D9EqK9vr.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.DBfQK_eX.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.DGkAQ7bx.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.TwMEPJXq.pdf (100%) rename groups/beginner/{_astro => astro}/presentation.sJThXCKJ.pdf (100%) rename groups/beginner/{_astro/slack.B-p126JW_1sXDrv.svg => astro/slack.B-p126JW_Z1MwKGX.svg} (100%) diff --git a/groups/beginner/.nojekyll b/groups/beginner/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/groups/beginner/_astro/.nojekyll b/groups/beginner/_astro/.nojekyll deleted file mode 100644 index 8b13789..0000000 --- a/groups/beginner/_astro/.nojekyll +++ /dev/null @@ -1 +0,0 @@ - diff --git a/groups/beginner/_astro/AnnotationLayer.BpazIcXQ.css b/groups/beginner/astro/AnnotationLayer.BpazIcXQ.css similarity index 100% rename from groups/beginner/_astro/AnnotationLayer.BpazIcXQ.css rename to groups/beginner/astro/AnnotationLayer.BpazIcXQ.css diff --git a/groups/beginner/_astro/PDFViewer.DKKJkZsP.js b/groups/beginner/astro/PDFViewer.CKrkA-Gp.js similarity index 99% rename from groups/beginner/_astro/PDFViewer.DKKJkZsP.js rename to groups/beginner/astro/PDFViewer.CKrkA-Gp.js index 601335e..89b355e 100644 --- a/groups/beginner/_astro/PDFViewer.DKKJkZsP.js +++ b/groups/beginner/astro/PDFViewer.CKrkA-Gp.js @@ -23,4 +23,4 @@ import{r as C,R as dn,g as un}from"./index.CZlPm10g.js";/* empty css `)}`,this.#u();const d=new Range;let u=c.reduce((p,f)=>p+f.length,0);for(const{firstChild:p}of this.editorDiv.childNodes)if(p.nodeType===Node.TEXT_NODE){const f=p.nodeValue.length;if(u<=f){d.setStart(p,u),d.setEnd(p,u);break}u-=f}n.removeAllRanges(),n.addRange(d)}#u(){if(this.editorDiv.replaceChildren(),!!this.#r)for(const t of this.#r.split(` `)){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#v(){return this.#r.replaceAll(" "," ")}static#g(t){return t.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static deserialize(t,e,s){let i=null;if(t instanceof Oi){const{data:{defaultAppearanceData:{fontSize:r,fontColor:a},rect:o,rotation:c,id:h},textContent:d,textPosition:u,parent:{page:{pageNumber:p}}}=t;if(!d||d.length===0)return null;i=t={annotationType:N.FREETEXT,color:Array.from(a),fontSize:r,value:d.join(` `),position:u,pageIndex:p-1,rect:o.slice(0),rotation:c,id:h,deleted:!1}}const n=super.deserialize(t,e,s);return n.#c=t.fontSize,n.#i=P.makeHexColor(...t.color),n.#r=it.#g(t.value),n.annotationElementId=t.id||null,n.#d=i,n}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const e=it._internalPadding*this.parentScale,s=this.getRect(e,e),i=I._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#i),n={annotationType:N.FREETEXT,color:i,fontSize:this.#c,value:this.#v(),pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!this.#A(n)?null:(n.id=this.annotationElementId,n)}#A(t){const{value:e,fontSize:s,color:i,pageIndex:n}=this.#d;return this._hasBeenMoved||t.value!==e||t.fontSize!==s||t.color.some((r,a)=>r!==i[a])||t.pageIndex!==n}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:s}=e;s.fontSize=`calc(${this.#c}px * var(--scale-factor))`,s.color=this.#i,e.replaceChildren();for(const n of this.#r.split(` -`)){const r=document.createElement("div");r.append(n?document.createTextNode(n):document.createElement("br")),e.append(r)}const i=it._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(i,i),popupContent:this.#r}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class ms{#t;#e=[];#s=[];constructor(t,e=0,s=0,i=!0){let n=1/0,r=-1/0,a=1/0,o=-1/0;const h=10**-4;for(const{x:m,y:v,width:_,height:A}of t){const y=Math.floor((m-e)/h)*h,w=Math.ceil((m+_+e)/h)*h,E=Math.floor((v-e)/h)*h,x=Math.ceil((v+A+e)/h)*h,S=[y,E,x,!0],L=[w,E,x,!1];this.#e.push(S,L),n=Math.min(n,y),r=Math.max(r,w),a=Math.min(a,E),o=Math.max(o,x)}const d=r-n+2*s,u=o-a+2*s,p=n-s,f=a-s,g=this.#e.at(i?-1:-2),b=[g[0],g[2]];for(const m of this.#e){const[v,_,A]=m;m[0]=(v-p)/d,m[1]=(_-f)/u,m[2]=(A-f)/u}this.#t={x:p,y:f,width:d,height:u,lastPoint:b}}getOutlines(){this.#e.sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of this.#e)e[3]?(t.push(...this.#l(e)),this.#i(e)):(this.#r(e),t.push(...this.#l(e)));return this.#n(t)}#n(t){const e=[],s=new Set;for(const r of t){const[a,o,c]=r;e.push([a,o,r],[a,c,r])}e.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=e.length;r0;){const r=s.values().next().value;let[a,o,c,h,d]=r;s.delete(r);let u=a,p=o;for(n=[a,c],i.push(n);;){let f;if(s.has(h))f=h;else if(s.has(d))f=d;else break;s.delete(f),[a,o,c,h,d]=f,u!==a&&(n.push(u,p,a,p===o?o:c),u=a),p=p===o?c:o}n.push(u,p)}return new xa(i,this.#t)}#o(t){const e=this.#s;let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,r=e[n][0];if(r===t)return n;r=0;i--){const[n,r]=this.#s[i];if(n!==t)break;if(n===t&&r===e){this.#s.splice(i,1);return}}}#l(t){const[e,s,i]=t,n=[[e,s,i]],r=this.#o(i);for(let a=0;a=o){if(p>c)n[h][1]=c;else{if(d===1)return[];n.splice(h,1),h--,d--}continue}n[h][2]=o,p>c&&n.push([e,c,p])}}}return n}}class ji{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof bs}}class xa extends ji{#t;#e;constructor(t,e){super(),this.#e=t,this.#t=e}toSVGPath(){const t=[];for(const e of this.#e){let[s,i]=e;t.push(`M${s} ${i}`);for(let n=2;n=6;f-=6)isNaN(e[f])?p.push(`L${e[f+4]} ${e[f+5]}`):p.push(`C${e[f]} ${e[f+1]} ${e[f+2]} ${e[f+3]} ${e[f+4]} ${e[f+5]}`);return p.push(`L${e[4]} ${e[5]} Z`),p.join(" ")}getOutlines(){const t=this.#o,e=this.#e,s=this.#i,i=s.subarray(4,6),n=s.subarray(16,18),[r,a,o,c]=this.#t,h=new Float64Array((this.#a?.length??0)+2);for(let m=0,v=h.length-2;m=6;m-=6)for(let v=0;v<6;v+=2){if(isNaN(e[m+v])){g[b]=g[b+1]=NaN,b+=2;continue}g[b]=e[m+v],g[b+1]=e[m+v+1],b+=2}return g.set([NaN,NaN,NaN,NaN,e[4],e[5]],b),new bs(g,h,this.#t,this.#f,this.#s,this.#n)}}class bs extends ji{#t;#e=null;#s;#n;#o;#i;#r;constructor(t,e,s,i,n,r){super(),this.#r=t,this.#o=e,this.#t=s,this.#i=i,this.#s=n,this.#n=r,this.#d(r);const{x:a,y:o,width:c,height:h}=this.#e;for(let d=0,u=t.length;d-1?(this.#h=!0,this.#E(t),this.#_()):(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#r=t.focusNode,this.#l=t.focusOffset,this.#y(),this.#_(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#g,methodOfCreation:this.#A}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#y(){const t=new ms(this.#s,.001);this.#d=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#d.box;const e=new ms(this.#s,.0025,.001,this._uiManager.direction==="ltr");this.#i=e.getOutlines();const{lastPoint:s}=this.#i.box;this.#p=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]}#E({highlightOutlines:t,highlightId:e,clipPathId:s}){this.#d=t;const i=1.5;if(this.#i=t.getNewOutline(this.#g/2+i,.0025),e>=0)this.#f=e,this.#n=s,this.parent.drawLayer.finalizeLine(e,t),this.#u=this.parent.drawLayer.highlightOutline(this.#i);else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#f,t),this.parent.drawLayer.updateBox(this.#f,et.#b(this.#d.box,(h-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#u,this.#i),this.parent.drawLayer.updateBox(this.#u,et.#b(this.#i.box,h))}const{x:n,y:r,width:a,height:o}=t.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=a,this.height=o;break;case 90:{const[h,d]=this.parentDimensions;this.x=r,this.y=1-n,this.width=a*d/h,this.height=o*h/d;break}case 180:this.x=1-n,this.y=1-r,this.width=a,this.height=o;break;case 270:{const[h,d]=this.parentDimensions;this.x=1-r,this.y=n,this.width=a*d/h,this.height=o*h/d;break}}const{lastPoint:c}=this.#i.box;this.#p=[(c[0]-n)/a,(c[1]-r)/o]}static initialize(t,e){I.initialize(t,e),et._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case D.HIGHLIGHT_DEFAULT_COLOR:et._defaultColor=e;break;case D.HIGHLIGHT_THICKNESS:et._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#p}updateParams(t,e){switch(t){case D.HIGHLIGHT_COLOR:this.#x(e);break;case D.HIGHLIGHT_THICKNESS:this.#C(e);break}}static get defaultPropertiesToUpdate(){return[[D.HIGHLIGHT_DEFAULT_COLOR,et._defaultColor],[D.HIGHLIGHT_THICKNESS,et._defaultThickness]]}get propertiesToUpdate(){return[[D.HIGHLIGHT_COLOR,this.color||et._defaultColor],[D.HIGHLIGHT_THICKNESS,this.#g||et._defaultThickness],[D.HIGHLIGHT_FREE,this.#h]]}#x(t){const e=i=>{this.color=i,this.parent?.drawLayer.changeColor(this.#f,i),this.#o?.updateColor(i)},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#C(t){const e=this.#g,s=i=>{this.#g=i,this.#L(i)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#o=new Mt({editor:this}),t.addColorPicker(this.#o)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#R())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#R())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#S(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#_(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#S():t&&(this.#_(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#L(t){if(!this.#h)return;this.#E({highlightOutlines:this.#d.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,s]=this.parentDimensions;this.setDims(this.width*e,this.height*s)}#S(){this.#f===null||!this.parent||(this.parent.drawLayer.remove(this.#f),this.#f=null,this.parent.drawLayer.remove(this.#u),this.#u=null)}#_(t=this.parent){this.#f===null&&({id:this.#f,clipPathId:this.#n}=t.drawLayer.highlight(this.#d,this.color,this.#m),this.#u=t.drawLayer.highlightOutline(this.#i),this.#c&&(this.#c.style.clipPath=this.#n))}static#b({x:t,y:e,width:s,height:i},n){switch(n){case 90:return{x:1-e-i,y:t,width:i,height:s};case 180:return{x:1-t-s,y:1-e-i,width:s,height:i};case 270:return{x:e,y:1-t-s,width:i,height:s}}return{x:t,y:e,width:s,height:i}}rotate(t){const{drawLayer:e}=this.parent;let s;this.#h?(t=(t-this.rotation+360)%360,s=et.#b(this.#d.box,t)):s=et.#b(this,t),e.rotate(this.#f,t),e.rotate(this.#u,t),e.updateBox(this.#f,s),e.updateBox(this.#u,et.#b(this.#i.box,t))}render(){if(this.div)return this.div;const t=super.render();this.#v&&(t.setAttribute("aria-label",this.#v),t.setAttribute("role","mark")),this.#h?t.classList.add("free"):this.div.addEventListener("keydown",this.#a,{signal:this._uiManager._signal});const e=this.#c=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#n;const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),De(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#u,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#u,"hovered")}#w(t){et._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#T(!0);break;case 1:case 3:this.#T(!1);break}}#T(t){if(!this.#t)return;const e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#r,this.#l)}select(){super.select(),this.#u&&(this.parent?.drawLayer.removeClass(this.#u,"hovered"),this.parent?.drawLayer.addClass(this.#u,"selected"))}unselect(){super.unselect(),this.#u&&(this.parent?.drawLayer.removeClass(this.#u,"selected"),this.#h||this.#T(!1))}get _mustFixPosition(){return!this.#h}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#f,t),this.parent.drawLayer.show(this.#u,t))}#R(){return this.#h?this.rotation:0}#M(){if(this.#h)return null;const[t,e]=this.pageDimensions,s=this.#s,i=new Float32Array(s.length*8);let n=0;for(const{x:r,y:a,width:o,height:c}of s){const h=r*t,d=(1-a-c)*e;i[n]=i[n+4]=h,i[n+1]=i[n+3]=d,i[n+2]=i[n+6]=h+o*t,i[n+5]=i[n+7]=d+c*e,n+=8}return i}#k(t){return this.#d.serialize(t,this.#R())}static startHighlighting(t,e,{target:s,x:i,y:n}){const{x:r,y:a,width:o,height:c}=s.getBoundingClientRect(),h=g=>{this.#F(t,g)},d=t._signal,u={capture:!0,passive:!1,signal:d},p=g=>{g.preventDefault(),g.stopPropagation()},f=g=>{s.removeEventListener("pointermove",h),window.removeEventListener("blur",f),window.removeEventListener("pointerup",f),window.removeEventListener("pointerdown",p,u),window.removeEventListener("contextmenu",At),this.#I(t,g)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",p,u),window.addEventListener("contextmenu",At,{signal:d}),s.addEventListener("pointermove",h,{signal:d}),this._freeHighlight=new qt({x:i,y:n},[r,a,o,c],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static#F(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#I(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,s){const i=super.deserialize(t,e,s),{rect:[n,r,a,o],color:c,quadPoints:h}=t;i.color=P.makeHexColor(...c),i.#m=t.opacity;const[d,u]=i.pageDimensions;i.width=(a-n)/d,i.height=(o-r)/u;const p=i.#s=[];for(let f=0;f{this.thickness=i,this.#N()},s=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#v(t){const e=i=>{this.color=i,this.#w()},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(t){const e=i=>{this.opacity=i,this.#w()};t/=100;const s=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#R(),this.#M()),this.isAttachedToDOM||(this.parent.add(this),this.#k()),this.#N()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#h?.disconnect(),this.#h=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,s=this.width*t,i=this.height*e;this.setDimensions(s,i)}enableEditMode(){this.#c||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#i,{signal:this._uiManager._signal}))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#i))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#A(){const{parentRotation:t,parentDimensions:[e,s]}=this;switch(t){case 90:return[0,s,s,e];case 180:return[e,s,e,s];case 270:return[e,0,s,e];default:return[0,0,e,s]}}#y(){const{ctx:t,color:e,opacity:s,thickness:i,parentScale:n,scaleFactor:r}=this;t.lineWidth=i*n/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${Yn(s)}`}#E(t,e){const s=this._uiManager._signal;this.canvas.addEventListener("contextmenu",At,{signal:s}),this.canvas.addEventListener("pointerleave",this.#n,{signal:s}),this.canvas.addEventListener("pointermove",this.#s,{signal:s}),this.canvas.addEventListener("pointerup",this.#o,{signal:s}),this.canvas.removeEventListener("pointerdown",this.#i),this.isEditing=!0,this.#f||(this.#f=!0,this.#k(),this.thickness||=ot._defaultThickness,this.color||=ot._defaultColor||I._defaultLineColor,this.opacity??=ot._defaultOpacity),this.currentPath.push([t,e]),this.#d=!1,this.#y(),this.#m=()=>{this.#S(),this.#m&&window.requestAnimationFrame(this.#m)},window.requestAnimationFrame(this.#m)}#x(t,e){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===s&&e===i)return;const n=this.currentPath;let r=this.#l;if(n.push([t,e]),this.#d=!0,n.length<=2){r.moveTo(...n[0]),r.lineTo(t,e);return}n.length===3&&(this.#l=r=new Path2D,r.moveTo(...n[0])),this.#_(r,...n.at(-3),...n.at(-2),t,e)}#C(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);this.#l.lineTo(...t)}#L(t,e){this.#m=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#x(t,e),this.#C();let s;if(this.currentPath.length!==1)s=this.#b();else{const o=[t,e];s=[[o,o.slice(),o.slice(),o]]}const i=this.#l,n=this.currentPath;this.currentPath=[],this.#l=new Path2D;const r=()=>{this.allRawPaths.push(n),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},a=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#R(),this.#M()),this.#N())};this.addCommands({cmd:r,undo:a,mustExec:!0})}#S(){if(!this.#d)return;this.#d=!1;const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),s=e.map(r=>r[0]),i=e.map(r=>r[1]);Math.min(...s)-t,Math.max(...s)+t,Math.min(...i)-t,Math.max(...i)+t;const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const r of this.bezierPath2D)n.stroke(r);n.stroke(this.#l),n.restore()}#_(t,e,s,i,n,r,a){const o=(e+i)/2,c=(s+n)/2,h=(i+r)/2,d=(n+a)/2;t.bezierCurveTo(o+2*(i-o)/3,c+2*(n-c)/3,h+2*(i-h)/3,d+2*(n-d)/3,h,d)}#b(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let s,[i,n]=t[0];for(s=1;s{this.#r=null,this.canvas.removeEventListener("contextmenu",At)},10),this.#L(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#R(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#M(){this.#h=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#h.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#h?.disconnect(),this.#h=null},{once:!0})}get isResizable(){return!this.isEmpty()&&this.#c}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,n,r]=this.#A();if(this.setAt(s,i,0,0),this.setDims(n,r),this.#R(),this.width){const[a,o]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*o),this.setAt(t*a,e*o,this.width*a,this.height*o),this.#f=!0,this.#k(),this.setDims(this.width*a,this.height*o),this.#w(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#M(),this.div}#k(){if(!this.#f)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#I()}setDimensions(t,e){const s=Math.round(t),i=Math.round(e);if(this.#a===s&&this.#p===i)return;this.#a=s,this.#p=i,this.canvas.style.visibility="hidden";const[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.fixAndSetPosition(),this.#c&&this.#F(t,e),this.#k(),this.#w(),this.canvas.style.visibility="visible",this.fixDims()}#F(t,e){const s=this.#j(),i=(t-s)/this.#e,n=(e-s)/this.#t;this.scaleFactor=Math.min(i,n)}#I(){const t=this.#j()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#O(t){const e=new Path2D;for(let s=0,i=t.length;s`image/${e}`))}static get supportedTypesStr(){return H(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(N.STAMP,{bitmapFile:t.getAsFile()})}#h(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#d=t.isSvg),t.file&&(this.#i=t.file.name),this.#m()}#a(){this.#s=null,this._uiManager.enableWaiting(!1),this.#r&&this.div.focus()}#p(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(s=>this.#h(s,!0)).finally(()=>this.#a());return}if(this.#n){const s=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromUrl(s).then(i=>this.#h(i)).finally(()=>this.#a());return}if(this.#o){const s=this.#o;this.#o=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromFile(s).then(i=>this.#h(i)).finally(()=>this.#a());return}const t=document.createElement("input");t.type="file",t.accept=Fs.supportedTypesStr;const e=this._uiManager._signal;this.#s=new Promise(s=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#h(i)}s()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),s()},{signal:e})}).finally(()=>this.#a()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#r?.remove(),this.#r=null,this.#l?.disconnect(),this.#l=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#p();return}super.rebuild(),this.div!==null&&(this.#e&&this.#r===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#s||this.#t||this.#n||this.#o||this.#e)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#t?this.#m():this.#p(),this.width){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i)}return this.div}#m(){const{div:t}=this;let{width:e,height:s}=this.#t;const[i,n]=this.pageDimensions,r=.75;if(this.width)e=this.width*i,s=this.height*n;else if(e>r*i||s>r*n){const h=Math.min(r*i/e,r*n/s);e*=h,s*=h}const[a,o]=this.parentDimensions;this.setDims(e*a/i,s*o/n),this._uiManager.enableWaiting(!1);const c=this.#r=document.createElement("canvas");t.append(c),t.hidden=!1,this.#g(e,s),this.#y(),this.#f||(this.parent.addUndoableEditor(this),this.#f=!0),this._reportTelemetry({action:"inserted_image"}),this.#i&&c.setAttribute("aria-label",this.#i)}#u(t,e){const[s,i]=this.parentDimensions;this.width=t/s,this.height=e/i,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#c!==null&&clearTimeout(this.#c);const n=200;this.#c=setTimeout(()=>{this.#c=null,this.#g(t,e)},n)}#v(t,e){const{width:s,height:i}=this.#t;let n=s,r=i,a=this.#t;for(;n>2*t||r>2*e;){const o=n,c=r;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const h=new OffscreenCanvas(n,r);h.getContext("2d").drawImage(a,0,0,o,c,0,0,n,r),a=h.transferToImageBitmap()}return a}#g(t,e){t=Math.ceil(t),e=Math.ceil(e);const s=this.#r;if(!s||s.width===t&&s.height===e)return;s.width=t,s.height=e;const i=this.#d?this.#t:this.#v(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const a=new OffscreenCanvas(t,e).getContext("2d");a.drawImage(i,0,0,i.width,i.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:a.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then(o=>{const c=o?.output||"";this.parent&&c&&!this.hasAltText()&&(this.altTextData={altText:c,decorative:!1})})}const n=s.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(i,0,0,i.width,i.height,0,0,t,e)}getImageForAltText(){return this.#r}#A(t){if(t){if(this.#d){const i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}const e=document.createElement("canvas");return{width:e.width,height:e.height}=this.#t,e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#d){const[e,s]=this.pageDimensions,i=Math.round(this.width*e*ae.PDF_TO_CSS_UNITS),n=Math.round(this.height*s*ae.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(i,n);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,n),r.transferToImageBitmap()}return structuredClone(this.#t)}#y(){this._uiManager._signal&&(this.#l=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.#u(e.width,e.height)}),this.#l.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#l?.disconnect(),this.#l=null},{once:!0}))}static deserialize(t,e,s){if(t instanceof Bi)return null;const i=super.deserialize(t,e,s),{rect:n,bitmapUrl:r,bitmapId:a,isSvg:o,accessibilityData:c}=t;a&&s.imageManager.isValidId(a)?i.#e=a:i.#n=r,i.#d=o;const[h,d]=i.pageDimensions;return i.width=(n[2]-n[0])/h,i.height=(n[3]-n[1])/d,c&&(i.altTextData=c),i}serialize(t=!1,e=null){if(this.isEmpty())return null;const s={annotationType:N.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#d,structTreeParentId:this._structTreeParentId};if(t)return s.bitmapUrl=this.#A(!0),s.accessibilityData=this.altTextData,s;const{decorative:i,altText:n}=this.altTextData;if(!i&&n&&(s.accessibilityData={type:"Figure",alt:n}),e===null)return s;e.stamps||=new Map;const r=this.#d?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:s}),s.bitmap=this.#A(!1);else if(this.#d){const a=e.stamps.get(this.#e);r>a.area&&(a.area=r,a.serialized.bitmap.close(),a.serialized.bitmap=this.#A(!1))}return s}}class Nt{#t;#e=!1;#s=null;#n=null;#o=null;#i=null;#r=null;#l=new Map;#c=!1;#d=!1;#f=!1;#h=null;#a;static _initialized=!1;static#p=new Map([it,ot,Fs,et].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:s,accessibilityManager:i,annotationLayer:n,drawLayer:r,textLayer:a,viewport:o,l10n:c}){const h=[...Nt.#p.values()];if(!Nt._initialized){Nt._initialized=!0;for(const d of h)d.initialize(c,t)}t.registerEditorTypes(h),this.#a=t,this.pageIndex=e,this.div=s,this.#t=i,this.#s=n,this.viewport=o,this.#h=a,this.drawLayer=r,this.#a.addLayer(this)}get isEmpty(){return this.#l.size===0}get isInvisible(){return this.isEmpty&&this.#a.getMode()===N.NONE}updateToolbar(t){this.#a.updateToolbar(t)}updateMode(t=this.#a.getMode()){switch(this.#A(),t){case N.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case N.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case N.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of Nt.#p.values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#h?.div}addInkEditorIfNeeded(t){if(this.#a.getMode()!==N.INK)return;if(!t){for(const s of this.#l.values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){this.#a.setEditingState(t)}addCommands(t){this.#a.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#s?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of this.#l.values())s.enableEditing(),s.show(!0),s.annotationElementId&&(this.#a.removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!this.#s)return;const e=this.#s.getEditableAnnotations();for(const s of e){if(s.hide(),this.#a.isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#f=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const i of this.#l.values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){t.set(i.annotationElementId,i);continue}else e.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}if(this.#s){const i=this.#s.getEditableAnnotations();for(const n of i){const{id:r}=n.data;if(this.#a.isDeletedAnnotationElement(r))continue;let a=e.get(r);if(a){a.resetAnnotationElement(n),a.show(!1),n.show();continue}a=t.get(r),a&&(this.#a.addChangedExistingAnnotation(a),a.renderAnnotationElement(n),a.show(!1)),n.show()}}this.#A(),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const i of Nt.#p.values())s.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#f=!1}getEditableAnnotation(t){return this.#s?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#a.getActive()!==t&&this.#a.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#h?.div&&!this.#i&&(this.#i=this.#m.bind(this),this.#h.div.addEventListener("pointerdown",this.#i,{signal:this.#a._signal}),this.#h.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#i&&(this.#h.div.removeEventListener("pointerdown",this.#i),this.#i=null,this.#h.div.classList.remove("highlighting"))}#m(t){if(this.#a.unselectAll(),t.target===this.#h.div){const{isMac:e}=vt.platform;if(t.button!==0||t.ctrlKey&&e)return;this.#a.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),et.startHighlighting(this,this.#a.direction==="ltr",t),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free")},{once:!0,signal:this.#a._signal}),t.preventDefault()}}enableClick(){if(this.#o)return;const t=this.#a._signal;this.#o=this.pointerdown.bind(this),this.#n=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#o,{signal:t}),this.div.addEventListener("pointerup",this.#n,{signal:t})}disableClick(){this.#o&&(this.div.removeEventListener("pointerdown",this.#o),this.div.removeEventListener("pointerup",this.#n),this.#o=null,this.#n=null)}attach(t){this.#l.set(t.id,t);const{annotationElementId:e}=t;e&&this.#a.isDeletedAnnotationElement(e)&&this.#a.removeDeletedAnnotationElement(t)}detach(t){this.#l.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#f&&t.annotationElementId&&this.#a.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#a.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#d||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#a.addDeletedAnnotationElement(t.annotationElementId),I.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),this.#a.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#a.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#r&&(t._focusEventsAllowed=!1,this.#r=setTimeout(()=>{this.#r=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#a._signal}),e.focus())},0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return this.#a.getId()}get#u(){return Nt.#p.get(this.#a.getMode())}get _signal(){return this.#a._signal}#v(t){const e=this.#u;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#u?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#a.updateToolbar(t),this.#a.updateMode(t);const{offsetX:s,offsetY:i}=this.#g(),n=this.getNextId(),r=this.#v({parent:this,id:n,x:s,y:i,uiManager:this.#a,isCentered:!0,...e});r&&this.add(r)}deserialize(t){return Nt.#p.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#a)||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=this.#v({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#a,isCentered:e,...s});return n&&this.add(n),n}#g(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),r=Math.max(0,e),a=Math.min(window.innerWidth,t+s),o=Math.min(window.innerHeight,e+i),c=(n+a)/2-t,h=(r+o)/2-e,[d,u]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:u}}addNewEditor(){this.createAndAddNewEditor(this.#g(),!0)}setSelected(t){this.#a.setSelected(t)}toggleSelected(t){this.#a.toggleSelected(t)}isSelected(t){return this.#a.isSelected(t)}unselect(t){this.#a.unselect(t)}pointerup(t){const{isMac:e}=vt.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&this.#c){if(this.#c=!1,!this.#e){this.#e=!0;return}if(this.#a.getMode()===N.STAMP){this.#a.unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#a.getMode()===N.HIGHLIGHT&&this.enableTextSelection(),this.#c){this.#c=!1;return}const{isMac:e}=vt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;this.#c=!0;const s=this.#a.getActive();this.#e=!s||s.isEmpty()}findNewParent(t,e,s){const i=this.#a.findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null)),this.#r&&(clearTimeout(this.#r),this.#r=null);for(const t of this.#l.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#l.clear(),this.#a.removeLayer(this)}#A(){this.#d=!0;for(const t of this.#l.values())t.isEmpty()&&t.remove();this.#d=!1}render({viewport:t}){this.viewport=t,Xt(this.div,t);for(const e of this.#a.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#a.commitOrRemove(),this.#A();const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Xt(this.div,{rotation:s}),e!==s)for(const i of this.#l.values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#a.viewParameters.realScale}}class ct{#t=null;#e=0;#s=new Map;#n=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#t){this.#t=t;return}if(this.#t!==t){if(this.#s.size>0)for(const e of this.#s.values())e.remove(),t.append(e);this.#t=t}}static get _svgFactory(){return H(this,"_svgFactory",new ws)}static#o(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=t;r.top=`${100*s}%`,r.left=`${100*e}%`,r.width=`${100*i}%`,r.height=`${100*n}%`}#i(t){const e=ct._svgFactory.create(1,1,!0);return this.#t.append(e),e.setAttribute("aria-hidden",!0),ct.#o(e,t),e}#r(t,e){const s=ct._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=ct._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i}highlight(t,e,s,i=!1){const n=this.#e++,r=this.#i(t.box);r.classList.add("highlight"),t.free&&r.classList.add("free");const a=ct._svgFactory.createElement("defs");r.append(a);const o=ct._svgFactory.createElement("path");a.append(o);const c=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",c),o.setAttribute("d",t.toSVGPath()),i&&this.#n.set(n,o);const h=this.#r(a,c),d=ct._svgFactory.createElement("use");return r.append(d),r.setAttribute("fill",e),r.setAttribute("fill-opacity",s),d.setAttribute("href",`#${c}`),this.#s.set(n,r),{id:n,clipPathId:`url(#${h})`}}highlightOutline(t){const e=this.#e++,s=this.#i(t.box);s.classList.add("highlightOutline");const i=ct._svgFactory.createElement("defs");s.append(i);const n=ct._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let a;if(t.free){s.classList.add("free");const h=ct._svgFactory.createElement("mask");i.append(h),a=`mask_p${this.pageIndex}_${e}`,h.setAttribute("id",a),h.setAttribute("maskUnits","objectBoundingBox");const d=ct._svgFactory.createElement("rect");h.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");const u=ct._svgFactory.createElement("use");h.append(u),u.setAttribute("href",`#${r}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}const o=ct._svgFactory.createElement("use");s.append(o),o.setAttribute("href",`#${r}`),a&&o.setAttribute("mask",`url(#${a})`);const c=o.cloneNode();return s.append(c),o.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.#s.set(e,s),e}finalizeLine(t,e){const s=this.#n.get(t);this.#n.delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#s.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#n.delete(t)}updatePath(t,e){this.#n.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){ct.#o(this.#s.get(t),e)}show(t,e){this.#s.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#s.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#s.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#s.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#s.get(t).classList.add(e)}removeClass(t,e){this.#s.get(t).classList.remove(e)}remove(t){this.#t!==null&&(this.#s.get(t).remove(),this.#s.delete(t))}destroy(){this.#t=null;for(const t of this.#s.values())t.remove();this.#s.clear()}}var Ca=M.AbortException,Ta=M.AnnotationEditorLayer,Ra=M.AnnotationEditorParamsType,Pa=M.AnnotationEditorType,La=M.AnnotationEditorUIManager,Ui=M.AnnotationLayer,$i=M.AnnotationMode,ka=M.CMapCompressionType,Ma=M.ColorPicker,Ia=M.DOMSVGFactory,Da=M.DrawLayer,Fa=M.FeatureTest,Os=M.GlobalWorkerOptions,Oa=M.ImageKind,Na=M.InvalidPDFException,Ha=M.MissingPDFException,Ba=M.OPS,ja=M.Outliner,Ua=M.PDFDataRangeTransport,$a=M.PDFDateString,za=M.PDFWorker,Ga=M.PasswordResponses,Va=M.PermissionFlag,Wa=M.PixelsPerInch,qa=M.RenderingCancelledException,zi=M.TextLayer,Xa=M.UnexpectedResponseException,Ya=M.Util,Ka=M.VerbosityLevel,Qa=M.XfaLayer,Ja=M.build,Za=M.createValidAbsoluteUrl,to=M.fetchData,Gi=M.getDocument,eo=M.getFilenameFromUrl,so=M.getPdfFilenameFromUrl,io=M.getXfaPageViewport,no=M.isDataScheme,ro=M.isPdfFile,ao=M.noContextMenu,oo=M.normalizeUnicode,lo=M.renderTextLayer,ho=M.setLayerDimensions,co=M.shadow,uo=M.updateTextLayer,fo=M.version;const po=Object.freeze(Object.defineProperty({__proto__:null,AbortException:Ca,AnnotationEditorLayer:Ta,AnnotationEditorParamsType:Ra,AnnotationEditorType:Pa,AnnotationEditorUIManager:La,AnnotationLayer:Ui,AnnotationMode:$i,CMapCompressionType:ka,ColorPicker:Ma,DOMSVGFactory:Ia,DrawLayer:Da,FeatureTest:Fa,GlobalWorkerOptions:Os,ImageKind:Oa,InvalidPDFException:Na,MissingPDFException:Ha,OPS:Ba,Outliner:ja,PDFDataRangeTransport:Ua,PDFDateString:$a,PDFWorker:za,PasswordResponses:Ga,PermissionFlag:Va,PixelsPerInch:Wa,RenderingCancelledException:qa,TextLayer:zi,UnexpectedResponseException:Xa,Util:Ya,VerbosityLevel:Ka,XfaLayer:Qa,build:Ja,createValidAbsoluteUrl:Za,fetchData:to,getDocument:Gi,getFilenameFromUrl:eo,getPdfFilenameFromUrl:so,getXfaPageViewport:io,isDataScheme:no,isPdfFile:ro,noContextMenu:ao,normalizeUnicode:oo,renderTextLayer:lo,setLayerDimensions:ho,shadow:co,updateTextLayer:uo,version:fo},Symbol.toStringTag,{value:"Module"}));var at=function(l,t,e){if(e||arguments.length===2)for(var s=0,i=t.length,n;s{V(this.pdfDocument),V(t),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{V(Array.isArray(e));const s=e[0];new Promise(i=>{V(this.pdfDocument),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{V(!1)}):typeof s=="number"?i(s):V(!1)}).then(i=>{const n=i+1;V(this.pdfViewer),V(n>=1&&n<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;V(this.pdfViewer),V(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||Ho,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const ni={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Ke=typeof window<"u",Xi=Ke&&window.location.protocol==="file:";function jo(l){return typeof l<"u"}function Vt(l){return jo(l)&&l!==null}function Uo(l){return typeof l=="string"}function $o(l){return l instanceof ArrayBuffer}function zo(l){return V(Ke),l instanceof Blob}function vs(l){return Uo(l)&&/^data:/.test(l)}function ri(l){V(vs(l));const[t="",e=""]=l.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Go(){return Ke&&window.devicePixelRatio||1}const Yi="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function ai(){dt(!Xi,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Yi}`)}function Vo(){dt(!Xi,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Yi}`)}function Kt(l){l?.cancel&&l.cancel()}function As(l,t){return Object.defineProperty(l,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(l,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(l,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(l,"originalHeight",{get(){return this.view[3]},configurable:!0}),l}function Wo(l){return l.name==="RenderingCancelledException"}function qo(l){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(l)})}function Xo(l,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return l}}function oe(){return C.useReducer(Xo,{value:void 0,error:void 0})}var Yo=function(l,t,e,s){function i(n){return n instanceof e?n:new e(function(r){r(n)})}return new(e||(e=Promise))(function(n,r){function a(h){try{c(s.next(h))}catch(d){r(d)}}function o(h){try{c(s.throw(h))}catch(d){r(d)}}function c(h){h.done?n(h.value):i(h.value).then(a,o)}c((s=s.apply(l,t||[])).next())})},oi=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i{switch(t){case ni.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");l(e);break}case ni.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");l(e);break}}};function li(l){return typeof l=="object"&&l!==null&&("data"in l||"range"in l||"url"in l)}const Jo=C.forwardRef(function(t,e){var{children:s,className:i,error:n="Failed to load PDF file.",externalLinkRel:r,externalLinkTarget:a,file:o,inputRef:c,imageResourcesPath:h,loading:d="Loading PDF…",noData:u="No PDF file specified.",onItemClick:p,onLoadError:f,onLoadProgress:g,onLoadSuccess:b,onPassword:m=Qo,onSourceError:v,onSourceSuccess:_,options:A,renderMode:y,rotate:w}=t,E=oi(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[x,S]=oe(),{value:L,error:R}=x,[z,B]=oe(),{value:O,error:j}=z,U=C.useRef(new Bo),T=C.useRef([]),k=C.useRef(void 0),_t=C.useRef(void 0);o&&o!==k.current&&li(o)&&(dt(!ne(o,k.current),`File prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),k.current=o),A&&A!==_t.current&&(dt(!ne(A,_t.current),`Options prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),_t.current=A);const Et=C.useRef({scrollPageIntoView:W=>{const{dest:Z,pageNumber:lt,pageIndex:rt=lt-1}=W;if(p){p({dest:Z,pageIndex:rt,pageNumber:lt});return}const te=T.current[rt];if(te){te.scrollIntoView();return}dt(!1,`An internal link leading to page ${lt} was clicked, but neither was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within .`)}});C.useImperativeHandle(e,()=>({linkService:U,pages:T,viewer:Et}),[]);function jt(){_&&_()}function Q(){R&&(dt(!1,R.toString()),v&&v(R))}function X(){S({type:"RESET"})}C.useEffect(X,[o,S]);const St=C.useCallback(()=>Yo(this,void 0,void 0,function*(){if(!o)return null;if(typeof o=="string")return vs(o)?{data:ri(o)}:(ai(),{url:o});if(o instanceof Ko)return{range:o};if($o(o))return{data:o};if(Ke&&zo(o))return{data:yield qo(o)};if(V(typeof o=="object"),V(li(o)),"url"in o&&typeof o.url=="string"){if(vs(o.url)){const{url:W}=o,Z=oi(o,["url"]),lt=ri(W);return Object.assign({data:lt},Z)}ai()}return o}),[o]);C.useEffect(()=>{const W=Se(St());return W.promise.then(Z=>{S({type:"RESOLVE",value:Z})}).catch(Z=>{S({type:"REJECT",error:Z})}),()=>{Kt(W)}},[St,S]),C.useEffect(()=>{if(!(typeof L>"u")){if(L===!1){Q();return}jt()}},[L]);function yt(){O&&(b&&b(O),T.current=new Array(O.numPages),U.current.setDocument(O))}function ft(){j&&(dt(!1,j.toString()),f&&f(j))}C.useEffect(function(){B({type:"RESET"})},[B,L]),C.useEffect(function(){if(!L)return;const Z=A?Object.assign(Object.assign({},L),A):L,lt=Gi(Z);g&&(lt.onProgress=g),m&&(lt.onPassword=m);const rt=lt,te=rt.promise.then(ce=>{B({type:"RESOLVE",value:ce})}).catch(ce=>{rt.destroyed||B({type:"REJECT",error:ce})});return()=>{te.finally(()=>rt.destroy())}},[A,B,L]),C.useEffect(()=>{if(!(typeof O>"u")){if(O===!1){ft();return}yt()}},[O]),C.useEffect(function(){U.current.setViewer(Et.current),U.current.setExternalLinkRel(r),U.current.setExternalLinkTarget(a)},[r,a]);const q=C.useCallback((W,Z)=>{T.current[W]=Z},[]),gt=C.useCallback(W=>{delete T.current[W]},[]),Pt=C.useMemo(()=>({imageResourcesPath:h,linkService:U.current,onItemClick:p,pdf:O,registerPage:q,renderMode:y,rotate:w,unregisterPage:gt}),[h,p,O,q,y,w,gt]),K=C.useMemo(()=>Vi(E,()=>O),[E,O]);function le(){return $.jsx(qi.Provider,{value:Pt,children:s})}function he(){return o?O==null?$.jsx(re,{type:"loading",children:typeof d=="function"?d():d}):O===!1?$.jsx(re,{type:"error",children:typeof n=="function"?n():n}):le():$.jsx(re,{type:"no-data",children:typeof u=="function"?u():u})}return $.jsx("div",Object.assign({className:Ye("react-pdf__Document",i),ref:c,style:{"--scale-factor":"1"}},K,{children:he()}))}),Zo=Jo;function Ki(){return C.useContext(qi)}function Qi(){for(var l=[],t=0;tnl(t),[t]),s=C.useMemo(()=>!Qe(t)||tn(t)?null:t.children.map((i,n)=>$.jsx(sn,{node:i},n)),[t]);return $.jsx("span",Object.assign({className:l},e,{children:s}))}function Je(){return C.useContext(Ji)}function rl(){const l=Je();V(l);const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=l,[s,i]=oe(),{value:n,error:r}=s,{customTextRenderer:a,page:o}=l;function c(){n&&e&&e(n)}function h(){r&&(dt(!1,r.toString()),t&&t(r))}return C.useEffect(function(){i({type:"RESET"})},[i,o]),C.useEffect(function(){if(a||!o)return;const u=Se(o.getStructTree()),p=u;return u.promise.then(f=>{i({type:"RESOLVE",value:f})}).catch(f=>{i({type:"REJECT",error:f})}),()=>Kt(p)},[a,o,i]),C.useEffect(()=>{if(n!==void 0){if(n===!1){h();return}c()}},[n]),n?$.jsx(sn,{className:"react-pdf__Page__structTree structTree",node:n}):null}const hi=$i;function al(l){const t=Je();V(t);const e=Object.assign(Object.assign({},t),l),{_className:s,canvasBackground:i,devicePixelRatio:n=Go(),onRenderError:r,onRenderSuccess:a,page:o,renderForms:c,renderTextLayer:h,rotate:d,scale:u}=e,{canvasRef:p}=l;V(o);const f=C.useRef(null);function g(){o&&a&&a(As(o,u))}function b(A){Wo(A)||(dt(!1,A.toString()),r&&r(A))}const m=C.useMemo(()=>o.getViewport({scale:u*n,rotation:d}),[n,o,d,u]),v=C.useMemo(()=>o.getViewport({scale:u,rotation:d}),[o,d,u]);C.useEffect(function(){if(!o)return;o.cleanup();const{current:y}=f;if(!y)return;y.width=m.width,y.height=m.height,y.style.width=`${Math.floor(v.width)}px`,y.style.height=`${Math.floor(v.height)}px`,y.style.visibility="hidden";const w={annotationMode:c?hi.ENABLE_FORMS:hi.ENABLE,canvasContext:y.getContext("2d",{alpha:!1}),viewport:m};i&&(w.background=i);const E=o.render(w),x=E;return E.promise.then(()=>{y.style.visibility="",g()}).catch(b),()=>Kt(x)},[i,o,c,m,v]);const _=C.useCallback(()=>{const{current:A}=f;A&&(A.width=0,A.height=0)},[]);return C.useEffect(()=>_,[_]),$.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:Qi(p,f),style:{display:"block",userSelect:"none"},children:h?$.jsx(rl,{}):null})}function ol(l){return"str"in l}function ll(){const l=Je();V(l);const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:r,pageIndex:a,pageNumber:o,rotate:c,scale:h}=l;V(r);const[d,u]=oe(),{value:p,error:f}=d,g=C.useRef(null),b=C.useRef(void 0);dt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function m(){p&&s&&s(p)}function v(){f&&(dt(!1,f.toString()),e&&e(f))}C.useEffect(function(){u({type:"RESET"})},[r,u]),C.useEffect(function(){if(!r)return;const S=Se(r.getTextContent()),L=S;return S.promise.then(R=>{u({type:"RESOLVE",value:R})}).catch(R=>{u({type:"REJECT",error:R})}),()=>Kt(L)},[r,u]),C.useEffect(()=>{if(p!==void 0){if(p===!1){v();return}m()}},[p]);const _=C.useCallback(()=>{n&&n()},[n]),A=C.useCallback(x=>{dt(!1,x.toString()),i&&i(x)},[i]);function y(){const x=b.current;x&&x.classList.add("active")}function w(){const x=b.current;x&&x.classList.remove("active")}const E=C.useMemo(()=>r.getViewport({scale:h,rotation:c}),[r,c,h]);return C.useLayoutEffect(function(){if(!r||!p)return;const{current:S}=g;if(!S)return;S.innerHTML="";const L=r.streamTextContent({includeMarkedContent:!0}),R={container:S,textContentSource:L,viewport:E},z=new zi(R),B=z;return z.render().then(()=>{const O=document.createElement("div");O.className="endOfContent",S.append(O),b.current=O;const j=S.querySelectorAll('[role="presentation"]');if(t){let U=0;p.items.forEach((T,k)=>{if(!ol(T))return;const _t=j[U];if(!_t)return;const Et=t(Object.assign({pageIndex:a,pageNumber:o,itemIndex:k},T));_t.innerHTML=Et,U+=T.str&&T.hasEOL?2:1})}_()}).catch(A),()=>Kt(B)},[t,A,_,r,a,o,p,E]),$.jsx("div",{className:Ye("react-pdf__Page__textContent","textLayer"),onMouseUp:w,onMouseDown:y,ref:g})}function hl(){const l=Ki(),t=Je();V(t);const e=Object.assign(Object.assign({},l),t),{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:a,onRenderAnnotationLayerSuccess:o,page:c,pdf:h,renderForms:d,rotate:u,scale:p=1}=e;V(h),V(c),V(i);const[f,g]=oe(),{value:b,error:m}=f,v=C.useRef(null);dt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function _(){b&&r&&r(b)}function A(){m&&(dt(!1,m.toString()),n&&n(m))}C.useEffect(function(){g({type:"RESET"})},[g,c]),C.useEffect(function(){if(!c)return;const S=Se(c.getAnnotations()),L=S;return S.promise.then(R=>{g({type:"RESOLVE",value:R})}).catch(R=>{g({type:"REJECT",error:R})}),()=>{Kt(L)}},[g,c]),C.useEffect(()=>{if(b!==void 0){if(b===!1){A();return}_()}},[b]);function y(){o&&o()}function w(x){dt(!1,`${x}`),a&&a(x)}const E=C.useMemo(()=>c.getViewport({scale:p,rotation:u}),[c,u,p]);return C.useEffect(function(){if(!h||!c||!i||!b)return;const{current:S}=v;if(!S)return;const L=E.clone({dontFlip:!0}),R={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:S,l10n:null,page:c,viewport:L},z={annotations:b,annotationStorage:h.annotationStorage,div:S,imageResourcesPath:s,linkService:i,page:c,renderForms:d,viewport:L};S.innerHTML="";try{new Ui(R).render(z),y()}catch(B){w(B)}return()=>{}},[b,s,i,c,h,d,E]),$.jsx("div",{className:Ye("react-pdf__Page__annotations","annotationLayer"),ref:v})}var cl=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i{if(!K)return null;let ee=1;const Ce=St??ci;if(ft||p){const Te=K.getViewport({scale:1,rotation:lt});ft?ee=ft/Te.width:p&&(ee=p/Te.height)}return Ce*ee},[p,K,lt,St,ft]);C.useEffect(function(){return()=>{Vt(W)&&i&&yt&&yt(W)}},[i,T,W,yt]);function te(){if(x){if(!K||!rt)return;x(As(K,rt))}if(i&&k){if(!Vt(W)||!he.current)return;k(W,he.current)}}function ce(){le&&(dt(!1,le.toString()),E&&E(le))}C.useEffect(function(){Pt({type:"RESET"})},[Pt,T,W]),C.useEffect(function(){if(!T||!Z)return;const Ce=Se(T.getPage(Z)),Te=Ce;return Ce.promise.then(Ze=>{Pt({type:"RESOLVE",value:Ze})}).catch(Ze=>{Pt({type:"REJECT",error:Ze})}),()=>Kt(Te)},[Pt,T,Z]),C.useEffect(()=>{if(K!==void 0){if(K===!1){ce();return}te()}},[K,rt]);const nn=C.useMemo(()=>K&&Vt(W)&&Z&&Vt(lt)&&Vt(rt)?{_className:s,canvasBackground:n,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:_,onGetStructTreeSuccess:A,onGetTextError:y,onGetTextSuccess:w,onRenderAnnotationLayerError:S,onRenderAnnotationLayerSuccess:L,onRenderError:R,onRenderSuccess:z,onRenderTextLayerError:B,onRenderTextLayerSuccess:O,page:K,pageIndex:W,pageNumber:Z,renderForms:Et,renderTextLayer:Q,rotate:lt,scale:rt}:null,[s,n,h,d,m,v,_,A,y,w,S,L,R,z,B,O,K,W,Z,Et,Q,lt,rt]),rn=C.useMemo(()=>Vi(q,()=>K&&(rt?As(K,rt):void 0)),[q,K,rt]),xe=`${W}@${rt}/${lt}`;function an(){switch(jt){case"custom":return V(c),$.jsx(c,{},`${xe}_custom`);case"none":return null;case"canvas":default:return $.jsx(al,{canvasRef:r},`${xe}_canvas`)}}function on(){return Q?$.jsx(ll,{},`${xe}_text`):null}function ln(){return _t?$.jsx(hl,{},`${xe}_annotations`):null}function hn(){return $.jsxs(Ji.Provider,{value:nn,children:[an(),on(),ln(),a]})}function cn(){return Z?T===null||K===void 0||K===null?$.jsx(re,{type:"loading",children:typeof g=="function"?g():g}):T===!1||K===!1?$.jsx(re,{type:"error",children:typeof u=="function"?u():u}):hn():$.jsx(re,{type:"no-data",children:typeof b=="function"?b():b})}return $.jsx("div",Object.assign({className:Ye(s,o),"data-page-number":Z,ref:Qi(f,he),style:{"--scale-factor":`${rt}`,backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},rn,{children:cn()}))}Vo();Os.workerSrc="pdf.worker.mjs";function ul({title:l,titleId:t,...e},s){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},e),l?C.createElement("title",{id:t},l):null,C.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))}const fl=C.forwardRef(ul),pl=fl;function gl({title:l,titleId:t,...e},s){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},e),l?C.createElement("title",{id:t},l):null,C.createElement("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"}))}const ml=C.forwardRef(gl),bl=ml;Os.workerSrc=new URL("/groups/beginner/_astro/pdf.worker.min.BVPM1tzH.mjs",import.meta.url).toString();const vl={cMapUrl:"/cmaps/"};function Sl({file:l}){const[t,e]=C.useState(),[s,i]=C.useState(1),[n,r]=C.useState(null),[a,o]=C.useState();wn(n,h=>o(h.contentRect.width));function c({numPages:h}){e(h)}return $.jsxs("div",{ref:r,className:"relative p-2 bg-zinc-200 rounded border border-zinc-300 dark:bg-zinc-800 dark:border-zinc-700",children:[$.jsx(Zo,{file:l,onLoadSuccess:c,options:vl,children:Array.from(new Array(t),(h,d)=>$.jsx(dl,{pageNumber:d+1,width:a,className:s===d+1?"block":"hidden"},`page_${d+1}`))}),$.jsx("div",{className:"z-50 absolute bottom-4 left-4 md:bottom-6 md:left-6 flex items-center",children:$.jsx("button",{onClick:()=>i(h=>h-1),disabled:s<=1,className:"p-1 md:p-2 bg-black/30 hover:bg-black/50 text-white rounded-full disabled:opacity-30 disabled:cursor-not-allowed",children:$.jsx(pl,{className:"w-5 h-5"})})}),$.jsx("div",{className:"z-50 absolute bottom-4 right-4 md:bottom-6 md:right-6 flex items-center",children:$.jsx("button",{onClick:()=>i(h=>h+1),disabled:s>=t,className:"p-1 md:p-2 bg-black/30 hover:bg-black/50 text-white rounded-full disabled:opacity-30 disabled:cursor-not-allowed",children:$.jsx(bl,{className:"w-5 h-5"})})})]})}export{Sl as default}; +`)){const r=document.createElement("div");r.append(n?document.createTextNode(n):document.createElement("br")),e.append(r)}const i=it._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(i,i),popupContent:this.#r}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class ms{#t;#e=[];#s=[];constructor(t,e=0,s=0,i=!0){let n=1/0,r=-1/0,a=1/0,o=-1/0;const h=10**-4;for(const{x:m,y:v,width:_,height:A}of t){const y=Math.floor((m-e)/h)*h,w=Math.ceil((m+_+e)/h)*h,E=Math.floor((v-e)/h)*h,x=Math.ceil((v+A+e)/h)*h,S=[y,E,x,!0],L=[w,E,x,!1];this.#e.push(S,L),n=Math.min(n,y),r=Math.max(r,w),a=Math.min(a,E),o=Math.max(o,x)}const d=r-n+2*s,u=o-a+2*s,p=n-s,f=a-s,g=this.#e.at(i?-1:-2),b=[g[0],g[2]];for(const m of this.#e){const[v,_,A]=m;m[0]=(v-p)/d,m[1]=(_-f)/u,m[2]=(A-f)/u}this.#t={x:p,y:f,width:d,height:u,lastPoint:b}}getOutlines(){this.#e.sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of this.#e)e[3]?(t.push(...this.#l(e)),this.#i(e)):(this.#r(e),t.push(...this.#l(e)));return this.#n(t)}#n(t){const e=[],s=new Set;for(const r of t){const[a,o,c]=r;e.push([a,o,r],[a,c,r])}e.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=e.length;r0;){const r=s.values().next().value;let[a,o,c,h,d]=r;s.delete(r);let u=a,p=o;for(n=[a,c],i.push(n);;){let f;if(s.has(h))f=h;else if(s.has(d))f=d;else break;s.delete(f),[a,o,c,h,d]=f,u!==a&&(n.push(u,p,a,p===o?o:c),u=a),p=p===o?c:o}n.push(u,p)}return new xa(i,this.#t)}#o(t){const e=this.#s;let s=0,i=e.length-1;for(;s<=i;){const n=s+i>>1,r=e[n][0];if(r===t)return n;r=0;i--){const[n,r]=this.#s[i];if(n!==t)break;if(n===t&&r===e){this.#s.splice(i,1);return}}}#l(t){const[e,s,i]=t,n=[[e,s,i]],r=this.#o(i);for(let a=0;a=o){if(p>c)n[h][1]=c;else{if(d===1)return[];n.splice(h,1),h--,d--}continue}n[h][2]=o,p>c&&n.push([e,c,p])}}}return n}}class ji{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof bs}}class xa extends ji{#t;#e;constructor(t,e){super(),this.#e=t,this.#t=e}toSVGPath(){const t=[];for(const e of this.#e){let[s,i]=e;t.push(`M${s} ${i}`);for(let n=2;n=6;f-=6)isNaN(e[f])?p.push(`L${e[f+4]} ${e[f+5]}`):p.push(`C${e[f]} ${e[f+1]} ${e[f+2]} ${e[f+3]} ${e[f+4]} ${e[f+5]}`);return p.push(`L${e[4]} ${e[5]} Z`),p.join(" ")}getOutlines(){const t=this.#o,e=this.#e,s=this.#i,i=s.subarray(4,6),n=s.subarray(16,18),[r,a,o,c]=this.#t,h=new Float64Array((this.#a?.length??0)+2);for(let m=0,v=h.length-2;m=6;m-=6)for(let v=0;v<6;v+=2){if(isNaN(e[m+v])){g[b]=g[b+1]=NaN,b+=2;continue}g[b]=e[m+v],g[b+1]=e[m+v+1],b+=2}return g.set([NaN,NaN,NaN,NaN,e[4],e[5]],b),new bs(g,h,this.#t,this.#f,this.#s,this.#n)}}class bs extends ji{#t;#e=null;#s;#n;#o;#i;#r;constructor(t,e,s,i,n,r){super(),this.#r=t,this.#o=e,this.#t=s,this.#i=i,this.#s=n,this.#n=r,this.#d(r);const{x:a,y:o,width:c,height:h}=this.#e;for(let d=0,u=t.length;d-1?(this.#h=!0,this.#E(t),this.#_()):(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#r=t.focusNode,this.#l=t.focusOffset,this.#y(),this.#_(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#h?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#g,methodOfCreation:this.#A}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#y(){const t=new ms(this.#s,.001);this.#d=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#d.box;const e=new ms(this.#s,.0025,.001,this._uiManager.direction==="ltr");this.#i=e.getOutlines();const{lastPoint:s}=this.#i.box;this.#p=[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height]}#E({highlightOutlines:t,highlightId:e,clipPathId:s}){this.#d=t;const i=1.5;if(this.#i=t.getNewOutline(this.#g/2+i,.0025),e>=0)this.#f=e,this.#n=s,this.parent.drawLayer.finalizeLine(e,t),this.#u=this.parent.drawLayer.highlightOutline(this.#i);else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#f,t),this.parent.drawLayer.updateBox(this.#f,et.#b(this.#d.box,(h-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#u,this.#i),this.parent.drawLayer.updateBox(this.#u,et.#b(this.#i.box,h))}const{x:n,y:r,width:a,height:o}=t.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=a,this.height=o;break;case 90:{const[h,d]=this.parentDimensions;this.x=r,this.y=1-n,this.width=a*d/h,this.height=o*h/d;break}case 180:this.x=1-n,this.y=1-r,this.width=a,this.height=o;break;case 270:{const[h,d]=this.parentDimensions;this.x=1-r,this.y=n,this.width=a*d/h,this.height=o*h/d;break}}const{lastPoint:c}=this.#i.box;this.#p=[(c[0]-n)/a,(c[1]-r)/o]}static initialize(t,e){I.initialize(t,e),et._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case D.HIGHLIGHT_DEFAULT_COLOR:et._defaultColor=e;break;case D.HIGHLIGHT_THICKNESS:et._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#p}updateParams(t,e){switch(t){case D.HIGHLIGHT_COLOR:this.#x(e);break;case D.HIGHLIGHT_THICKNESS:this.#C(e);break}}static get defaultPropertiesToUpdate(){return[[D.HIGHLIGHT_DEFAULT_COLOR,et._defaultColor],[D.HIGHLIGHT_THICKNESS,et._defaultThickness]]}get propertiesToUpdate(){return[[D.HIGHLIGHT_COLOR,this.color||et._defaultColor],[D.HIGHLIGHT_THICKNESS,this.#g||et._defaultThickness],[D.HIGHLIGHT_FREE,this.#h]]}#x(t){const e=i=>{this.color=i,this.parent?.drawLayer.changeColor(this.#f,i),this.#o?.updateColor(i)},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#C(t){const e=this.#g,s=i=>{this.#g=i,this.#L(i)};this.addCommands({cmd:s.bind(this,t),undo:s.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#o=new Mt({editor:this}),t.addColorPicker(this.#o)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#R())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#R())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#S(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#_(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#S():t&&(this.#_(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#L(t){if(!this.#h)return;this.#E({highlightOutlines:this.#d.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,s]=this.parentDimensions;this.setDims(this.width*e,this.height*s)}#S(){this.#f===null||!this.parent||(this.parent.drawLayer.remove(this.#f),this.#f=null,this.parent.drawLayer.remove(this.#u),this.#u=null)}#_(t=this.parent){this.#f===null&&({id:this.#f,clipPathId:this.#n}=t.drawLayer.highlight(this.#d,this.color,this.#m),this.#u=t.drawLayer.highlightOutline(this.#i),this.#c&&(this.#c.style.clipPath=this.#n))}static#b({x:t,y:e,width:s,height:i},n){switch(n){case 90:return{x:1-e-i,y:t,width:i,height:s};case 180:return{x:1-t-s,y:1-e-i,width:s,height:i};case 270:return{x:e,y:1-t-s,width:i,height:s}}return{x:t,y:e,width:s,height:i}}rotate(t){const{drawLayer:e}=this.parent;let s;this.#h?(t=(t-this.rotation+360)%360,s=et.#b(this.#d.box,t)):s=et.#b(this,t),e.rotate(this.#f,t),e.rotate(this.#u,t),e.updateBox(this.#f,s),e.updateBox(this.#u,et.#b(this.#i.box,t))}render(){if(this.div)return this.div;const t=super.render();this.#v&&(t.setAttribute("aria-label",this.#v),t.setAttribute("role","mark")),this.#h?t.classList.add("free"):this.div.addEventListener("keydown",this.#a,{signal:this._uiManager._signal});const e=this.#c=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#n;const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),De(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#u,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#u,"hovered")}#w(t){et._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#T(!0);break;case 1:case 3:this.#T(!1);break}}#T(t){if(!this.#t)return;const e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#r,this.#l)}select(){super.select(),this.#u&&(this.parent?.drawLayer.removeClass(this.#u,"hovered"),this.parent?.drawLayer.addClass(this.#u,"selected"))}unselect(){super.unselect(),this.#u&&(this.parent?.drawLayer.removeClass(this.#u,"selected"),this.#h||this.#T(!1))}get _mustFixPosition(){return!this.#h}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#f,t),this.parent.drawLayer.show(this.#u,t))}#R(){return this.#h?this.rotation:0}#M(){if(this.#h)return null;const[t,e]=this.pageDimensions,s=this.#s,i=new Float32Array(s.length*8);let n=0;for(const{x:r,y:a,width:o,height:c}of s){const h=r*t,d=(1-a-c)*e;i[n]=i[n+4]=h,i[n+1]=i[n+3]=d,i[n+2]=i[n+6]=h+o*t,i[n+5]=i[n+7]=d+c*e,n+=8}return i}#k(t){return this.#d.serialize(t,this.#R())}static startHighlighting(t,e,{target:s,x:i,y:n}){const{x:r,y:a,width:o,height:c}=s.getBoundingClientRect(),h=g=>{this.#F(t,g)},d=t._signal,u={capture:!0,passive:!1,signal:d},p=g=>{g.preventDefault(),g.stopPropagation()},f=g=>{s.removeEventListener("pointermove",h),window.removeEventListener("blur",f),window.removeEventListener("pointerup",f),window.removeEventListener("pointerdown",p,u),window.removeEventListener("contextmenu",At),this.#I(t,g)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",p,u),window.addEventListener("contextmenu",At,{signal:d}),s.addEventListener("pointermove",h,{signal:d}),this._freeHighlight=new qt({x:i,y:n},[r,a,o,c],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static#F(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#I(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,s){const i=super.deserialize(t,e,s),{rect:[n,r,a,o],color:c,quadPoints:h}=t;i.color=P.makeHexColor(...c),i.#m=t.opacity;const[d,u]=i.pageDimensions;i.width=(a-n)/d,i.height=(o-r)/u;const p=i.#s=[];for(let f=0;f{this.thickness=i,this.#N()},s=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#v(t){const e=i=>{this.color=i,this.#w()},s=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(t){const e=i=>{this.opacity=i,this.#w()};t/=100;const s=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#R(),this.#M()),this.isAttachedToDOM||(this.parent.add(this),this.#k()),this.#N()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#h?.disconnect(),this.#h=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,s=this.width*t,i=this.height*e;this.setDimensions(s,i)}enableEditMode(){this.#c||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#i,{signal:this._uiManager._signal}))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#i))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#A(){const{parentRotation:t,parentDimensions:[e,s]}=this;switch(t){case 90:return[0,s,s,e];case 180:return[e,s,e,s];case 270:return[e,0,s,e];default:return[0,0,e,s]}}#y(){const{ctx:t,color:e,opacity:s,thickness:i,parentScale:n,scaleFactor:r}=this;t.lineWidth=i*n/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${Yn(s)}`}#E(t,e){const s=this._uiManager._signal;this.canvas.addEventListener("contextmenu",At,{signal:s}),this.canvas.addEventListener("pointerleave",this.#n,{signal:s}),this.canvas.addEventListener("pointermove",this.#s,{signal:s}),this.canvas.addEventListener("pointerup",this.#o,{signal:s}),this.canvas.removeEventListener("pointerdown",this.#i),this.isEditing=!0,this.#f||(this.#f=!0,this.#k(),this.thickness||=ot._defaultThickness,this.color||=ot._defaultColor||I._defaultLineColor,this.opacity??=ot._defaultOpacity),this.currentPath.push([t,e]),this.#d=!1,this.#y(),this.#m=()=>{this.#S(),this.#m&&window.requestAnimationFrame(this.#m)},window.requestAnimationFrame(this.#m)}#x(t,e){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===s&&e===i)return;const n=this.currentPath;let r=this.#l;if(n.push([t,e]),this.#d=!0,n.length<=2){r.moveTo(...n[0]),r.lineTo(t,e);return}n.length===3&&(this.#l=r=new Path2D,r.moveTo(...n[0])),this.#_(r,...n.at(-3),...n.at(-2),t,e)}#C(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);this.#l.lineTo(...t)}#L(t,e){this.#m=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#x(t,e),this.#C();let s;if(this.currentPath.length!==1)s=this.#b();else{const o=[t,e];s=[[o,o.slice(),o.slice(),o]]}const i=this.#l,n=this.currentPath;this.currentPath=[],this.#l=new Path2D;const r=()=>{this.allRawPaths.push(n),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},a=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#R(),this.#M()),this.#N())};this.addCommands({cmd:r,undo:a,mustExec:!0})}#S(){if(!this.#d)return;this.#d=!1;const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),s=e.map(r=>r[0]),i=e.map(r=>r[1]);Math.min(...s)-t,Math.max(...s)+t,Math.min(...i)-t,Math.max(...i)+t;const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const r of this.bezierPath2D)n.stroke(r);n.stroke(this.#l),n.restore()}#_(t,e,s,i,n,r,a){const o=(e+i)/2,c=(s+n)/2,h=(i+r)/2,d=(n+a)/2;t.bezierCurveTo(o+2*(i-o)/3,c+2*(n-c)/3,h+2*(i-h)/3,d+2*(n-d)/3,h,d)}#b(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let s,[i,n]=t[0];for(s=1;s{this.#r=null,this.canvas.removeEventListener("contextmenu",At)},10),this.#L(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#R(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#M(){this.#h=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#h.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#h?.disconnect(),this.#h=null},{once:!0})}get isResizable(){return!this.isEmpty()&&this.#c}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,n,r]=this.#A();if(this.setAt(s,i,0,0),this.setDims(n,r),this.#R(),this.width){const[a,o]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*o),this.setAt(t*a,e*o,this.width*a,this.height*o),this.#f=!0,this.#k(),this.setDims(this.width*a,this.height*o),this.#w(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#M(),this.div}#k(){if(!this.#f)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#I()}setDimensions(t,e){const s=Math.round(t),i=Math.round(e);if(this.#a===s&&this.#p===i)return;this.#a=s,this.#p=i,this.canvas.style.visibility="hidden";const[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.fixAndSetPosition(),this.#c&&this.#F(t,e),this.#k(),this.#w(),this.canvas.style.visibility="visible",this.fixDims()}#F(t,e){const s=this.#j(),i=(t-s)/this.#e,n=(e-s)/this.#t;this.scaleFactor=Math.min(i,n)}#I(){const t=this.#j()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#O(t){const e=new Path2D;for(let s=0,i=t.length;s`image/${e}`))}static get supportedTypesStr(){return H(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(N.STAMP,{bitmapFile:t.getAsFile()})}#h(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#d=t.isSvg),t.file&&(this.#i=t.file.name),this.#m()}#a(){this.#s=null,this._uiManager.enableWaiting(!1),this.#r&&this.div.focus()}#p(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(s=>this.#h(s,!0)).finally(()=>this.#a());return}if(this.#n){const s=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromUrl(s).then(i=>this.#h(i)).finally(()=>this.#a());return}if(this.#o){const s=this.#o;this.#o=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromFile(s).then(i=>this.#h(i)).finally(()=>this.#a());return}const t=document.createElement("input");t.type="file",t.accept=Fs.supportedTypesStr;const e=this._uiManager._signal;this.#s=new Promise(s=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#h(i)}s()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),s()},{signal:e})}).finally(()=>this.#a()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#r?.remove(),this.#r=null,this.#l?.disconnect(),this.#l=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#p();return}super.rebuild(),this.div!==null&&(this.#e&&this.#r===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#s||this.#t||this.#n||this.#o||this.#e)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#t?this.#m():this.#p(),this.width){const[s,i]=this.parentDimensions;this.setAt(t*s,e*i,this.width*s,this.height*i)}return this.div}#m(){const{div:t}=this;let{width:e,height:s}=this.#t;const[i,n]=this.pageDimensions,r=.75;if(this.width)e=this.width*i,s=this.height*n;else if(e>r*i||s>r*n){const h=Math.min(r*i/e,r*n/s);e*=h,s*=h}const[a,o]=this.parentDimensions;this.setDims(e*a/i,s*o/n),this._uiManager.enableWaiting(!1);const c=this.#r=document.createElement("canvas");t.append(c),t.hidden=!1,this.#g(e,s),this.#y(),this.#f||(this.parent.addUndoableEditor(this),this.#f=!0),this._reportTelemetry({action:"inserted_image"}),this.#i&&c.setAttribute("aria-label",this.#i)}#u(t,e){const[s,i]=this.parentDimensions;this.width=t/s,this.height=e/i,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#c!==null&&clearTimeout(this.#c);const n=200;this.#c=setTimeout(()=>{this.#c=null,this.#g(t,e)},n)}#v(t,e){const{width:s,height:i}=this.#t;let n=s,r=i,a=this.#t;for(;n>2*t||r>2*e;){const o=n,c=r;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const h=new OffscreenCanvas(n,r);h.getContext("2d").drawImage(a,0,0,o,c,0,0,n,r),a=h.transferToImageBitmap()}return a}#g(t,e){t=Math.ceil(t),e=Math.ceil(e);const s=this.#r;if(!s||s.width===t&&s.height===e)return;s.width=t,s.height=e;const i=this.#d?this.#t:this.#v(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const a=new OffscreenCanvas(t,e).getContext("2d");a.drawImage(i,0,0,i.width,i.height,0,0,t,e),this._uiManager.mlGuess({service:"image-to-text",request:{data:a.getImageData(0,0,t,e).data,width:t,height:e,channels:4}}).then(o=>{const c=o?.output||"";this.parent&&c&&!this.hasAltText()&&(this.altTextData={altText:c,decorative:!1})})}const n=s.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(i,0,0,i.width,i.height,0,0,t,e)}getImageForAltText(){return this.#r}#A(t){if(t){if(this.#d){const i=this._uiManager.imageManager.getSvgUrl(this.#e);if(i)return i}const e=document.createElement("canvas");return{width:e.width,height:e.height}=this.#t,e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#d){const[e,s]=this.pageDimensions,i=Math.round(this.width*e*ae.PDF_TO_CSS_UNITS),n=Math.round(this.height*s*ae.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(i,n);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,i,n),r.transferToImageBitmap()}return structuredClone(this.#t)}#y(){this._uiManager._signal&&(this.#l=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.#u(e.width,e.height)}),this.#l.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#l?.disconnect(),this.#l=null},{once:!0}))}static deserialize(t,e,s){if(t instanceof Bi)return null;const i=super.deserialize(t,e,s),{rect:n,bitmapUrl:r,bitmapId:a,isSvg:o,accessibilityData:c}=t;a&&s.imageManager.isValidId(a)?i.#e=a:i.#n=r,i.#d=o;const[h,d]=i.pageDimensions;return i.width=(n[2]-n[0])/h,i.height=(n[3]-n[1])/d,c&&(i.altTextData=c),i}serialize(t=!1,e=null){if(this.isEmpty())return null;const s={annotationType:N.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#d,structTreeParentId:this._structTreeParentId};if(t)return s.bitmapUrl=this.#A(!0),s.accessibilityData=this.altTextData,s;const{decorative:i,altText:n}=this.altTextData;if(!i&&n&&(s.accessibilityData={type:"Figure",alt:n}),e===null)return s;e.stamps||=new Map;const r=this.#d?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:s}),s.bitmap=this.#A(!1);else if(this.#d){const a=e.stamps.get(this.#e);r>a.area&&(a.area=r,a.serialized.bitmap.close(),a.serialized.bitmap=this.#A(!1))}return s}}class Nt{#t;#e=!1;#s=null;#n=null;#o=null;#i=null;#r=null;#l=new Map;#c=!1;#d=!1;#f=!1;#h=null;#a;static _initialized=!1;static#p=new Map([it,ot,Fs,et].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:s,accessibilityManager:i,annotationLayer:n,drawLayer:r,textLayer:a,viewport:o,l10n:c}){const h=[...Nt.#p.values()];if(!Nt._initialized){Nt._initialized=!0;for(const d of h)d.initialize(c,t)}t.registerEditorTypes(h),this.#a=t,this.pageIndex=e,this.div=s,this.#t=i,this.#s=n,this.viewport=o,this.#h=a,this.drawLayer=r,this.#a.addLayer(this)}get isEmpty(){return this.#l.size===0}get isInvisible(){return this.isEmpty&&this.#a.getMode()===N.NONE}updateToolbar(t){this.#a.updateToolbar(t)}updateMode(t=this.#a.getMode()){switch(this.#A(),t){case N.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case N.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case N.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;for(const s of Nt.#p.values())e.toggle(`${s._type}Editing`,t===s._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#h?.div}addInkEditorIfNeeded(t){if(this.#a.getMode()!==N.INK)return;if(!t){for(const s of this.#l.values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(t){this.#a.setEditingState(t)}addCommands(t){this.#a.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#s?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const s of this.#l.values())s.enableEditing(),s.show(!0),s.annotationElementId&&(this.#a.removeChangedExistingAnnotation(s),t.add(s.annotationElementId));if(!this.#s)return;const e=this.#s.getEditableAnnotations();for(const s of e){if(s.hide(),this.#a.isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const i=this.deserialize(s);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#f=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Map,e=new Map;for(const i of this.#l.values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){t.set(i.annotationElementId,i);continue}else e.set(i.annotationElementId,i);this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}if(this.#s){const i=this.#s.getEditableAnnotations();for(const n of i){const{id:r}=n.data;if(this.#a.isDeletedAnnotationElement(r))continue;let a=e.get(r);if(a){a.resetAnnotationElement(n),a.show(!1),n.show();continue}a=t.get(r),a&&(this.#a.addChangedExistingAnnotation(a),a.renderAnnotationElement(n),a.show(!1)),n.show()}}this.#A(),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const i of Nt.#p.values())s.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#f=!1}getEditableAnnotation(t){return this.#s?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#a.getActive()!==t&&this.#a.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#h?.div&&!this.#i&&(this.#i=this.#m.bind(this),this.#h.div.addEventListener("pointerdown",this.#i,{signal:this.#a._signal}),this.#h.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#h?.div&&this.#i&&(this.#h.div.removeEventListener("pointerdown",this.#i),this.#i=null,this.#h.div.classList.remove("highlighting"))}#m(t){if(this.#a.unselectAll(),t.target===this.#h.div){const{isMac:e}=vt.platform;if(t.button!==0||t.ctrlKey&&e)return;this.#a.showAllEditors("highlight",!0,!0),this.#h.div.classList.add("free"),et.startHighlighting(this,this.#a.direction==="ltr",t),this.#h.div.addEventListener("pointerup",()=>{this.#h.div.classList.remove("free")},{once:!0,signal:this.#a._signal}),t.preventDefault()}}enableClick(){if(this.#o)return;const t=this.#a._signal;this.#o=this.pointerdown.bind(this),this.#n=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#o,{signal:t}),this.div.addEventListener("pointerup",this.#n,{signal:t})}disableClick(){this.#o&&(this.div.removeEventListener("pointerdown",this.#o),this.div.removeEventListener("pointerup",this.#n),this.#o=null,this.#n=null)}attach(t){this.#l.set(t.id,t);const{annotationElementId:e}=t;e&&this.#a.isDeletedAnnotationElement(e)&&this.#a.removeDeletedAnnotationElement(t)}detach(t){this.#l.delete(t.id),this.#t?.removePointerInTextLayer(t.contentDiv),!this.#f&&t.annotationElementId&&this.#a.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#a.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#d||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#a.addDeletedAnnotationElement(t.annotationElementId),I.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),this.#a.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#a.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#r&&(t._focusEventsAllowed=!1,this.#r=setTimeout(()=>{this.#r=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#a._signal}),e.focus())},0)),t._structTreeParentId=this.#t?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),s=()=>{t.remove()};this.addCommands({cmd:e,undo:s,mustExec:!1})}getNextId(){return this.#a.getId()}get#u(){return Nt.#p.get(this.#a.getMode())}get _signal(){return this.#a._signal}#v(t){const e=this.#u;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#u?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#a.updateToolbar(t),this.#a.updateMode(t);const{offsetX:s,offsetY:i}=this.#g(),n=this.getNextId(),r=this.#v({parent:this,id:n,x:s,y:i,uiManager:this.#a,isCentered:!0,...e});r&&this.add(r)}deserialize(t){return Nt.#p.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#a)||null}createAndAddNewEditor(t,e,s={}){const i=this.getNextId(),n=this.#v({parent:this,id:i,x:t.offsetX,y:t.offsetY,uiManager:this.#a,isCentered:e,...s});return n&&this.add(n),n}#g(){const{x:t,y:e,width:s,height:i}=this.div.getBoundingClientRect(),n=Math.max(0,t),r=Math.max(0,e),a=Math.min(window.innerWidth,t+s),o=Math.min(window.innerHeight,e+i),c=(n+a)/2-t,h=(r+o)/2-e,[d,u]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:u}}addNewEditor(){this.createAndAddNewEditor(this.#g(),!0)}setSelected(t){this.#a.setSelected(t)}toggleSelected(t){this.#a.toggleSelected(t)}isSelected(t){return this.#a.isSelected(t)}unselect(t){this.#a.unselect(t)}pointerup(t){const{isMac:e}=vt.platform;if(!(t.button!==0||t.ctrlKey&&e)&&t.target===this.div&&this.#c){if(this.#c=!1,!this.#e){this.#e=!0;return}if(this.#a.getMode()===N.STAMP){this.#a.unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#a.getMode()===N.HIGHLIGHT&&this.enableTextSelection(),this.#c){this.#c=!1;return}const{isMac:e}=vt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;this.#c=!0;const s=this.#a.getActive();this.#e=!s||s.isEmpty()}findNewParent(t,e,s){const i=this.#a.findParent(e,s);return i===null||i===this?!1:(i.changeParent(t),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null)),this.#r&&(clearTimeout(this.#r),this.#r=null);for(const t of this.#l.values())this.#t?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#l.clear(),this.#a.removeLayer(this)}#A(){this.#d=!0;for(const t of this.#l.values())t.isEmpty()&&t.remove();this.#d=!1}render({viewport:t}){this.viewport=t,Xt(this.div,t);for(const e of this.#a.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#a.commitOrRemove(),this.#A();const e=this.viewport.rotation,s=t.rotation;if(this.viewport=t,Xt(this.div,{rotation:s}),e!==s)for(const i of this.#l.values())i.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#a.viewParameters.realScale}}class ct{#t=null;#e=0;#s=new Map;#n=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#t){this.#t=t;return}if(this.#t!==t){if(this.#s.size>0)for(const e of this.#s.values())e.remove(),t.append(e);this.#t=t}}static get _svgFactory(){return H(this,"_svgFactory",new ws)}static#o(t,{x:e=0,y:s=0,width:i=1,height:n=1}={}){const{style:r}=t;r.top=`${100*s}%`,r.left=`${100*e}%`,r.width=`${100*i}%`,r.height=`${100*n}%`}#i(t){const e=ct._svgFactory.create(1,1,!0);return this.#t.append(e),e.setAttribute("aria-hidden",!0),ct.#o(e,t),e}#r(t,e){const s=ct._svgFactory.createElement("clipPath");t.append(s);const i=`clip_${e}`;s.setAttribute("id",i),s.setAttribute("clipPathUnits","objectBoundingBox");const n=ct._svgFactory.createElement("use");return s.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),i}highlight(t,e,s,i=!1){const n=this.#e++,r=this.#i(t.box);r.classList.add("highlight"),t.free&&r.classList.add("free");const a=ct._svgFactory.createElement("defs");r.append(a);const o=ct._svgFactory.createElement("path");a.append(o);const c=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",c),o.setAttribute("d",t.toSVGPath()),i&&this.#n.set(n,o);const h=this.#r(a,c),d=ct._svgFactory.createElement("use");return r.append(d),r.setAttribute("fill",e),r.setAttribute("fill-opacity",s),d.setAttribute("href",`#${c}`),this.#s.set(n,r),{id:n,clipPathId:`url(#${h})`}}highlightOutline(t){const e=this.#e++,s=this.#i(t.box);s.classList.add("highlightOutline");const i=ct._svgFactory.createElement("defs");s.append(i);const n=ct._svgFactory.createElement("path");i.append(n);const r=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let a;if(t.free){s.classList.add("free");const h=ct._svgFactory.createElement("mask");i.append(h),a=`mask_p${this.pageIndex}_${e}`,h.setAttribute("id",a),h.setAttribute("maskUnits","objectBoundingBox");const d=ct._svgFactory.createElement("rect");h.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");const u=ct._svgFactory.createElement("use");h.append(u),u.setAttribute("href",`#${r}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}const o=ct._svgFactory.createElement("use");s.append(o),o.setAttribute("href",`#${r}`),a&&o.setAttribute("mask",`url(#${a})`);const c=o.cloneNode();return s.append(c),o.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.#s.set(e,s),e}finalizeLine(t,e){const s=this.#n.get(t);this.#n.delete(t),this.updateBox(t,e.box),s.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#s.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#n.delete(t)}updatePath(t,e){this.#n.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){ct.#o(this.#s.get(t),e)}show(t,e){this.#s.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#s.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#s.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#s.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#s.get(t).classList.add(e)}removeClass(t,e){this.#s.get(t).classList.remove(e)}remove(t){this.#t!==null&&(this.#s.get(t).remove(),this.#s.delete(t))}destroy(){this.#t=null;for(const t of this.#s.values())t.remove();this.#s.clear()}}var Ca=M.AbortException,Ta=M.AnnotationEditorLayer,Ra=M.AnnotationEditorParamsType,Pa=M.AnnotationEditorType,La=M.AnnotationEditorUIManager,Ui=M.AnnotationLayer,$i=M.AnnotationMode,ka=M.CMapCompressionType,Ma=M.ColorPicker,Ia=M.DOMSVGFactory,Da=M.DrawLayer,Fa=M.FeatureTest,Os=M.GlobalWorkerOptions,Oa=M.ImageKind,Na=M.InvalidPDFException,Ha=M.MissingPDFException,Ba=M.OPS,ja=M.Outliner,Ua=M.PDFDataRangeTransport,$a=M.PDFDateString,za=M.PDFWorker,Ga=M.PasswordResponses,Va=M.PermissionFlag,Wa=M.PixelsPerInch,qa=M.RenderingCancelledException,zi=M.TextLayer,Xa=M.UnexpectedResponseException,Ya=M.Util,Ka=M.VerbosityLevel,Qa=M.XfaLayer,Ja=M.build,Za=M.createValidAbsoluteUrl,to=M.fetchData,Gi=M.getDocument,eo=M.getFilenameFromUrl,so=M.getPdfFilenameFromUrl,io=M.getXfaPageViewport,no=M.isDataScheme,ro=M.isPdfFile,ao=M.noContextMenu,oo=M.normalizeUnicode,lo=M.renderTextLayer,ho=M.setLayerDimensions,co=M.shadow,uo=M.updateTextLayer,fo=M.version;const po=Object.freeze(Object.defineProperty({__proto__:null,AbortException:Ca,AnnotationEditorLayer:Ta,AnnotationEditorParamsType:Ra,AnnotationEditorType:Pa,AnnotationEditorUIManager:La,AnnotationLayer:Ui,AnnotationMode:$i,CMapCompressionType:ka,ColorPicker:Ma,DOMSVGFactory:Ia,DrawLayer:Da,FeatureTest:Fa,GlobalWorkerOptions:Os,ImageKind:Oa,InvalidPDFException:Na,MissingPDFException:Ha,OPS:Ba,Outliner:ja,PDFDataRangeTransport:Ua,PDFDateString:$a,PDFWorker:za,PasswordResponses:Ga,PermissionFlag:Va,PixelsPerInch:Wa,RenderingCancelledException:qa,TextLayer:zi,UnexpectedResponseException:Xa,Util:Ya,VerbosityLevel:Ka,XfaLayer:Qa,build:Ja,createValidAbsoluteUrl:Za,fetchData:to,getDocument:Gi,getFilenameFromUrl:eo,getPdfFilenameFromUrl:so,getXfaPageViewport:io,isDataScheme:no,isPdfFile:ro,noContextMenu:ao,normalizeUnicode:oo,renderTextLayer:lo,setLayerDimensions:ho,shadow:co,updateTextLayer:uo,version:fo},Symbol.toStringTag,{value:"Module"}));var at=function(l,t,e){if(e||arguments.length===2)for(var s=0,i=t.length,n;s{V(this.pdfDocument),V(t),typeof t=="string"?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(e=>{V(Array.isArray(e));const s=e[0];new Promise(i=>{V(this.pdfDocument),s instanceof Object?this.pdfDocument.getPageIndex(s).then(n=>{i(n)}).catch(()=>{V(!1)}):typeof s=="number"?i(s):V(!1)}).then(i=>{const n=i+1;V(this.pdfViewer),V(n>=1&&n<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:e,pageIndex:i,pageNumber:n})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){const e=t-1;V(this.pdfViewer),V(t>=1&&t<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:e,pageNumber:t})}addLinkAttributes(t,e,s){t.href=e,t.rel=this.externalLinkRel||Ho,t.target=s?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const ni={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Ke=typeof window<"u",Xi=Ke&&window.location.protocol==="file:";function jo(l){return typeof l<"u"}function Vt(l){return jo(l)&&l!==null}function Uo(l){return typeof l=="string"}function $o(l){return l instanceof ArrayBuffer}function zo(l){return V(Ke),l instanceof Blob}function vs(l){return Uo(l)&&/^data:/.test(l)}function ri(l){V(vs(l));const[t="",e=""]=l.split(",");return t.split(";").indexOf("base64")!==-1?atob(e):unescape(e)}function Go(){return Ke&&window.devicePixelRatio||1}const Yi="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function ai(){dt(!Xi,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Yi}`)}function Vo(){dt(!Xi,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Yi}`)}function Kt(l){l?.cancel&&l.cancel()}function As(l,t){return Object.defineProperty(l,"width",{get(){return this.view[2]*t},configurable:!0}),Object.defineProperty(l,"height",{get(){return this.view[3]*t},configurable:!0}),Object.defineProperty(l,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(l,"originalHeight",{get(){return this.view[3]},configurable:!0}),l}function Wo(l){return l.name==="RenderingCancelledException"}function qo(l){return new Promise((t,e)=>{const s=new FileReader;s.onload=()=>{if(!s.result)return e(new Error("Error while reading a file."));t(s.result)},s.onerror=i=>{if(!i.target)return e(new Error("Error while reading a file."));const{error:n}=i.target;if(!n)return e(new Error("Error while reading a file."));switch(n.code){case n.NOT_FOUND_ERR:return e(new Error("Error while reading a file: File not found."));case n.SECURITY_ERR:return e(new Error("Error while reading a file: Security error."));case n.ABORT_ERR:return e(new Error("Error while reading a file: Aborted."));default:return e(new Error("Error while reading a file."))}},s.readAsArrayBuffer(l)})}function Xo(l,t){switch(t.type){case"RESOLVE":return{value:t.value,error:void 0};case"REJECT":return{value:!1,error:t.error};case"RESET":return{value:void 0,error:void 0};default:return l}}function oe(){return C.useReducer(Xo,{value:void 0,error:void 0})}var Yo=function(l,t,e,s){function i(n){return n instanceof e?n:new e(function(r){r(n)})}return new(e||(e=Promise))(function(n,r){function a(h){try{c(s.next(h))}catch(d){r(d)}}function o(h){try{c(s.throw(h))}catch(d){r(d)}}function c(h){h.done?n(h.value):i(h.value).then(a,o)}c((s=s.apply(l,t||[])).next())})},oi=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i{switch(t){case ni.NEED_PASSWORD:{const e=prompt("Enter the password to open this PDF file.");l(e);break}case ni.INCORRECT_PASSWORD:{const e=prompt("Invalid password. Please try again.");l(e);break}}};function li(l){return typeof l=="object"&&l!==null&&("data"in l||"range"in l||"url"in l)}const Jo=C.forwardRef(function(t,e){var{children:s,className:i,error:n="Failed to load PDF file.",externalLinkRel:r,externalLinkTarget:a,file:o,inputRef:c,imageResourcesPath:h,loading:d="Loading PDF…",noData:u="No PDF file specified.",onItemClick:p,onLoadError:f,onLoadProgress:g,onLoadSuccess:b,onPassword:m=Qo,onSourceError:v,onSourceSuccess:_,options:A,renderMode:y,rotate:w}=t,E=oi(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[x,S]=oe(),{value:L,error:R}=x,[z,B]=oe(),{value:O,error:j}=z,U=C.useRef(new Bo),T=C.useRef([]),k=C.useRef(void 0),_t=C.useRef(void 0);o&&o!==k.current&&li(o)&&(dt(!ne(o,k.current),`File prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),k.current=o),A&&A!==_t.current&&(dt(!ne(A,_t.current),`Options prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),_t.current=A);const Et=C.useRef({scrollPageIntoView:W=>{const{dest:Z,pageNumber:lt,pageIndex:rt=lt-1}=W;if(p){p({dest:Z,pageIndex:rt,pageNumber:lt});return}const te=T.current[rt];if(te){te.scrollIntoView();return}dt(!1,`An internal link leading to page ${lt} was clicked, but neither was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within .`)}});C.useImperativeHandle(e,()=>({linkService:U,pages:T,viewer:Et}),[]);function jt(){_&&_()}function Q(){R&&(dt(!1,R.toString()),v&&v(R))}function X(){S({type:"RESET"})}C.useEffect(X,[o,S]);const St=C.useCallback(()=>Yo(this,void 0,void 0,function*(){if(!o)return null;if(typeof o=="string")return vs(o)?{data:ri(o)}:(ai(),{url:o});if(o instanceof Ko)return{range:o};if($o(o))return{data:o};if(Ke&&zo(o))return{data:yield qo(o)};if(V(typeof o=="object"),V(li(o)),"url"in o&&typeof o.url=="string"){if(vs(o.url)){const{url:W}=o,Z=oi(o,["url"]),lt=ri(W);return Object.assign({data:lt},Z)}ai()}return o}),[o]);C.useEffect(()=>{const W=Se(St());return W.promise.then(Z=>{S({type:"RESOLVE",value:Z})}).catch(Z=>{S({type:"REJECT",error:Z})}),()=>{Kt(W)}},[St,S]),C.useEffect(()=>{if(!(typeof L>"u")){if(L===!1){Q();return}jt()}},[L]);function yt(){O&&(b&&b(O),T.current=new Array(O.numPages),U.current.setDocument(O))}function ft(){j&&(dt(!1,j.toString()),f&&f(j))}C.useEffect(function(){B({type:"RESET"})},[B,L]),C.useEffect(function(){if(!L)return;const Z=A?Object.assign(Object.assign({},L),A):L,lt=Gi(Z);g&&(lt.onProgress=g),m&&(lt.onPassword=m);const rt=lt,te=rt.promise.then(ce=>{B({type:"RESOLVE",value:ce})}).catch(ce=>{rt.destroyed||B({type:"REJECT",error:ce})});return()=>{te.finally(()=>rt.destroy())}},[A,B,L]),C.useEffect(()=>{if(!(typeof O>"u")){if(O===!1){ft();return}yt()}},[O]),C.useEffect(function(){U.current.setViewer(Et.current),U.current.setExternalLinkRel(r),U.current.setExternalLinkTarget(a)},[r,a]);const q=C.useCallback((W,Z)=>{T.current[W]=Z},[]),gt=C.useCallback(W=>{delete T.current[W]},[]),Pt=C.useMemo(()=>({imageResourcesPath:h,linkService:U.current,onItemClick:p,pdf:O,registerPage:q,renderMode:y,rotate:w,unregisterPage:gt}),[h,p,O,q,y,w,gt]),K=C.useMemo(()=>Vi(E,()=>O),[E,O]);function le(){return $.jsx(qi.Provider,{value:Pt,children:s})}function he(){return o?O==null?$.jsx(re,{type:"loading",children:typeof d=="function"?d():d}):O===!1?$.jsx(re,{type:"error",children:typeof n=="function"?n():n}):le():$.jsx(re,{type:"no-data",children:typeof u=="function"?u():u})}return $.jsx("div",Object.assign({className:Ye("react-pdf__Document",i),ref:c,style:{"--scale-factor":"1"}},K,{children:he()}))}),Zo=Jo;function Ki(){return C.useContext(qi)}function Qi(){for(var l=[],t=0;tnl(t),[t]),s=C.useMemo(()=>!Qe(t)||tn(t)?null:t.children.map((i,n)=>$.jsx(sn,{node:i},n)),[t]);return $.jsx("span",Object.assign({className:l},e,{children:s}))}function Je(){return C.useContext(Ji)}function rl(){const l=Je();V(l);const{onGetStructTreeError:t,onGetStructTreeSuccess:e}=l,[s,i]=oe(),{value:n,error:r}=s,{customTextRenderer:a,page:o}=l;function c(){n&&e&&e(n)}function h(){r&&(dt(!1,r.toString()),t&&t(r))}return C.useEffect(function(){i({type:"RESET"})},[i,o]),C.useEffect(function(){if(a||!o)return;const u=Se(o.getStructTree()),p=u;return u.promise.then(f=>{i({type:"RESOLVE",value:f})}).catch(f=>{i({type:"REJECT",error:f})}),()=>Kt(p)},[a,o,i]),C.useEffect(()=>{if(n!==void 0){if(n===!1){h();return}c()}},[n]),n?$.jsx(sn,{className:"react-pdf__Page__structTree structTree",node:n}):null}const hi=$i;function al(l){const t=Je();V(t);const e=Object.assign(Object.assign({},t),l),{_className:s,canvasBackground:i,devicePixelRatio:n=Go(),onRenderError:r,onRenderSuccess:a,page:o,renderForms:c,renderTextLayer:h,rotate:d,scale:u}=e,{canvasRef:p}=l;V(o);const f=C.useRef(null);function g(){o&&a&&a(As(o,u))}function b(A){Wo(A)||(dt(!1,A.toString()),r&&r(A))}const m=C.useMemo(()=>o.getViewport({scale:u*n,rotation:d}),[n,o,d,u]),v=C.useMemo(()=>o.getViewport({scale:u,rotation:d}),[o,d,u]);C.useEffect(function(){if(!o)return;o.cleanup();const{current:y}=f;if(!y)return;y.width=m.width,y.height=m.height,y.style.width=`${Math.floor(v.width)}px`,y.style.height=`${Math.floor(v.height)}px`,y.style.visibility="hidden";const w={annotationMode:c?hi.ENABLE_FORMS:hi.ENABLE,canvasContext:y.getContext("2d",{alpha:!1}),viewport:m};i&&(w.background=i);const E=o.render(w),x=E;return E.promise.then(()=>{y.style.visibility="",g()}).catch(b),()=>Kt(x)},[i,o,c,m,v]);const _=C.useCallback(()=>{const{current:A}=f;A&&(A.width=0,A.height=0)},[]);return C.useEffect(()=>_,[_]),$.jsx("canvas",{className:`${s}__canvas`,dir:"ltr",ref:Qi(p,f),style:{display:"block",userSelect:"none"},children:h?$.jsx(rl,{}):null})}function ol(l){return"str"in l}function ll(){const l=Je();V(l);const{customTextRenderer:t,onGetTextError:e,onGetTextSuccess:s,onRenderTextLayerError:i,onRenderTextLayerSuccess:n,page:r,pageIndex:a,pageNumber:o,rotate:c,scale:h}=l;V(r);const[d,u]=oe(),{value:p,error:f}=d,g=C.useRef(null),b=C.useRef(void 0);dt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function m(){p&&s&&s(p)}function v(){f&&(dt(!1,f.toString()),e&&e(f))}C.useEffect(function(){u({type:"RESET"})},[r,u]),C.useEffect(function(){if(!r)return;const S=Se(r.getTextContent()),L=S;return S.promise.then(R=>{u({type:"RESOLVE",value:R})}).catch(R=>{u({type:"REJECT",error:R})}),()=>Kt(L)},[r,u]),C.useEffect(()=>{if(p!==void 0){if(p===!1){v();return}m()}},[p]);const _=C.useCallback(()=>{n&&n()},[n]),A=C.useCallback(x=>{dt(!1,x.toString()),i&&i(x)},[i]);function y(){const x=b.current;x&&x.classList.add("active")}function w(){const x=b.current;x&&x.classList.remove("active")}const E=C.useMemo(()=>r.getViewport({scale:h,rotation:c}),[r,c,h]);return C.useLayoutEffect(function(){if(!r||!p)return;const{current:S}=g;if(!S)return;S.innerHTML="";const L=r.streamTextContent({includeMarkedContent:!0}),R={container:S,textContentSource:L,viewport:E},z=new zi(R),B=z;return z.render().then(()=>{const O=document.createElement("div");O.className="endOfContent",S.append(O),b.current=O;const j=S.querySelectorAll('[role="presentation"]');if(t){let U=0;p.items.forEach((T,k)=>{if(!ol(T))return;const _t=j[U];if(!_t)return;const Et=t(Object.assign({pageIndex:a,pageNumber:o,itemIndex:k},T));_t.innerHTML=Et,U+=T.str&&T.hasEOL?2:1})}_()}).catch(A),()=>Kt(B)},[t,A,_,r,a,o,p,E]),$.jsx("div",{className:Ye("react-pdf__Page__textContent","textLayer"),onMouseUp:w,onMouseDown:y,ref:g})}function hl(){const l=Ki(),t=Je();V(t);const e=Object.assign(Object.assign({},l),t),{imageResourcesPath:s,linkService:i,onGetAnnotationsError:n,onGetAnnotationsSuccess:r,onRenderAnnotationLayerError:a,onRenderAnnotationLayerSuccess:o,page:c,pdf:h,renderForms:d,rotate:u,scale:p=1}=e;V(h),V(c),V(i);const[f,g]=oe(),{value:b,error:m}=f,v=C.useRef(null);dt(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function _(){b&&r&&r(b)}function A(){m&&(dt(!1,m.toString()),n&&n(m))}C.useEffect(function(){g({type:"RESET"})},[g,c]),C.useEffect(function(){if(!c)return;const S=Se(c.getAnnotations()),L=S;return S.promise.then(R=>{g({type:"RESOLVE",value:R})}).catch(R=>{g({type:"REJECT",error:R})}),()=>{Kt(L)}},[g,c]),C.useEffect(()=>{if(b!==void 0){if(b===!1){A();return}_()}},[b]);function y(){o&&o()}function w(x){dt(!1,`${x}`),a&&a(x)}const E=C.useMemo(()=>c.getViewport({scale:p,rotation:u}),[c,u,p]);return C.useEffect(function(){if(!h||!c||!i||!b)return;const{current:S}=v;if(!S)return;const L=E.clone({dontFlip:!0}),R={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:S,l10n:null,page:c,viewport:L},z={annotations:b,annotationStorage:h.annotationStorage,div:S,imageResourcesPath:s,linkService:i,page:c,renderForms:d,viewport:L};S.innerHTML="";try{new Ui(R).render(z),y()}catch(B){w(B)}return()=>{}},[b,s,i,c,h,d,E]),$.jsx("div",{className:Ye("react-pdf__Page__annotations","annotationLayer"),ref:v})}var cl=function(l,t){var e={};for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&t.indexOf(s)<0&&(e[s]=l[s]);if(l!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(l);i{if(!K)return null;let ee=1;const Ce=St??ci;if(ft||p){const Te=K.getViewport({scale:1,rotation:lt});ft?ee=ft/Te.width:p&&(ee=p/Te.height)}return Ce*ee},[p,K,lt,St,ft]);C.useEffect(function(){return()=>{Vt(W)&&i&&yt&&yt(W)}},[i,T,W,yt]);function te(){if(x){if(!K||!rt)return;x(As(K,rt))}if(i&&k){if(!Vt(W)||!he.current)return;k(W,he.current)}}function ce(){le&&(dt(!1,le.toString()),E&&E(le))}C.useEffect(function(){Pt({type:"RESET"})},[Pt,T,W]),C.useEffect(function(){if(!T||!Z)return;const Ce=Se(T.getPage(Z)),Te=Ce;return Ce.promise.then(Ze=>{Pt({type:"RESOLVE",value:Ze})}).catch(Ze=>{Pt({type:"REJECT",error:Ze})}),()=>Kt(Te)},[Pt,T,Z]),C.useEffect(()=>{if(K!==void 0){if(K===!1){ce();return}te()}},[K,rt]);const nn=C.useMemo(()=>K&&Vt(W)&&Z&&Vt(lt)&&Vt(rt)?{_className:s,canvasBackground:n,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:m,onGetAnnotationsSuccess:v,onGetStructTreeError:_,onGetStructTreeSuccess:A,onGetTextError:y,onGetTextSuccess:w,onRenderAnnotationLayerError:S,onRenderAnnotationLayerSuccess:L,onRenderError:R,onRenderSuccess:z,onRenderTextLayerError:B,onRenderTextLayerSuccess:O,page:K,pageIndex:W,pageNumber:Z,renderForms:Et,renderTextLayer:Q,rotate:lt,scale:rt}:null,[s,n,h,d,m,v,_,A,y,w,S,L,R,z,B,O,K,W,Z,Et,Q,lt,rt]),rn=C.useMemo(()=>Vi(q,()=>K&&(rt?As(K,rt):void 0)),[q,K,rt]),xe=`${W}@${rt}/${lt}`;function an(){switch(jt){case"custom":return V(c),$.jsx(c,{},`${xe}_custom`);case"none":return null;case"canvas":default:return $.jsx(al,{canvasRef:r},`${xe}_canvas`)}}function on(){return Q?$.jsx(ll,{},`${xe}_text`):null}function ln(){return _t?$.jsx(hl,{},`${xe}_annotations`):null}function hn(){return $.jsxs(Ji.Provider,{value:nn,children:[an(),on(),ln(),a]})}function cn(){return Z?T===null||K===void 0||K===null?$.jsx(re,{type:"loading",children:typeof g=="function"?g():g}):T===!1||K===!1?$.jsx(re,{type:"error",children:typeof u=="function"?u():u}):hn():$.jsx(re,{type:"no-data",children:typeof b=="function"?b():b})}return $.jsx("div",Object.assign({className:Ye(s,o),"data-page-number":Z,ref:Qi(f,he),style:{"--scale-factor":`${rt}`,backgroundColor:n||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},rn,{children:cn()}))}Vo();Os.workerSrc="pdf.worker.mjs";function ul({title:l,titleId:t,...e},s){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},e),l?C.createElement("title",{id:t},l):null,C.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))}const fl=C.forwardRef(ul),pl=fl;function gl({title:l,titleId:t,...e},s){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},e),l?C.createElement("title",{id:t},l):null,C.createElement("path",{fillRule:"evenodd",d:"M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",clipRule:"evenodd"}))}const ml=C.forwardRef(gl),bl=ml;Os.workerSrc=new URL("/groups/beginner/astro/pdf.worker.min.BVPM1tzH.mjs",import.meta.url).toString();const vl={cMapUrl:"/cmaps/"};function Sl({file:l}){const[t,e]=C.useState(),[s,i]=C.useState(1),[n,r]=C.useState(null),[a,o]=C.useState();wn(n,h=>o(h.contentRect.width));function c({numPages:h}){e(h)}return $.jsxs("div",{ref:r,className:"relative p-2 bg-zinc-200 rounded border border-zinc-300 dark:bg-zinc-800 dark:border-zinc-700",children:[$.jsx(Zo,{file:l,onLoadSuccess:c,options:vl,children:Array.from(new Array(t),(h,d)=>$.jsx(dl,{pageNumber:d+1,width:a,className:s===d+1?"block":"hidden"},`page_${d+1}`))}),$.jsx("div",{className:"z-50 absolute bottom-4 left-4 md:bottom-6 md:left-6 flex items-center",children:$.jsx("button",{onClick:()=>i(h=>h-1),disabled:s<=1,className:"p-1 md:p-2 bg-black/30 hover:bg-black/50 text-white rounded-full disabled:opacity-30 disabled:cursor-not-allowed",children:$.jsx(pl,{className:"w-5 h-5"})})}),$.jsx("div",{className:"z-50 absolute bottom-4 right-4 md:bottom-6 md:right-6 flex items-center",children:$.jsx("button",{onClick:()=>i(h=>h+1),disabled:s>=t,className:"p-1 md:p-2 bg-black/30 hover:bg-black/50 text-white rounded-full disabled:opacity-30 disabled:cursor-not-allowed",children:$.jsx(bl,{className:"w-5 h-5"})})})]})}export{Sl as default}; diff --git a/groups/beginner/_astro/TextLayer.Ct0_y4Em.css b/groups/beginner/astro/TextLayer.Ct0_y4Em.css similarity index 100% rename from groups/beginner/_astro/TextLayer.Ct0_y4Em.css rename to groups/beginner/astro/TextLayer.Ct0_y4Em.css diff --git a/groups/beginner/_astro/__vite-browser-external.BIHI7g3E.js b/groups/beginner/astro/__vite-browser-external.BIHI7g3E.js similarity index 100% rename from groups/beginner/_astro/__vite-browser-external.BIHI7g3E.js rename to groups/beginner/astro/__vite-browser-external.BIHI7g3E.js diff --git a/groups/beginner/_astro/client.E677JtKR.js b/groups/beginner/astro/client.E677JtKR.js similarity index 100% rename from groups/beginner/_astro/client.E677JtKR.js rename to groups/beginner/astro/client.E677JtKR.js diff --git a/groups/beginner/_astro/hoisted.IxFg9jpS.js b/groups/beginner/astro/hoisted.IxFg9jpS.js similarity index 100% rename from groups/beginner/_astro/hoisted.IxFg9jpS.js rename to groups/beginner/astro/hoisted.IxFg9jpS.js diff --git a/groups/beginner/_astro/index.CSkeIq9P.css b/groups/beginner/astro/index.CSkeIq9P.css similarity index 100% rename from groups/beginner/_astro/index.CSkeIq9P.css rename to groups/beginner/astro/index.CSkeIq9P.css diff --git a/groups/beginner/_astro/index.CZlPm10g.js b/groups/beginner/astro/index.CZlPm10g.js similarity index 100% rename from groups/beginner/_astro/index.CZlPm10g.js rename to groups/beginner/astro/index.CZlPm10g.js diff --git a/groups/beginner/_astro/meetup.BrD4ROEp_10888r.svg b/groups/beginner/astro/meetup.BrD4ROEp_Z1zQnEO.svg similarity index 100% rename from groups/beginner/_astro/meetup.BrD4ROEp_10888r.svg rename to groups/beginner/astro/meetup.BrD4ROEp_Z1zQnEO.svg diff --git a/groups/beginner/_astro/pdf.worker.min.BVPM1tzH.mjs b/groups/beginner/astro/pdf.worker.min.BVPM1tzH.mjs similarity index 100% rename from groups/beginner/_astro/pdf.worker.min.BVPM1tzH.mjs rename to groups/beginner/astro/pdf.worker.min.BVPM1tzH.mjs diff --git a/groups/beginner/_astro/presentation.BSltd4Vl.pdf b/groups/beginner/astro/presentation.BSltd4Vl.pdf similarity index 100% rename from groups/beginner/_astro/presentation.BSltd4Vl.pdf rename to groups/beginner/astro/presentation.BSltd4Vl.pdf diff --git a/groups/beginner/_astro/presentation.Bblywtee.pdf b/groups/beginner/astro/presentation.Bblywtee.pdf similarity index 100% rename from groups/beginner/_astro/presentation.Bblywtee.pdf rename to groups/beginner/astro/presentation.Bblywtee.pdf diff --git a/groups/beginner/_astro/presentation.BcyISGVS.pdf b/groups/beginner/astro/presentation.BcyISGVS.pdf similarity index 100% rename from groups/beginner/_astro/presentation.BcyISGVS.pdf rename to groups/beginner/astro/presentation.BcyISGVS.pdf diff --git a/groups/beginner/_astro/presentation.BgGtsm1L.pdf b/groups/beginner/astro/presentation.BgGtsm1L.pdf similarity index 100% rename from groups/beginner/_astro/presentation.BgGtsm1L.pdf rename to groups/beginner/astro/presentation.BgGtsm1L.pdf diff --git a/groups/beginner/_astro/presentation.C7hL0CRe.pdf b/groups/beginner/astro/presentation.C7hL0CRe.pdf similarity index 100% rename from groups/beginner/_astro/presentation.C7hL0CRe.pdf rename to groups/beginner/astro/presentation.C7hL0CRe.pdf diff --git a/groups/beginner/_astro/presentation.CdE4nefP.pdf b/groups/beginner/astro/presentation.CdE4nefP.pdf similarity index 100% rename from groups/beginner/_astro/presentation.CdE4nefP.pdf rename to groups/beginner/astro/presentation.CdE4nefP.pdf diff --git a/groups/beginner/_astro/presentation.CgZ60pEK.pdf b/groups/beginner/astro/presentation.CgZ60pEK.pdf similarity index 100% rename from groups/beginner/_astro/presentation.CgZ60pEK.pdf rename to groups/beginner/astro/presentation.CgZ60pEK.pdf diff --git a/groups/beginner/_astro/presentation.D9EqK9vr.pdf b/groups/beginner/astro/presentation.D9EqK9vr.pdf similarity index 100% rename from groups/beginner/_astro/presentation.D9EqK9vr.pdf rename to groups/beginner/astro/presentation.D9EqK9vr.pdf diff --git a/groups/beginner/_astro/presentation.DBfQK_eX.pdf b/groups/beginner/astro/presentation.DBfQK_eX.pdf similarity index 100% rename from groups/beginner/_astro/presentation.DBfQK_eX.pdf rename to groups/beginner/astro/presentation.DBfQK_eX.pdf diff --git a/groups/beginner/_astro/presentation.DGkAQ7bx.pdf b/groups/beginner/astro/presentation.DGkAQ7bx.pdf similarity index 100% rename from groups/beginner/_astro/presentation.DGkAQ7bx.pdf rename to groups/beginner/astro/presentation.DGkAQ7bx.pdf diff --git a/groups/beginner/_astro/presentation.TwMEPJXq.pdf b/groups/beginner/astro/presentation.TwMEPJXq.pdf similarity index 100% rename from groups/beginner/_astro/presentation.TwMEPJXq.pdf rename to groups/beginner/astro/presentation.TwMEPJXq.pdf diff --git a/groups/beginner/_astro/presentation.sJThXCKJ.pdf b/groups/beginner/astro/presentation.sJThXCKJ.pdf similarity index 100% rename from groups/beginner/_astro/presentation.sJThXCKJ.pdf rename to groups/beginner/astro/presentation.sJThXCKJ.pdf diff --git a/groups/beginner/_astro/slack.B-p126JW_1sXDrv.svg b/groups/beginner/astro/slack.B-p126JW_Z1MwKGX.svg similarity index 100% rename from groups/beginner/_astro/slack.B-p126JW_1sXDrv.svg rename to groups/beginner/astro/slack.B-p126JW_Z1MwKGX.svg diff --git a/groups/beginner/browserconfig.xml b/groups/beginner/browserconfig.xml index c554148..85c9cf3 100644 --- a/groups/beginner/browserconfig.xml +++ b/groups/beginner/browserconfig.xml @@ -1,2 +1,2 @@ -#ffffff \ No newline at end of file +#ffffff \ No newline at end of file diff --git a/groups/beginner/index.html b/groups/beginner/index.html index 59dfd1f..89ea97d 100644 --- a/groups/beginner/index.html +++ b/groups/beginner/index.html @@ -106,7 +106,7 @@ document.addEventListener("DOMContentLoaded", () => init()); document.addEventListener("astro:after-swap", () => init()); preloadTheme(); -

AWSKRUG Beginner 소모임

+

AWSKRUG Beginner 소모임

Next Meetup

다음 모임은 2024년 11월 초에 진행될 예정입니다. 구체적인 일정은 추후 공지됩니다.

Call for Speakers

diff --git a/groups/beginner/manifest.json b/groups/beginner/manifest.json index 013d4a6..3eddadd 100644 --- a/groups/beginner/manifest.json +++ b/groups/beginner/manifest.json @@ -1,41 +1,41 @@ { - "name": "App", - "icons": [ - { - "src": "\/android-icon-36x36.png", - "sizes": "36x36", - "type": "image\/png", - "density": "0.75" - }, - { - "src": "\/android-icon-48x48.png", - "sizes": "48x48", - "type": "image\/png", - "density": "1.0" - }, - { - "src": "\/android-icon-72x72.png", - "sizes": "72x72", - "type": "image\/png", - "density": "1.5" - }, - { - "src": "\/android-icon-96x96.png", - "sizes": "96x96", - "type": "image\/png", - "density": "2.0" - }, - { - "src": "\/android-icon-144x144.png", - "sizes": "144x144", - "type": "image\/png", - "density": "3.0" - }, - { - "src": "\/android-icon-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": "4.0" - } - ] -} \ No newline at end of file + "name": "App", + "icons": [ + { + "src": "\/groups\/beginner\/android-icon-36x36.png", + "sizes": "36x36", + "type": "image\/png", + "density": "0.75" + }, + { + "src": "\/groups\/beginner\/android-icon-48x48.png", + "sizes": "48x48", + "type": "image\/png", + "density": "1.0" + }, + { + "src": "\/groups\/beginner\/android-icon-72x72.png", + "sizes": "72x72", + "type": "image\/png", + "density": "1.5" + }, + { + "src": "\/groups\/beginner\/android-icon-96x96.png", + "sizes": "96x96", + "type": "image\/png", + "density": "2.0" + }, + { + "src": "\/groups\/beginner\/android-icon-144x144.png", + "sizes": "144x144", + "type": "image\/png", + "density": "3.0" + }, + { + "src": "\/groups\/beginner\/android-icon-192x192.png", + "sizes": "192x192", + "type": "image\/png", + "density": "4.0" + } + ] + } \ No newline at end of file diff --git "a/groups/beginner/sessions/aws\354\231\200_\355\225\250\352\273\230\355\225\230\353\212\224_\353\266\200\355\225\230\355\205\214\354\212\244\355\212\270_\354\236\205\353\254\270_\353\254\270\354\204\261\355\230\201/index.html" "b/groups/beginner/sessions/aws\354\231\200_\355\225\250\352\273\230\355\225\230\353\212\224_\353\266\200\355\225\230\355\205\214\354\212\244\355\212\270_\354\236\205\353\254\270_\353\254\270\354\204\261\355\230\201/index.html" index 497b68a..1146ab1 100644 --- "a/groups/beginner/sessions/aws\354\231\200_\355\225\250\352\273\230\355\225\230\353\212\224_\353\266\200\355\225\230\355\205\214\354\212\244\355\212\270_\354\236\205\353\254\270_\353\254\270\354\204\261\355\230\201/index.html" +++ "b/groups/beginner/sessions/aws\354\231\200_\355\225\250\352\273\230\355\225\230\353\212\224_\353\266\200\355\225\230\355\205\214\354\212\244\355\212\270_\354\236\205\353\254\270_\353\254\270\354\204\261\355\230\201/index.html" @@ -106,6 +106,6 @@ document.addEventListener("DOMContentLoaded", () => init()); document.addEventListener("astro:after-swap", () => init()); preloadTheme(); -

AWS와 함께하는 부하테스트 입문

문성혁 | 모요