Socket
Socket
Sign inDemoInstall

@react-pdf-viewer/core

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-viewer/core - npm Package Compare versions

Comparing version 2.10.1 to 2.11.0

17

lib/cjs/core.min.js

@@ -1,1 +0,16 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("pdfjs-dist");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,o,a,i,c,s,l=n(e),p=n(t);exports.AnnotationType=void 0,(r=exports.AnnotationType||(exports.AnnotationType={}))[r.Text=1]="Text",r[r.Link=2]="Link",r[r.FreeText=3]="FreeText",r[r.Line=4]="Line",r[r.Square=5]="Square",r[r.Circle=6]="Circle",r[r.Polygon=7]="Polygon",r[r.Polyline=8]="Polyline",r[r.Highlight=9]="Highlight",r[r.Underline=10]="Underline",r[r.Squiggly=11]="Squiggly",r[r.StrikeOut=12]="StrikeOut",r[r.Stamp=13]="Stamp",r[r.Caret=14]="Caret",r[r.Ink=15]="Ink",r[r.Popup=16]="Popup",r[r.FileAttachment=17]="FileAttachment",exports.LayerRenderStatus=void 0,(o=exports.LayerRenderStatus||(exports.LayerRenderStatus={}))[o.PreRender=0]="PreRender",o[o.DidRender=1]="DidRender",exports.Position=void 0,(a=exports.Position||(exports.Position={})).TopLeft="TOP_LEFT",a.TopCenter="TOP_CENTER",a.TopRight="TOP_RIGHT",a.RightTop="RIGHT_TOP",a.RightCenter="RIGHT_CENTER",a.RightBottom="RIGHT_BOTTOM",a.BottomLeft="BOTTOM_LEFT",a.BottomCenter="BOTTOM_CENTER",a.BottomRight="BOTTOM_RIGHT",a.LeftTop="LEFT_TOP",a.LeftCenter="LEFT_CENTER",a.LeftBottom="LEFT_BOTTOM",exports.SpecialZoomLevel=void 0,(i=exports.SpecialZoomLevel||(exports.SpecialZoomLevel={})).ActualSize="ActualSize",i.PageFit="PageFit",i.PageWidth="PageWidth",exports.ToggleStatus=void 0,(c=exports.ToggleStatus||(exports.ToggleStatus={})).Close="Close",c.Open="Open",c.Toggle="Toggle",exports.TextDirection=void 0,(s=exports.TextDirection||(exports.TextDirection={})).RightToLeft="RTL",s.LeftToRight="LTR";var u=l.createContext({currentTheme:"light",direction:exports.TextDirection.LeftToRight,setCurrentTheme:function(){}}),d=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},f="undefined"!=typeof window?l.useLayoutEffect:l.useEffect,v=function(e){var t=e.children,n=e.ignoreDirection,r=void 0!==n&&n,o=e.size,a=void 0===o?24:o,i=l.useContext(u).direction,c=!r&&i===exports.TextDirection.RightToLeft,s=(a||24)+"px";return l.createElement("svg",{"aria-hidden":"true",className:d({"rpv-core__icon":!0,"rpv-core__icon--rtl":c}),focusable:"false",height:s,viewBox:"0 0 24 24",width:s},t)},g=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},m=function(e,t){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},m(e,t)};function h(e,t){function n(){this.constructor=e}m(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var E=function(){return E=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},E.apply(this,arguments)},x=function(e){var t=e.children,n=e.onClick,r=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":r}),type:"button",onClick:n},t)},_=function(e){var t=l.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return f((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;r({isVisible:t,ratio:n})}))}),{threshold:n||0}),o=t.current;if(o)return e.observe(o),function(){e.unobserve(o)}}),[]),t},y=function(e){var t=e.size,n=void 0===t?"4rem":t,r=l.useState(!1),o=r[0],a=r[1],i=_({onVisibilityChanged:function(e){a(e.isVisible)}});return l.createElement("div",{className:d({"rpv-core__spinner":!0,"rpv-core__spinner--animating":o}),ref:i,style:{height:n,width:n}})},w=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.autoFocus,o=void 0!==r&&r,a=e.placeholder,i=void 0===a?"":a,c=e.testId,s=e.type,p=void 0===s?"text":s,v=e.value,g=void 0===v?"":v,m=e.onChange,h=e.onKeyDown,x=void 0===h?function(){}:h,_=l.useContext(u).direction,y=l.useRef(),w=_===exports.TextDirection.RightToLeft,b={ref:y,"data-testid":"","aria-label":n,className:d({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":w}),placeholder:i,value:g,onChange:function(e){return m(e.target.value)},onKeyDown:x};return c&&(b["data-testid"]=c),f((function(){if(o){var e=y.current;if(e){var t=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(t,n)}}}),[]),"text"===p?l.createElement("input",E({type:"text"},b)):l.createElement("input",E({type:"password"},b))},b=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};l.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener("click",r,t),function(){document.removeEventListener("click",r,t)}}}),[])},P=function(e){var t=function(t){"Escape"===t.key&&e()};l.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},R=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=l.useRef(),c=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),P((function(){i.current&&o&&a()})),b(r,i,a),f((function(){var e=i.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]),l.createElement("div",{"aria-modal":"true",className:d({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":c}),id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},T=function(e){var t=e.children;return l.createElement("div",{className:"rpv-core__modal-overlay"},t)},L=function(e){var t=l.useState(e),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case exports.ToggleStatus.Close:r(!1);break;case exports.ToggleStatus.Open:r(!0);break;case exports.ToggleStatus.Toggle:default:r((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.isOpened,r=void 0!==n&&n,o=e.target,a=L(r),i=a.opened,c=a.toggle;return l.createElement(l.Fragment,null,o&&o(c,i),i&&t(c))},C=0,O=function(){return C++},S=function(e,t,n,r,o){f((function(){var a=t.current,i=e.current,c=n.current;if(i&&a&&c){var s=c.getBoundingClientRect(),l=function(e,t,n,r){var o=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=a.height,c=a.width,s=0,l=0;switch(n){case exports.Position.TopLeft:s=o.top-i,l=o.left;break;case exports.Position.TopCenter:s=o.top-i,l=o.left+o.width/2-c/2;break;case exports.Position.TopRight:s=o.top-i,l=o.left+o.width-c;break;case exports.Position.RightTop:s=o.top,l=o.left+o.width;break;case exports.Position.RightCenter:s=o.top+o.height/2-i/2,l=o.left+o.width;break;case exports.Position.RightBottom:s=o.top+o.height-i,l=o.left+o.width;break;case exports.Position.BottomLeft:s=o.top+o.height,l=o.left;break;case exports.Position.BottomCenter:s=o.top+o.height,l=o.left+o.width/2-c/2;break;case exports.Position.BottomRight:s=o.top+o.height,l=o.left+o.width-c;break;case exports.Position.LeftTop:s=o.top,l=o.left-c;break;case exports.Position.LeftCenter:s=o.top+o.height/2-i/2,l=o.left-c;break;case exports.Position.LeftBottom:s=o.top+o.height-i,l=o.left-c}return{left:l+(r.left||0),top:s+(r.top||0)}}(i,a,r,o),p=l.top,u=l.left;i.style.top=p-s.top+"px",i.style.left=u-s.left+"px"}}),[])},A=function(e){var t,n=e.customClassName,r=e.position;return l.createElement("div",{className:d((t={"rpv-core__arrow":!0,"rpv-core__arrow--tl":r===exports.Position.TopLeft,"rpv-core__arrow--tc":r===exports.Position.TopCenter,"rpv-core__arrow--tr":r===exports.Position.TopRight,"rpv-core__arrow--rt":r===exports.Position.RightTop,"rpv-core__arrow--rc":r===exports.Position.RightCenter,"rpv-core__arrow--rb":r===exports.Position.RightBottom,"rpv-core__arrow--bl":r===exports.Position.BottomLeft,"rpv-core__arrow--bc":r===exports.Position.BottomCenter,"rpv-core__arrow--br":r===exports.Position.BottomRight,"rpv-core__arrow--lt":r===exports.Position.LeftTop,"rpv-core__arrow--lc":r===exports.Position.LeftCenter,"rpv-core__arrow--lb":r===exports.Position.LeftBottom},t[""+n]=""!==n,t))})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.offset,a=e.position,i=e.targetRef,c=e.onClose,s=l.useRef(),p=l.useRef(),v=l.useRef(),g=l.useContext(u).direction===exports.TextDirection.RightToLeft;b(r,s,c),S(s,i,v,a,o),f((function(){var e=p.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]);var m="rpv-core__popover-body-inner-"+t;return l.createElement(l.Fragment,null,l.createElement("div",{ref:v,style:{left:0,position:"absolute",top:0}}),l.createElement("div",{"aria-describedby":m,className:d({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":g}),id:"rpv-core__popover-body-"+t,ref:s,role:"dialog",tabIndex:-1},l.createElement(A,{customClassName:"rpv-core__popover-body-arrow",position:a}),l.createElement("div",{id:m,ref:p},n)))},D=function(e){var t=e.closeOnEscape,n=e.onClose,r=l.useRef();return P((function(){r.current&&t&&n()})),l.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},N=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=l.useRef(),s=l.useContext(u).direction===exports.TextDirection.RightToLeft;return S(r,i,c,a,o),l.createElement(l.Fragment,null,l.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),l.createElement("div",{className:d({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":s}),id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},l.createElement(A,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),l.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var H={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},I=l.createContext({l10n:H,setL10n:function(){}});function B(e){var t=l.useRef(e);return l.useEffect((function(){t.current=e}),[e]),t.current}var F;!function(e){e[e.Solid=1]="Solid",e[e.Dashed=2]="Dashed",e[e.Beveled=3]="Beveled",e[e.Inset=4]="Inset",e[e.Underline=5]="Underline"}(F||(F={}));var W,z=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),j=function(e,t,n,r){var o=parseInt(e,10);return o>=t&&o<=n?o:r},V=function(e){var t=e.annotation,n=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o="";if(t.modificationDate){var a=function(e){var t=z.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=j(t[2],1,12,1)-1,o=j(t[3],1,31,1),a=j(t[4],0,23,0),i=j(t[5],0,59,0),c=j(t[6],0,59,0),s=t[7]||"Z",l=j(t[8],0,23,0),p=j(t[9],0,59,0);switch(s){case"-":a+=l,i+=p;break;case"+":a-=l,i-=p}return new Date(Date.UTC(n,r,o,a,i,c))}(t.modificationDate);o=a?a.toLocaleDateString()+", "+a.toLocaleTimeString():""}return l.useLayoutEffect((function(){if(r.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var n=e;return n.style.zIndex+=1,function(){n.style.zIndex=""+(parseInt(n.style.zIndex,10)-1)}}}}),[]),l.createElement("div",{ref:r,className:d({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":n}),style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&l.createElement(l.Fragment,null,l.createElement("div",{className:d({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!n,"rpv-core__annotation-popup-title--rtl":n})},t.title),l.createElement("div",{className:"rpv-core__annotation-popup-date"},o)),t.contents&&l.createElement("div",{className:"rpv-core__annotation-popup-content"},t.contents.split("\n").map((function(e,t){return l.createElement(l.Fragment,{key:t},e,l.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(W||(W={}));var q,Z=function(e){var t,n=e.annotation,r=e.children,o=e.ignoreBorder,a=e.hasPopup,i=e.isRenderable,c=e.page,s=e.viewport,p=n.rect,u=function(){var e=L(!1),t=e.opened,n=e.toggle,r=l.useState(W.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case W.Click:t&&a(W.Hover),n(exports.ToggleStatus.Toggle);break;case W.Hover:a(W.Click),n(exports.ToggleStatus.Open)}}}}(),d=u.closeOnHover,f=u.opened,v=u.openOnHover,g=u.toggleOnClick,m=(t=[p[0],c.view[3]+c.view[1]-p[1],p[2],c.view[3]+c.view[1]-p[3]],[Math.min(t[0],t[2]),Math.min(t[1],t[3]),Math.max(t[0],t[2]),Math.max(t[1],t[3])]),h=p[2]-p[0],E=p[3]-p[1],x={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case F.Dashed:x.borderStyle="dashed";break;case F.Solid:x.borderStyle="solid";break;case F.Underline:x=Object.assign({borderBottomStyle:"solid"},x);case F.Beveled:case F.Inset:}var _=n.borderStyle.width;x.borderWidth=_+"px",n.borderStyle.style!==F.Underline&&(h-=2*_,E-=2*_);var y=n.borderStyle,w=y.horizontalCornerRadius,b=y.verticalCornerRadius;(w>0||b>0)&&(x.borderRadius=w+"px / "+b+"px"),n.color?x.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":x.borderWidth="0"}return l.createElement(l.Fragment,null,i&&r({popup:{opened:f,closeOnHover:d,openOnHover:v,toggleOnClick:g},slot:{attrs:{style:Object.assign({height:E+"px",left:m[0]+"px",top:m[1]+"px",transform:"matrix("+s.transform.join(",")+")",transformOrigin:"-"+m[0]+"px -"+m[1]+"px",width:h+"px"},x)},children:l.createElement(l.Fragment,null,a&&f&&l.createElement(V,{annotation:n}))}}))},U=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},G=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("circle",{cy:s/2,fill:"none",rx:c/2-p/2,ry:s/2-p/2,stroke:"transparent",strokeWidth:p||1})),e.slot.children)}))},J=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!1!==t.hasPopup||!t.title&&!t.contents),a=function(){var e,n,r,o,a=t.file;a&&(e=a.filename,n=a.content,r="string"==typeof n?"":URL.createObjectURL(new Blob([n],{type:""})),(o=document.createElement("a")).style.display="none",o.href=r||e,o.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(o),o.click(),document.body.removeChild(o),r&&URL.revokeObjectURL(r))};return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:a,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},K=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Q=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!t.title&&!t.contents),a=!t.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(t.parentType);return f((function(){if(t.parentId){var e=document.querySelector('[data-annotation-id="'+t.parentId+'"]'),n=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e&&n){var r=parseFloat(e.style.left),o=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=r+"px",n.style.top=o+"px",n.style.transformOrigin="-"+r+"px -"+o+"px"}}}),[]),l.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:o,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),l.createElement(V,{annotation:t}))}))},X=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents);if(t.quadPoints&&t.quadPoints.length>0){var c=t.quadPoints.map((function(e){return Object.assign({},t,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return l.createElement(l.Fragment,null,c.map((function(e,t){return l.createElement(X,{key:t,annotation:e,childAnnotation:n,page:r,viewport:o})})))}return l.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:i,page:r,viewport:o},(function(e){return l.createElement(l.Fragment,null,l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--highlight","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(Q,{annotation:n,page:r,viewport:o}))}))},Y=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},t.inkLists.map((function(e,t){return l.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:p||1,points:e.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})}))),e.slot.children)}))},$=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("line",{stroke:"transparent",strokeWidth:p||1,x1:i[2]-t.lineCoordinates[0],x2:i[2]-t.lineCoordinates[2],y1:i[3]-t.lineCoordinates[1],y2:i[3]-t.lineCoordinates[3]})),e.slot.children)}))},ee=function(e,t){return new Promise((function(n){new Promise((function(n){"string"==typeof t?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(t){return"object"==typeof t[0]?e.getPageIndex(t[0]).then((function(e){return Promise.resolve({pageIndex:e,destArray:t})})):Promise.resolve({pageIndex:t[0],destArray:t})})).then((function(e){var t=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":case"FitB":return{bottomOffset:0,pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},te=function(e){var t=e.annotation,n=e.doc,r=e.page,o=e.viewport,a=e.onExecuteNamedAction,i=e.onJumpToDest,c=!!(t.url||t.dest||t.action),s=t.url?{href:t.url,rel:"noopener noreferrer nofollow",target:t.newWindow?"_blank":"",title:t.url}:{href:"","data-annotation-link-dest":t.dest,onClick:function(e){e.preventDefault(),t.action?a(t.action):ee(n,t.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;i(n?t+1:t,n,0,r)}))}};return l.createElement(Z,{annotation:t,hasPopup:!1,ignoreBorder:!1,isRenderable:c,page:r,viewport:o},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),l.createElement("a",E({},s)))}))},ne=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},re=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},oe=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],s=i[3]-i[1],p=t.borderStyle.width;return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),l.createElement("svg",{height:s+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+s,width:c+"px"},l.createElement("rect",{height:s-p,fill:"none",stroke:"transparent",strokeWidth:p||1,x:p/2,y:p/2,width:c-p})),e.slot.children)}))},ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ce=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},se=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),l.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),l.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),l.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},le=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),l.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),l.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),l.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),l.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),l.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),l.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),l.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),l.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),l.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},pe=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),l.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},ue=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),l.createElement("path",{d:"M6 4.5L6 0.5"}),l.createElement("path",{d:"M18 4.5L18 0.5"}),l.createElement("path",{d:"M10 4.5L10 0.5"}),l.createElement("path",{d:"M14 4.5L14 0.5"}))},de=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),l.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),l.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},fe=function(){return l.createElement(v,{size:16},l.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},ve=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents),c=t.name?t.name.toLowerCase():"";return l.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:i,page:r,viewport:o},(function(e){return l.createElement(l.Fragment,null,l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),c&&l.createElement("div",{className:"rpv-core__annotation-text-icon"},"check"===c&&l.createElement(g,null),"comment"===c&&l.createElement(se,null),"help"===c&&l.createElement(le,null),"insert"===c&&l.createElement(fe,null),"key"===c&&l.createElement(pe,null),"note"===c&&l.createElement(ue,null),("newparagraph"===c||"paragraph"===c)&&l.createElement(de,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&l.createElement(Q,{annotation:n,page:r,viewport:o}))}))},ge=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return l.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return l.createElement("div",E({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},me=function(e){var t=e.annotations,n=e.containerRef,r=e.doc,o=e.page,a=e.pageIndex,i=e.plugins,c=e.rotation,s=e.scale,p=e.onExecuteNamedAction,u=e.onJumpToDest,d=o.getViewport({rotation:c,scale:s}).clone({dontFlip:!0}),f=t.filter((function(e){return!e.parentId}));return l.useEffect((function(){var e=n.current;e&&i.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:f,container:e,pageIndex:a,rotation:c,scale:s})}))}),[]),l.createElement(l.Fragment,null,f.map((function(e){var n=t.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case exports.AnnotationType.Caret:return l.createElement(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return l.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return l.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return l.createElement(K,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Highlight:return l.createElement(X,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return l.createElement(Y,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Line:return l.createElement($,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return l.createElement(te,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return l.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return l.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return l.createElement(Q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return l.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return l.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return l.createElement(ie,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return l.createElement(ce,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return l.createElement(ve,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return l.createElement(ge,{key:e.id,annotation:e,page:o,viewport:d});default:return l.createElement(l.Fragment,{key:e.id})}})))},he=function(e){var t=e.page,n=e.renderAnnotations,r=l.useState({loading:!0,annotations:[]}),o=r[0],a=r[1];return l.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){a({loading:!1,annotations:e})}))}),[]),o.loading?l.createElement(l.Fragment,null):n(o.annotations)},Ee=function(e){var t=e.doc,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.onExecuteNamedAction,s=e.onJumpToDest,p=l.useRef();return l.createElement("div",{ref:p,className:"rpv-core__annotation-layer"},l.createElement(he,{page:n,renderAnnotations:function(e){return l.createElement(me,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:s})}}))},xe=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return f((function(){t()}),[r,o]),l.createElement(l.Fragment,null,n)},_e=function(e){var t=e.height,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.width,s=l.useRef(),p=l.useRef(),u=l.useState(!1),d=u[0],f=u[1],v=window.devicePixelRatio||1;return l.createElement(xe,{callback:function(){f(!1);var e=p.current;e&&e.cancel();var l=s.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:l,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.PreRender})})),l.height=t*v,l.width=c*v,l.style.opacity="0";var u=l.getContext("2d",{alpha:!1}),d=n.getViewport({rotation:a,scale:i*v});p.current=n.render({canvasContext:u,viewport:d}),p.current.promise.then((function(){f(!0),l.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:l,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.DidRender})}))}),(function(){f(!0)}))},rotation:a,scale:i},l.createElement("div",{className:"rpv-core__canvas-layer",style:{height:t+"px",width:c+"px"}},!d&&l.createElement("div",{className:"rpv-core__canvas-layer-loader"},l.createElement(y,null)),l.createElement("canvas",{ref:s,style:{transform:"scale("+1/v+")",transformOrigin:"top left"}})))},ye=function(e){var t=e.height,n=e.page,r=e.rotation,o=e.scale,a=e.width,i=l.useRef();return l.createElement(xe,{callback:function(){var e=i.current,c=n.getViewport({rotation:r,scale:o});n.getOperatorList().then((function(r){!function(){var e=i.current;e&&(e.innerHTML="")}(),new p.SVGGraphics(n.commonObjs,n.objs).getSVG(r,c).then((function(n){n.style.height=t+"px",n.style.width=a+"px",e.appendChild(n)}))}))},rotation:r,scale:o},l.createElement("div",{className:"rpv-core__svg-layer",ref:i}))},we=function(e){var t=e.page,n=e.pageIndex,r=e.plugins,o=e.rotation,a=e.scale,i=l.useRef(),c=l.useRef();return l.createElement(xe,{callback:function(){var e=c.current;e&&e.cancel();var s=i.current;if(s){var l=t.getViewport({rotation:o,scale:a});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.PreRender})})),t.getTextContent().then((function(e){!function(){var e=i.current;e&&([].slice.call(e.querySelectorAll("span.rpv-core__text-layer-text")).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll('br[role="presentation"]')).forEach((function(t){return e.removeChild(t)})))}(),c.current=p.renderTextLayer({container:s,textContent:e,viewport:l,enhanceTextSelection:!0}),c.current.promise.then((function(){[].slice.call(s.querySelectorAll("span")).forEach((function(e){return e.classList.add("rpv-core__text-layer-text")})),r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.DidRender})}))}),(function(){}))}))}},rotation:o,scale:a},l.createElement("div",{className:"rpv-core__text-layer",ref:i}))},be=function(e){var t=e.currentPage,n=e.doc,r=e.height,o=e.pageIndex,a=e.plugins,i=e.renderPage,c=e.rotation,s=e.scale,p=e.width,u=e.onExecuteNamedAction,d=e.onJumpToDest,f=e.onPageVisibilityChanged,v=l.useState({page:null,pageHeight:r,pageWidth:p,viewportRotation:0}),g=v[0],m=v[1],h=g.page,E=g.pageHeight,x=g.pageWidth,w=l.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),P=x*s,R=E*s,T=Math.abs(c)%180==0,L=T?P:R,k=T?R:P,C=function(){w.current||(w.current=!0,n.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});m({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},O=i||function(e){return l.createElement(l.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},S=(c+g.viewportRotation)%360,A=_({threshold:b,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&C()}});return l.useEffect((function(){t-2<=o&&o<=t+2&&C()}),[t]),l.createElement("div",{ref:A,className:"rpv-core__page-layer","data-testid":"core__page-layer-"+o,style:{height:k+"px",width:L+"px"}},h?l.createElement(l.Fragment,null,O({annotationLayer:{attrs:{},children:l.createElement(Ee,{doc:n,page:h,pageIndex:o,plugins:a,rotation:S,scale:s,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:l.createElement(_e,{height:k,page:h,pageIndex:o,plugins:a,rotation:S,scale:s,width:L})},doc:n,height:k,pageIndex:o,rotation:c,scale:s,svgLayer:{attrs:{},children:l.createElement(ye,{height:k,page:h,rotation:S,scale:s,width:L})},textLayer:{attrs:{},children:l.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:S,scale:s})},width:L}),a.map((function(e,t){return e.renderPageLayer?l.createElement(l.Fragment,{key:t},e.renderPageLayer({doc:n,height:k,pageIndex:o,rotation:c,scale:s,width:L})):l.createElement(l.Fragment,{key:t})}))):l.createElement(y,null))},Pe=function(e,t,n,r){switch(r){case exports.SpecialZoomLevel.ActualSize:return 1;case exports.SpecialZoomLevel.PageFit:return Math.min((e.clientWidth-17)/n,(e.clientHeight-16)/t);case exports.SpecialZoomLevel.PageWidth:return(e.clientWidth-17)/n}},Re=function(e){var t=e.currentFile,n=e.defaultScale,r=e.doc,o=e.initialPage,a=e.pageSize,i=e.plugins,c=e.renderPage,s=e.viewerState,p=e.onDocumentLoad,d=e.onOpenFile,v=e.onPageChange,g=e.onZoom,m=l.useContext(I).l10n,h=l.useContext(u),x=l.useRef(null),_=l.useRef(null),y=l.useState(0),w=y[0],b=y[1],P=l.useState(0),R=P[0],T=P[1],L=l.useRef(s),k=l.useState(a.scale),C=k[0],O=k[1],S=l.useRef("string"==typeof n?n:null);!function(e){var t=e.targetRef,n=e.onResize;f((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])}({targetRef:_,onResize:function(e){S.current&&G(S.current)}});var A=r.numPages,M=a.pageWidth,D=a.pageHeight,N=Array(A).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return l.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),L.current=t},W=function(){return _.current},z=function(e){return e<0||e>=A?null:B[e].current},j=function(){return L.current},V=function(e,t,n,o){var a=_.current,i=L.current;if(a&&i){var c=e+1;r.getPage(c).then((function(r){var c=r.getViewport({scale:1}),s=0,l=t||0,p=n||0,u=i.scale;switch(o){case exports.SpecialZoomLevel.PageFit:s=0,p=0,G(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=Pe(a,D,M,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,G(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=B[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},q=function(e){if(!(e<0||e>=A)){var t=_.current,n=B[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),b(e)}},Z=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){d(e.name,t)}))},U=function(e){T(e),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:e,scale:C})},G=function(e){var t=_.current,n=t?"string"==typeof e?Pe(t,D,M,e):e:1;S.current="string"==typeof e?e:null,O(n),g({doc:r,scale:n})};l.useEffect((function(){var e=_.current,t=L.current;e&&t&&(e.scrollTop=e.scrollTop*C/t.scale,e.scrollLeft=e.scrollLeft*C/t.scale,F({file:s.file,pageIndex:t.pageIndex,pageHeight:D,pageWidth:M,rotation:R,scale:C}))}),[C]);l.useEffect((function(){var e={getPageElement:z,getPagesContainer:W,getViewerState:j,jumpToDestination:V,jumpToPage:q,openFile:Z,rotate:U,setViewerState:F,zoom:G};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),l.useEffect((function(){p({doc:r,file:t}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r,file:t})})),o&&q(o)}),[]),l.useEffect((function(){v({currentPage:w,doc:r}),F({file:s.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:R,scale:C})}),[w]);var J,K=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);b(n)},Q=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":q(0);break;case"LastPage":q(A-1);break;case"NextPage":n<A&&q(n);break;case"PrevPage":t>=0&&q(t)}},X=m&&m.core?m.core.pageLabel:"Page {{pageIndex}}",Y=function(e){return l.createElement("div",E({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&Y(e.subSlot))};return Y((J={attrs:{"data-testid":"core__inner-container",ref:x,style:{height:"100%"}},children:l.createElement(l.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",ref:_,style:{height:"100%",overflow:"auto",position:"relative"}},children:l.createElement(l.Fragment,null,Array(A).fill(0).map((function(e,t){return l.createElement("div",{"aria-label":X.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e},role:"region"},l.createElement(be,{currentPage:w,doc:r,height:D,pageIndex:t,plugins:i,renderPage:c,rotation:R,scale:C,width:M,onExecuteNamedAction:Q,onJumpToDest:V,onPageVisibilityChanged:K}))})))}},i.forEach((function(e){e.renderViewer&&(J=e.renderViewer({containerRef:x,doc:r,pageHeight:D,pageWidth:M,rotation:R,slot:J,themeContext:h,jumpToPage:q,openFile:Z,rotate:U,zoom:G}))})),J))},Te=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Le=function(e){var t=e.defaultScale,n=e.doc,r=e.render,o=l.useRef(null),a=l.useState({pageHeight:0,pageWidth:0,scale:1}),i=a[0],c=a[1];return l.useEffect((function(){n.getPage(1).then((function(e){var n=e.getViewport({scale:1}),r=n.width,a=n.height,i=o.current;if(i){var s,l,p=i.parentElement,u=p.clientWidth/r,d=t?"string"==typeof t?Pe(p,a,r,t):t:(s=u,-1===(l=Te.findIndex((function(e){return e>=s})))||0===l?s:Te[l-1]);c({pageHeight:a,pageWidth:r,scale:d})}}))}),[n]),0===i.pageWidth?l.createElement("div",{className:"rpv-core__page-size-calculator",ref:o},l.createElement(y,null)):r(i)},ke=function(){var e=l.useRef(!1);return l.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e},Ce=function(){};!function(e){e[e.REQUIRE_PASSWORD=0]="REQUIRE_PASSWORD",e[e.WRONG_PASSWORD=1]="WRONG_PASSWORD"}(q||(q={}));var Oe=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.submitPassword=n,r}return h(t,e),t}(Ce),Se=function(e){var t=e.submitPassword,n=e.verifyPassword,r=e.onDocumentAskPassword,o=l.useContext(I).l10n,a=l.useState(""),i=a[0],c=a[1],s=l.useContext(u).direction===exports.TextDirection.RightToLeft,p=function(){return n(i)};return l.useEffect((function(){r&&r({verifyPassword:n})}),[]),l.createElement("div",{className:"rpv-core__asking-password-wrapper"},l.createElement("div",{className:d({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":s})},l.createElement("div",{className:"rpv-core__asking-password-message"},t===q.REQUIRE_PASSWORD&&o.core.askingPassword.requirePasswordToOpen,t===q.WRONG_PASSWORD&&o.core.wrongPassword.tryAgain),l.createElement("div",{className:"rpv-core__asking-password-body"},l.createElement("div",{className:d({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!s,"rpv-core__asking-password-input--rtl":s})},l.createElement(w,{testId:"core__asking-password-input",type:"password",value:i,onChange:c,onKeyDown:function(e){"Enter"===e.key&&p()}})),l.createElement(x,{onClick:p},o.core.askingPassword.submit))))},Ae=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return h(t,e),t}(Ce),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return h(t,e),t}(Ce),De=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return h(t,e),t}(Ce),Ne=function(e){var t=e.characterMap,n=e.file,r=e.httpHeaders,o=e.render,a=e.renderError,i=e.renderLoader,c=e.transformGetDocumentParams,s=e.withCredentials,f=e.onDocumentAskPassword,v=l.useContext(u).direction===exports.TextDirection.RightToLeft,g=l.useState(new De(0)),m=g[0],h=g[1],E=l.useState(0),x=E[0],_=E[1],w=l.useState(null),b=w[0],P=w[1],R=ke();return l.useEffect((function(){h(new De(0));var e=new p.PDFWorker({name:"PDFWorker_"+Date.now()}),o=Object.assign({httpHeaders:r,withCredentials:s,worker:e},"string"==typeof n?{url:n}:{data:n},t?{cMapUrl:t.url,cMapPacked:t.isCompressed}:{}),a=c?c(o):o,i=p.getDocument(a);return i.onPassword=function(e,t){switch(t){case p.PasswordResponses.NEED_PASSWORD:R.current&&h(new Oe(e,q.REQUIRE_PASSWORD));break;case p.PasswordResponses.INCORRECT_PASSWORD:R.current&&h(new Oe(e,q.WRONG_PASSWORD))}},i.onProgress=function(e){e.total>0?R.current&&_(Math.min(100,100*e.loaded/e.total)):R.current&&_(100)},i.promise.then((function(e){return R.current&&P(e)}),(function(t){return R.current&&!e.destroyed&&h(new Me({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[n]),l.useEffect((function(){100===x&&b?R.current&&h(new Ae(b)):R.current&&h(new De(x))}),[x,b]),m instanceof Oe?l.createElement(Se,{submitPassword:m.submitPassword,verifyPassword:m.verifyPassword,onDocumentAskPassword:f}):m instanceof Ae?o(m.doc):m instanceof Me?a?a(m.error):l.createElement("div",{className:d({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":v})},l.createElement("div",{className:"rpv-core__doc-error-text"},m.error.message)):m instanceof De?l.createElement("div",{"data-testid":"core__doc-loading",className:d({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":v})},i?i(m.percentages):l.createElement(y,null)):l.createElement("div",{className:"rpv-core__doc-loading","data-testid":"core__doc-loading"},l.createElement(y,null))},He=function(e,t){var n=l.useMemo((function(){return"auto"===e?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}),[]),r=l.useState(n),o=r[0],a=r[1],i=B(o);return l.useEffect((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){a(e.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}}),[]),l.useEffect((function(){o!==i&&t&&t(o)}),[o]),l.useEffect((function(){e!==o&&a(e)}),[e]),{currentTheme:o,setCurrentTheme:a}};exports.Button=function(e){var t=e.children,n=e.onClick,r=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__button":!0,"rpv-core__button--rtl":r}),type:"button",onClick:n},t)},exports.Icon=v,exports.LocalizationContext=I,exports.Menu=function(e){var t=e.children,n=l.useRef(),r=l.useRef([]),o=l.useContext(u).direction===exports.TextDirection.RightToLeft,a=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),i((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),i((function(e,t){return t-1}));break;case"End":e.preventDefault(),i((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),i((function(e,t){return 0}))}},i=function(e){if(n.current){var t=r.current,o=t.findIndex((function(e){return"0"===e.getAttribute("tabindex")})),a=Math.min(t.length-1,Math.max(0,e(t,o)));o>=0&&o<=t.length-1&&t[o].setAttribute("tabindex","-1"),t[a].setAttribute("tabindex","0"),t[a].focus()}};return f((function(){var e=n.current;if(e){var t=function(e){var t=[];return e.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach((function(n){if(n instanceof HTMLElement){var r=n.parentElement;(r===e||"none"!==window.getComputedStyle(r).display)&&t.push(n)}})),t}(e);r.current=t}}),[]),f((function(){return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}}),[]),l.createElement("div",{ref:n,"aria-orientation":"vertical",className:d({"rpv-core__menu":!0,"rpv-core__menu--rtl":o}),role:"menu",tabIndex:0},t)},exports.MenuDivider=function(){return l.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},exports.MenuItem=function(e){var t=e.checked,n=void 0!==t&&t,r=e.children,o=e.icon,a=void 0===o?null:o,i=e.isDisabled,c=void 0!==i&&i,s=e.onClick,p=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",{className:d({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c,"rpv-core__menu-item--ltr":!p,"rpv-core__menu-item--rtl":p}),role:"menuitem",tabIndex:-1,type:"button",onClick:s},l.createElement("div",{className:d({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!p,"rpv-core__menu-item-icon--rtl":p})},a),l.createElement("div",{className:d({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!p,"rpv-core__menu-item-label--rtl":p})},r),l.createElement("div",{className:d({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!p,"rpv-core__menu-item-check--rtl":p})},n&&l.createElement(g,null)))},exports.MinimalButton=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.ariaKeyShortcuts,o=void 0===r?"":r,a=e.children,i=e.isDisabled,c=void 0!==i&&i,s=e.isSelected,p=void 0!==s&&s,f=e.onClick,v=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("button",E({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:d({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"rpv-core__minimal-button--rtl":v,"rpv-core__minimal-button--selected":p}),type:"button",onClick:f}),a)},exports.Modal=function(e){var t=e.ariaControlsSuffix,n=e.closeOnClickOutside,r=e.closeOnEscape,o=e.content,a=e.isOpened,i=void 0!==a&&a,c=e.target,s=t||""+O();return l.createElement(k,{target:c?function(e,t){return l.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+s},c(e,t))}:null,content:function(e){return l.createElement(T,null,l.createElement(R,{ariaControlsSuffix:s,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))},isOpened:i})},exports.Popover=function(e){var t=e.ariaHasPopup,n=void 0===t?"dialog":t,r=e.ariaControlsSuffix,o=e.closeOnClickOutside,a=e.closeOnEscape,i=e.content,c=e.offset,s=e.position,p=e.target,u=L(!1),d=u.opened,f=u.toggle,v=l.useRef(),g=r||""+O();return l.createElement("div",{ref:v,"aria-expanded":d?"true":"false","aria-haspopup":n,"aria-controls":"rpv-core__popver-body-"+g},p(f,d),d&&l.createElement(l.Fragment,null,l.createElement(D,{closeOnEscape:a,onClose:f}),l.createElement(M,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:s,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=x,exports.ProgressBar=function(e){var t=e.progress,n=l.useContext(u).direction===exports.TextDirection.RightToLeft;return l.createElement("div",{className:d({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":n})},l.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:t+"%"}},t,"%"))},exports.Separator=function(){return l.createElement("div",{className:"rpv-core__separator"})},exports.Spinner=y,exports.Splitter=function(e){var t=e.constrain,n=l.useContext(u).direction===exports.TextDirection.RightToLeft,r=l.useRef(),o=l.useRef(),a=l.useRef(),i=l.useRef(0),c=l.useRef(0),s=l.useRef(0),p=l.useRef(0),d={capture:!0},f=function(e){var c=r.current,l=o.current,u=a.current;if(c&&l&&u){var d=p.current,f=e.clientX-i.current,v=s.current+(n?-f:f),g=c.parentElement.getBoundingClientRect().width,m=100*v/g;if(c.classList.add("rpv-core__splitter--resizing"),t){var h=g-v-d;if(!t({firstHalfPercentage:m,firstHalfSize:v,secondHalfPercentage:100*h/g,secondHalfSize:h}))return}l.style.width=m+"%",document.body.classList.add("rpv-core__splitter-body--resizing"),l.classList.add("rpv-core__splitter-sibling--resizing"),u.classList.add("rpv-core__splitter-sibling--resizing")}},v=function(e){var t=r.current,n=o.current,i=a.current;t&&n&&i&&(document.body.classList.remove("rpv-core__splitter-body--resizing"),t.classList.remove("rpv-core__splitter--resizing"),n.classList.remove("rpv-core__splitter-sibling--resizing"),i.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",f,d),document.removeEventListener("mouseup",v,d))};return l.useEffect((function(){var e=r.current;e&&(p.current=e.getBoundingClientRect().width,o.current=e.previousElementSibling,a.current=e.nextElementSibling)}),[]),l.createElement("div",{ref:r,className:"rpv-core__splitter",onMouseDown:function(e){var t=o.current;t&&(i.current=e.clientX,c.current=e.clientY,s.current=t.getBoundingClientRect().width,document.addEventListener("mousemove",f,d),document.addEventListener("mouseup",v,d))}})},exports.TextBox=w,exports.ThemeContext=u,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=L(!1),c=i.opened,s=i.toggle,p=l.useRef(),u=l.useRef(),d=t||""+O();P((function(){p.current&&document.activeElement&&p.current.contains(document.activeElement)&&v()}));var f=function(){s(exports.ToggleStatus.Open)},v=function(){s(exports.ToggleStatus.Close)};return l.createElement(l.Fragment,null,l.createElement("div",{ref:p,"aria-describedby":"rpv-core__tooltip-body-"+d,onBlur:function(e){e.relatedTarget instanceof HTMLElement&&e.currentTarget.parentElement&&e.currentTarget.parentElement.contains(e.relatedTarget)?u.current&&(u.current.style.display="none"):v()},onFocus:f,onMouseEnter:f,onMouseLeave:v},a),c&&l.createElement(N,{ariaControlsSuffix:d,contentRef:u,offset:r,position:o,targetRef:p},n()))},exports.Viewer=function(e){var t=e.characterMap,n=e.defaultScale,r=e.fileUrl,o=e.httpHeaders,a=void 0===o?{}:o,i=e.initialPage,c=void 0===i?0:i,s=e.localization,p=e.plugins,d=void 0===p?[]:p,f=e.renderError,v=e.renderPage,g=e.renderLoader,m=e.transformGetDocumentParams,h=e.theme,E=void 0===h?{direction:exports.TextDirection.LeftToRight,theme:"light"}:h,x=e.withCredentials,y=void 0!==x&&x,w=e.onDocumentAskPassword,b=e.onDocumentLoad,P=void 0===b?function(){}:b,R=e.onPageChange,T=void 0===R?function(){}:R,L=e.onSwitchTheme,k=void 0===L?function(){}:L,C=e.onZoom,O=void 0===C?function(){}:C,S=l.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),A=S[0],M=S[1],D=function(e,t){M({data:t,name:e,shouldLoad:!0})},N=l.useState(!1),F=N[0],W=N[1],z=B(A);l.useEffect((function(){var e,t,n,o;e=z.data,o=typeof(t=r),"string"===(n=typeof e)&&"string"===o&&e===t||"object"===n&&"object"===o&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||M({data:r,name:"string"==typeof r?r:"",shouldLoad:F})}),[r,F]);var j=_({onVisibilityChanged:function(e){W(e.isVisible),e.isVisible&&M((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),V="string"==typeof E?{direction:exports.TextDirection.LeftToRight,theme:E}:E,q=l.useState(s||H),Z=q[0],U=q[1],G={l10n:Z,setL10n:U},J=Object.assign({},{direction:V.direction},He(V.theme||"light",k));return l.useEffect((function(){s&&U(s)}),[s]),l.createElement(I.Provider,{value:G},l.createElement(u.Provider,{value:J},l.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+J.currentTheme,"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},A.shouldLoad&&l.createElement(Ne,{characterMap:t,file:A.data,httpHeaders:a,render:function(e){return l.createElement(Le,{defaultScale:n,doc:e,render:function(t){return l.createElement(Re,{currentFile:{data:A.data,name:A.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:d,renderPage:v,viewerState:{file:A,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:P,onOpenFile:D,onPageChange:T,onZoom:O})}})},renderError:f,renderLoader:g,transformGetDocumentParams:m,withCredentials:y,onDocumentAskPassword:w}))))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return p.GlobalWorkerOptions.workerSrc=n,l.createElement(l.Fragment,null,t)},exports.classNames=d,exports.createStore=function(e){var t=e||{},n={};return{subscribe:function(e,t){n[e]=(n[e]||[]).concat(t)},unsubscribe:function(e,t){n[e]=(n[e]||[]).filter((function(e){return e!==t}))},update:function(e,r){var o;t=E(E({},t),((o={})[e]=r,o)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=ee,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=_,exports.useIsMounted=ke,exports.useIsomorphicLayoutEffect=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("pdfjs-dist");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r,o,a,i,c,s=n(e),l=n(t);exports.AnnotationType=void 0,(r=exports.AnnotationType||(exports.AnnotationType={}))[r.Text=1]="Text",r[r.Link=2]="Link",r[r.FreeText=3]="FreeText",r[r.Line=4]="Line",r[r.Square=5]="Square",r[r.Circle=6]="Circle",r[r.Polygon=7]="Polygon",r[r.Polyline=8]="Polyline",r[r.Highlight=9]="Highlight",r[r.Underline=10]="Underline",r[r.Squiggly=11]="Squiggly",r[r.StrikeOut=12]="StrikeOut",r[r.Stamp=13]="Stamp",r[r.Caret=14]="Caret",r[r.Ink=15]="Ink",r[r.Popup=16]="Popup",r[r.FileAttachment=17]="FileAttachment",exports.LayerRenderStatus=void 0,(o=exports.LayerRenderStatus||(exports.LayerRenderStatus={}))[o.PreRender=0]="PreRender",o[o.DidRender=1]="DidRender",exports.Position=void 0,(a=exports.Position||(exports.Position={})).TopLeft="TOP_LEFT",a.TopCenter="TOP_CENTER",a.TopRight="TOP_RIGHT",a.RightTop="RIGHT_TOP",a.RightCenter="RIGHT_CENTER",a.RightBottom="RIGHT_BOTTOM",a.BottomLeft="BOTTOM_LEFT",a.BottomCenter="BOTTOM_CENTER",a.BottomRight="BOTTOM_RIGHT",a.LeftTop="LEFT_TOP",a.LeftCenter="LEFT_CENTER",a.LeftBottom="LEFT_BOTTOM",exports.SpecialZoomLevel=void 0,(i=exports.SpecialZoomLevel||(exports.SpecialZoomLevel={})).ActualSize="ActualSize",i.PageFit="PageFit",i.PageWidth="PageWidth",exports.ToggleStatus=void 0,(c=exports.ToggleStatus||(exports.ToggleStatus={})).Close="Close",c.Open="Open",c.Toggle="Toggle";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var p=function(e,t){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},p(e,t)};function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d,f=function(){return f=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},f.apply(this,arguments)};exports.TextDirection=void 0,(d=exports.TextDirection||(exports.TextDirection={})).RightToLeft="RTL",d.LeftToRight="LTR";var v=s.createContext({currentTheme:"light",direction:exports.TextDirection.LeftToRight,setCurrentTheme:function(){}}),g=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},m="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,h=function(e){var t=e.children,n=e.ignoreDirection,r=void 0!==n&&n,o=e.size,a=void 0===o?24:o,i=s.useContext(v).direction,c=!r&&i===exports.TextDirection.RightToLeft,l=(a||24)+"px";return s.createElement("svg",{"aria-hidden":"true",className:g({"rpv-core__icon":!0,"rpv-core__icon--rtl":c}),focusable:"false",height:l,viewBox:"0 0 24 24",width:l},t)},E=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},x=function(e){var t=e.children,n=e.onClick,r=s.useContext(v).direction===exports.TextDirection.RightToLeft;return s.createElement("button",{className:g({"rpv-core__primary-button":!0,"rpv-core__primary-button--rtl":r}),type:"button",onClick:n},t)},_=function(e){var t=s.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return m((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;r({isVisible:t,ratio:n})}))}),{threshold:n||0}),o=t.current;if(o)return e.observe(o),function(){e.unobserve(o)}}),[]),t},y=function(e){var t=e.size,n=void 0===t?"4rem":t,r=s.useState(!1),o=r[0],a=r[1],i=_({onVisibilityChanged:function(e){a(e.isVisible)}});return s.createElement("div",{className:g({"rpv-core__spinner":!0,"rpv-core__spinner--animating":o}),ref:i,style:{height:n,width:n}})},w=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.autoFocus,o=void 0!==r&&r,a=e.placeholder,i=void 0===a?"":a,c=e.testId,l=e.type,p=void 0===l?"text":l,u=e.value,d=void 0===u?"":u,h=e.onChange,E=e.onKeyDown,x=void 0===E?function(){}:E,_=s.useContext(v).direction,y=s.useRef(),w=_===exports.TextDirection.RightToLeft,b={ref:y,"data-testid":"","aria-label":n,className:g({"rpv-core__textbox":!0,"rpv-core__textbox--rtl":w}),placeholder:i,value:d,onChange:function(e){return h(e.target.value)},onKeyDown:x};return c&&(b["data-testid"]=c),m((function(){if(o){var e=y.current;if(e){var t=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(t,n)}}}),[]),"text"===p?s.createElement("input",f({type:"text"},b)):s.createElement("input",f({type:"password"},b))},b=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};s.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener("click",r,t),function(){document.removeEventListener("click",r,t)}}}),[])},P=function(e){var t=function(t){"Escape"===t.key&&e()};s.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},T=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=s.useRef(),c=s.useContext(v).direction===exports.TextDirection.RightToLeft;return s.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),P((function(){i.current&&o&&a()})),b(r,i,a),m((function(){var e=i.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]),s.createElement("div",{"aria-modal":"true",className:g({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":c}),id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},R=function(e){var t=e.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},t)},L=function(e){var t=s.useState(e),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case exports.ToggleStatus.Close:r(!1);break;case exports.ToggleStatus.Open:r(!0);break;case exports.ToggleStatus.Toggle:default:r((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.isOpened,r=void 0!==n&&n,o=e.target,a=L(r),i=a.opened,c=a.toggle;return s.createElement(s.Fragment,null,o&&o(c,i),i&&t(c))},C=0,O=function(){return C++},S=function(e,t,n,r,o){m((function(){var a=t.current,i=e.current,c=n.current;if(i&&a&&c){var s=c.getBoundingClientRect(),l=function(e,t,n,r){var o=t.getBoundingClientRect(),a=e.getBoundingClientRect(),i=a.height,c=a.width,s=0,l=0;switch(n){case exports.Position.TopLeft:s=o.top-i,l=o.left;break;case exports.Position.TopCenter:s=o.top-i,l=o.left+o.width/2-c/2;break;case exports.Position.TopRight:s=o.top-i,l=o.left+o.width-c;break;case exports.Position.RightTop:s=o.top,l=o.left+o.width;break;case exports.Position.RightCenter:s=o.top+o.height/2-i/2,l=o.left+o.width;break;case exports.Position.RightBottom:s=o.top+o.height-i,l=o.left+o.width;break;case exports.Position.BottomLeft:s=o.top+o.height,l=o.left;break;case exports.Position.BottomCenter:s=o.top+o.height,l=o.left+o.width/2-c/2;break;case exports.Position.BottomRight:s=o.top+o.height,l=o.left+o.width-c;break;case exports.Position.LeftTop:s=o.top,l=o.left-c;break;case exports.Position.LeftCenter:s=o.top+o.height/2-i/2,l=o.left-c;break;case exports.Position.LeftBottom:s=o.top+o.height-i,l=o.left-c}return{left:l+(r.left||0),top:s+(r.top||0)}}(i,a,r,o),p=l.top,u=l.left;i.style.top=p-s.top+"px",i.style.left=u-s.left+"px"}}),[])},A=function(e){var t,n=e.customClassName,r=e.position;return s.createElement("div",{className:g((t={"rpv-core__arrow":!0,"rpv-core__arrow--tl":r===exports.Position.TopLeft,"rpv-core__arrow--tc":r===exports.Position.TopCenter,"rpv-core__arrow--tr":r===exports.Position.TopRight,"rpv-core__arrow--rt":r===exports.Position.RightTop,"rpv-core__arrow--rc":r===exports.Position.RightCenter,"rpv-core__arrow--rb":r===exports.Position.RightBottom,"rpv-core__arrow--bl":r===exports.Position.BottomLeft,"rpv-core__arrow--bc":r===exports.Position.BottomCenter,"rpv-core__arrow--br":r===exports.Position.BottomRight,"rpv-core__arrow--lt":r===exports.Position.LeftTop,"rpv-core__arrow--lc":r===exports.Position.LeftCenter,"rpv-core__arrow--lb":r===exports.Position.LeftBottom},t[""+n]=""!==n,t))})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.offset,a=e.position,i=e.targetRef,c=e.onClose,l=s.useRef(),p=s.useRef(),u=s.useRef(),d=s.useContext(v).direction===exports.TextDirection.RightToLeft;b(r,l,c),S(l,i,u,a,o),m((function(){var e=p.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight=t+"px")}}),[]);var f="rpv-core__popover-body-inner-"+t;return s.createElement(s.Fragment,null,s.createElement("div",{ref:u,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":f,className:g({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":d}),id:"rpv-core__popover-body-"+t,ref:l,role:"dialog",tabIndex:-1},s.createElement(A,{customClassName:"rpv-core__popover-body-arrow",position:a}),s.createElement("div",{id:f,ref:p},n)))},D=function(e){var t=e.closeOnEscape,n=e.onClose,r=s.useRef();return P((function(){r.current&&t&&n()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},N=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=s.useRef(),l=s.useContext(v).direction===exports.TextDirection.RightToLeft;return S(r,i,c,a,o),s.createElement(s.Fragment,null,s.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{className:g({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":l}),id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},s.createElement(A,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var H={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},I=s.createContext({l10n:H,setL10n:function(){}});function B(e){var t=s.useRef(e);return s.useEffect((function(){t.current=e}),[e]),t.current}var F;!function(e){e[e.Solid=1]="Solid",e[e.Dashed=2]="Dashed",e[e.Beveled=3]="Beveled",e[e.Inset=4]="Inset",e[e.Underline=5]="Underline"}(F||(F={}));var W,z=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),j=function(e,t,n,r){var o=parseInt(e,10);return o>=t&&o<=n?o:r},V=function(e){var t=e.annotation,n=s.useContext(v).direction===exports.TextDirection.RightToLeft,r=s.useRef(),o="";if(t.modificationDate){var a=function(e){var t=z.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=j(t[2],1,12,1)-1,o=j(t[3],1,31,1),a=j(t[4],0,23,0),i=j(t[5],0,59,0),c=j(t[6],0,59,0),s=t[7]||"Z",l=j(t[8],0,23,0),p=j(t[9],0,59,0);switch(s){case"-":a+=l,i+=p;break;case"+":a-=l,i-=p}return new Date(Date.UTC(n,r,o,a,i,c))}(t.modificationDate);o=a?a.toLocaleDateString()+", "+a.toLocaleTimeString():""}return s.useLayoutEffect((function(){if(r.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var n=e;return n.style.zIndex+=1,function(){n.style.zIndex=""+(parseInt(n.style.zIndex,10)-1)}}}}),[]),s.createElement("div",{ref:r,className:g({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":n}),style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&s.createElement(s.Fragment,null,s.createElement("div",{className:g({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!n,"rpv-core__annotation-popup-title--rtl":n})},t.title),s.createElement("div",{className:"rpv-core__annotation-popup-date"},o)),t.contents&&s.createElement("div",{className:"rpv-core__annotation-popup-content"},t.contents.split("\n").map((function(e,t){return s.createElement(s.Fragment,{key:t},e,s.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(W||(W={}));var q,Z=function(e){var t,n=e.annotation,r=e.children,o=e.ignoreBorder,a=e.hasPopup,i=e.isRenderable,c=e.page,l=e.viewport,p=n.rect,u=function(){var e=L(!1),t=e.opened,n=e.toggle,r=s.useState(W.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===W.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case W.Click:t&&a(W.Hover),n(exports.ToggleStatus.Toggle);break;case W.Hover:a(W.Click),n(exports.ToggleStatus.Open)}}}}(),d=u.closeOnHover,f=u.opened,v=u.openOnHover,g=u.toggleOnClick,m=(t=[p[0],c.view[3]+c.view[1]-p[1],p[2],c.view[3]+c.view[1]-p[3]],[Math.min(t[0],t[2]),Math.min(t[1],t[3]),Math.max(t[0],t[2]),Math.max(t[1],t[3])]),h=p[2]-p[0],E=p[3]-p[1],x={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case F.Dashed:x.borderStyle="dashed";break;case F.Solid:x.borderStyle="solid";break;case F.Underline:x=Object.assign({borderBottomStyle:"solid"},x);case F.Beveled:case F.Inset:}var _=n.borderStyle.width;x.borderWidth=_+"px",n.borderStyle.style!==F.Underline&&(h-=2*_,E-=2*_);var y=n.borderStyle,w=y.horizontalCornerRadius,b=y.verticalCornerRadius;(w>0||b>0)&&(x.borderRadius=w+"px / "+b+"px"),n.color?x.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":x.borderWidth="0"}return s.createElement(s.Fragment,null,i&&r({popup:{opened:f,closeOnHover:d,openOnHover:v,toggleOnClick:g},slot:{attrs:{style:Object.assign({height:E+"px",left:m[0]+"px",top:m[1]+"px",transform:"matrix("+l.transform.join(",")+")",transformOrigin:"-"+m[0]+"px -"+m[1]+"px",width:h+"px"},x)},children:s.createElement(s.Fragment,null,a&&f&&s.createElement(V,{annotation:n}))}}))},U=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},G=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("circle",{cy:l/2,fill:"none",rx:c/2-p/2,ry:l/2-p/2,stroke:"transparent",strokeWidth:p||1})),e.slot.children)}))},J=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!1!==t.hasPopup||!t.title&&!t.contents),a=function(){var e,n,r,o,a=t.file;a&&(e=a.filename,n=a.content,r="string"==typeof n?"":URL.createObjectURL(new Blob([n],{type:""})),(o=document.createElement("a")).style.display="none",o.href=r||e,o.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(o),o.click(),document.body.removeChild(o),r&&URL.revokeObjectURL(r))};return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:a,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},K=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Q=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!(!t.title&&!t.contents),a=!t.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(t.parentType);return m((function(){if(t.parentId){var e=document.querySelector('[data-annotation-id="'+t.parentId+'"]'),n=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e&&n){var r=parseFloat(e.style.left),o=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left=r+"px",n.style.top=o+"px",n.style.transformOrigin="-"+r+"px -"+o+"px"}}}),[]),s.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:o,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),s.createElement(V,{annotation:t}))}))},X=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents);if(t.quadPoints&&t.quadPoints.length>0){var c=t.quadPoints.map((function(e){return Object.assign({},t,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return s.createElement(s.Fragment,null,c.map((function(e,t){return s.createElement(X,{key:t,annotation:e,childAnnotation:n,page:r,viewport:o})})))}return s.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:i,page:r,viewport:o},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--highlight","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&s.createElement(Q,{annotation:n,page:r,viewport:o}))}))},Y=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},t.inkLists.map((function(e,t){return s.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:p||1,points:e.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})}))),e.slot.children)}))},$=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("line",{stroke:"transparent",strokeWidth:p||1,x1:i[2]-t.lineCoordinates[0],x2:i[2]-t.lineCoordinates[2],y1:i[3]-t.lineCoordinates[1],y2:i[3]-t.lineCoordinates[3]})),e.slot.children)}))},ee=function(e,t){return new Promise((function(n){new Promise((function(n){"string"==typeof t?e.getDestination(t).then((function(e){n(e)})):n(t)})).then((function(t){return"object"==typeof t[0]?e.getPageIndex(t[0]).then((function(e){return Promise.resolve({pageIndex:e,destArray:t})})):Promise.resolve({pageIndex:t[0],destArray:t})})).then((function(e){var t=function(e,t){switch(t[1].name){case"XYZ":return{bottomOffset:t[3],pageIndex:e-1,scaleTo:t[4]};case"Fit":case"FitB":return{bottomOffset:0,pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:exports.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},te=function(e){var t=e.annotation,n=e.doc,r=e.page,o=e.viewport,a=e.onExecuteNamedAction,i=e.onJumpToDest,c=!!(t.url||t.dest||t.action),l=t.url?{href:t.url,rel:"noopener noreferrer nofollow",target:t.newWindow?"_blank":"",title:t.url}:{href:"","data-annotation-link-dest":t.dest,onClick:function(e){e.preventDefault(),t.action?a(t.action):ee(n,t.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;i(n?t+1:t,n,0,r)}))}};return s.createElement(Z,{annotation:t,hasPopup:!1,ignoreBorder:!1,isRenderable:c,page:r,viewport:o},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),s.createElement("a",f({},l)))}))},ne=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},re=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:p||1,points:t.vertices.map((function(e){return e.x-i[0]+","+(i[3]-e.y)})).join(" ")})),e.slot.children)}))},oe=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents),i=t.rect,c=i[2]-i[0],l=i[3]-i[1],p=t.borderStyle.width;return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:l+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+c+" "+l,width:c+"px"},s.createElement("rect",{height:l-p,fill:"none",stroke:"transparent",strokeWidth:p||1,x:p/2,y:p/2,width:c-p})),e.slot.children)}))},ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ie=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},ce=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},se=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),s.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),s.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),s.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},le=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),s.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),s.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),s.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),s.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),s.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),s.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),s.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),s.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),s.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},pe=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),s.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},ue=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),s.createElement("path",{d:"M6 4.5L6 0.5"}),s.createElement("path",{d:"M18 4.5L18 0.5"}),s.createElement("path",{d:"M10 4.5L10 0.5"}),s.createElement("path",{d:"M14 4.5L14 0.5"}))},de=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),s.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),s.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},fe=function(){return s.createElement(h,{size:16},s.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},ve=function(e){var t=e.annotation,n=e.childAnnotation,r=e.page,o=e.viewport,a=!1===t.hasPopup,i=!!(t.hasPopup||t.title||t.contents),c=t.name?t.name.toLowerCase():"";return s.createElement(Z,{annotation:t,hasPopup:a,ignoreBorder:!1,isRenderable:i,page:r,viewport:o},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),c&&s.createElement("div",{className:"rpv-core__annotation-text-icon"},"check"===c&&s.createElement(E,null),"comment"===c&&s.createElement(se,null),"help"===c&&s.createElement(le,null),"insert"===c&&s.createElement(fe,null),"key"===c&&s.createElement(pe,null),"note"===c&&s.createElement(ue,null),("newparagraph"===c||"paragraph"===c)&&s.createElement(de,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&s.createElement(Q,{annotation:n,page:r,viewport:o}))}))},ge=function(e){var t=e.annotation,n=e.page,r=e.viewport,o=!1===t.hasPopup,a=!!(t.hasPopup||t.title||t.contents);return s.createElement(Z,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:a,page:n,viewport:r},(function(e){return s.createElement("div",f({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},me=function(e){var t=e.annotations,n=e.containerRef,r=e.doc,o=e.page,a=e.pageIndex,i=e.plugins,c=e.rotation,l=e.scale,p=e.onExecuteNamedAction,u=e.onJumpToDest,d=o.getViewport({rotation:c,scale:l}).clone({dontFlip:!0}),f=t.filter((function(e){return!e.parentId}));return s.useEffect((function(){var e=n.current;e&&i.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:f,container:e,pageIndex:a,rotation:c,scale:l})}))}),[]),s.createElement(s.Fragment,null,f.map((function(e){var n=t.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case exports.AnnotationType.Caret:return s.createElement(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return s.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return s.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return s.createElement(K,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Highlight:return s.createElement(X,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return s.createElement(Y,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Line:return s.createElement($,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return s.createElement(te,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return s.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return s.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return s.createElement(Q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return s.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return s.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return s.createElement(ie,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return s.createElement(ce,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return s.createElement(ve,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return s.createElement(ge,{key:e.id,annotation:e,page:o,viewport:d});default:return s.createElement(s.Fragment,{key:e.id})}})))},he=function(e){var t=e.page,n=e.renderAnnotations,r=s.useState({loading:!0,annotations:[]}),o=r[0],a=r[1];return s.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){a({loading:!1,annotations:e})}))}),[]),o.loading?s.createElement(s.Fragment,null):n(o.annotations)},Ee=function(e){var t=e.doc,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.onExecuteNamedAction,l=e.onJumpToDest,p=s.useRef();return s.createElement("div",{ref:p,className:"rpv-core__annotation-layer"},s.createElement(he,{page:n,renderAnnotations:function(e){return s.createElement(me,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:l})}}))},xe=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return m((function(){t()}),[r,o]),s.createElement(s.Fragment,null,n)},_e=function(e){var t=e.height,n=e.page,r=e.pageIndex,o=e.plugins,a=e.rotation,i=e.scale,c=e.width,l=s.useRef(),p=s.useRef(),u=s.useState(!1),d=u[0],f=u[1],v=window.devicePixelRatio||1;return s.createElement(xe,{callback:function(){f(!1);var e=p.current;e&&e.cancel();var s=l.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:s,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.PreRender})})),s.height=t*v,s.width=c*v,s.style.opacity="0";var u=s.getContext("2d",{alpha:!1}),d=n.getViewport({rotation:a,scale:i*v});p.current=n.render({canvasContext:u,viewport:d}),p.current.promise.then((function(){f(!0),s.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:s,pageIndex:r,rotation:a,scale:i,status:exports.LayerRenderStatus.DidRender})}))}),(function(){f(!0)}))},rotation:a,scale:i},s.createElement("div",{className:"rpv-core__canvas-layer",style:{height:t+"px",width:c+"px"}},!d&&s.createElement("div",{className:"rpv-core__canvas-layer-loader"},s.createElement(y,null)),s.createElement("canvas",{ref:l,style:{transform:"scale("+1/v+")",transformOrigin:"top left"}})))},ye=function(e){var t=e.height,n=e.page,r=e.rotation,o=e.scale,a=e.width,i=s.useRef();return s.createElement(xe,{callback:function(){var e=i.current,c=n.getViewport({rotation:r,scale:o});n.getOperatorList().then((function(r){!function(){var e=i.current;e&&(e.innerHTML="")}(),new l.SVGGraphics(n.commonObjs,n.objs).getSVG(r,c).then((function(n){n.style.height=t+"px",n.style.width=a+"px",e.appendChild(n)}))}))},rotation:r,scale:o},s.createElement("div",{className:"rpv-core__svg-layer",ref:i}))},we=function(e){var t=e.page,n=e.pageIndex,r=e.plugins,o=e.rotation,a=e.scale,i=s.useRef(),c=s.useRef();return s.createElement(xe,{callback:function(){var e=c.current;e&&e.cancel();var s=i.current;if(s){var p=t.getViewport({rotation:o,scale:a});r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.PreRender})})),t.getTextContent().then((function(e){!function(){var e=i.current;e&&([].slice.call(e.querySelectorAll("span.rpv-core__text-layer-text")).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll('br[role="presentation"]')).forEach((function(t){return e.removeChild(t)})))}(),c.current=l.renderTextLayer({container:s,textContent:e,viewport:p,enhanceTextSelection:!0}),c.current.promise.then((function(){[].slice.call(s.children).forEach((function(e){return e.classList.add("rpv-core__text-layer-text")})),r.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:n,scale:a,status:exports.LayerRenderStatus.DidRender})}))}),(function(){}))}))}},rotation:o,scale:a},s.createElement("div",{className:"rpv-core__text-layer",ref:i}))},be=function(e){var t=e.currentPage,n=e.doc,r=e.height,o=e.pageIndex,a=e.plugins,i=e.renderPage,c=e.rotation,l=e.scale,p=e.width,u=e.onExecuteNamedAction,d=e.onJumpToDest,f=e.onPageVisibilityChanged,v=s.useState({page:null,pageHeight:r,pageWidth:p,viewportRotation:0}),g=v[0],m=v[1],h=g.page,E=g.pageHeight,x=g.pageWidth,w=s.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),P=x*l,T=E*l,R=Math.abs(c)%180==0,L=R?P:T,k=R?T:P,C=function(){w.current||(w.current=!0,n.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});m({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},O=i||function(e){return s.createElement(s.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)},S=(c+g.viewportRotation)%360,A=_({threshold:b,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&C()}});return s.useEffect((function(){t-2<=o&&o<=t+2&&C()}),[t]),s.createElement("div",{ref:A,className:"rpv-core__page-layer","data-testid":"core__page-layer-"+o,style:{height:k+"px",width:L+"px"}},h?s.createElement(s.Fragment,null,O({annotationLayer:{attrs:{},children:s.createElement(Ee,{doc:n,page:h,pageIndex:o,plugins:a,rotation:S,scale:l,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:s.createElement(_e,{height:k,page:h,pageIndex:o,plugins:a,rotation:S,scale:l,width:L})},doc:n,height:k,pageIndex:o,rotation:c,scale:l,svgLayer:{attrs:{},children:s.createElement(ye,{height:k,page:h,rotation:S,scale:l,width:L})},textLayer:{attrs:{},children:s.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:S,scale:l})},width:L}),a.map((function(e,t){return e.renderPageLayer?s.createElement(s.Fragment,{key:t},e.renderPageLayer({doc:n,height:k,pageIndex:o,rotation:c,scale:l,width:L})):s.createElement(s.Fragment,{key:t})}))):s.createElement(y,null))},Pe=function(e,t,n,r){switch(r){case exports.SpecialZoomLevel.ActualSize:return 1;case exports.SpecialZoomLevel.PageFit:return Math.min((e.clientWidth-17)/n,(e.clientHeight-16)/t);case exports.SpecialZoomLevel.PageWidth:return(e.clientWidth-17)/n}},Te=function(e){var t=e.currentFile,n=e.defaultScale,r=e.doc,o=e.initialPage,a=e.pageSize,i=e.plugins,c=e.renderPage,l=e.viewerState,p=e.onDocumentLoad,u=e.onOpenFile,d=e.onPageChange,g=e.onZoom,h=s.useContext(I).l10n,E=s.useContext(v),x=s.useRef(null),_=s.useRef(null),y=s.useState(0),w=y[0],b=y[1],P=s.useState(0),T=P[0],R=P[1],L=s.useRef(l),k=s.useState(a.scale),C=k[0],O=k[1],S=s.useRef("string"==typeof n?n:null);!function(e){var t=e.targetRef,n=e.onResize;m((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])}({targetRef:_,onResize:function(e){S.current&&G(S.current)}});var A=r.numPages,M=a.pageWidth,D=a.pageHeight,N=Array(A).fill(null),H=N.map((function(){return 0})),B=N.map((function(){return s.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),L.current=t},W=function(){return _.current},z=function(e){return e<0||e>=A?null:B[e].current},j=function(){return L.current},V=function(e,t,n,o){var a=_.current,i=L.current;if(a&&i){var c=e+1;r.getPage(c).then((function(r){var c=r.getViewport({scale:1}),s=0,l=t||0,p=n||0,u=i.scale;switch(o){case exports.SpecialZoomLevel.PageFit:s=0,p=0,G(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=Pe(a,D,M,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,G(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=B[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},q=function(e){if(!(e<0||e>=A)){var t=_.current,n=B[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),b(e)}},Z=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){u(e.name,t)}))},U=function(e){R(e),F({file:l.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:e,scale:C})},G=function(e){var t=_.current,n=t?"string"==typeof e?Pe(t,D,M,e):e:1;S.current="string"==typeof e?e:null,O(n),g({doc:r,scale:n})};s.useEffect((function(){var e=_.current,t=L.current;e&&t&&(e.scrollTop=e.scrollTop*C/t.scale,e.scrollLeft=e.scrollLeft*C/t.scale,F({file:l.file,pageIndex:t.pageIndex,pageHeight:D,pageWidth:M,rotation:T,scale:C}))}),[C]);s.useEffect((function(){var e={getPageElement:z,getPagesContainer:W,getViewerState:j,jumpToDestination:V,jumpToPage:q,openFile:Z,rotate:U,setViewerState:F,zoom:G};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),s.useEffect((function(){p({doc:r,file:t}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r,file:t})})),o&&q(o)}),[]),s.useEffect((function(){d({currentPage:w,doc:r}),F({file:l.file,pageIndex:w,pageHeight:D,pageWidth:M,rotation:T,scale:C})}),[w]);var J,K=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);b(n)},Q=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":q(0);break;case"LastPage":q(A-1);break;case"NextPage":n<A&&q(n);break;case"PrevPage":t>=0&&q(t)}},X=h&&h.core?h.core.pageLabel:"Page {{pageIndex}}",Y=function(e){return s.createElement("div",f({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&Y(e.subSlot))};return Y((J={attrs:{"data-testid":"core__inner-container",ref:x,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",ref:_,style:{height:"100%",overflow:"auto",position:"relative"}},children:s.createElement(s.Fragment,null,Array(A).fill(0).map((function(e,t){return s.createElement("div",{"aria-label":X.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){B[t].current=e},role:"region"},s.createElement(be,{currentPage:w,doc:r,height:D,pageIndex:t,plugins:i,renderPage:c,rotation:T,scale:C,width:M,onExecuteNamedAction:Q,onJumpToDest:V,onPageVisibilityChanged:K}))})))}},i.forEach((function(e){e.renderViewer&&(J=e.renderViewer({containerRef:x,doc:r,pageHeight:D,pageWidth:M,rotation:T,slot:J,themeContext:E,jumpToPage:q,openFile:Z,rotate:U,zoom:G}))})),J))},Re=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.1,1.3,1.5,1.7,1.9,2.1,2.4,2.7,3,3.3,3.7,4.1,4.6,5.1,5.7,6.3,7,7.7,8.5,9.4,10],Le=function(e){var t=e.defaultScale,n=e.doc,r=e.render,o=s.useRef(null),a=s.useState({pageHeight:0,pageWidth:0,scale:1}),i=a[0],c=a[1];return s.useEffect((function(){n.getPage(1).then((function(e){var n=e.getViewport({scale:1}),r=n.width,a=n.height,i=o.current;if(i){var s,l,p=i.parentElement,u=p.clientWidth/r,d=t?"string"==typeof t?Pe(p,a,r,t):t:(s=u,-1===(l=Re.findIndex((function(e){return e>=s})))||0===l?s:Re[l-1]);c({pageHeight:a,pageWidth:r,scale:d})}}))}),[n]),0===i.pageWidth?s.createElement("div",{className:"rpv-core__page-size-calculator",ref:o},s.createElement(y,null)):r(i)},ke=function(){var e=s.useRef(!1);return s.useEffect((function(){return e.current=!0,function(){e.current=!1}}),[]),e},Ce=function(){};!function(e){e[e.REQUIRE_PASSWORD=0]="REQUIRE_PASSWORD",e[e.WRONG_PASSWORD=1]="WRONG_PASSWORD"}(q||(q={}));var Oe=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.submitPassword=n,r}return u(t,e),t}(Ce),Se=function(e){var t=e.submitPassword,n=e.verifyPassword,r=e.onDocumentAskPassword,o=s.useContext(I).l10n,a=s.useState(""),i=a[0],c=a[1],l=s.useContext(v).direction===exports.TextDirection.RightToLeft,p=function(){return n(i)};return s.useEffect((function(){r&&r({verifyPassword:n})}),[]),s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:g({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":l})},s.createElement("div",{className:"rpv-core__asking-password-message"},t===q.REQUIRE_PASSWORD&&o.core.askingPassword.requirePasswordToOpen,t===q.WRONG_PASSWORD&&o.core.wrongPassword.tryAgain),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:g({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!l,"rpv-core__asking-password-input--rtl":l})},s.createElement(w,{testId:"core__asking-password-input",type:"password",value:i,onChange:c,onKeyDown:function(e){"Enter"===e.key&&p()}})),s.createElement(x,{onClick:p},o.core.askingPassword.submit))))},Ae=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return u(t,e),t}(Ce),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return u(t,e),t}(Ce),De=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return u(t,e),t}(Ce),Ne=function(e){var t=e.characterMap,n=e.file,r=e.httpHeaders,o=e.render,a=e.renderError,i=e.renderLoader,c=e.transformGetDocumentParams,p=e.withCredentials,u=e.onDocumentAskPassword,d=s.useContext(v).direction===exports.TextDirection.RightToLeft,f=s.useState(new De(0)),m=f[0],h=f[1],E=s.useState(0),x=E[0],_=E[1],w=s.useState(null),b=w[0],P=w[1],T=ke();return s.useEffect((function(){h(new De(0));var e=new l.PDFWorker({name:"PDFWorker_"+Date.now()}),o=Object.assign({httpHeaders:r,withCredentials:p,worker:e},"string"==typeof n?{url:n}:{data:n},t?{cMapUrl:t.url,cMapPacked:t.isCompressed}:{}),a=c?c(o):o,i=l.getDocument(a);return i.onPassword=function(e,t){switch(t){case l.PasswordResponses.NEED_PASSWORD:T.current&&h(new Oe(e,q.REQUIRE_PASSWORD));break;case l.PasswordResponses.INCORRECT_PASSWORD:T.current&&h(new Oe(e,q.WRONG_PASSWORD))}},i.onProgress=function(e){e.total>0?T.current&&_(Math.min(100,100*e.loaded/e.total)):T.current&&_(100)},i.promise.then((function(e){return T.current&&P(e)}),(function(t){return T.current&&!e.destroyed&&h(new Me({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[n]),s.useEffect((function(){100===x&&b?T.current&&h(new Ae(b)):T.current&&h(new De(x))}),[x,b]),m instanceof Oe?s.createElement(Se,{submitPassword:m.submitPassword,verifyPassword:m.verifyPassword,onDocumentAskPassword:u}):m instanceof Ae?o(m.doc):m instanceof Me?a?a(m.error):s.createElement("div",{className:g({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":d})},s.createElement("div",{className:"rpv-core__doc-error-text"},m.error.message)):m instanceof De?s.createElement("div",{"data-testid":"core__doc-loading",className:g({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":d})},i?i(m.percentages):s.createElement(y,null)):s.createElement("div",{className:"rpv-core__doc-loading","data-testid":"core__doc-loading"},s.createElement(y,null))},He=function(e,t){var n=s.useMemo((function(){return"auto"===e?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}),[]),r=s.useState(n),o=r[0],a=r[1],i=B(o);return s.useEffect((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){a(e.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}}),[]),s.useEffect((function(){o!==i&&t&&t(o)}),[o]),s.useEffect((function(){e!==o&&a(e)}),[e]),{currentTheme:o,setCurrentTheme:a}};exports.Button=function(e){var t=e.children,n=e.testId,r=e.onClick,o=s.useContext(v).direction===exports.TextDirection.RightToLeft,a=n?{"data-testid":n}:{};return s.createElement("button",f({className:g({"rpv-core__button":!0,"rpv-core__button--rtl":o}),type:"button",onClick:r},a),t)},exports.Icon=h,exports.LocalizationContext=I,exports.Menu=function(e){var t=e.children,n=s.useRef(),r=s.useRef([]),o=s.useContext(v).direction===exports.TextDirection.RightToLeft,a=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),i((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),i((function(e,t){return t-1}));break;case"End":e.preventDefault(),i((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),i((function(e,t){return 0}))}},i=function(e){if(n.current){var t=r.current,o=t.findIndex((function(e){return"0"===e.getAttribute("tabindex")})),a=Math.min(t.length-1,Math.max(0,e(t,o)));o>=0&&o<=t.length-1&&t[o].setAttribute("tabindex","-1"),t[a].setAttribute("tabindex","0"),t[a].focus()}};return m((function(){var e=n.current;if(e){var t=function(e){var t=[];return e.querySelectorAll('.rpv-core__menu-item[role="menuitem"]').forEach((function(n){if(n instanceof HTMLElement){var r=n.parentElement;(r===e||"none"!==window.getComputedStyle(r).display)&&t.push(n)}})),t}(e);r.current=t}}),[]),m((function(){return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}}),[]),s.createElement("div",{ref:n,"aria-orientation":"vertical",className:g({"rpv-core__menu":!0,"rpv-core__menu--rtl":o}),role:"menu",tabIndex:0},t)},exports.MenuDivider=function(){return s.createElement("div",{"aria-orientation":"horizontal",className:"rpv-core__menu-divider",role:"separator"})},exports.MenuItem=function(e){var t=e.checked,n=void 0!==t&&t,r=e.children,o=e.icon,a=void 0===o?null:o,i=e.isDisabled,c=void 0!==i&&i,l=e.onClick,p=s.useContext(v).direction===exports.TextDirection.RightToLeft;return s.createElement("button",{className:g({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c,"rpv-core__menu-item--ltr":!p,"rpv-core__menu-item--rtl":p}),role:"menuitem",tabIndex:-1,type:"button",onClick:l},s.createElement("div",{className:g({"rpv-core__menu-item-icon":!0,"rpv-core__menu-item-icon--ltr":!p,"rpv-core__menu-item-icon--rtl":p})},a),s.createElement("div",{className:g({"rpv-core__menu-item-label":!0,"rpv-core__menu-item-label--ltr":!p,"rpv-core__menu-item-label--rtl":p})},r),s.createElement("div",{className:g({"rpv-core__menu-item-check":!0,"rpv-core__menu-item-check--ltr":!p,"rpv-core__menu-item-check--rtl":p})},n&&s.createElement(E,null)))},exports.MinimalButton=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.ariaKeyShortcuts,o=void 0===r?"":r,a=e.children,i=e.isDisabled,c=void 0!==i&&i,l=e.isSelected,p=void 0!==l&&l,u=e.onClick,d=s.useContext(v).direction===exports.TextDirection.RightToLeft;return s.createElement("button",f({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:g({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"rpv-core__minimal-button--rtl":d,"rpv-core__minimal-button--selected":p}),type:"button",onClick:u}),a)},exports.Modal=function(e){var t=e.ariaControlsSuffix,n=e.closeOnClickOutside,r=e.closeOnEscape,o=e.content,a=e.isOpened,i=void 0!==a&&a,c=e.target,l=t||""+O();return s.createElement(k,{target:c?function(e,t){return s.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+l},c(e,t))}:null,content:function(e){return s.createElement(R,null,s.createElement(T,{ariaControlsSuffix:l,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))},isOpened:i})},exports.Popover=function(e){var t=e.ariaHasPopup,n=void 0===t?"dialog":t,r=e.ariaControlsSuffix,o=e.closeOnClickOutside,a=e.closeOnEscape,i=e.content,c=e.offset,l=e.position,p=e.target,u=L(!1),d=u.opened,f=u.toggle,v=s.useRef(),g=r||""+O();return s.createElement("div",{ref:v,"aria-expanded":d?"true":"false","aria-haspopup":n,"aria-controls":"rpv-core__popver-body-"+g},p(f,d),d&&s.createElement(s.Fragment,null,s.createElement(D,{closeOnEscape:a,onClose:f}),s.createElement(M,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:l,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=x,exports.ProgressBar=function(e){var t=e.progress,n=s.useContext(v).direction===exports.TextDirection.RightToLeft;return s.createElement("div",{className:g({"rpv-core__progress-bar":!0,"rpv-core__progress-bar--rtl":n})},s.createElement("div",{className:"rpv-core__progress-bar-progress",style:{width:t+"%"}},t,"%"))},exports.Separator=function(){return s.createElement("div",{className:"rpv-core__separator"})},exports.Spinner=y,exports.Splitter=function(e){var t=e.constrain,n=s.useContext(v).direction===exports.TextDirection.RightToLeft,r=s.useRef(),o=s.useRef(),a=s.useRef(),i=s.useRef(0),c=s.useRef(0),l=s.useRef(0),p=s.useRef(0),u={capture:!0},d=function(e){var c=r.current,s=o.current,u=a.current;if(c&&s&&u){var d=p.current,f=e.clientX-i.current,v=l.current+(n?-f:f),g=c.parentElement.getBoundingClientRect().width,m=100*v/g;if(c.classList.add("rpv-core__splitter--resizing"),t){var h=g-v-d;if(!t({firstHalfPercentage:m,firstHalfSize:v,secondHalfPercentage:100*h/g,secondHalfSize:h}))return}s.style.width=m+"%",document.body.classList.add("rpv-core__splitter-body--resizing"),s.classList.add("rpv-core__splitter-sibling--resizing"),u.classList.add("rpv-core__splitter-sibling--resizing")}},f=function(e){var t=r.current,n=o.current,i=a.current;t&&n&&i&&(document.body.classList.remove("rpv-core__splitter-body--resizing"),t.classList.remove("rpv-core__splitter--resizing"),n.classList.remove("rpv-core__splitter-sibling--resizing"),i.classList.remove("rpv-core__splitter-sibling--resizing"),document.removeEventListener("mousemove",d,u),document.removeEventListener("mouseup",f,u))};return s.useEffect((function(){var e=r.current;e&&(p.current=e.getBoundingClientRect().width,o.current=e.previousElementSibling,a.current=e.nextElementSibling)}),[]),s.createElement("div",{ref:r,className:"rpv-core__splitter",onMouseDown:function(e){var t=o.current;t&&(i.current=e.clientX,c.current=e.clientY,l.current=t.getBoundingClientRect().width,document.addEventListener("mousemove",d,u),document.addEventListener("mouseup",f,u))}})},exports.TextBox=w,exports.ThemeContext=v,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=L(!1),c=i.opened,l=i.toggle,p=s.useRef(),u=s.useRef(),d=t||""+O();P((function(){p.current&&document.activeElement&&p.current.contains(document.activeElement)&&v()}));var f=function(){l(exports.ToggleStatus.Open)},v=function(){l(exports.ToggleStatus.Close)};return s.createElement(s.Fragment,null,s.createElement("div",{ref:p,"aria-describedby":"rpv-core__tooltip-body-"+d,onBlur:function(e){e.relatedTarget instanceof HTMLElement&&e.currentTarget.parentElement&&e.currentTarget.parentElement.contains(e.relatedTarget)?u.current&&(u.current.style.display="none"):v()},onFocus:f,onMouseEnter:f,onMouseLeave:v},a),c&&s.createElement(N,{ariaControlsSuffix:d,contentRef:u,offset:r,position:o,targetRef:p},n()))},exports.Viewer=function(e){var t=e.characterMap,n=e.defaultScale,r=e.fileUrl,o=e.httpHeaders,a=void 0===o?{}:o,i=e.initialPage,c=void 0===i?0:i,l=e.localization,p=e.plugins,u=void 0===p?[]:p,d=e.renderError,f=e.renderPage,g=e.renderLoader,m=e.transformGetDocumentParams,h=e.theme,E=void 0===h?{direction:exports.TextDirection.LeftToRight,theme:"light"}:h,x=e.withCredentials,y=void 0!==x&&x,w=e.onDocumentAskPassword,b=e.onDocumentLoad,P=void 0===b?function(){}:b,T=e.onPageChange,R=void 0===T?function(){}:T,L=e.onSwitchTheme,k=void 0===L?function(){}:L,C=e.onZoom,O=void 0===C?function(){}:C,S=s.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),A=S[0],M=S[1],D=function(e,t){M({data:t,name:e,shouldLoad:!0})},N=s.useState(!1),F=N[0],W=N[1],z=B(A);s.useEffect((function(){var e,t,n,o;e=z.data,o=typeof(t=r),"string"===(n=typeof e)&&"string"===o&&e===t||"object"===n&&"object"===o&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||M({data:r,name:"string"==typeof r?r:"",shouldLoad:F})}),[r,F]);var j=_({onVisibilityChanged:function(e){W(e.isVisible),e.isVisible&&M((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),V="string"==typeof E?{direction:exports.TextDirection.LeftToRight,theme:E}:E,q=s.useState(l||H),Z=q[0],U=q[1],G={l10n:Z,setL10n:U},J=Object.assign({},{direction:V.direction},He(V.theme||"light",k));return s.useEffect((function(){l&&U(l)}),[l]),s.createElement(I.Provider,{value:G},s.createElement(v.Provider,{value:J},s.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+J.currentTheme,"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},A.shouldLoad&&s.createElement(Ne,{characterMap:t,file:A.data,httpHeaders:a,render:function(e){return s.createElement(Le,{defaultScale:n,doc:e,render:function(t){return s.createElement(Te,{currentFile:{data:A.data,name:A.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:u,renderPage:f,viewerState:{file:A,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:P,onOpenFile:D,onPageChange:R,onZoom:O})}})},renderError:d,renderLoader:g,transformGetDocumentParams:m,withCredentials:y,onDocumentAskPassword:w}))))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return l.GlobalWorkerOptions.workerSrc=n,s.createElement(s.Fragment,null,t)},exports.classNames=g,exports.createStore=function(e){var t=e||{},n={};return{subscribe:function(e,t){n[e]=(n[e]||[]).concat(t)},unsubscribe:function(e,t){n[e]=(n[e]||[]).filter((function(e){return e!==t}))},update:function(e,r){var o;t=f(f({},t),((o={})[e]=r,o)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=ee,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=_,exports.useIsMounted=ke,exports.useIsomorphicLayoutEffect=m;

@@ -199,2 +199,3 @@ /**

export interface ButtonProps {
testId?: string;
onClick(): void;

@@ -474,2 +475,3 @@ }

getAttachments(): Promise<{ [filename: string]: Attachment }>;
getData(): Promise<Uint8Array>;
getDestination(dest: string): Promise<OutlineDestination>;

@@ -476,0 +478,0 @@ getDownloadInfo(): Promise<{ length: number }>;

4

package.json
{
"name": "@react-pdf-viewer/core",
"version": "2.10.1",
"version": "2.11.0",
"description": "A React component to view a PDF document",

@@ -50,3 +50,3 @@ "license": "https://react-pdf-viewer.dev/license",

},
"gitHead": "1a83b6bdf2c509cccfca2c53cb946c4dd9ebffc7"
"gitHead": "5e4074055f48210e89c1fdf5b1cc53d78d56be44"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc