@react-pdf-viewer/core
Advanced tools
Comparing version 2.7.1 to 2.7.2
@@ -1,1 +0,1 @@ | ||
"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";var p="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,u=function(e){var t=e.children,n=e.size,r=((void 0===n?24:n)||24)+"px";return s.createElement("svg",{"aria-hidden":"true",className:"rpv-core__icon",focusable:"false",height:r,viewBox:"0 0 24 24",width:r},t)},d=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},f=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},v=function(e,t){return(v=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])})(e,t)};function g(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var m=function(){return(m=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}).apply(this,arguments)},h=function(e){var t=e.children,n=e.onClick;return s.createElement("button",{className:"rpv-core__primary-button",type:"button",onClick:n},t)},E=function(e){var t=e.size,n=void 0===t?"4rem":t;return s.createElement("div",{className:"rpv-core__spinner",style:{height:n,width:n}})},y=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.placeholder,o=void 0===r?"":r,a=e.type,i=void 0===a?"text":a,c=e.value,l=void 0===c?"":c,p=e.onChange,u=e.onKeyDown,d=void 0===u?function(){}:u;return s.createElement("input",{"aria-label":n,className:"rpv-core__textbox",placeholder:o,type:i,value:l,onChange:function(e){return p(e.target.value)},onKeyDown:d})},x=function(e,t,n){var r=function(e){var r=t.current;r&&!r.contains(e.target)&&n()};s.useEffect((function(){if(e)return document.addEventListener("click",r),function(){document.removeEventListener("click",r)}}),[])},w=function(e){var t=function(t){"Escape"===t.key&&e()};s.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},_=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=s.useRef();return s.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),w((function(){i.current&&o&&a()})),x(r,i,a),p((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:"rpv-core__modal-body",id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},b=function(e){var t=e.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},t)},P=function(){var e=s.useState(!1),t=e[0],n=e[1];return{opened:t,toggle:function(e){switch(e){case exports.ToggleStatus.Close:n(!1);break;case exports.ToggleStatus.Open:n(!0);break;case exports.ToggleStatus.Toggle:default:n((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.target,r=P(),o=r.opened,a=r.toggle;return s.createElement(s.Fragment,null,n(a,o),o&&t(a))},C=0,L=function(){return C++},T=function(e,t,n,r,o){p((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"}}),[])},O=function(e){var t,n=e.customClassName,r=e.position;return s.createElement("div",{className:f((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))})},S=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(),u=s.useRef(),d=s.useRef();x(r,l,c),T(l,i,d,a,o),p((function(){var e=u.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:d,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":f,className:"rpv-core__popover-body",id:"rpv-core__popover-body-"+t,ref:l,role:"dialog",tabIndex:-1},s.createElement(O,{customClassName:"rpv-core__popover-body-arrow",position:a}),s.createElement("div",{id:f,ref:u},n)))},R=function(e){var t=e.closeOnEscape,n=e.onClose,r=s.useRef();return w((function(){r.current&&t&&n()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=s.useRef();return T(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:"rpv-core__tooltip-body",id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},s.createElement(O,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var N=s.createContext({}),A={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},H=function(e){var t=e.children,n=e.localization,r=A,o=s.useState(n||r),a=o[0],i=o[1];return s.createElement(N.Provider,{value:a},t((function(e){return i(e)})))},I=s.createContext({currentTheme:"light",setCurrentTheme:function(){}});function B(e){var t=s.useRef(e);return s.useEffect((function(){t.current=e}),[e]),t.current}var F,D=function(e){var t=e.children,n=e.theme,r=e.onSwitchTheme,o=s.useMemo((function(){return"auto"===n?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":n}),[]),a=s.useState(o),i=a[0],c=a[1],l=B(i);s.useEffect((function(){if("auto"===n){var e=window.matchMedia("(prefers-color-scheme: dark)"),t=function(e){c(e.matches?"dark":"light")};return e.addEventListener("change",t),function(){return e.removeEventListener("change",t)}}}),[]),s.useEffect((function(){i!==l&&r&&r(i)}),[i]);var p={currentTheme:i,setCurrentTheme:c};return s.createElement(I.Provider,{value:p},t)},W=function(e){var t=s.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return p((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};!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 j,V=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),z=function(e,t,n,r){var o=parseInt(e,10);return o>=t&&o<=n?o:r},q=function(e){var t=e.annotation,n=s.useRef(),r="";if(t.modificationDate){var o=function(e){var t=V.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=z(t[2],1,12,1)-1,o=z(t[3],1,31,1),a=z(t[4],0,23,0),i=z(t[5],0,59,0),c=z(t[6],0,59,0),s=t[7]||"Z",l=z(t[8],0,23,0),p=z(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);r=o?o.toLocaleDateString()+", "+o.toLocaleTimeString():""}return s.useLayoutEffect((function(){if(n.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var r=e;return r.style.zIndex+=1,function(){r.style.zIndex=""+(parseInt(r.style.zIndex,10)-1)}}}}),[]),s.createElement("div",{ref:n,className:"rpv-core__annotation-popup-wrapper",style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&s.createElement("div",{className:"rpv-core__annotation-popup-header"},s.createElement("div",{className:"rpv-core__annotation-popup-title"},t.title),s.createElement("span",{className:"rpv-core__annotation-popup-date"},r)),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"}(j||(j={}));var 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=P(),t=e.opened,n=e.toggle,r=s.useState(j.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===j.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===j.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case j.Click:t&&a(j.Hover),n(exports.ToggleStatus.Toggle);break;case j.Hover:a(j.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],y={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case F.Dashed:y.borderStyle="dashed";break;case F.Solid:y.borderStyle="solid";break;case F.Underline:y=Object.assign({borderBottomStyle:"solid"},y);break;case F.Beveled:case F.Inset:}var x=n.borderStyle.width;y.borderWidth=x+"px",n.borderStyle.style!==F.Underline&&(h-=2*x,E-=2*x);var w=n.borderStyle,_=w.horizontalCornerRadius,b=w.verticalCornerRadius;(_>0||b>0)&&(y.borderRadius=_+"px / "+b+"px"),n.color?y.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":y.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"},y)},children:s.createElement(s.Fragment,null,a&&f&&s.createElement(q,{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",m({},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",m({},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",m({},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",m({},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)}))},X=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 p((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",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),s.createElement(q,{annotation:t}))}))},Y=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(Y,{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",m({},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(X,{annotation:n,page:r,viewport:o}))}))},Q=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",m({},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",m({},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",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),s.createElement("a",m({},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",m({},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",m({},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",m({},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",m({},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",m({},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",m({},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(u,{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(u,{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(u,{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(u,{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(u,{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(u,{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",m({},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(d,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(X,{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",m({},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(Y,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return s.createElement(Q,{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(X,{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})}}))},ye=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return p((function(){t()}),[r,o]),s.createElement(s.Fragment,null,n)},xe=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(ye,{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(E,null)),s.createElement("canvas",{ref:l,style:{transform:"scale("+1/v+")",transformOrigin:"top left"}})))},we=function(e){var t=e.height,n=e.page,r=e.rotation,o=e.scale,a=e.width,i=s.useRef();return s.createElement(ye,{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}))},_e=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(ye,{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.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},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,y=g.pageHeight,x=g.pageWidth,w=s.useRef(!1),_=Array(10).fill(null).map((function(e,t){return t/10})),b=x*l,P=y*l,k=Math.abs(c)%180==0,C=k?b:P,L=k?P:b,T=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,R=W({threshold:_,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&T()}});return s.useEffect((function(){t-2<=o&&o<=t+2&&T()}),[t]),s.createElement("div",{ref:R,className:"rpv-core__page-layer","data-testid":"viewer-page-layer-"+o,style:{height:L+"px",width:C+"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(xe,{height:L,page:h,pageIndex:o,plugins:a,rotation:S,scale:l,width:C})},doc:n,height:L,pageIndex:o,rotation:c,scale:l,svgLayer:{attrs:{},children:s.createElement(we,{height:L,page:h,rotation:S,scale:l,width:C})},textLayer:{attrs:{},children:s.createElement(_e,{page:h,pageIndex:o,plugins:a,rotation:S,scale:l})},width:C}),a.map((function(e,t){return e.renderPageLayer?s.createElement(s.Fragment,{key:t},e.renderPageLayer({doc:n,height:L,pageIndex:o,rotation:c,scale:l,width:C})):s.createElement(s.Fragment,{key:t})}))):s.createElement(E,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}},ke=function(e){var t=e.doc,n=e.initialPage,r=e.pageSize,o=e.plugins,a=e.renderPage,i=e.viewerState,c=e.onDocumentLoad,l=e.onOpenFile,p=e.onPageChange,u=e.onZoom,d=s.useContext(N),f=s.useRef(null),v=s.useRef(null),g=s.useState(0),h=g[0],E=g[1],y=s.useState(0),x=y[0],w=y[1],_=s.useRef(i),b=s.useState(r.scale),P=b[0],k=b[1],C=t.numPages,L=r.pageWidth,T=r.pageHeight,O=Array(C).fill(null),S=O.map((function(){return 0})),R=O.map((function(){return s.useRef()})),M=function(e){var t=e;o.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),_.current=t},A=function(){return v.current},H=function(e){return e<0||e>=C?null:R[e].current},I=function(){return _.current},B=function(e,n,r,o){var a=v.current,i=_.current;if(a&&i){var c=e+1;t.getPage(c).then((function(t){var c=t.getViewport({scale:1}),s=0,l=n||0,p=r||0,u=i.scale;switch(o){case exports.SpecialZoomLevel.PageFit:s=0,p=0,j(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=Pe(a,T,L,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,j(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=R[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},F=function(e){if(!(e<0||e>=C)){var t=v.current,n=R[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),E(e)}},D=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){l(e.name,t)}))},W=function(e){w(e),M({file:i.file,pageIndex:h,pageHeight:T,pageWidth:L,rotation:e,scale:P})},j=function(e){var n=v.current,r=n?"string"==typeof e?Pe(n,T,L,e):e:1;k(r),u({doc:t,scale:r})};s.useEffect((function(){var e=v.current,t=_.current;e&&t&&(e.scrollTop=e.scrollTop*P/t.scale,e.scrollLeft=e.scrollLeft*P/t.scale,M({file:i.file,pageIndex:t.pageIndex,pageHeight:T,pageWidth:L,rotation:x,scale:P}))}),[P]);s.useEffect((function(){var e={getPageElement:H,getPagesContainer:A,getViewerState:I,jumpToDestination:B,jumpToPage:F,openFile:D,rotate:W,setViewerState:M,zoom:j};return o.forEach((function(t){t.install&&t.install(e)})),function(){o.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),s.useEffect((function(){c({doc:t}),o.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:t})})),n&&F(n)}),[]),s.useEffect((function(){p({currentPage:h,doc:t}),M({file:i.file,pageIndex:h,pageHeight:T,pageWidth:L,rotation:x,scale:P})}),[h]);var V,z=function(e,t){S[e]=t;var n=S.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);E(n)},q=function(e){var t=h-1,n=h+1;switch(e){case"FirstPage":F(0);break;case"LastPage":F(C-1);break;case"NextPage":n<C&&F(n);break;case"PrevPage":t>=0&&F(t)}},Z=d&&d.core?d.core.pageLabel:"Page {{pageIndex}}",U=function(e){return s.createElement("div",m({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&U(e.subSlot))};return U((V={attrs:{ref:f,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{ref:v,style:{height:"100%",overflow:"auto",position:"relative"}},children:s.createElement(s.Fragment,null,Array(C).fill(0).map((function(e,n){return s.createElement("div",{"aria-label":Z.replace("{{pageIndex}}",""+(n+1)),className:"rpv-core__inner-page",key:"pagelayer-"+n,ref:function(e){R[n].current=e},role:"region"},s.createElement(be,{currentPage:h,doc:t,height:T,pageIndex:n,plugins:o,renderPage:a,rotation:x,scale:P,width:L,onExecuteNamedAction:q,onJumpToDest:B,onPageVisibilityChanged:z}))})))}},o.forEach((function(e){e.renderViewer&&(V=e.renderViewer({containerRef:f,doc:t,pageHeight:T,pageWidth:L,rotation:x,slot:V,jumpToPage:F,openFile:D,rotate:W,zoom:j}))})),V))},Ce=[.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.clientWidth-100)/r,u=t?"string"==typeof t?Pe(i,a,r,t):t:(s=p,-1===(l=Ce.findIndex((function(e){return e>=s})))||0===l?s:Ce[l-1]);c({pageHeight:a,pageWidth:r,scale:u})}}))}),[n]),0===i.pageWidth?s.createElement("div",{className:"rpv-core__page-size-calculator",ref:o},s.createElement(E,null)):r(i)},Te=function(){},Oe=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Te),Se=function(e){var t=e.verifyPasswordFn,n=s.useContext(N),r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.askingPassword.requirePasswordToOpen,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement(h,{onClick:function(){return t(o)}},n.core.askingPassword.submit))))},Re=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return g(t,e),t}(Te),Me=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return g(t,e),t}(Te),Ne=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return g(t,e),t}(Te),Ae=function(e){var t=e.verifyPasswordFn,n=s.useContext(N),r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.wrongPassword.tryAgain,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement("button",{className:"rpv-core__asking-password-button",onClick:function(){return t(o)}},n.core.wrongPassword.submit))))},He=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Te),Ie=function(e){var t,n=e.characterMap,r=e.file,o=e.httpHeaders,a=e.render,i=e.renderError,c=e.renderLoader,p=e.transformGetDocumentParams,u=e.withCredentials,d=s.useState(new Ne(0)),f=d[0],v=d[1],g=s.useState(0),m=g[0],h=g[1],y=s.useState(null),x=y[0],w=y[1],_=(t=s.useRef(!1),s.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);switch(s.useEffect((function(){v(new Ne(0));var e=new l.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:o,withCredentials:u,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),a=p?p(t):t,i=l.getDocument(a);return i.onPassword=function(e,t){switch(t){case l.PasswordResponses.NEED_PASSWORD:_.current&&v(new Oe(e));break;case l.PasswordResponses.INCORRECT_PASSWORD:_.current&&v(new He(e))}},i.onProgress=function(e){e.total>0?_.current&&h(Math.min(100,100*e.loaded/e.total)):_.current&&h(100)},i.promise.then((function(e){return _.current&&w(e)}),(function(t){return _.current&&!e.destroyed&&v(new Me({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[r]),s.useEffect((function(){100===m&&x?_.current&&v(new Re(x)):_.current&&v(new Ne(m))}),[m,x]),!0){case f instanceof Oe:return s.createElement(Se,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof He:return s.createElement(Ae,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof Re:return a(f.doc);case f instanceof Me:return i?i(f.error):s.createElement("div",{className:"rpv-core__doc-error"},s.createElement("div",{className:"rpv-core__doc-error-text"},f.error.message));case f instanceof Ne:return s.createElement("div",{className:"rpv-core__doc-loading"},c?c(f.percentages):s.createElement(E,null));default:return s.createElement("div",{className:"rpv-core__doc-loading"},s.createElement(E,null))}};exports.Button=function(e){var t=e.children,n=e.onClick;return s.createElement("button",{className:"rpv-core__button",type:"button",onClick:n},t)},exports.Icon=u,exports.LocalizationContext=N,exports.LocalizationProvider=H,exports.Menu=function(e){var t=e.children,n=s.useRef(),r=s.useRef([]),o=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),a((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),a((function(e,t){return t-1}));break;case"End":e.preventDefault(),a((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),a((function(e,t){return 0}))}},a=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 p((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}}),[]),p((function(){return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}}),[]),s.createElement("div",{ref:n,"aria-orientation":"vertical",className:"rpv-core__menu",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;return s.createElement("button",{className:f({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c}),role:"menuitem",tabIndex:-1,type:"button",onClick:l},s.createElement("div",{className:"rpv-core__menu-item-icon"},a),s.createElement("div",{className:"rpv-core__menu-item-label"},r),s.createElement("div",{className:"rpv-core__menu-item-check"},n&&s.createElement(d,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;return s.createElement("button",m({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:f({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"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.target,i=t||""+L();return s.createElement(k,{target:function(e,t){return s.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+i},a(e,t))},content:function(e){return s.createElement(b,null,s.createElement(_,{ariaControlsSuffix:i,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))}})},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=P(),d=u.opened,f=u.toggle,v=s.useRef(),g=r||""+L();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(R,{closeOnEscape:a,onClose:f}),s.createElement(S,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:l,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=h,exports.ProgressBar=function(e){var t=e.progress;return s.createElement("div",{className:"rpv-core__progress-bar"},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=E,exports.TextBox=y,exports.ThemeContext=I,exports.ThemeProvider=D,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=P(),c=i.opened,l=i.toggle,p=s.useRef(),u=s.useRef(),d=t||""+L();w((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(M,{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,v=e.renderLoader,g=e.transformGetDocumentParams,m=e.theme,h=void 0===m?"light":m,E=e.withCredentials,y=void 0!==E&&E,x=e.onDocumentLoad,w=void 0===x?function(){}:x,_=e.onPageChange,b=void 0===_?function(){}:_,P=e.onSwitchTheme,k=void 0===P?function(){}:P,C=e.onZoom,L=void 0===C?function(){}:C,T=s.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),O=T[0],S=T[1],R=function(e,t){S({data:t,name:e,shouldLoad:!0})},M=s.useState(!1),N=M[0],A=M[1],F=B(O);s.useEffect((function(){var e,t,n,o;e=F.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]}))||S({data:r,name:"string"==typeof r?r:"",shouldLoad:N})}),[r,N]);var j=W({onVisibilityChanged:function(e){A(e.isVisible),e.isVisible&&S((function(e){return Object.assign({},e,{shouldLoad:!0})}))}});return s.createElement(D,{theme:h,onSwitchTheme:k},s.createElement(H,{localization:l},(function(e){var r=s.useContext(I);return s.createElement("div",{ref:j,className:"rpv-core__viewer rpv-core__viewer--"+r.currentTheme,"data-testid":"viewer",style:{height:"100%",width:"100%"}},O.shouldLoad&&s.createElement(Ie,{characterMap:t,file:O.data,httpHeaders:a,render:function(e){return s.createElement(Le,{defaultScale:n,doc:e,render:function(t){return s.createElement(ke,{doc:e,initialPage:c,pageSize:t,plugins:u,renderPage:f,viewerState:{file:O,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:w,onOpenFile:R,onPageChange:b,onZoom:L})}})},renderError:d,renderLoader:v,transformGetDocumentParams:g,withCredentials:y}))})))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return l.GlobalWorkerOptions.workerSrc=n,s.createElement(s.Fragment,null,t)},exports.classNames=f,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=m(m({},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=W,exports.useIsomorphicLayoutEffect=p; | ||
"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";var p="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,u=function(e){var t=e.children,n=e.size,r=((void 0===n?24:n)||24)+"px";return s.createElement("svg",{"aria-hidden":"true",className:"rpv-core__icon",focusable:"false",height:r,viewBox:"0 0 24 24",width:r},t)},d=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},f=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},v=function(e,t){return(v=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])})(e,t)};function g(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}v(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var m=function(){return(m=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}).apply(this,arguments)},h=function(e){var t=e.children,n=e.onClick;return s.createElement("button",{className:"rpv-core__primary-button",type:"button",onClick:n},t)},E=function(e){var t=e.size,n=void 0===t?"4rem":t;return s.createElement("div",{className:"rpv-core__spinner",style:{height:n,width:n}})},y=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.placeholder,o=void 0===r?"":r,a=e.type,i=void 0===a?"text":a,c=e.value,l=void 0===c?"":c,p=e.onChange,u=e.onKeyDown,d=void 0===u?function(){}:u;return s.createElement("input",{"aria-label":n,className:"rpv-core__textbox",placeholder:o,type:i,value:l,onChange:function(e){return p(e.target.value)},onKeyDown:d})},w=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)}}}),[])},x=function(e){var t=function(t){"Escape"===t.key&&e()};s.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},_=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.closeOnClickOutside,o=e.closeOnEscape,a=e.onToggle,i=s.useRef();return s.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),x((function(){i.current&&o&&a()})),w(r,i,a),p((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:"rpv-core__modal-body",id:"rpv-core__modal-body-"+t,ref:i,role:"dialog",tabIndex:-1},n)},b=function(e){var t=e.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},t)},P=function(){var e=s.useState(!1),t=e[0],n=e[1];return{opened:t,toggle:function(e){switch(e){case exports.ToggleStatus.Close:n(!1);break;case exports.ToggleStatus.Open:n(!0);break;case exports.ToggleStatus.Toggle:default:n((function(e){return!e}))}}}},k=function(e){var t=e.content,n=e.target,r=P(),o=r.opened,a=r.toggle;return s.createElement(s.Fragment,null,n(a,o),o&&t(a))},C=0,L=function(){return C++},T=function(e,t,n,r,o){p((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"}}),[])},O=function(e){var t,n=e.customClassName,r=e.position;return s.createElement("div",{className:f((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))})},R=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(),u=s.useRef(),d=s.useRef();w(r,l,c),T(l,i,d,a,o),p((function(){var e=u.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:d,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":f,className:"rpv-core__popover-body",id:"rpv-core__popover-body-"+t,ref:l,role:"dialog",tabIndex:-1},s.createElement(O,{customClassName:"rpv-core__popover-body-arrow",position:a}),s.createElement("div",{id:f,ref:u},n)))},S=function(e){var t=e.closeOnEscape,n=e.onClose,r=s.useRef();return x((function(){r.current&&t&&n()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},M=function(e){var t=e.ariaControlsSuffix,n=e.children,r=e.contentRef,o=e.offset,a=e.position,i=e.targetRef,c=s.useRef();return T(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:"rpv-core__tooltip-body",id:"rpv-core__tooltip-body-"+t,ref:r,role:"tooltip"},s.createElement(O,{customClassName:"rpv-core__tooltip-body-arrow",position:a}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},n)))};var N={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},A=s.createContext({l10n:N,setL10n:function(){}}),H=s.createContext({currentTheme:"light",setCurrentTheme:function(){}}),I=function(e){var t=s.useRef(null),n=e.threshold,r=e.onVisibilityChanged;return p((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};function F(e){var t=s.useRef(e);return s.useEffect((function(){t.current=e}),[e]),t.current}var B;!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"}(B||(B={}));var D,W=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.useRef(),r="";if(t.modificationDate){var o=function(e){var t=W.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);r=o?o.toLocaleDateString()+", "+o.toLocaleTimeString():""}return s.useLayoutEffect((function(){if(n.current){var e=document.querySelector('[data-annotation-id="'+t.id+'"]');if(e){var r=e;return r.style.zIndex+=1,function(){r.style.zIndex=""+(parseInt(r.style.zIndex,10)-1)}}}}),[]),s.createElement("div",{ref:n,className:"rpv-core__annotation-popup-wrapper",style:{top:t.annotationType===exports.AnnotationType.Popup?"":"100%"}},t.title&&s.createElement("div",{className:"rpv-core__annotation-popup-header"},s.createElement("div",{className:"rpv-core__annotation-popup-title"},t.title),s.createElement("span",{className:"rpv-core__annotation-popup-date"},r)),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"}(D||(D={}));var 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=P(),t=e.opened,n=e.toggle,r=s.useState(D.Hover),o=r[0],a=r[1];return{opened:t,closeOnHover:function(){o===D.Hover&&n(exports.ToggleStatus.Close)},openOnHover:function(){o===D.Hover&&n(exports.ToggleStatus.Open)},toggleOnClick:function(){switch(o){case D.Click:t&&a(D.Hover),n(exports.ToggleStatus.Toggle);break;case D.Hover:a(D.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],y={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!o&&n.borderStyle.width>0){switch(n.borderStyle.style){case B.Dashed:y.borderStyle="dashed";break;case B.Solid:y.borderStyle="solid";break;case B.Underline:y=Object.assign({borderBottomStyle:"solid"},y);break;case B.Beveled:case B.Inset:}var w=n.borderStyle.width;y.borderWidth=w+"px",n.borderStyle.style!==B.Underline&&(h-=2*w,E-=2*w);var x=n.borderStyle,_=x.horizontalCornerRadius,b=x.verticalCornerRadius;(_>0||b>0)&&(y.borderRadius=_+"px / "+b+"px"),n.color?y.borderColor="rgb("+(0|n.color[0])+", "+(0|n.color[1])+", "+(0|n.color[2])+")":y.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"},y)},children:s.createElement(s.Fragment,null,a&&f&&s.createElement(V,{annotation:n}))}}))},q=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",m({},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)}))},Z=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",m({},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)}))},U=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",m({},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)}))},G=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",m({},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)}))},J=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 p((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",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),s.createElement(V,{annotation:t}))}))},K=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(K,{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",m({},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(J,{annotation:n,page:r,viewport:o}))}))},X=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",m({},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)}))},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",m({},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)}))},Q=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)}))}))},$=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):Q(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",m({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":t.id}),s.createElement("a",m({},l)))}))},ee=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",m({},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)}))},te=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",m({},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)}))},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",m({},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)}))},re=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",m({},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)}))},oe=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",m({},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)}))},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",m({},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)}))},ie=function(){return s.createElement(u,{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"}))},ce=function(){return s.createElement(u,{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"}))},se=function(){return s.createElement(u,{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"}))},le=function(){return s.createElement(u,{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"}))},pe=function(){return s.createElement(u,{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"}))},ue=function(){return s.createElement(u,{size:16},s.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},de=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",m({},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(d,null),"comment"===c&&s.createElement(ie,null),"help"===c&&s.createElement(ce,null),"insert"===c&&s.createElement(ue,null),"key"===c&&s.createElement(se,null),"note"===c&&s.createElement(le,null),("newparagraph"===c||"paragraph"===c)&&s.createElement(pe,null)),e.slot.children),n&&n.annotationType===exports.AnnotationType.Popup&&e.popup.opened&&s.createElement(J,{annotation:n,page:r,viewport:o}))}))},fe=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",m({},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)}))},ve=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(q,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Circle:return s.createElement(Z,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FileAttachment:return s.createElement(U,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.FreeText:return s.createElement(G,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Highlight:return s.createElement(K,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Ink:return s.createElement(X,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Line:return s.createElement(Y,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Link:return s.createElement($,{key:e.id,annotation:e,doc:r,page:o,viewport:d,onExecuteNamedAction:p,onJumpToDest:u});case exports.AnnotationType.Polygon:return s.createElement(ee,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Polyline:return s.createElement(te,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Popup:return s.createElement(J,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Square:return s.createElement(ne,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Squiggly:return s.createElement(re,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Stamp:return s.createElement(oe,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.StrikeOut:return s.createElement(ae,{key:e.id,annotation:e,page:o,viewport:d});case exports.AnnotationType.Text:return s.createElement(de,{key:e.id,annotation:e,childAnnotation:n,page:o,viewport:d});case exports.AnnotationType.Underline:return s.createElement(fe,{key:e.id,annotation:e,page:o,viewport:d});default:return s.createElement(s.Fragment,{key:e.id})}})))},ge=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)},me=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(ge,{page:n,renderAnnotations:function(e){return s.createElement(ve,{annotations:e,containerRef:p,doc:t,page:n,pageIndex:r,plugins:o,rotation:a,scale:i,onExecuteNamedAction:c,onJumpToDest:l})}}))},he=function(e){var t=e.callback,n=e.children,r=e.rotation,o=e.scale;return p((function(){t()}),[r,o]),s.createElement(s.Fragment,null,n)},Ee=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(he,{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(E,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(he,{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(he,{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.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},s.createElement("div",{className:"rpv-core__text-layer",ref:i}))},xe=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,y=g.pageHeight,w=g.pageWidth,x=s.useRef(!1),_=Array(10).fill(null).map((function(e,t){return t/10})),b=w*l,P=y*l,k=Math.abs(c)%180==0,C=k?b:P,L=k?P:b,T=function(){x.current||(x.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)},R=(c+g.viewportRotation)%360,S=I({threshold:_,onVisibilityChanged:function(e){f(o,e.isVisible?e.ratio:-1),e.isVisible&&T()}});return s.useEffect((function(){t-2<=o&&o<=t+2&&T()}),[t]),s.createElement("div",{ref:S,className:"rpv-core__page-layer","data-testid":"viewer-page-layer-"+o,style:{height:L+"px",width:C+"px"}},h?s.createElement(s.Fragment,null,O({annotationLayer:{attrs:{},children:s.createElement(me,{doc:n,page:h,pageIndex:o,plugins:a,rotation:R,scale:l,onExecuteNamedAction:u,onJumpToDest:d})},canvasLayer:{attrs:{},children:s.createElement(Ee,{height:L,page:h,pageIndex:o,plugins:a,rotation:R,scale:l,width:C})},doc:n,height:L,pageIndex:o,rotation:c,scale:l,svgLayer:{attrs:{},children:s.createElement(ye,{height:L,page:h,rotation:R,scale:l,width:C})},textLayer:{attrs:{},children:s.createElement(we,{page:h,pageIndex:o,plugins:a,rotation:R,scale:l})},width:C}),a.map((function(e,t){return e.renderPageLayer?s.createElement(s.Fragment,{key:t},e.renderPageLayer({doc:n,height:L,pageIndex:o,rotation:c,scale:l,width:C})):s.createElement(s.Fragment,{key:t})}))):s.createElement(E,null))},_e=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}},be=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,u=e.onDocumentLoad,d=e.onOpenFile,f=e.onPageChange,v=e.onZoom,g=s.useContext(A).l10n,h=s.useRef(null),E=s.useRef(null),y=s.useState(0),w=y[0],x=y[1],_=s.useState(0),b=_[0],P=_[1],k=s.useRef(l),C=s.useState(a.scale),L=C[0],T=C[1],O=s.useRef("string"==typeof n?n:null);!function(e){var t=e.targetRef,n=e.onResize;p((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:E,onResize:function(e){O.current&&Z(O.current)}});var R=r.numPages,S=a.pageWidth,M=a.pageHeight,N=Array(R).fill(null),H=N.map((function(){return 0})),I=N.map((function(){return s.useRef()})),F=function(e){var t=e;i.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),k.current=t},B=function(){return E.current},D=function(e){return e<0||e>=R?null:I[e].current},W=function(){return k.current},j=function(e,t,n,o){var a=E.current,i=k.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,Z(exports.SpecialZoomLevel.PageFit);break;case exports.SpecialZoomLevel.PageWidth:u=_e(a,M,S,exports.SpecialZoomLevel.PageWidth),s=(c.height-l)*u,p*=u,Z(u);break;default:s=(c.height-l)*i.scale,p*=i.scale}var d=I[e].current;d&&(a.scrollTop=d.offsetTop+s,a.scrollLeft=d.offsetLeft+p)}))}},V=function(e){if(!(e<0||e>=R)){var t=E.current,n=I[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),x(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)}))},q=function(e){P(e),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:S,rotation:e,scale:L})},Z=function(e){var t=E.current,n=t?"string"==typeof e?_e(t,M,S,e):e:1;O.current="string"==typeof e?e:null,T(n),v({doc:r,scale:n})};s.useEffect((function(){var e=E.current,t=k.current;e&&t&&(e.scrollTop=e.scrollTop*L/t.scale,e.scrollLeft=e.scrollLeft*L/t.scale,F({file:l.file,pageIndex:t.pageIndex,pageHeight:M,pageWidth:S,rotation:b,scale:L}))}),[L]);s.useEffect((function(){var e={getPageElement:D,getPagesContainer:B,getViewerState:W,jumpToDestination:j,jumpToPage:V,openFile:z,rotate:q,setViewerState:F,zoom:Z};return i.forEach((function(t){t.install&&t.install(e)})),function(){i.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),s.useEffect((function(){u({doc:r,file:t}),i.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r,file:t})})),o&&V(o)}),[]),s.useEffect((function(){f({currentPage:w,doc:r}),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:S,rotation:b,scale:L})}),[w]);var U,G=function(e,t){H[e]=t;var n=H.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);x(n)},J=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":V(0);break;case"LastPage":V(R-1);break;case"NextPage":n<R&&V(n);break;case"PrevPage":t>=0&&V(t)}},K=g&&g.core?g.core.pageLabel:"Page {{pageIndex}}",X=function(e){return s.createElement("div",m({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&X(e.subSlot))};return X((U={attrs:{ref:h,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{ref:E,style:{height:"100%",overflow:"auto",position:"relative"}},children:s.createElement(s.Fragment,null,Array(R).fill(0).map((function(e,t){return s.createElement("div",{"aria-label":K.replace("{{pageIndex}}",""+(t+1)),className:"rpv-core__inner-page",key:"pagelayer-"+t,ref:function(e){I[t].current=e},role:"region"},s.createElement(xe,{currentPage:w,doc:r,height:M,pageIndex:t,plugins:i,renderPage:c,rotation:b,scale:L,width:S,onExecuteNamedAction:J,onJumpToDest:j,onPageVisibilityChanged:G}))})))}},i.forEach((function(e){e.renderViewer&&(U=e.renderViewer({containerRef:h,doc:r,pageHeight:M,pageWidth:S,rotation:b,slot:U,jumpToPage:V,openFile:z,rotate:q,zoom:Z}))})),U))},Pe=[.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],ke=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?_e(p,a,r,t):t:(s=u,-1===(l=Pe.findIndex((function(e){return e>=s})))||0===l?s:Pe[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(E,null)):r(i)},Ce=function(){},Le=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Ce),Te=function(e){var t=e.verifyPasswordFn,n=s.useContext(A).l10n,r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.askingPassword.requirePasswordToOpen,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement(h,{onClick:function(){return t(o)}},n.core.askingPassword.submit))))},Oe=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return g(t,e),t}(Ce),Re=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return g(t,e),t}(Ce),Se=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return g(t,e),t}(Ce),Me=function(e){var t=e.verifyPasswordFn,n=s.useContext(A).l10n,r=s.useState(""),o=r[0],a=r[1];return s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:"rpv-core__asking-password"},s.createElement("div",{className:"rpv-core__asking-password-message"},n.core.wrongPassword.tryAgain,":"),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:"rpv-core__asking-password-input"},s.createElement(y,{type:"password",value:o,onChange:a})),s.createElement("button",{className:"rpv-core__asking-password-button",onClick:function(){return t(o)}},n.core.wrongPassword.submit))))},Ne=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return g(t,e),t}(Ce),Ae=function(e){var t,n=e.characterMap,r=e.file,o=e.httpHeaders,a=e.render,i=e.renderError,c=e.renderLoader,p=e.transformGetDocumentParams,u=e.withCredentials,d=s.useState(new Se(0)),f=d[0],v=d[1],g=s.useState(0),m=g[0],h=g[1],y=s.useState(null),w=y[0],x=y[1],_=(t=s.useRef(!1),s.useEffect((function(){return t.current=!0,function(){t.current=!1}}),[]),t);switch(s.useEffect((function(){v(new Se(0));var e=new l.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:o,withCredentials:u,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),a=p?p(t):t,i=l.getDocument(a);return i.onPassword=function(e,t){switch(t){case l.PasswordResponses.NEED_PASSWORD:_.current&&v(new Le(e));break;case l.PasswordResponses.INCORRECT_PASSWORD:_.current&&v(new Ne(e))}},i.onProgress=function(e){e.total>0?_.current&&h(Math.min(100,100*e.loaded/e.total)):_.current&&h(100)},i.promise.then((function(e){return _.current&&x(e)}),(function(t){return _.current&&!e.destroyed&&v(new Re({message:t.message||"Cannot load document",name:t.name}))})),function(){i.destroy(),e.destroy()}}),[r]),s.useEffect((function(){100===m&&w?_.current&&v(new Oe(w)):_.current&&v(new Se(m))}),[m,w]),!0){case f instanceof Le:return s.createElement(Te,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof Ne:return s.createElement(Me,{verifyPasswordFn:f.verifyPasswordFn});case f instanceof Oe:return a(f.doc);case f instanceof Re:return i?i(f.error):s.createElement("div",{className:"rpv-core__doc-error"},s.createElement("div",{className:"rpv-core__doc-error-text"},f.error.message));case f instanceof Se:return s.createElement("div",{className:"rpv-core__doc-loading"},c?c(f.percentages):s.createElement(E,null));default:return s.createElement("div",{className:"rpv-core__doc-loading"},s.createElement(E,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=F(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.onClick;return s.createElement("button",{className:"rpv-core__button",type:"button",onClick:n},t)},exports.Icon=u,exports.LocalizationContext=A,exports.Menu=function(e){var t=e.children,n=s.useRef(),r=s.useRef([]),o=function(e){if(n.current)switch(e.key){case"Tab":e.preventDefault();break;case"ArrowDown":e.preventDefault(),a((function(e,t){return t+1}));break;case"ArrowUp":e.preventDefault(),a((function(e,t){return t-1}));break;case"End":e.preventDefault(),a((function(e,t){return e.length-1}));break;case"Home":e.preventDefault(),a((function(e,t){return 0}))}},a=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 p((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}}),[]),p((function(){return document.addEventListener("keydown",o),function(){document.removeEventListener("keydown",o)}}),[]),s.createElement("div",{ref:n,"aria-orientation":"vertical",className:"rpv-core__menu",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;return s.createElement("button",{className:f({"rpv-core__menu-item":!0,"rpv-core__menu-item--disabled":c}),role:"menuitem",tabIndex:-1,type:"button",onClick:l},s.createElement("div",{className:"rpv-core__menu-item-icon"},a),s.createElement("div",{className:"rpv-core__menu-item-label"},r),s.createElement("div",{className:"rpv-core__menu-item-check"},n&&s.createElement(d,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;return s.createElement("button",m({"aria-label":n},o&&{"aria-keyshortcuts":o},c&&{"aria-disabled":!0},{className:f({"rpv-core__minimal-button":!0,"rpv-core__minimal-button--disabled":c,"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.target,i=t||""+L();return s.createElement(k,{target:function(e,t){return s.createElement("div",{"aria-expanded":t?"true":"false","aria-haspopup":"dialog","aria-controls":"rpv-core__modal-body-"+i},a(e,t))},content:function(e){return s.createElement(b,null,s.createElement(_,{ariaControlsSuffix:i,closeOnClickOutside:n,closeOnEscape:r,onToggle:e},o(e)))}})},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=P(),d=u.opened,f=u.toggle,v=s.useRef(),g=r||""+L();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(S,{closeOnEscape:a,onClose:f}),s.createElement(R,{ariaControlsSuffix:g,closeOnClickOutside:o,offset:c,position:l,targetRef:v,onClose:f},i(f))))},exports.PrimaryButton=h,exports.ProgressBar=function(e){var t=e.progress;return s.createElement("div",{className:"rpv-core__progress-bar"},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=E,exports.TextBox=y,exports.ThemeContext=H,exports.Tooltip=function(e){var t=e.ariaControlsSuffix,n=e.content,r=e.offset,o=e.position,a=e.target,i=P(),c=i.opened,l=i.toggle,p=s.useRef(),u=s.useRef(),d=t||""+L();x((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(M,{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,v=e.renderLoader,g=e.transformGetDocumentParams,m=e.theme,h=void 0===m?"light":m,E=e.withCredentials,y=void 0!==E&&E,w=e.onDocumentLoad,x=void 0===w?function(){}:w,_=e.onPageChange,b=void 0===_?function(){}:_,P=e.onSwitchTheme,k=void 0===P?function(){}:P,C=e.onZoom,L=void 0===C?function(){}:C,T=s.useState({data:r,name:"string"==typeof r?r:"",shouldLoad:!1}),O=T[0],R=T[1],S=function(e,t){R({data:t,name:e,shouldLoad:!0})},M=s.useState(!1),N=M[0],B=M[1],D=F(O);s.useEffect((function(){var e,t,n,o;e=D.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]}))||R({data:r,name:"string"==typeof r?r:"",shouldLoad:N})}),[r,N]);var W=I({onVisibilityChanged:function(e){B(e.isVisible),e.isVisible&&R((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),j=s.useState(l),V=j[0],z=j[1],q={l10n:V,setL10n:z},Z=He(h,k);return s.useEffect((function(){z(l)}),[l]),s.createElement(A.Provider,{value:q},s.createElement(H.Provider,{value:Z},s.createElement("div",{ref:W,className:"rpv-core__viewer rpv-core__viewer--"+Z.currentTheme,"data-testid":"viewer",style:{height:"100%",width:"100%"}},O.shouldLoad&&s.createElement(Ae,{characterMap:t,file:O.data,httpHeaders:a,render:function(e){return s.createElement(ke,{defaultScale:n,doc:e,render:function(t){return s.createElement(be,{currentFile:{data:O.data,name:O.name},defaultScale:n,doc:e,initialPage:c,pageSize:t,plugins:u,renderPage:f,viewerState:{file:O,pageIndex:c,pageHeight:t.pageHeight,pageWidth:t.pageWidth,rotation:0,scale:t.scale},onDocumentLoad:x,onOpenFile:S,onPageChange:b,onZoom:L})}})},renderError:d,renderLoader:v,transformGetDocumentParams:g,withCredentials:y}))))},exports.Worker=function(e){var t=e.children,n=e.workerUrl;return l.GlobalWorkerOptions.workerSrc=n,s.createElement(s.Fragment,null,t)},exports.classNames=f,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=m(m({},t),((o={})[e]=r,o)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=Q,exports.isMac=function(){return"undefined"!=typeof window&&/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)},exports.useIntersectionObserver=I,exports.useIsomorphicLayoutEffect=p; |
@@ -54,2 +54,3 @@ /** | ||
doc: PdfJs.PdfDocument; | ||
file: OpenFile; | ||
} | ||
@@ -304,9 +305,7 @@ export interface PluginOnTextLayerRender { | ||
} | ||
export const LocalizationContext: React.Context<LocalizationMap>; | ||
export type SetLocalization = (l10n: LocalizationMap) => void; | ||
export interface LocalizationProviderProps { | ||
children: (setLocalization: SetLocalization) => React.ReactElement; | ||
localization?: LocalizationMap; | ||
export interface LocalizationContextProps { | ||
l10n: LocalizationMap; | ||
setL10n(l10n: LocalizationMap): void; | ||
} | ||
export class LocalizationProvider extends React.Component<LocalizationProviderProps> {} | ||
export const LocalizationContext: React.Context<LocalizationContextProps>; | ||
@@ -318,6 +317,2 @@ export interface ThemeContextProps { | ||
export const ThemeContext: React.Context<ThemeContextProps>; | ||
export interface ThemeProviderProps { | ||
theme?: string; | ||
} | ||
export class ThemeProvider extends React.Component<ThemeProviderProps> {} | ||
@@ -350,2 +345,3 @@ // Viewer | ||
doc: PdfJs.PdfDocument; | ||
file: OpenFile; | ||
} | ||
@@ -352,0 +348,0 @@ |
{ | ||
"name": "@react-pdf-viewer/core", | ||
"version": "2.7.1", | ||
"version": "2.7.2", | ||
"description": "A React component to view a PDF document", | ||
@@ -50,3 +50,3 @@ "license": "https://react-pdf-viewer.dev/license", | ||
}, | ||
"gitHead": "e7e1a5a6c3c2706198c71b57fff3cff285c5fe54" | ||
"gitHead": "d5084b21f1e89e11ee45764849b8c61e4e6f4216" | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
196137
2901