Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf-viewer/core

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 2.3.1 to 2.3.2

4

lib/cjs/core.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(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 n,r=t(require("pdfjs-dist"));!function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment"}(n||(n={}));var a,o=n,i=e.createContext({prefixClass:"rpv-core"}),s=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},c=function(t){var n=t.children,r=t.size,a=void 0===r?24:r,o=e.useContext(i),s=(a||24)+"px";return e.createElement("svg",{className:o.prefixClass+"-icon",height:s,viewBox:"0 0 24 24",width:s},n)},l=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},p=function(){var t=e.useContext(i);return e.createElement("svg",{className:t.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},e.createElement("circle",{className:t.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},u=function(t){var n=t.children,r=t.threshold,a=t.onVisibilityChanged,o=e.useRef(null);return e.useLayoutEffect((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;a({isVisible:t,ratio:n})}))}),{threshold:r||0}),t=o.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),e.createElement("div",{ref:o},n)},d=e.createContext({}),f={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"}}},g=function(t){var n=t.children,r=t.localization,a=f,o=e.useState(r||a),i=o[0],s=o[1];return e.createElement(d.Provider,{value:i},n((function(e){return s(e)})))},m=function(t,n,r){var a=function(e){var t=n.current;t&&!t.contains(e.target)&&r()};e.useEffect((function(){if(t)return document.addEventListener("click",a),function(){document.removeEventListener("click",a)}}),[])},h=function(t,n){var r=function(e){e.keyCode===t&&n()};e.useEffect((function(){return document.addEventListener("keyup",r),function(){document.removeEventListener("keyup",r)}}),[])},v=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.closeOnEscape,o=t.onToggle,s=e.useContext(i),c=e.createRef();return e.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),h(27,(function(){return a&&o()})),m(r,c,o),e.createElement("div",{className:s.prefixClass+"-modal-body",ref:c},n)},E=function(t){var n=t.children,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-modal-overlay"},n)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(a||(a={}));var x,C=function(){var t=e.useState(!1),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case a.Close:r(!1);break;case a.Open:r(!0);break;case a.Toggle:default:r((function(e){return!e}))}}}},w=function(t){var n=t.content,r=t.target,a=C(),o=a.opened,i=a.toggle;return e.createElement(e.Fragment,null,r(i,o),o&&n(i))};!function(e){e.TopLeft="TOP_LEFT",e.TopCenter="TOP_CENTER",e.TopRight="TOP_RIGHT",e.RightTop="RIGHT_TOP",e.RightCenter="RIGHT_CENTER",e.RightBottom="RIGHT_BOTTOM",e.BottomLeft="BOTTOM_LEFT",e.BottomCenter="BOTTOM_CENTER",e.BottomRight="BOTTOM_RIGHT",e.LeftTop="LEFT_TOP",e.LeftCenter="LEFT_CENTER",e.LeftBottom="LEFT_BOTTOM"}(x||(x={}));var y,k=x,P=function(t,n,r,a,o){e.useLayoutEffect((function(){var e=n.current,i=t.current,s=r.current;if(i&&e&&s){var c=s.getBoundingClientRect(),l=function(e,t,n,r){var a=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,s=o.width,c=0,l=0;switch(n){case k.TopLeft:c=a.top-i,l=a.left;break;case k.TopCenter:c=a.top-i,l=a.left+a.width/2-s/2;break;case k.TopRight:c=a.top-i,l=a.left+a.width-s;break;case k.RightTop:c=a.top,l=a.left+a.width;break;case k.RightCenter:c=a.top+a.height/2-i/2,l=a.left+a.width;break;case k.RightBottom:c=a.top+a.height-i,l=a.left+a.width;break;case k.BottomLeft:c=a.top+a.height,l=a.left;break;case k.BottomCenter:c=a.top+a.height,l=a.left+a.width/2-s/2;break;case k.BottomRight:c=a.top+a.height,l=a.left+a.width-s;break;case k.LeftTop:c=a.top,l=a.left-s;break;case k.LeftCenter:c=a.top+a.height/2-i/2,l=a.left-s;break;case k.LeftBottom:c=a.top+a.height-i,l=a.left-s}return{left:l+(r.left||0),top:c+(r.top||0)}}(i,e,a,o),p=l.top,u=l.left;i.style.top=p-c.top+"px",i.style.left=u-c.left+"px"}}),[])},b=function(t){var n,r=t.customClassName,a=t.position,o=e.useContext(i);return e.createElement("div",{className:s((n={},n[o.prefixClass+"-arrow"]=!0,n[o.prefixClass+"-arrow-tl"]=a===k.TopLeft,n[o.prefixClass+"-arrow-tc"]=a===k.TopCenter,n[o.prefixClass+"-arrow-tr"]=a===k.TopRight,n[o.prefixClass+"-arrow-rt"]=a===k.RightTop,n[o.prefixClass+"-arrow-rc"]=a===k.RightCenter,n[o.prefixClass+"-arrow-rb"]=a===k.RightBottom,n[o.prefixClass+"-arrow-bl"]=a===k.BottomLeft,n[o.prefixClass+"-arrow-bc"]=a===k.BottomCenter,n[o.prefixClass+"-arrow-br"]=a===k.BottomRight,n[o.prefixClass+"-arrow-lt"]=a===k.LeftTop,n[o.prefixClass+"-arrow-lc"]=a===k.LeftCenter,n[o.prefixClass+"-arrow-lb"]=a===k.LeftBottom,n[""+r]=""!==r,n))})},O=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.offset,o=t.position,s=t.targetRef,c=t.onClose,l=e.useContext(i),p=e.createRef(),u=e.createRef();return m(r,p,c),P(p,s,u,o,a),e.createElement(e.Fragment,null,e.createElement("div",{ref:u,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:l.prefixClass+"-popover-body",ref:p},e.createElement(b,{customClassName:l.prefixClass+"-popover-body-arrow",position:o}),n))},L=function(t){var n=t.closeOnEscape,r=t.onClose,a=e.useContext(i);return h(27,(function(){return n&&r()})),e.createElement("div",{className:a.prefixClass+"-popover-overlay"})},R=function(t){var n=t.children,r=t.offset,a=t.position,o=t.targetRef,s=e.useContext(i),c=e.createRef(),l=e.createRef();return P(c,o,l,a,r),e.createElement(e.Fragment,null,e.createElement("div",{ref:l,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:s.prefixClass+"-tooltip-body",ref:c},e.createElement(b,{customClassName:s.prefixClass+"-tooltip-body-arrow",position:a}),e.createElement("div",{className:s.prefixClass+"-tooltip-body-content"},n)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(y||(y={}));var T=y,M=function(e,t){return(M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(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 n,r=t(require("pdfjs-dist"));!function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment"}(n||(n={}));var a,o=n,i=e.createContext({prefixClass:"rpv-core"}),s=function(e){var t=[];return Object.keys(e).forEach((function(n){n&&e[n]&&t.push(n)})),t.join(" ")},c=function(t){var n=t.children,r=t.size,a=void 0===r?24:r,o=e.useContext(i),s=(a||24)+"px";return e.createElement("svg",{className:o.prefixClass+"-icon",height:s,viewBox:"0 0 24 24",width:s},n)},l=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M23.5,0.499l-16.5,23l-6.5-6.5"}))},u=function(){var t=e.useContext(i);return e.createElement("svg",{className:t.prefixClass+"-spinner",width:"64px",height:"64px",viewBox:"0 0 32 32"},e.createElement("circle",{className:t.prefixClass+"-spinner-circle",cx:"16",cy:"16",r:"12",strokeDasharray:2*Math.PI*9}))},p=function(t){var n=e.useRef(null),r=t.threshold,a=t.onVisibilityChanged;return e.useLayoutEffect((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;a({isVisible:t,ratio:n})}))}),{threshold:r||0}),t=n.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),n},d=e.createContext({}),f={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{submit:"Submit",tryAgain:"The password is wrong. Please try again"}}},g=function(t){var n=t.children,r=t.localization,a=f,o=e.useState(r||a),i=o[0],s=o[1];return e.createElement(d.Provider,{value:i},n((function(e){return s(e)})))},m=function(t,n,r){var a=function(e){var t=n.current;t&&!t.contains(e.target)&&r()};e.useEffect((function(){if(t)return document.addEventListener("click",a),function(){document.removeEventListener("click",a)}}),[])},h=function(t,n){var r=function(e){e.keyCode===t&&n()};e.useEffect((function(){return document.addEventListener("keyup",r),function(){document.removeEventListener("keyup",r)}}),[])},v=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.closeOnEscape,o=t.onToggle,s=e.useContext(i),c=e.createRef();return e.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),h(27,(function(){return a&&o()})),m(r,c,o),e.createElement("div",{className:s.prefixClass+"-modal-body",ref:c},n)},E=function(t){var n=t.children,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-modal-overlay"},n)};!function(e){e.Close="Close",e.Open="Open",e.Toggle="Toggle"}(a||(a={}));var x,C=function(){var t=e.useState(!1),n=t[0],r=t[1];return{opened:n,toggle:function(e){switch(e){case a.Close:r(!1);break;case a.Open:r(!0);break;case a.Toggle:default:r((function(e){return!e}))}}}},w=function(t){var n=t.content,r=t.target,a=C(),o=a.opened,i=a.toggle;return e.createElement(e.Fragment,null,r(i,o),o&&n(i))};!function(e){e.TopLeft="TOP_LEFT",e.TopCenter="TOP_CENTER",e.TopRight="TOP_RIGHT",e.RightTop="RIGHT_TOP",e.RightCenter="RIGHT_CENTER",e.RightBottom="RIGHT_BOTTOM",e.BottomLeft="BOTTOM_LEFT",e.BottomCenter="BOTTOM_CENTER",e.BottomRight="BOTTOM_RIGHT",e.LeftTop="LEFT_TOP",e.LeftCenter="LEFT_CENTER",e.LeftBottom="LEFT_BOTTOM"}(x||(x={}));var y,k=x,b=function(t,n,r,a,o){e.useLayoutEffect((function(){var e=n.current,i=t.current,s=r.current;if(i&&e&&s){var c=s.getBoundingClientRect(),l=function(e,t,n,r){var a=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=o.height,s=o.width,c=0,l=0;switch(n){case k.TopLeft:c=a.top-i,l=a.left;break;case k.TopCenter:c=a.top-i,l=a.left+a.width/2-s/2;break;case k.TopRight:c=a.top-i,l=a.left+a.width-s;break;case k.RightTop:c=a.top,l=a.left+a.width;break;case k.RightCenter:c=a.top+a.height/2-i/2,l=a.left+a.width;break;case k.RightBottom:c=a.top+a.height-i,l=a.left+a.width;break;case k.BottomLeft:c=a.top+a.height,l=a.left;break;case k.BottomCenter:c=a.top+a.height,l=a.left+a.width/2-s/2;break;case k.BottomRight:c=a.top+a.height,l=a.left+a.width-s;break;case k.LeftTop:c=a.top,l=a.left-s;break;case k.LeftCenter:c=a.top+a.height/2-i/2,l=a.left-s;break;case k.LeftBottom:c=a.top+a.height-i,l=a.left-s}return{left:l+(r.left||0),top:c+(r.top||0)}}(i,e,a,o),u=l.top,p=l.left;i.style.top=u-c.top+"px",i.style.left=p-c.left+"px"}}),[])},P=function(t){var n,r=t.customClassName,a=t.position,o=e.useContext(i);return e.createElement("div",{className:s((n={},n[o.prefixClass+"-arrow"]=!0,n[o.prefixClass+"-arrow-tl"]=a===k.TopLeft,n[o.prefixClass+"-arrow-tc"]=a===k.TopCenter,n[o.prefixClass+"-arrow-tr"]=a===k.TopRight,n[o.prefixClass+"-arrow-rt"]=a===k.RightTop,n[o.prefixClass+"-arrow-rc"]=a===k.RightCenter,n[o.prefixClass+"-arrow-rb"]=a===k.RightBottom,n[o.prefixClass+"-arrow-bl"]=a===k.BottomLeft,n[o.prefixClass+"-arrow-bc"]=a===k.BottomCenter,n[o.prefixClass+"-arrow-br"]=a===k.BottomRight,n[o.prefixClass+"-arrow-lt"]=a===k.LeftTop,n[o.prefixClass+"-arrow-lc"]=a===k.LeftCenter,n[o.prefixClass+"-arrow-lb"]=a===k.LeftBottom,n[""+r]=""!==r,n))})},O=function(t){var n=t.children,r=t.closeOnClickOutside,a=t.offset,o=t.position,s=t.targetRef,c=t.onClose,l=e.useContext(i),u=e.createRef(),p=e.createRef();return m(r,u,c),b(u,s,p,o,a),e.createElement(e.Fragment,null,e.createElement("div",{ref:p,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:l.prefixClass+"-popover-body",ref:u},e.createElement(P,{customClassName:l.prefixClass+"-popover-body-arrow",position:o}),n))},L=function(t){var n=t.closeOnEscape,r=t.onClose,a=e.useContext(i);return h(27,(function(){return n&&r()})),e.createElement("div",{className:a.prefixClass+"-popover-overlay"})},R=function(t){var n=t.children,r=t.offset,a=t.position,o=t.targetRef,s=e.useContext(i),c=e.createRef(),l=e.createRef();return b(c,o,l,a,r),e.createElement(e.Fragment,null,e.createElement("div",{ref:l,style:{left:0,position:"absolute",top:0}}),e.createElement("div",{className:s.prefixClass+"-tooltip-body",ref:c},e.createElement(P,{customClassName:s.prefixClass+"-tooltip-body-arrow",position:a}),e.createElement("div",{className:s.prefixClass+"-tooltip-body-content"},n)))};!function(e){e.ActualSize="ActualSize",e.PageFit="PageFit",e.PageWidth="PageWidth"}(y||(y={}));var T=y,S=function(e,t){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};
/*! *****************************************************************************

@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function N(e,t){function n(){this.constructor=e}M(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var S,H=function(){return(H=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(S||(S={}));var B,F=S;!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 I,A=B,D=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),W=function(e,t,n,r){var a=parseInt(e,10);return a>=t&&a<=n?a:r},j=function(t){var n=t.annotation,r=e.useContext(i),a="";if(n.modificationDate){var s=function(e){var t=D.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=W(t[2],1,12,1)-1,a=W(t[3],1,31,1),o=W(t[4],0,23,0),i=W(t[5],0,59,0),s=W(t[6],0,59,0),c=t[7]||"Z",l=W(t[8],0,23,0),p=W(t[9],0,59,0);switch(c){case"-":o+=l,i+=p;break;case"+":o-=l,i-=p}return new Date(Date.UTC(n,r,a,o,i,s))}(n.modificationDate);a=s?s.toLocaleDateString()+", "+s.toLocaleTimeString():""}return e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper",style:{top:n.annotationType===o.Popup?"":"100%"}},n.title&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-header"},e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-title"},n.title),e.createElement("span",{className:r.prefixClass+"-annotation-popup-wrapper-date"},a)),n.contents&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-content"},n.contents.split("\n").map((function(t,n){return e.createElement(e.Fragment,{key:n},t,e.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(I||(I={}));var V=function(t){var n,r=t.annotation,o=t.children,i=t.ignoreBorder,s=t.hasPopup,c=t.isRenderable,l=t.page,p=t.viewport,u=r.rect,d=function(){var t=C(),n=t.opened,r=t.toggle,o=e.useState(I.Hover),i=o[0],s=o[1];return{opened:n,closeOnHover:function(){i===I.Hover&&r(a.Close)},openOnHover:function(){i===I.Hover&&r(a.Open)},toggleOnClick:function(){switch(i){case I.Click:n&&s(I.Hover),r(a.Toggle);break;case I.Hover:s(I.Click),r(a.Open)}}}}(),f=d.closeOnHover,g=d.opened,m=d.openOnHover,h=d.toggleOnClick,v=(n=[u[0],l.view[3]+l.view[1]-u[1],u[2],l.view[3]+l.view[1]-u[3]],[Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),E=u[2]-u[0],x=u[3]-u[1],w={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&r.borderStyle.width>0){switch(r.borderStyle.style){case A.Dashed:w.borderStyle="dashed";break;case A.Solid:w.borderStyle="solid";break;case A.Underline:w=Object.assign({borderBottomStyle:"solid"},w);break;case A.Beveled:case A.Inset:}var y=r.borderStyle.width;w.borderWidth=y+"px",r.borderStyle.style!==A.Underline&&(E-=2*y,x-=2*y);var k=r.borderStyle,P=k.horizontalCornerRadius,b=k.verticalCornerRadius;(P>0||b>0)&&(w.borderRadius=P+"px / "+b+"px"),r.color?w.borderColor="rgb("+(0|r.color[0])+", "+(0|r.color[1])+", "+(0|r.color[2])+")":w.borderWidth="0"}return e.createElement(e.Fragment,null,c&&o({popup:{opened:g,closeOnHover:f,openOnHover:m,toggleOnClick:h},slot:{attrs:{style:Object.assign({height:x+"px",left:v[0]+"px",top:v[1]+"px",transform:"matrix("+p.transform.join(",")+")",transformOrigin:"-"+v[0]+"px -"+v[1]+"px",width:E+"px"},w)},children:e.createElement(e.Fragment,null,s&&g&&e.createElement(j,{annotation:r}))}}))},_=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-caret","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-circle","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("circle",{cy:u/2,fill:"none",rx:p/2-d/2,ry:u/2-d/2,stroke:"transparent",strokeWidth:d||1})),t.slot.children)}))},q=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!1!==n.hasPopup||!n.title&&!n.contents),c=function(){var e,t,r,a,o=n.file;o&&(e=o.filename,t=o.content,r="string"==typeof t?"":URL.createObjectURL(new Blob([t],{type:""})),(a=document.createElement("a")).style.display="none",a.href=r||e,a.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(a),a.click(),document.body.removeChild(a),r&&URL.revokeObjectURL(r))};return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:!0,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-file-attachment","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onDoubleClick:c,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},U=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-free-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},Z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!n.title&&!n.contents),c=!n.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(n.parentType);return e.useLayoutEffect((function(){if(n.parentId){var e=document.querySelector('[data-annotation-id="'+n.parentId+'"]'),t=document.querySelector('[data-annotation-id="'+n.id+'"]');if(e&&t){var r=parseFloat(e.style.left),a=parseFloat(e.style.top)+parseFloat(e.style.height);t.style.left=r+"px",t.style.top=a+"px",t.style.transformOrigin="-"+r+"px -"+a+"px"}}}),[]),e.createElement(V,{annotation:n,hasPopup:c,ignoreBorder:!1,isRenderable:s,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-popup","data-annotation-id":n.id}),e.createElement(j,{annotation:n}))}))},G=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),l=!1===n.hasPopup,p=!!(n.hasPopup||n.title||n.contents);if(n.quadPoints&&n.quadPoints.length>0){var u=n.quadPoints.map((function(e){return Object.assign({},n,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return e.createElement(e.Fragment,null,u.map((function(t,n){return e.createElement(G,{key:n,annotation:t,childAnnotation:r,page:a,viewport:s})})))}return e.createElement(V,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:p,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",H({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-highlight","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(Z,{annotation:r,page:a,viewport:s}))}))},J=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-ink","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.inkLists&&n.inkLists.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},n.inkLists.map((function(t,n){return e.createElement("polyline",{key:n,fill:"none",stroke:"transparent",strokeWidth:d||1,points:t.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})}))),t.slot.children)}))},X=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-line","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("line",{stroke:"transparent",strokeWidth:d||1,x1:l[2]-n.lineCoordinates[0],x2:l[2]-n.lineCoordinates[2],y1:l[3]-n.lineCoordinates[1],y2:l[3]-n.lineCoordinates[3]})),t.slot.children)}))},Y=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:T.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:T.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},K=function(t){var n=t.annotation,r=t.doc,a=t.page,o=t.viewport,s=t.onExecuteNamedAction,c=t.onJumpToDest,l=e.useContext(i),p=!!(n.url||n.dest||n.action),u=n.url?{href:n.url,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:n.url}:{href:"",onClick:function(e){e.preventDefault(),n.action?s(n.action):Y(r,n.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;c(t+1,n,0,r)}))}};return e.createElement(V,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:p,page:a,viewport:o},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-link","data-annotation-id":n.id}),e.createElement("a",H({},u)))}))},Q=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polygon","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},$=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polyline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},ee=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,p=l[2]-l[0],u=l[3]-l[1],d=n.borderStyle.width;return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-square","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:u+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+p+" "+u,width:p+"px"},e.createElement("rect",{height:u-d,fill:"none",stroke:"transparent",strokeWidth:d||1,x:d/2,y:d/2,width:p-d})),t.slot.children)}))},te=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-squiggly","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},ne=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-stamp","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},re=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-strike-out","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},ae=function(){return e.createElement(c,{size:16},e.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"}),e.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),e.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),e.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},oe=function(){return e.createElement(c,{size:16},e.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"}),e.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"}),e.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),e.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),e.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),e.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),e.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),e.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),e.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),e.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},ie=function(){return e.createElement(c,{size:16},e.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"}),e.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"}))},se=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),e.createElement("path",{d:"M6 4.5L6 0.5"}),e.createElement("path",{d:"M18 4.5L18 0.5"}),e.createElement("path",{d:"M10 4.5L10 0.5"}),e.createElement("path",{d:"M14 4.5L14 0.5"}))},ce=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),e.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),e.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},le=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},pe=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),p=!1===n.hasPopup,u=!!(n.hasPopup||n.title||n.contents),d=n.name?n.name.toLowerCase():"";return e.createElement(V,{annotation:n,hasPopup:p,ignoreBorder:!1,isRenderable:u,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",H({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),d&&e.createElement("div",{className:c.prefixClass+"-annotation-text-icon"},"check"===d&&e.createElement(l,null),"comment"===d&&e.createElement(ae,null),"help"===d&&e.createElement(oe,null),"insert"===d&&e.createElement(le,null),"key"===d&&e.createElement(ie,null),"note"===d&&e.createElement(se,null),("newparagraph"===d||"paragraph"===d)&&e.createElement(ce,null)),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(Z,{annotation:r,page:a,viewport:s}))}))},ue=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(V,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-underline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},de=function(t){var n=t.annotations,r=t.containerRef,a=t.doc,i=t.page,s=t.pageIndex,c=t.plugins,l=t.rotation,p=t.scale,u=t.onExecuteNamedAction,d=t.onJumpToDest,f=i.getViewport({rotation:l,scale:p}).clone({dontFlip:!0}),g=n.filter((function(e){return!e.parentId}));return e.useEffect((function(){var e=r.current;e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:g,container:e,pageIndex:s,rotation:l,scale:p})}))}),[]),e.createElement(e.Fragment,null,g.map((function(t){var r=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case o.Caret:return e.createElement(_,{key:t.id,annotation:t,page:i,viewport:f});case o.Circle:return e.createElement(z,{key:t.id,annotation:t,page:i,viewport:f});case o.FileAttachment:return e.createElement(q,{key:t.id,annotation:t,page:i,viewport:f});case o.FreeText:return e.createElement(U,{key:t.id,annotation:t,page:i,viewport:f});case o.Highlight:return e.createElement(G,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Ink:return e.createElement(J,{key:t.id,annotation:t,page:i,viewport:f});case o.Line:return e.createElement(X,{key:t.id,annotation:t,page:i,viewport:f});case o.Link:return e.createElement(K,{key:t.id,annotation:t,doc:a,page:i,viewport:f,onExecuteNamedAction:u,onJumpToDest:d});case o.Polygon:return e.createElement(Q,{key:t.id,annotation:t,page:i,viewport:f});case o.Polyline:return e.createElement($,{key:t.id,annotation:t,page:i,viewport:f});case o.Popup:return e.createElement(Z,{key:t.id,annotation:t,page:i,viewport:f});case o.Square:return e.createElement(ee,{key:t.id,annotation:t,page:i,viewport:f});case o.Squiggly:return e.createElement(te,{key:t.id,annotation:t,page:i,viewport:f});case o.Stamp:return e.createElement(ne,{key:t.id,annotation:t,page:i,viewport:f});case o.StrikeOut:return e.createElement(re,{key:t.id,annotation:t,page:i,viewport:f});case o.Text:return e.createElement(pe,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Underline:return e.createElement(ue,{key:t.id,annotation:t,page:i,viewport:f});default:return e.createElement(e.Fragment,{key:t.id})}})))},fe=function(t){var n=t.page,r=t.renderAnnotations,a=e.useState({loading:!0,annotations:[]}),o=a[0],i=a[1];return e.useEffect((function(){n.getAnnotations({intent:"display"}).then((function(e){i({loading:!1,annotations:e})}))}),[]),o.loading?e.createElement(e.Fragment,null):r(o.annotations)},ge=function(t){var n=t.doc,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.onExecuteNamedAction,p=t.onJumpToDest,u=e.useContext(i),d=e.createRef();return e.createElement("div",{ref:d,className:u.prefixClass+"-annotation-layer"},e.createElement(fe,{page:r,renderAnnotations:function(t){return e.createElement(de,{annotations:t,containerRef:d,doc:n,page:r,pageIndex:a,plugins:o,rotation:s,scale:c,onExecuteNamedAction:l,onJumpToDest:p})}}))},me=function(t){var n=t.callback,r=t.children,a=t.rotation,o=t.scale;return e.useLayoutEffect((function(){n()}),[a,o]),e.createElement(e.Fragment,null,r)},he=function(t){var n=t.height,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.width,p=e.useContext(i),u=e.createRef(),d=e.useRef(),f=window.devicePixelRatio||1;return e.createElement(me,{callback:function(){var e=d.current;e&&e.cancel();var t=u.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:F.PreRender})})),t.height=n*f,t.width=l*f,t.style.opacity="0";var i=t.getContext("2d",{alpha:!1}),p=r.getViewport({rotation:s,scale:c*f});d.current=r.render({canvasContext:i,viewport:p}),d.current.promise.then((function(){t.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:F.DidRender})}))}),(function(){}))},rotation:s,scale:c},e.createElement("div",{className:p.prefixClass+"-canvas-layer",style:{height:n+"px",width:l+"px"}},e.createElement("canvas",{ref:u,style:{transform:"scale("+1/f+")",transformOrigin:"top left"}})))},ve=function(t){var n=t.height,a=t.page,o=t.rotation,s=t.scale,c=t.width,l=e.useContext(i),p=e.createRef();return e.createElement(me,{callback:function(){var e=p.current,t=a.getViewport({rotation:o,scale:s});a.getOperatorList().then((function(o){!function(){var e=p.current;e&&(e.innerHTML="")}(),new r.SVGGraphics(a.commonObjs,a.objs).getSVG(o,t).then((function(t){t.style.height=n+"px",t.style.width=c+"px",e.appendChild(t)}))}))},rotation:o,scale:s},e.createElement("div",{className:l.prefixClass+"-svg-layer",ref:p}))},Ee=function(t){var n=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=e.useContext(i),p=e.createRef(),u=e.useRef();return e.createElement(me,{callback:function(){var e=u.current;e&&e.cancel();var t=p.current;if(t){var i=n.getViewport({rotation:s,scale:c});o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:F.PreRender})})),n.getTextContent().then((function(e){!function(){var e=p.current;if(e)for(var t=e.querySelectorAll("span."+l.prefixClass+"-text"),n=t.length,r=0;r<n;r++){var a=t[r];e.removeChild(a)}}(),u.current=r.renderTextLayer({container:t,textContent:e,viewport:i}),u.current.promise.then((function(){for(var e=t.childNodes,n=e.length,r=0;r<n;r++){e[r].classList.add(l.prefixClass+"-text")}o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:F.DidRender})}))}),(function(){}))}))}},rotation:s,scale:c},e.createElement("div",{className:l.prefixClass+"-text-layer",ref:p}))},xe=function(t){var n=t.currentPage,r=t.doc,a=t.height,o=t.pageIndex,s=t.plugins,c=t.renderPage,l=t.rotation,d=t.scale,f=t.width,g=t.onExecuteNamedAction,m=t.onJumpToDest,h=t.onPageVisibilityChanged,v=e.useContext(i),E=e.useState({page:null,pageHeight:a,pageWidth:f,viewportRotation:0}),x=E[0],C=E[1],w=x.page,y=x.pageHeight,k=x.pageWidth,P=e.useRef(!1),b=Array(10).fill(null).map((function(e,t){return t/10})),O=k*d,L=y*d,R=Math.abs(l)%180==0,T=R?O:L,M=R?L:O,N=function(){P.current||(P.current=!0,r.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});C({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},S=c||function(t){return e.createElement(e.Fragment,null,t.canvasLayer.children,t.textLayer.children,t.annotationLayer.children)},H=(l+x.viewportRotation)%360;return e.useEffect((function(){n-2<=o&&o<=n+2&&N()}),[n]),e.createElement(u,{onVisibilityChanged:function(e){h(o,e.isVisible?e.ratio:-1),e.isVisible&&N()},threshold:b},e.createElement("div",{className:v.prefixClass+"-page-layer",style:{height:M+"px",width:T+"px"}},w?e.createElement(e.Fragment,null,S({annotationLayer:{attrs:{},children:e.createElement(ge,{doc:r,page:w,pageIndex:o,plugins:s,rotation:H,scale:d,onExecuteNamedAction:g,onJumpToDest:m})},canvasLayer:{attrs:{},children:e.createElement(he,{height:M,page:w,pageIndex:o,plugins:s,rotation:H,scale:d,width:T})},doc:r,height:M,pageIndex:o,rotation:l,scale:d,svgLayer:{attrs:{},children:e.createElement(ve,{height:M,page:w,rotation:H,scale:d,width:T})},textLayer:{attrs:{},children:e.createElement(Ee,{page:w,pageIndex:o,plugins:s,rotation:H,scale:d})},width:T}),s.map((function(t,n){return t.renderPageLayer?e.createElement(e.Fragment,{key:n},t.renderPageLayer({doc:r,height:M,pageIndex:o,rotation:l,scale:d,width:T})):e.createElement(e.Fragment,{key:n})}))):e.createElement(p,null)))},Ce=function(t){var n=t.defaultScale,r=t.doc,a=t.initialPage,o=t.pageSize,s=t.plugins,c=t.renderPage,l=t.viewerState,p=t.onDocumentLoad,u=t.onOpenFile,d=t.onPageChange,f=t.onZoom,g=e.useContext(i),m=e.useRef(null),h=e.useRef(null),v=e.useState(o.scale),E=v[0],x=v[1],C=e.useState(0),w=C[0],y=C[1],k=e.useState(0),P=k[0],b=k[1],O=e.useRef(l),L=r.numPages,R=o.pageWidth,M=o.pageHeight,N=Array(L).fill(null),S=N.map((function(){return 0})),B=N.map((function(){return e.useRef()})),F=function(e){var t=e;s.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),O.current=t},I=function(){return h.current},A=function(e){return e<0||e>=L?null:B[e].current},D=function(){return O.current},W=function(e,t,n,a){var o=h.current,i=O.current;if(o&&i){var s=e+1;r.getPage(s).then((function(r){var s=r.getViewport({scale:1}),c=0,l=t||0,p=n||0;switch(a){case T.PageFit:c=0,p=0,z(T.PageFit);break;case T.PageWidth:c=(s.height-l)*i.scale,p*=i.scale,z(T.PageWidth);break;default:c=(s.height-l)*i.scale,p*=i.scale}var u=B[e].current;u&&(o.scrollTop=u.offsetTop+c,o.scrollLeft=u.offsetLeft+p)}))}},j=function(e){if(!(e<0||e>=L)){var t=h.current,n=B[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),y(e)}},V=function(e){var t,n;"pdf"===(t=e.name,n=t.split(/\./).pop(),n?n.toLowerCase():"").toLowerCase()&&new Promise((function(t){var n=new FileReader;n.readAsArrayBuffer(e),n.onload=function(){var e=new Uint8Array(n.result);t(e)}})).then((function(t){u(e.name,t)}))},_=function(e){b(e),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:R,rotation:e,scale:E})},z=function(e){var t=h.current,n=O.current;if(t&&n){var a=1;switch(e){case T.ActualSize:a=1;break;case T.PageFit:a=Math.min((t.clientWidth-17)/R,(t.clientHeight-16)/M);break;case T.PageWidth:a=(t.clientWidth-17)/R;break;default:a=e}x(a),f({doc:r,scale:a})}};e.useEffect((function(){var e=h.current,t=O.current;e&&t&&(e.scrollTop=e.scrollTop*E/t.scale,e.scrollLeft=e.scrollLeft*E/t.scale,F({file:l.file,pageIndex:t.pageIndex,pageHeight:M,pageWidth:R,rotation:P,scale:E}))}),[E]);e.useEffect((function(){var e={getPageElement:A,getPagesContainer:I,getViewerState:D,jumpToDestination:W,jumpToPage:j,openFile:V,rotate:_,setViewerState:F,zoom:z};return s.forEach((function(t){t.install&&t.install(e)})),function(){s.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),e.useEffect((function(){p({doc:r}),s.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r})})),a&&j(a)}),[]),e.useEffect((function(){d({currentPage:w,doc:r}),F({file:l.file,pageIndex:w,pageHeight:M,pageWidth:R,rotation:P,scale:E})}),[w]),e.useEffect((function(){n&&z(n)}),[]);var q,U=function(e,t){S[e]=t;var n=S.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);y(n)},Z=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":j(0);break;case"LastPage":j(L-1);break;case"NextPage":n<L&&j(n);break;case"PrevPage":t>=0&&j(t)}},G=function(t){return e.createElement("div",H({},t.attrs,{style:t.attrs&&t.attrs.style?t.attrs.style:{}}),t.children,t.subSlot&&G(t.subSlot))};return G((q={attrs:{ref:m,style:{height:"100%"}},children:e.createElement(e.Fragment,null),subSlot:{attrs:{ref:h,style:{height:"100%",overflow:"auto",position:"relative"}},children:e.createElement(e.Fragment,null,Array(L).fill(0).map((function(t,n){return e.createElement("div",{className:g.prefixClass+"-inner-page",key:"pagelayer-"+n,ref:function(e){B[n].current=e}},e.createElement(xe,{currentPage:w,doc:r,height:M,pageIndex:n,plugins:s,renderPage:c,rotation:P,scale:E,width:R,onExecuteNamedAction:Z,onJumpToDest:W,onPageVisibilityChanged:U}))})))}},s.forEach((function(e){e.renderViewer&&(q=e.renderViewer({containerRef:m,doc:r,pageHeight:M,pageWidth:R,rotation:P,slot:q,jumpToPage:j,openFile:V,rotate:_,zoom:z}))})),q))},we=[.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],ye=function(t){var n=t.doc,r=t.render,a=e.useContext(i),o=e.useRef(null),s=e.useState({pageHeight:0,pageWidth:0,scale:1}),c=s[0],l=s[1];return e.useEffect((function(){n.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,r=t.height,a=o.current;if(a){var i,s,c=(a.clientWidth-100)/n,p=(i=Math.max(1,c),-1===(s=we.findIndex((function(e){return e>=i})))||0===s?i:we[s-1]);l({pageHeight:r,pageWidth:n,scale:p})}}))}),[n]),0===c.pageWidth?e.createElement("div",{className:a.prefixClass+"-page-size-calculator",ref:o},e.createElement(p,null)):r(c)},ke=function(){},Pe=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return N(t,e),t}(ke),be=function(t){var n=t.verifyPasswordFn,r=e.useContext(d),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.askingPassword.requirePasswordToOpen,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.askingPassword.submit))))},Oe=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return N(t,e),t}(ke),Le=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return N(t,e),t}(ke),Re=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return N(t,e),t}(ke),Te=function(t){var n=t.verifyPasswordFn,r=e.useContext(d),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.wrongPassword.tryAgain,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.wrongPassword.submit))))},Me=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return N(t,e),t}(ke),Ne=function(t){var n=t.characterMap,a=t.file,o=t.httpHeaders,s=t.render,c=t.renderError,l=t.renderLoader,u=t.withCredentials,d=e.useContext(i),f=e.useState(new Re(0)),g=f[0],m=f[1],h=e.useState(0),v=h[0],E=h[1],x=e.useState(null),C=x[0],w=x[1];switch(e.useEffect((function(){m(new Re(0));var e=Object.assign({httpHeaders:o,withCredentials:u},"string"==typeof a?{url:a}:{data:a},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),t=r.getDocument(e);return t.onPassword=function(e,t){switch(t){case r.PasswordResponses.NEED_PASSWORD:m(new Pe(e));break;case r.PasswordResponses.INCORRECT_PASSWORD:m(new Me(e))}},t.onProgress=function(e){e.total>0?E(Math.min(100,100*e.loaded/e.total)):E(100)},t.promise.then((function(e){return w(e)}),(function(e){return m(new Le({message:e.message||"Cannot load document",name:e.name}))})),function(){t.destroy()}}),[a]),e.useEffect((function(){m(100===v&&C?new Oe(C):new Re(v))}),[v,C]),!0){case g instanceof Pe:return e.createElement(be,{verifyPasswordFn:g.verifyPasswordFn});case g instanceof Me:return e.createElement(Te,{verifyPasswordFn:g.verifyPasswordFn});case g instanceof Oe:return s(g.doc);case g instanceof Le:return c?c(g.error):e.createElement("div",{className:d.prefixClass+"-doc-error"},e.createElement("div",{className:d.prefixClass+"-doc-error-text"},g.error.message));case g instanceof Re:return e.createElement("div",{className:d.prefixClass+"-doc-loading"},l?l(g.percentages):e.createElement(p,null));default:return e.createElement("div",{className:d.prefixClass+"-doc-loading"},e.createElement(p,null))}},Se=function(t){var n=t.children,r=t.prefixClass;return e.createElement(i.Provider,{value:{prefixClass:r||"rpv-core"}},n)};exports.AnnotationType=o,exports.Button=function(t){var n,r=t.children,a=t.isSelected,o=void 0!==a&&a,c=t.onClick,l=e.useContext(i);return e.createElement("button",{className:s((n={},n[l.prefixClass+"-button"]=!0,n[l.prefixClass+"-button-selected"]=o,n)),onClick:c},r)},exports.Icon=c,exports.LayerRenderStatus=F,exports.LocalizationContext=d,exports.LocalizationProvider=g,exports.Menu=function(t){var n=t.children,r=e.useContext(i);return e.createElement("ul",{className:r.prefixClass+"-menu"},n)},exports.MenuDivider=function(){var t=e.useContext(i);return e.createElement("li",{className:t.prefixClass+"-menu-divider"})},exports.MenuItem=function(t){var n=t.checked,r=void 0!==n&&n,a=t.children,o=t.icon,s=void 0===o?null:o,c=t.onClick,p=e.useContext(i);return e.createElement("li",{className:p.prefixClass+"-menu-item",onClick:c},e.createElement("div",{className:p.prefixClass+"-menu-item-icon"},s),e.createElement("div",{className:p.prefixClass+"-menu-item-label"},a),e.createElement("div",{className:p.prefixClass+"-menu-item-check"},r&&e.createElement(l,null)))},exports.Modal=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.target;return e.createElement(w,{target:o,content:function(t){return e.createElement(E,null,e.createElement(v,{closeOnClickOutside:n,closeOnEscape:r,onToggle:t},a(t)))}})},exports.Observer=u,exports.Popover=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.offset,i=t.position,s=t.target,c=e.createRef();return e.createElement(w,{content:function(t){return e.createElement(e.Fragment,null,e.createElement(L,{closeOnEscape:r,onClose:t}),e.createElement(O,{closeOnClickOutside:n,offset:o,position:i,targetRef:c,onClose:t},a(t)))},target:function(t,n){return e.createElement("div",{ref:c},s(t,n))}})},exports.Position=k,exports.PrimaryButton=function(t){var n=t.children,r=t.onClick,a=e.useContext(i);return e.createElement("button",{className:a.prefixClass+"-primary-button",onClick:r},n)},exports.ProgressBar=function(t){var n=t.progress,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-progress-bar"},e.createElement("div",{className:r.prefixClass+"-progress-bar-inner",style:{width:n+"%"}},n,"%"))},exports.Separator=function(){var t=e.useContext(i);return e.createElement("div",{className:t.prefixClass+"-separator"})},exports.SpecialZoomLevel=T,exports.Spinner=p,exports.Tooltip=function(t){var n=t.content,r=t.offset,o=t.position,i=t.target,s=e.createRef();return e.createElement(w,{target:function(t){return e.createElement("div",{ref:s,onMouseEnter:function(){t(a.Open)},onMouseLeave:function(){t(a.Close)}},i)},content:function(){return e.createElement(R,{offset:r,position:o,targetRef:s},n())}})},exports.Viewer=function(t){var n=t.characterMap,r=t.defaultScale,a=t.fileUrl,o=t.httpHeaders,i=void 0===o?{}:o,s=t.initialPage,c=void 0===s?0:s,l=t.localization,p=t.plugins,u=void 0===p?[]:p,d=t.prefixClass,f=t.renderError,m=t.renderPage,h=t.renderLoader,v=t.withCredentials,E=void 0!==v&&v,x=t.onDocumentLoad,C=void 0===x?function(){}:x,w=t.onPageChange,y=void 0===w?function(){}:w,k=t.onZoom,P=void 0===k?function(){}:k,b=e.useState({data:a,name:"string"==typeof a?a:""}),O=b[0],L=b[1],R=function(e,t){L({data:t,name:e})};return e.useEffect((function(){L({data:a,name:"string"==typeof a?a:""})}),[a]),e.createElement(Se,{prefixClass:d},e.createElement(g,{localization:l},(function(t){return e.createElement(Ne,{characterMap:n,file:O.data,httpHeaders:i,render:function(t){return e.createElement(ye,{doc:t,render:function(n){return e.createElement(Ce,{defaultScale:r,doc:t,initialPage:c,pageSize:n,plugins:u,renderPage:m,viewerState:{file:O,pageIndex:c,pageHeight:n.pageHeight,pageWidth:n.pageWidth,rotation:0,scale:n.scale},onDocumentLoad:C,onOpenFile:R,onPageChange:y,onZoom:P})}})},renderError:f,renderLoader:h,withCredentials:E})})))},exports.Worker=function(t){var n=t.children,a=t.workerUrl;return r.GlobalWorkerOptions.workerSrc=a,e.createElement(e.Fragment,null,n)},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 a;t=H(H({},t),((a={})[e]=r,a)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=Y;
***************************************************************************** */function M(e,t){function n(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var N,H=function(){return(H=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};!function(e){e[e.PreRender=0]="PreRender",e[e.DidRender=1]="DidRender"}(N||(N={}));var F,B=N;!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 I,A=F,D=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),W=function(e,t,n,r){var a=parseInt(e,10);return a>=t&&a<=n?a:r},V=function(t){var n=t.annotation,r=e.useContext(i),a="";if(n.modificationDate){var s=function(e){var t=D.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=W(t[2],1,12,1)-1,a=W(t[3],1,31,1),o=W(t[4],0,23,0),i=W(t[5],0,59,0),s=W(t[6],0,59,0),c=t[7]||"Z",l=W(t[8],0,23,0),u=W(t[9],0,59,0);switch(c){case"-":o+=l,i+=u;break;case"+":o-=l,i-=u}return new Date(Date.UTC(n,r,a,o,i,s))}(n.modificationDate);a=s?s.toLocaleDateString()+", "+s.toLocaleTimeString():""}return e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper",style:{top:n.annotationType===o.Popup?"":"100%"}},n.title&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-header"},e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-title"},n.title),e.createElement("span",{className:r.prefixClass+"-annotation-popup-wrapper-date"},a)),n.contents&&e.createElement("div",{className:r.prefixClass+"-annotation-popup-wrapper-content"},n.contents.split("\n").map((function(t,n){return e.createElement(e.Fragment,{key:n},t,e.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(I||(I={}));var j=function(t){var n,r=t.annotation,o=t.children,i=t.ignoreBorder,s=t.hasPopup,c=t.isRenderable,l=t.page,u=t.viewport,p=r.rect,d=function(){var t=C(),n=t.opened,r=t.toggle,o=e.useState(I.Hover),i=o[0],s=o[1];return{opened:n,closeOnHover:function(){i===I.Hover&&r(a.Close)},openOnHover:function(){i===I.Hover&&r(a.Open)},toggleOnClick:function(){switch(i){case I.Click:n&&s(I.Hover),r(a.Toggle);break;case I.Hover:s(I.Click),r(a.Open)}}}}(),f=d.closeOnHover,g=d.opened,m=d.openOnHover,h=d.toggleOnClick,v=(n=[p[0],l.view[3]+l.view[1]-p[1],p[2],l.view[3]+l.view[1]-p[3]],[Math.min(n[0],n[2]),Math.min(n[1],n[3]),Math.max(n[0],n[2]),Math.max(n[1],n[3])]),E=p[2]-p[0],x=p[3]-p[1],w={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&r.borderStyle.width>0){switch(r.borderStyle.style){case A.Dashed:w.borderStyle="dashed";break;case A.Solid:w.borderStyle="solid";break;case A.Underline:w=Object.assign({borderBottomStyle:"solid"},w);break;case A.Beveled:case A.Inset:}var y=r.borderStyle.width;w.borderWidth=y+"px",r.borderStyle.style!==A.Underline&&(E-=2*y,x-=2*y);var k=r.borderStyle,b=k.horizontalCornerRadius,P=k.verticalCornerRadius;(b>0||P>0)&&(w.borderRadius=b+"px / "+P+"px"),r.color?w.borderColor="rgb("+(0|r.color[0])+", "+(0|r.color[1])+", "+(0|r.color[2])+")":w.borderWidth="0"}return e.createElement(e.Fragment,null,c&&o({popup:{opened:g,closeOnHover:f,openOnHover:m,toggleOnClick:h},slot:{attrs:{style:Object.assign({height:x+"px",left:v[0]+"px",top:v[1]+"px",transform:"matrix("+u.transform.join(",")+")",transformOrigin:"-"+v[0]+"px -"+v[1]+"px",width:E+"px"},w)},children:e.createElement(e.Fragment,null,s&&g&&e.createElement(V,{annotation:r}))}}))},_=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-caret","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-circle","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},e.createElement("circle",{cy:p/2,fill:"none",rx:u/2-d/2,ry:p/2-d/2,stroke:"transparent",strokeWidth:d||1})),t.slot.children)}))},q=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!1!==n.hasPopup||!n.title&&!n.contents),c=function(){var e,t,r,a,o=n.file;o&&(e=o.filename,t=o.content,r="string"==typeof t?"":URL.createObjectURL(new Blob([t],{type:""})),(a=document.createElement("a")).style.display="none",a.href=r||e,a.setAttribute("download",function(e){var t=e.split("/").pop();return t?t.split("#")[0].split("?")[0]:e}(e)),document.body.appendChild(a),a.click(),document.body.removeChild(a),r&&URL.revokeObjectURL(r))};return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:!0,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-file-attachment","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onDoubleClick:c,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},U=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-free-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},Z=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!(!n.title&&!n.contents),c=!n.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(n.parentType);return e.useLayoutEffect((function(){if(n.parentId){var e=document.querySelector('[data-annotation-id="'+n.parentId+'"]'),t=document.querySelector('[data-annotation-id="'+n.id+'"]');if(e&&t){var r=parseFloat(e.style.left),a=parseFloat(e.style.top)+parseFloat(e.style.height);t.style.left=r+"px",t.style.top=a+"px",t.style.transformOrigin="-"+r+"px -"+a+"px"}}}),[]),e.createElement(j,{annotation:n,hasPopup:c,ignoreBorder:!1,isRenderable:s,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-popup","data-annotation-id":n.id}),e.createElement(V,{annotation:n}))}))},G=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),l=!1===n.hasPopup,u=!!(n.hasPopup||n.title||n.contents);if(n.quadPoints&&n.quadPoints.length>0){var p=n.quadPoints.map((function(e){return Object.assign({},n,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return e.createElement(e.Fragment,null,p.map((function(t,n){return e.createElement(G,{key:n,annotation:t,childAnnotation:r,page:a,viewport:s})})))}return e.createElement(j,{annotation:n,hasPopup:l,ignoreBorder:!0,isRenderable:u,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",H({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-highlight","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(Z,{annotation:r,page:a,viewport:s}))}))},J=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-ink","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.inkLists&&n.inkLists.length&&e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},n.inkLists.map((function(t,n){return e.createElement("polyline",{key:n,fill:"none",stroke:"transparent",strokeWidth:d||1,points:t.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})}))),t.slot.children)}))},X=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-line","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},e.createElement("line",{stroke:"transparent",strokeWidth:d||1,x1:l[2]-n.lineCoordinates[0],x2:l[2]-n.lineCoordinates[2],y1:l[3]-n.lineCoordinates[1],y2:l[3]-n.lineCoordinates[3]})),t.slot.children)}))},Y=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:T.PageFit};case"FitH":case"FitBH":return{bottomOffset:t[2],pageIndex:e-1,scaleTo:T.PageWidth};default:return{bottomOffset:0,pageIndex:e-1,scaleTo:1}}}(e.pageIndex,e.destArray);n(t)}))}))},K=function(t){var n=t.annotation,r=t.doc,a=t.page,o=t.viewport,s=t.onExecuteNamedAction,c=t.onJumpToDest,l=e.useContext(i),u=!!(n.url||n.dest||n.action),p=n.url?{href:n.url,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:n.url}:{href:"",onClick:function(e){e.preventDefault(),n.action?s(n.action):Y(r,n.dest).then((function(e){var t=e.pageIndex,n=e.bottomOffset,r=e.scaleTo;c(t+1,n,0,r)}))}};return e.createElement(j,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:u,page:a,viewport:o},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:l.prefixClass+"-annotation "+l.prefixClass+"-annotation-link","data-annotation-id":n.id}),e.createElement("a",H({},p)))}))},Q=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polygon","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},e.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},$=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-polyline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),n.vertices&&n.vertices.length&&e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},e.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:d||1,points:n.vertices.map((function(e){return e.x-l[0]+","+(l[3]-e.y)})).join(" ")})),t.slot.children)}))},ee=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents),l=n.rect,u=l[2]-l[0],p=l[3]-l[1],d=n.borderStyle.width;return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-square","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),e.createElement("svg",{height:p+"px",preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 "+u+" "+p,width:u+"px"},e.createElement("rect",{height:p-d,fill:"none",stroke:"transparent",strokeWidth:d||1,x:d/2,y:d/2,width:u-d})),t.slot.children)}))},te=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-squiggly","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},ne=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-stamp","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},re=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-strike-out","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},ae=function(){return e.createElement(c,{size:16},e.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"}),e.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),e.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),e.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},oe=function(){return e.createElement(c,{size:16},e.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"}),e.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"}),e.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),e.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),e.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),e.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),e.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),e.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),e.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),e.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},ie=function(){return e.createElement(c,{size:16},e.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"}),e.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"}))},se=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),e.createElement("path",{d:"M6 4.5L6 0.5"}),e.createElement("path",{d:"M18 4.5L18 0.5"}),e.createElement("path",{d:"M10 4.5L10 0.5"}),e.createElement("path",{d:"M14 4.5L14 0.5"}))},ce=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),e.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),e.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},le=function(){return e.createElement(c,{size:16},e.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},ue=function(t){var n=t.annotation,r=t.childAnnotation,a=t.page,s=t.viewport,c=e.useContext(i),u=!1===n.hasPopup,p=!!(n.hasPopup||n.title||n.contents),d=n.name?n.name.toLowerCase():"";return e.createElement(j,{annotation:n,hasPopup:u,ignoreBorder:!1,isRenderable:p,page:a,viewport:s},(function(t){return e.createElement(e.Fragment,null,e.createElement("div",H({},t.slot.attrs,{className:c.prefixClass+"-annotation "+c.prefixClass+"-annotation-text","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),d&&e.createElement("div",{className:c.prefixClass+"-annotation-text-icon"},"check"===d&&e.createElement(l,null),"comment"===d&&e.createElement(ae,null),"help"===d&&e.createElement(oe,null),"insert"===d&&e.createElement(le,null),"key"===d&&e.createElement(ie,null),"note"===d&&e.createElement(se,null),("newparagraph"===d||"paragraph"===d)&&e.createElement(ce,null)),t.slot.children),r&&r.annotationType===o.Popup&&t.popup.opened&&e.createElement(Z,{annotation:r,page:a,viewport:s}))}))},pe=function(t){var n=t.annotation,r=t.page,a=t.viewport,o=e.useContext(i),s=!1===n.hasPopup,c=!!(n.hasPopup||n.title||n.contents);return e.createElement(j,{annotation:n,hasPopup:s,ignoreBorder:!0,isRenderable:c,page:r,viewport:a},(function(t){return e.createElement("div",H({},t.slot.attrs,{className:o.prefixClass+"-annotation "+o.prefixClass+"-annotation-underline","data-annotation-id":n.id,onClick:t.popup.toggleOnClick,onMouseEnter:t.popup.openOnHover,onMouseLeave:t.popup.closeOnHover}),t.slot.children)}))},de=function(t){var n=t.annotations,r=t.containerRef,a=t.doc,i=t.page,s=t.pageIndex,c=t.plugins,l=t.rotation,u=t.scale,p=t.onExecuteNamedAction,d=t.onJumpToDest,f=i.getViewport({rotation:l,scale:u}).clone({dontFlip:!0}),g=n.filter((function(e){return!e.parentId}));return e.useEffect((function(){var e=r.current;e&&c.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:g,container:e,pageIndex:s,rotation:l,scale:u})}))}),[]),e.createElement(e.Fragment,null,g.map((function(t){var r=n.find((function(e){return e.parentId===t.id}));switch(t.annotationType){case o.Caret:return e.createElement(_,{key:t.id,annotation:t,page:i,viewport:f});case o.Circle:return e.createElement(z,{key:t.id,annotation:t,page:i,viewport:f});case o.FileAttachment:return e.createElement(q,{key:t.id,annotation:t,page:i,viewport:f});case o.FreeText:return e.createElement(U,{key:t.id,annotation:t,page:i,viewport:f});case o.Highlight:return e.createElement(G,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Ink:return e.createElement(J,{key:t.id,annotation:t,page:i,viewport:f});case o.Line:return e.createElement(X,{key:t.id,annotation:t,page:i,viewport:f});case o.Link:return e.createElement(K,{key:t.id,annotation:t,doc:a,page:i,viewport:f,onExecuteNamedAction:p,onJumpToDest:d});case o.Polygon:return e.createElement(Q,{key:t.id,annotation:t,page:i,viewport:f});case o.Polyline:return e.createElement($,{key:t.id,annotation:t,page:i,viewport:f});case o.Popup:return e.createElement(Z,{key:t.id,annotation:t,page:i,viewport:f});case o.Square:return e.createElement(ee,{key:t.id,annotation:t,page:i,viewport:f});case o.Squiggly:return e.createElement(te,{key:t.id,annotation:t,page:i,viewport:f});case o.Stamp:return e.createElement(ne,{key:t.id,annotation:t,page:i,viewport:f});case o.StrikeOut:return e.createElement(re,{key:t.id,annotation:t,page:i,viewport:f});case o.Text:return e.createElement(ue,{key:t.id,annotation:t,childAnnotation:r,page:i,viewport:f});case o.Underline:return e.createElement(pe,{key:t.id,annotation:t,page:i,viewport:f});default:return e.createElement(e.Fragment,{key:t.id})}})))},fe=function(t){var n=t.page,r=t.renderAnnotations,a=e.useState({loading:!0,annotations:[]}),o=a[0],i=a[1];return e.useEffect((function(){n.getAnnotations({intent:"display"}).then((function(e){i({loading:!1,annotations:e})}))}),[]),o.loading?e.createElement(e.Fragment,null):r(o.annotations)},ge=function(t){var n=t.doc,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.onExecuteNamedAction,u=t.onJumpToDest,p=e.useContext(i),d=e.createRef();return e.createElement("div",{ref:d,className:p.prefixClass+"-annotation-layer"},e.createElement(fe,{page:r,renderAnnotations:function(t){return e.createElement(de,{annotations:t,containerRef:d,doc:n,page:r,pageIndex:a,plugins:o,rotation:s,scale:c,onExecuteNamedAction:l,onJumpToDest:u})}}))},me=function(t){var n=t.callback,r=t.children,a=t.rotation,o=t.scale;return e.useLayoutEffect((function(){n()}),[a,o]),e.createElement(e.Fragment,null,r)},he=function(t){var n=t.height,r=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=t.width,u=e.useContext(i),p=e.createRef(),d=e.useRef(),f=window.devicePixelRatio||1;return e.createElement(me,{callback:function(){var e=d.current;e&&e.cancel();var t=p.current;o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:B.PreRender})})),t.height=n*f,t.width=l*f,t.style.opacity="0";var i=t.getContext("2d",{alpha:!1}),u=r.getViewport({rotation:s,scale:c*f});d.current=r.render({canvasContext:i,viewport:u}),d.current.promise.then((function(){t.style.removeProperty("opacity"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:t,pageIndex:a,rotation:s,scale:c,status:B.DidRender})}))}),(function(){}))},rotation:s,scale:c},e.createElement("div",{className:u.prefixClass+"-canvas-layer",style:{height:n+"px",width:l+"px"}},e.createElement("canvas",{ref:p,style:{transform:"scale("+1/f+")",transformOrigin:"top left"}})))},ve=function(t){var n=t.height,a=t.page,o=t.rotation,s=t.scale,c=t.width,l=e.useContext(i),u=e.createRef();return e.createElement(me,{callback:function(){var e=u.current,t=a.getViewport({rotation:o,scale:s});a.getOperatorList().then((function(o){!function(){var e=u.current;e&&(e.innerHTML="")}(),new r.SVGGraphics(a.commonObjs,a.objs).getSVG(o,t).then((function(t){t.style.height=n+"px",t.style.width=c+"px",e.appendChild(t)}))}))},rotation:o,scale:s},e.createElement("div",{className:l.prefixClass+"-svg-layer",ref:u}))},Ee=function(t){var n=t.page,a=t.pageIndex,o=t.plugins,s=t.rotation,c=t.scale,l=e.useContext(i),u=e.createRef(),p=e.useRef();return e.createElement(me,{callback:function(){var e=p.current;e&&e.cancel();var t=u.current;if(t){var i=n.getViewport({rotation:s,scale:c});o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:B.PreRender})})),n.getTextContent().then((function(e){!function(){var e=u.current;if(e)for(var t=e.querySelectorAll("span."+l.prefixClass+"-text"),n=t.length,r=0;r<n;r++){var a=t[r];e.removeChild(a)}}(),p.current=r.renderTextLayer({container:t,textContent:e,viewport:i}),p.current.promise.then((function(){for(var e=t.childNodes,n=e.length,r=0;r<n;r++){e[r].classList.add(l.prefixClass+"-text")}o.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:t,pageIndex:a,scale:c,status:B.DidRender})}))}),(function(){}))}))}},rotation:s,scale:c},e.createElement("div",{className:l.prefixClass+"-text-layer",ref:u}))},xe=function(t){var n=t.currentPage,r=t.doc,a=t.height,o=t.pageIndex,s=t.plugins,c=t.renderPage,l=t.rotation,d=t.scale,f=t.width,g=t.onExecuteNamedAction,m=t.onJumpToDest,h=t.onPageVisibilityChanged,v=e.useContext(i),E=e.useState({page:null,pageHeight:a,pageWidth:f,viewportRotation:0}),x=E[0],C=E[1],w=x.page,y=x.pageHeight,k=x.pageWidth,b=e.useRef(!1),P=Array(10).fill(null).map((function(e,t){return t/10})),O=k*d,L=y*d,R=Math.abs(l)%180==0,T=R?O:L,S=R?L:O,M=function(){b.current||(b.current=!0,r.getPage(o+1).then((function(e){var t=e.getViewport({scale:1});C({page:e,pageHeight:t.height,pageWidth:t.width,viewportRotation:t.rotation})})))},N=c||function(t){return e.createElement(e.Fragment,null,t.canvasLayer.children,t.textLayer.children,t.annotationLayer.children)},H=(l+x.viewportRotation)%360,F=p({threshold:P,onVisibilityChanged:function(e){h(o,e.isVisible?e.ratio:-1),e.isVisible&&M()}});return e.useEffect((function(){n-2<=o&&o<=n+2&&M()}),[n]),e.createElement("div",{ref:F,className:v.prefixClass+"-page-layer",style:{height:S+"px",width:T+"px"}},w?e.createElement(e.Fragment,null,N({annotationLayer:{attrs:{},children:e.createElement(ge,{doc:r,page:w,pageIndex:o,plugins:s,rotation:H,scale:d,onExecuteNamedAction:g,onJumpToDest:m})},canvasLayer:{attrs:{},children:e.createElement(he,{height:S,page:w,pageIndex:o,plugins:s,rotation:H,scale:d,width:T})},doc:r,height:S,pageIndex:o,rotation:l,scale:d,svgLayer:{attrs:{},children:e.createElement(ve,{height:S,page:w,rotation:H,scale:d,width:T})},textLayer:{attrs:{},children:e.createElement(Ee,{page:w,pageIndex:o,plugins:s,rotation:H,scale:d})},width:T}),s.map((function(t,n){return t.renderPageLayer?e.createElement(e.Fragment,{key:n},t.renderPageLayer({doc:r,height:S,pageIndex:o,rotation:l,scale:d,width:T})):e.createElement(e.Fragment,{key:n})}))):e.createElement(u,null))},Ce=function(t){var n=t.defaultScale,r=t.doc,a=t.initialPage,o=t.pageSize,s=t.plugins,c=t.renderPage,l=t.viewerState,u=t.onDocumentLoad,p=t.onOpenFile,d=t.onPageChange,f=t.onZoom,g=e.useContext(i),m=e.useRef(null),h=e.useRef(null),v=e.useState(o.scale),E=v[0],x=v[1],C=e.useState(0),w=C[0],y=C[1],k=e.useState(0),b=k[0],P=k[1],O=e.useRef(l),L=r.numPages,R=o.pageWidth,S=o.pageHeight,M=Array(L).fill(null),N=M.map((function(){return 0})),F=M.map((function(){return e.useRef()})),B=function(e){var t=e;s.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),O.current=t},I=function(){return h.current},A=function(e){return e<0||e>=L?null:F[e].current},D=function(){return O.current},W=function(e,t,n,a){var o=h.current,i=O.current;if(o&&i){var s=e+1;r.getPage(s).then((function(r){var s=r.getViewport({scale:1}),c=0,l=t||0,u=n||0;switch(a){case T.PageFit:c=0,u=0,z(T.PageFit);break;case T.PageWidth:c=(s.height-l)*i.scale,u*=i.scale,z(T.PageWidth);break;default:c=(s.height-l)*i.scale,u*=i.scale}var p=F[e].current;p&&(o.scrollTop=p.offsetTop+c,o.scrollLeft=p.offsetLeft+u)}))}},V=function(e){if(!(e<0||e>=L)){var t=h.current,n=F[e].current;t&&n&&(t.scrollTop=n.offsetTop,t.scrollLeft=n.offsetLeft),y(e)}},j=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){p(e.name,t)}))},_=function(e){P(e),B({file:l.file,pageIndex:w,pageHeight:S,pageWidth:R,rotation:e,scale:E})},z=function(e){var t=h.current,n=O.current;if(t&&n){var a=1;switch(e){case T.ActualSize:a=1;break;case T.PageFit:a=Math.min((t.clientWidth-17)/R,(t.clientHeight-16)/S);break;case T.PageWidth:a=(t.clientWidth-17)/R;break;default:a=e}x(a),f({doc:r,scale:a})}};e.useEffect((function(){var e=h.current,t=O.current;e&&t&&(e.scrollTop=e.scrollTop*E/t.scale,e.scrollLeft=e.scrollLeft*E/t.scale,B({file:l.file,pageIndex:t.pageIndex,pageHeight:S,pageWidth:R,rotation:b,scale:E}))}),[E]);e.useEffect((function(){var e={getPageElement:A,getPagesContainer:I,getViewerState:D,jumpToDestination:W,jumpToPage:V,openFile:j,rotate:_,setViewerState:B,zoom:z};return s.forEach((function(t){t.install&&t.install(e)})),function(){s.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[]),e.useEffect((function(){u({doc:r}),s.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:r})})),a&&V(a)}),[]),e.useEffect((function(){d({currentPage:w,doc:r}),B({file:l.file,pageIndex:w,pageHeight:S,pageWidth:R,rotation:b,scale:E})}),[w]),e.useEffect((function(){n&&z(n)}),[]);var q,U=function(e,t){N[e]=t;var n=N.reduce((function(e,t,n,r){return t>r[e]?n:e}),0);y(n)},Z=function(e){var t=w-1,n=w+1;switch(e){case"FirstPage":V(0);break;case"LastPage":V(L-1);break;case"NextPage":n<L&&V(n);break;case"PrevPage":t>=0&&V(t)}},G=function(t){return e.createElement("div",H({},t.attrs,{style:t.attrs&&t.attrs.style?t.attrs.style:{}}),t.children,t.subSlot&&G(t.subSlot))};return G((q={attrs:{ref:m,style:{height:"100%"}},children:e.createElement(e.Fragment,null),subSlot:{attrs:{ref:h,style:{height:"100%",overflow:"auto",position:"relative"}},children:e.createElement(e.Fragment,null,Array(L).fill(0).map((function(t,n){return e.createElement("div",{className:g.prefixClass+"-inner-page",key:"pagelayer-"+n,ref:function(e){F[n].current=e}},e.createElement(xe,{currentPage:w,doc:r,height:S,pageIndex:n,plugins:s,renderPage:c,rotation:b,scale:E,width:R,onExecuteNamedAction:Z,onJumpToDest:W,onPageVisibilityChanged:U}))})))}},s.forEach((function(e){e.renderViewer&&(q=e.renderViewer({containerRef:m,doc:r,pageHeight:S,pageWidth:R,rotation:b,slot:q,jumpToPage:V,openFile:j,rotate:_,zoom:z}))})),q))},we=[.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],ye=function(t){var n=t.doc,r=t.render,a=e.useContext(i),o=e.useRef(null),s=e.useState({pageHeight:0,pageWidth:0,scale:1}),c=s[0],l=s[1];return e.useEffect((function(){n.getPage(1).then((function(e){var t=e.getViewport({scale:1}),n=t.width,r=t.height,a=o.current;if(a){var i,s,c=(a.clientWidth-100)/n,u=(i=Math.max(1,c),-1===(s=we.findIndex((function(e){return e>=i})))||0===s?i:we[s-1]);l({pageHeight:r,pageWidth:n,scale:u})}}))}),[n]),0===c.pageWidth?e.createElement("div",{className:a.prefixClass+"-page-size-calculator",ref:o},e.createElement(u,null)):r(c)},ke=function(){},be=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return M(t,e),t}(ke),Pe=function(t){var n=t.verifyPasswordFn,r=e.useContext(d),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.askingPassword.requirePasswordToOpen,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.askingPassword.submit))))},Oe=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return M(t,e),t}(ke),Le=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return M(t,e),t}(ke),Re=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return M(t,e),t}(ke),Te=function(t){var n=t.verifyPasswordFn,r=e.useContext(d),a=e.useContext(i),o=e.useState(""),s=o[0],c=o[1];return e.createElement("div",{className:a.prefixClass+"-asking-password"},e.createElement("div",null,e.createElement("div",{className:a.prefixClass+"-asking-password-message"},r.core.wrongPassword.tryAgain,":"),e.createElement("div",{className:a.prefixClass+"-asking-password-input-container"},e.createElement("input",{className:a.prefixClass+"-asking-password-input",type:"password",onChange:function(e){return c(e.target.value)}}),e.createElement("button",{className:a.prefixClass+"-asking-password-button",onClick:function(){return n(s)}},r.core.wrongPassword.submit))))},Se=function(e){function t(t){var n=e.call(this)||this;return n.verifyPasswordFn=t,n}return M(t,e),t}(ke),Me=function(t){var n,a=t.characterMap,o=t.file,s=t.httpHeaders,c=t.render,l=t.renderError,p=t.renderLoader,d=t.withCredentials,f=e.useContext(i),g=e.useState(new Re(0)),m=g[0],h=g[1],v=e.useState(0),E=v[0],x=v[1],C=e.useState(null),w=C[0],y=C[1],k=(n=e.useRef(!1),e.useEffect((function(){return n.current=!0,function(){n.current=!1}}),[]),n);switch(e.useEffect((function(){h(new Re(0));var e=new r.PDFWorker({name:"PDFWorker_"+Date.now()}),t=Object.assign({httpHeaders:s,withCredentials:d,worker:e},"string"==typeof o?{url:o}:{data:o},a?{cMapUrl:a.url,cMapPacked:a.isCompressed}:{}),n=r.getDocument(t);return n.onPassword=function(e,t){switch(t){case r.PasswordResponses.NEED_PASSWORD:k.current&&h(new be(e));break;case r.PasswordResponses.INCORRECT_PASSWORD:k.current&&h(new Se(e))}},n.onProgress=function(e){e.total>0?k.current&&x(Math.min(100,100*e.loaded/e.total)):k.current&&x(100)},n.promise.then((function(e){return k.current&&y(e)}),(function(t){return k.current&&!e.destroyed&&h(new Le({message:t.message||"Cannot load document",name:t.name}))})),function(){n.destroy(),e.destroy()}}),[o]),e.useEffect((function(){100===E&&w?k.current&&h(new Oe(w)):k.current&&h(new Re(E))}),[E,w]),!0){case m instanceof be:return e.createElement(Pe,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Se:return e.createElement(Te,{verifyPasswordFn:m.verifyPasswordFn});case m instanceof Oe:return c(m.doc);case m instanceof Le:return l?l(m.error):e.createElement("div",{className:f.prefixClass+"-doc-error"},e.createElement("div",{className:f.prefixClass+"-doc-error-text"},m.error.message));case m instanceof Re:return e.createElement("div",{className:f.prefixClass+"-doc-loading"},p?p(m.percentages):e.createElement(u,null));default:return e.createElement("div",{className:f.prefixClass+"-doc-loading"},e.createElement(u,null))}},Ne=function(t){var n=t.children,r=t.prefixClass;return e.createElement(i.Provider,{value:{prefixClass:r||"rpv-core"}},n)};exports.AnnotationType=o,exports.Button=function(t){var n,r=t.children,a=t.isSelected,o=void 0!==a&&a,c=t.onClick,l=e.useContext(i);return e.createElement("button",{className:s((n={},n[l.prefixClass+"-button"]=!0,n[l.prefixClass+"-button-selected"]=o,n)),onClick:c},r)},exports.Icon=c,exports.LayerRenderStatus=B,exports.LocalizationContext=d,exports.LocalizationProvider=g,exports.Menu=function(t){var n=t.children,r=e.useContext(i);return e.createElement("ul",{className:r.prefixClass+"-menu"},n)},exports.MenuDivider=function(){var t=e.useContext(i);return e.createElement("li",{className:t.prefixClass+"-menu-divider"})},exports.MenuItem=function(t){var n=t.checked,r=void 0!==n&&n,a=t.children,o=t.icon,s=void 0===o?null:o,c=t.onClick,u=e.useContext(i);return e.createElement("li",{className:u.prefixClass+"-menu-item",onClick:c},e.createElement("div",{className:u.prefixClass+"-menu-item-icon"},s),e.createElement("div",{className:u.prefixClass+"-menu-item-label"},a),e.createElement("div",{className:u.prefixClass+"-menu-item-check"},r&&e.createElement(l,null)))},exports.Modal=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.target;return e.createElement(w,{target:o,content:function(t){return e.createElement(E,null,e.createElement(v,{closeOnClickOutside:n,closeOnEscape:r,onToggle:t},a(t)))}})},exports.Observer=function(t){var n=t.children,r=t.threshold,a=t.onVisibilityChanged,o=e.useRef(null);return e.useLayoutEffect((function(){var e=new IntersectionObserver((function(e){e.forEach((function(e){var t=e.isIntersecting,n=e.intersectionRatio;a({isVisible:t,ratio:n})}))}),{threshold:r||0}),t=o.current;if(t)return e.observe(t),function(){e.unobserve(t)}}),[]),e.createElement("div",{ref:o},n)},exports.Popover=function(t){var n=t.closeOnClickOutside,r=t.closeOnEscape,a=t.content,o=t.offset,i=t.position,s=t.target,c=e.createRef();return e.createElement(w,{content:function(t){return e.createElement(e.Fragment,null,e.createElement(L,{closeOnEscape:r,onClose:t}),e.createElement(O,{closeOnClickOutside:n,offset:o,position:i,targetRef:c,onClose:t},a(t)))},target:function(t,n){return e.createElement("div",{ref:c},s(t,n))}})},exports.Position=k,exports.PrimaryButton=function(t){var n=t.children,r=t.onClick,a=e.useContext(i);return e.createElement("button",{className:a.prefixClass+"-primary-button",onClick:r},n)},exports.ProgressBar=function(t){var n=t.progress,r=e.useContext(i);return e.createElement("div",{className:r.prefixClass+"-progress-bar"},e.createElement("div",{className:r.prefixClass+"-progress-bar-inner",style:{width:n+"%"}},n,"%"))},exports.Separator=function(){var t=e.useContext(i);return e.createElement("div",{className:t.prefixClass+"-separator"})},exports.SpecialZoomLevel=T,exports.Spinner=u,exports.Tooltip=function(t){var n=t.content,r=t.offset,o=t.position,i=t.target,s=e.createRef();return e.createElement(w,{target:function(t){return e.createElement("div",{ref:s,onMouseEnter:function(){t(a.Open)},onMouseLeave:function(){t(a.Close)}},i)},content:function(){return e.createElement(R,{offset:r,position:o,targetRef:s},n())}})},exports.Viewer=function(t){var n,r,a=t.characterMap,o=t.defaultScale,i=t.fileUrl,s=t.httpHeaders,c=void 0===s?{}:s,l=t.initialPage,u=void 0===l?0:l,d=t.localization,f=t.plugins,m=void 0===f?[]:f,h=t.prefixClass,v=t.renderError,E=t.renderPage,x=t.renderLoader,C=t.withCredentials,w=void 0!==C&&C,y=t.onDocumentLoad,k=void 0===y?function(){}:y,b=t.onPageChange,P=void 0===b?function(){}:b,O=t.onZoom,L=void 0===O?function(){}:O,R=e.useState({data:i,name:"string"==typeof i?i:"",shouldLoad:!1}),T=R[0],S=R[1],M=function(e,t){S({data:t,name:e,shouldLoad:!0})},N=e.useState(!1),H=N[0],F=N[1],B=(n=T,r=e.useRef(n),e.useEffect((function(){r.current=n}),[n]),r.current);e.useEffect((function(){B.data!==i&&S({data:i,name:"string"==typeof i?i:"",shouldLoad:H})}),[i,H]);var I=p({onVisibilityChanged:function(e){F(e.isVisible),e.isVisible&&S((function(e){return Object.assign({},e,{shouldLoad:!0})}))}});return e.createElement(Ne,{prefixClass:h},e.createElement(g,{localization:d},(function(t){return e.createElement("div",{ref:I,style:{height:"100%",width:"100%"}},T.shouldLoad&&e.createElement(Me,{characterMap:a,file:T.data,httpHeaders:c,render:function(t){return e.createElement(ye,{doc:t,render:function(n){return e.createElement(Ce,{defaultScale:o,doc:t,initialPage:u,pageSize:n,plugins:m,renderPage:E,viewerState:{file:T,pageIndex:u,pageHeight:n.pageHeight,pageWidth:n.pageWidth,rotation:0,scale:n.scale},onDocumentLoad:k,onOpenFile:M,onPageChange:P,onZoom:L})}})},renderError:v,renderLoader:x,withCredentials:w}))})))},exports.Worker=function(t){var n=t.children,a=t.workerUrl;return r.GlobalWorkerOptions.workerSrc=a,e.createElement(e.Fragment,null,n)},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 a;t=H(H({},t),((a={})[e]=r,a)),(n[e]||[]).forEach((function(n){return n(t[e])}))},get:function(e){return t[e]}}},exports.getDestination=Y,exports.useIntersectionObserver=p;

@@ -584,2 +584,11 @@ /**

// Hooks
export interface UseIntersectionObserverProps {
threshold?: number | number[];
onVisibilityChanged(params: VisibilityChanged): void;
}
export function useIntersectionObserver(
props: UseIntersectionObserverProps
): React.MutableRefObject<HTMLDivElement>;
// Utils

@@ -586,0 +595,0 @@ // -----

{
"name": "@react-pdf-viewer/core",
"version": "2.3.1",
"version": "2.3.2",
"description": "A React component to view a PDF document",

@@ -49,6 +49,5 @@ "license": "https://react-pdf-viewer.dev/license",

"js": "cp src/index.d.ts lib && cp dist/index.js lib && rollup -c ../../rollup.config.js",
"css": "rm lib/styles/index.less && postcss lib/styles/index.css > lib/styles/index.min.css",
"test": "jest --config ../../jest.config.js"
"css": "rm lib/styles/index.less && postcss lib/styles/index.css > lib/styles/index.min.css"
},
"gitHead": "35c85e7e2a77a9fcc78faed723d3e719a07451af"
"gitHead": "6c911fcc09cbd5cff03c3c9ebb3c3a7736e40fae"
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc