/*! For license information please see main.c0ce3835.js.LICENSE.txt */ (function(){var __webpack_modules__={9598:function(e,t,n){"use strict";var r=n(2791),a=n(3661);function i(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 o,s=i(r),l=i(a);t.JJ=void 0,(o=t.JJ||(t.JJ={}))[o.Text=1]="Text",o[o.Link=2]="Link",o[o.FreeText=3]="FreeText",o[o.Line=4]="Line",o[o.Square=5]="Square",o[o.Circle=6]="Circle",o[o.Polygon=7]="Polygon",o[o.Polyline=8]="Polyline",o[o.Highlight=9]="Highlight",o[o.Underline=10]="Underline",o[o.Squiggly=11]="Squiggly",o[o.StrikeOut=12]="StrikeOut",o[o.Stamp=13]="Stamp",o[o.Caret=14]="Caret",o[o.Ink=15]="Ink",o[o.Popup=16]="Popup",o[o.FileAttachment=17]="FileAttachment";var c=function(e,t){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},c(e,t)};function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d,h=function(){return h=Object.assign||function(e){for(var t,n=1,r=arguments.length;nD}));if(!e.length)return-1;for(var t=e[0].pageIndex,r=e[e.length-1].pageIndex,a=e.length,o=0;o=0&&i.current.visibilities[t-1].renderStatus!==w.Rendered?t-1:-1},isInRange:function(e){return e>=i.current.startRange&&e<=i.current.endRange},markNotRendered:function(){for(var e=0;et)&&(i.current.visibilities[r].visibility=D,i.current.visibilities[r].renderStatus=w.NotRenderedYet)},setVisibility:o}},G={core:{askingPassword:{requirePasswordToOpen:"This document requires a password to open",submit:"Submit"},wrongPassword:{tryAgain:"The password is wrong. Please try again"},pageLabel:"Page {{pageIndex}}"}},j=s.createContext({l10n:G,setL10n:function(){}}),z=0,B=function(){return z++},H=function(e,t,n){var r=function(e){var r=t.current;if(r){var a=e.target;if(a instanceof Element&&a.shadowRoot){var i=e.composedPath();i.length>0&&!r.contains(i[0])&&n()}else r.contains(a)||n()}};s.useEffect((function(){if(e){var t={capture:!0};return document.addEventListener("click",r,t),function(){document.removeEventListener("click",r,t)}}}),[])},U=function(e){var t=function(t){"Escape"===t.key&&e()};s.useEffect((function(){return document.addEventListener("keyup",t),function(){document.removeEventListener("keyup",t)}}),[])},W=function(e){var n=e.ariaControlsSuffix,r=e.children,a=e.closeOnClickOutside,i=e.closeOnEscape,o=e.onToggle,l=s.useRef(),c=s.useContext(p).direction===t.m5.RightToLeft;return s.useEffect((function(){var e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",function(){document.body.style.overflow=e}}),[]),U((function(){l.current&&i&&o()})),H(a,l,o),g((function(){var e=l.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight="".concat(t,"px"))}}),[]),s.createElement("div",{"aria-modal":"true",className:v({"rpv-core__modal-body":!0,"rpv-core__modal-body--rtl":c}),id:"rpv-core__modal-body-".concat(n),ref:l,role:"dialog",tabIndex:-1},r)},q=function(e){var t=e.children;return s.createElement("div",{className:"rpv-core__modal-overlay"},t)};t.$Z=void 0,(L=t.$Z||(t.$Z={})).Close="Close",L.Open="Open",L.Toggle="Toggle";var V,K=function(e){var n=s.useState(e),r=n[0],a=n[1];return{opened:r,toggle:function(e){switch(e){case t.$Z.Close:a(!1);break;case t.$Z.Open:a(!0);break;case t.$Z.Toggle:default:a((function(e){return!e}))}}}},X=function(e){var t=e.content,n=e.isOpened,r=void 0!==n&&n,a=e.target,i=K(r),o=i.opened,l=i.toggle;return s.createElement(s.Fragment,null,a&&a(l,o),o&&t(l))};t.Ly=void 0,(V=t.Ly||(t.Ly={})).TopLeft="TOP_LEFT",V.TopCenter="TOP_CENTER",V.TopRight="TOP_RIGHT",V.RightTop="RIGHT_TOP",V.RightCenter="RIGHT_CENTER",V.RightBottom="RIGHT_BOTTOM",V.BottomLeft="BOTTOM_LEFT",V.BottomCenter="BOTTOM_CENTER",V.BottomRight="BOTTOM_RIGHT",V.LeftTop="LEFT_TOP",V.LeftCenter="LEFT_CENTER",V.LeftBottom="LEFT_BOTTOM";var Y,J,Q,Z,$,ee,te,ne,re=function(e,n,r,a,i){g((function(){var o=n.current,s=e.current,l=r.current;if(s&&o&&l){var c=l.getBoundingClientRect(),u=function(e,n,r,a){var i=n.getBoundingClientRect(),o=e.getBoundingClientRect(),s=o.height,l=o.width,c=0,u=0;switch(r){case t.Ly.TopLeft:c=i.top-s,u=i.left;break;case t.Ly.TopCenter:c=i.top-s,u=i.left+i.width/2-l/2;break;case t.Ly.TopRight:c=i.top-s,u=i.left+i.width-l;break;case t.Ly.RightTop:c=i.top,u=i.left+i.width;break;case t.Ly.RightCenter:c=i.top+i.height/2-s/2,u=i.left+i.width;break;case t.Ly.RightBottom:c=i.top+i.height-s,u=i.left+i.width;break;case t.Ly.BottomLeft:c=i.top+i.height,u=i.left;break;case t.Ly.BottomCenter:c=i.top+i.height,u=i.left+i.width/2-l/2;break;case t.Ly.BottomRight:c=i.top+i.height,u=i.left+i.width-l;break;case t.Ly.LeftTop:c=i.top,u=i.left-l;break;case t.Ly.LeftCenter:c=i.top+i.height/2-s/2,u=i.left-l;break;case t.Ly.LeftBottom:c=i.top+i.height-s,u=i.left-l}return{left:u+(a.left||0),top:c+(a.top||0)}}(s,o,a,i),d=u.top,h=u.left;s.style.top="".concat(d-c.top,"px"),s.style.left="".concat(h-c.left,"px")}}),[])},ae=function(e){var n,r=e.customClassName,a=e.position;return s.createElement("div",{className:v((n={"rpv-core__arrow":!0,"rpv-core__arrow--tl":a===t.Ly.TopLeft,"rpv-core__arrow--tc":a===t.Ly.TopCenter,"rpv-core__arrow--tr":a===t.Ly.TopRight,"rpv-core__arrow--rt":a===t.Ly.RightTop,"rpv-core__arrow--rc":a===t.Ly.RightCenter,"rpv-core__arrow--rb":a===t.Ly.RightBottom,"rpv-core__arrow--bl":a===t.Ly.BottomLeft,"rpv-core__arrow--bc":a===t.Ly.BottomCenter,"rpv-core__arrow--br":a===t.Ly.BottomRight,"rpv-core__arrow--lt":a===t.Ly.LeftTop,"rpv-core__arrow--lc":a===t.Ly.LeftCenter,"rpv-core__arrow--lb":a===t.Ly.LeftBottom},n["".concat(r)]=""!==r,n))})},ie=function(e){var n=e.ariaControlsSuffix,r=e.children,a=e.closeOnClickOutside,i=e.offset,o=e.position,l=e.targetRef,c=e.onClose,u=s.useRef(),d=s.useRef(),h=s.useRef(),f=s.useContext(p).direction===t.m5.RightToLeft;H(a,u,c),re(u,l,h,o,i),g((function(){var e=d.current;if(e){var t=.75*document.body.clientHeight;e.getBoundingClientRect().height>=t&&(e.style.overflow="auto",e.style.maxHeight="".concat(t,"px"))}}),[]);var m="rpv-core__popover-body-inner-".concat(n);return s.createElement(s.Fragment,null,s.createElement("div",{ref:h,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{"aria-describedby":m,className:v({"rpv-core__popover-body":!0,"rpv-core__popover-body--rtl":f}),id:"rpv-core__popover-body-".concat(n),ref:u,role:"dialog",tabIndex:-1},s.createElement(ae,{customClassName:"rpv-core__popover-body-arrow",position:o}),s.createElement("div",{id:m,ref:d},r)))},oe=function(e){var t=e.closeOnEscape,n=e.onClose,r=s.useRef();return U((function(){r.current&&t&&n()})),s.createElement("div",{className:"rpv-core__popover-overlay",ref:r})},se=function(e){var n=e.ariaControlsSuffix,r=e.children,a=e.contentRef,i=e.offset,o=e.position,l=e.targetRef,c=s.useRef(),u=s.useContext(p).direction===t.m5.RightToLeft;return re(a,l,c,o,i),s.createElement(s.Fragment,null,s.createElement("div",{ref:c,style:{left:0,position:"absolute",top:0}}),s.createElement("div",{className:v({"rpv-core__tooltip-body":!0,"rpv-core__tooltip-body--rtl":u}),id:"rpv-core__tooltip-body-".concat(n),ref:a,role:"tooltip"},s.createElement(ae,{customClassName:"rpv-core__tooltip-body-arrow",position:o}),s.createElement("div",{className:"rpv-core__tooltip-body-content"},r)))};t.Fi=void 0,(Y=t.Fi||(t.Fi={})).Normal="Normal",Y.Entering="Entering",Y.Entered="Entered",Y.EnteredCompletely="EnteredCompletely",Y.Exitting="Exitting",Y.Exited="Exited",t.B1=void 0,(J=t.B1||(t.B1={}))[J.PreRender=0]="PreRender",J[J.DidRender=1]="DidRender",t.Vc=void 0,(Q=t.Vc||(t.Vc={})).Attachments="UseAttachments",Q.Bookmarks="UseOutlines",Q.ContentGroup="UseOC",Q.Default="UserNone",Q.FullScreen="FullScreen",Q.Thumbnails="UseThumbs",t.Fn=void 0,(Z=t.Fn||(t.Fn={})).RequiredPassword="RequiredPassword",Z.WrongPassword="WrongPassword",t.Rn=void 0,($=t.Rn||(t.Rn={})).Backward="Backward",$.Forward="Forward",t.Gd=void 0,(ee=t.Gd||(t.Gd={})).Page="Page",ee.Horizontal="Horizontal",ee.Vertical="Vertical",ee.Wrapped="Wrapped",t.SpecialZoomLevel=void 0,(te=t.SpecialZoomLevel||(t.SpecialZoomLevel={})).ActualSize="ActualSize",te.PageFit="PageFit",te.PageWidth="PageWidth",t.wO=void 0,(ne=t.wO||(t.wO={})).DualPage="DualPage",ne.DualPageWithCover="DualPageWithCover",ne.SinglePage="SinglePage";var le,ce=function(e,t){return e.reduce((function(e,n,r){return r%t?e[e.length-1].push(n):e.push([n]),e}),[])},ue=function(e,n){switch(n[1].name){case"XYZ":return{bottomOffset:function(e,t){return null===n[3]?t:n[3]},leftOffset:function(e,t){return null===n[2]?0:n[2]},pageIndex:e,scaleTo:n[4]};case"Fit":case"FitB":return{bottomOffset:0,leftOffset:0,pageIndex:e,scaleTo:t.SpecialZoomLevel.PageFit};case"FitH":case"FitBH":return{bottomOffset:n[2],leftOffset:0,pageIndex:e,scaleTo:t.SpecialZoomLevel.PageWidth};default:return{bottomOffset:0,leftOffset:0,pageIndex:e,scaleTo:1}}},de=new Map,he=new Map,fe=function(e,t){return"".concat(e.loadingTask.docId,"___").concat(t.num,"R").concat(0===t.gen?"":t.gen)},pe=function(e,t,n){de.set(fe(e,t),n)},ve=function(e,t){if(!e)return Promise.reject("The document is not loaded yet");var n="".concat(e.loadingTask.docId,"___").concat(t),r=he.get(n);return r?Promise.resolve(r):new Promise((function(r,a){e.getPage(t+1).then((function(a){he.set(n,a),a.ref&&pe(e,a.ref,t),r(a)}))}))},ge=function e(t,n){return new Promise((function(r){new Promise((function(e){"string"==typeof n?t.getDestination(n).then((function(t){e(t)})):e(n)})).then((function(a){if("object"==typeof a[0]&&null!==a[0]){var i=a[0],o=function(e,t){var n=fe(e,t);return de.has(n)?de.get(n):null}(t,i);null===o?t.getPageIndex(i).then((function(a){pe(t,i,a),e(t,n).then((function(e){return r(e)}))})):r(ue(o,a))}else{var s=ue(a[0],a);r(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"}(le||(le={}));var me,ye=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"),_e=function(e,t,n,r){var a=parseInt(e,10);return a>=t&&a<=n?a:r},be=function(e){return e.contentsObj?e.contentsObj.str:e.contents||""},ke=function(e){return e.titleObj?e.titleObj.str:e.title||""},Se=function(e){var n=e.annotation,r=s.useContext(p).direction,a=ke(n),i=be(n),o=r===t.m5.RightToLeft,l=s.useRef(),c="";if(n.modificationDate){var u=function(e){var t=ye.exec(e);if(!t)return null;var n=parseInt(t[1],10),r=_e(t[2],1,12,1)-1,a=_e(t[3],1,31,1),i=_e(t[4],0,23,0),o=_e(t[5],0,59,0),s=_e(t[6],0,59,0),l=t[7]||"Z",c=_e(t[8],0,23,0),u=_e(t[9],0,59,0);switch(l){case"-":i+=c,o+=u;break;case"+":i-=c,o-=u}return new Date(Date.UTC(n,r,a,i,o,s))}(n.modificationDate);c=u?"".concat(u.toLocaleDateString(),", ").concat(u.toLocaleTimeString()):""}return s.useLayoutEffect((function(){if(l.current){var e=document.querySelector('[data-annotation-id="'.concat(n.id,'"]'));if(e){var t=e;return t.style.zIndex+=1,function(){t.style.zIndex="".concat(parseInt(t.style.zIndex,10)-1)}}}}),[]),s.createElement("div",{ref:l,className:v({"rpv-core__annotation-popup-wrapper":!0,"rpv-core__annotation-popup-wrapper--rtl":o}),style:{top:n.annotationType===t.JJ.Popup?"":"100%"}},a&&s.createElement(s.Fragment,null,s.createElement("div",{className:v({"rpv-core__annotation-popup-title":!0,"rpv-core__annotation-popup-title--ltr":!o,"rpv-core__annotation-popup-title--rtl":o})},a),s.createElement("div",{className:"rpv-core__annotation-popup-date"},c)),i&&s.createElement("div",{className:"rpv-core__annotation-popup-content"},i.split("\n").map((function(e,t){return s.createElement(s.Fragment,{key:t},e,s.createElement("br",null))}))))};!function(e){e.Click="Click",e.Hover="Hover"}(me||(me={}));var we,Pe=function(e){var n,r=e.annotation,a=e.children,i=e.ignoreBorder,o=e.hasPopup,l=e.isRenderable,c=e.page,u=e.viewport,d=r.rect,h=function(){var e=K(!1),n=e.opened,r=e.toggle,a=s.useState(me.Hover),i=a[0],o=a[1];return{opened:n,closeOnHover:function(){i===me.Hover&&r(t.$Z.Close)},openOnHover:function(){i===me.Hover&&r(t.$Z.Open)},toggleOnClick:function(){switch(i){case me.Click:n&&o(me.Hover),r(t.$Z.Toggle);break;case me.Hover:o(me.Click),r(t.$Z.Open)}}}}(),f=h.closeOnHover,p=h.opened,v=h.openOnHover,g=h.toggleOnClick,m=(n=[d[0],c.view[3]+c.view[1]-d[1],d[2],c.view[3]+c.view[1]-d[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])]),y=d[2]-d[0],_=d[3]-d[1],b={borderColor:"",borderRadius:"",borderStyle:"",borderWidth:""};if(!i&&r.borderStyle.width>0){switch(r.borderStyle.style){case le.Dashed:b.borderStyle="dashed";break;case le.Solid:b.borderStyle="solid";break;case le.Underline:b=Object.assign({borderBottomStyle:"solid"},b);case le.Beveled:case le.Inset:}var k=r.borderStyle.width;b.borderWidth="".concat(k,"px"),r.borderStyle.style!==le.Underline&&(y-=2*k,_-=2*k);var S=r.borderStyle,w=S.horizontalCornerRadius,P=S.verticalCornerRadius;(w>0||P>0)&&(b.borderRadius="".concat(w,"px / ").concat(P,"px")),r.color?b.borderColor="rgb(".concat(0|r.color[0],", ").concat(0|r.color[1],", ").concat(0|r.color[2],")"):b.borderWidth="0"}return s.createElement(s.Fragment,null,l&&a({popup:{opened:p,closeOnHover:f,openOnHover:v,toggleOnClick:g},slot:{attrs:{style:Object.assign({height:"".concat(_,"px"),left:"".concat(m[0],"px"),top:"".concat(m[1],"px"),transform:"matrix(".concat(u.transform.join(","),")"),transformOrigin:"-".concat(m[0],"px -").concat(m[1],"px"),width:"".concat(y,"px")},b)},children:s.createElement(s.Fragment,null,o&&p&&s.createElement(Se,{annotation:r}))}}))},xe=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--caret","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ae=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--circle","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},s.createElement("circle",{cy:d/2,fill:"none",rx:u/2-f/2,ry:d/2-f/2,stroke:"transparent",strokeWidth:f||1})),e.slot.children)}))},Ce=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=ke(t),i=be(t),o=!(!1!==t.hasPopup||!a&&!i),l=function(){var e,n,r,a,i=t.file;i&&(e=i.filename,r="string"==typeof(n=i.content)?"":URL.createObjectURL(new Blob([n],{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 s.createElement(Pe,{annotation:t,hasPopup:o,ignoreBorder:!0,isRenderable:!0,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--file-attachment","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onDoubleClick:l,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ee=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--free-text","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Fe=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=ke(t),i=be(t),o=!(!a&&!i),l=!t.parentType||-1!==["Circle","Ink","Line","Polygon","PolyLine","Square"].indexOf(t.parentType);return g((function(){if(t.parentId){var e=document.querySelector('[data-annotation-id="'.concat(t.parentId,'"]')),n=document.querySelector('[data-annotation-id="'.concat(t.id,'"]'));if(e&&n){var r=parseFloat(e.style.left),a=parseFloat(e.style.top)+parseFloat(e.style.height);n.style.left="".concat(r,"px"),n.style.top="".concat(a,"px"),n.style.transformOrigin="-".concat(r,"px -").concat(a,"px")}}}),[]),s.createElement(Pe,{annotation:t,hasPopup:l,ignoreBorder:!1,isRenderable:o,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--popup","data-annotation-id":t.id}),s.createElement(Se,{annotation:t}))}))},Te=function e(n){var r=n.annotation,a=n.childAnnotation,i=n.page,o=n.viewport,l=!1===r.hasPopup,c=ke(r),u=be(r),d=!!(r.hasPopup||c||u);if(r.quadPoints&&r.quadPoints.length>0){var f=r.quadPoints.map((function(e){return Object.assign({},r,{rect:[e[2].x,e[2].y,e[1].x,e[1].y],quadPoints:[]})}));return s.createElement(s.Fragment,null,f.map((function(t,n){return s.createElement(e,{key:n,annotation:t,childAnnotation:a,page:i,viewport:o})})))}return s.createElement(Pe,{annotation:r,hasPopup:l,ignoreBorder:!0,isRenderable:d,page:i,viewport:o},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--highlight","data-annotation-id":r.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children),a&&a.annotationType===t.JJ.Popup&&e.popup.opened&&s.createElement(Fe,{annotation:a,page:i,viewport:o}))}))},Me=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--ink","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.inkLists&&t.inkLists.length&&s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},t.inkLists.map((function(e,t){return s.createElement("polyline",{key:t,fill:"none",stroke:"transparent",strokeWidth:f||1,points:e.map((function(e){return"".concat(e.x-c[0],",").concat(c[3]-e.y)})).join(" ")})}))),e.slot.children)}))},Re=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--line","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},s.createElement("line",{stroke:"transparent",strokeWidth:f||1,x1:c[2]-t.lineCoordinates[0],x2:c[2]-t.lineCoordinates[2],y1:c[3]-t.lineCoordinates[1],y2:c[3]-t.lineCoordinates[3]})),e.slot.children)}))},Ie=/^([^\w]*)(javascript|data|vbscript)/im,Oe=/&#(\w+)(^\w|;)?/g,Le=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,De=/^([^:]+):/gm,Ne=function(e){var t,n=e.annotation,r=e.annotationContainerRef,a=e.doc,i=e.outlines,o=e.page,l=e.pageIndex,c=e.scale,u=e.viewport,d=e.onExecuteNamedAction,f=e.onJumpFromLinkAnnotation,p=e.onJumpToDest,v=s.useRef(),g=i&&i.length&&n.dest&&"string"==typeof n.dest?null===(t=i.find((function(e){return e.dest===n.dest})))||void 0===t?void 0:t.title:"",m=!!(n.url||n.dest||n.action||n.unsafeUrl),y={};if(n.url||n.unsafeUrl){var _=function(e,t){void 0===t&&(t="about:blank");var n,r=(n=e||"",n.replace(Oe,(function(e,t){return String.fromCharCode(t)}))).replace(Le,"").trim();if(!r)return t;var a=r[0];if("."===a||"/"===a)return r;var i=r.match(De);if(!i)return r;var o=i[0];return Ie.test(o)?t:r}(n.url||n.unsafeUrl,"");_?y={"data-target":"external",href:_,rel:"noopener noreferrer nofollow",target:n.newWindow?"_blank":"",title:_}:m=!1}else y={href:"","data-annotation-link":n.id,onClick:function(e){e.preventDefault(),n.action?d(n.action):ge(a,n.dest).then((function(e){var t=v.current,n=r.current;if(t&&n){var a=t.getBoundingClientRect();n.style.setProperty("height","100%"),n.style.setProperty("width","100%");var i=n.getBoundingClientRect();n.style.removeProperty("height"),n.style.removeProperty("width");var o=(a.left-i.left)/c,s=(i.bottom-a.bottom+a.height)/c;f({bottomOffset:s,label:g,leftOffset:o,pageIndex:l})}p(e)}))}};return g&&(y=Object.assign({},y,{title:g,"aria-label":g})),s.createElement(Pe,{annotation:n,hasPopup:!1,ignoreBorder:!1,isRenderable:m,page:o,viewport:u},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--link","data-annotation-id":n.id,"data-testid":"core__annotation--link-".concat(n.id)}),s.createElement("a",h({ref:v},y)))}))},Ge=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polygon","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},s.createElement("polygon",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:t.vertices.map((function(e){return"".concat(e.x-c[0],",").concat(c[3]-e.y)})).join(" ")})),e.slot.children)}))},je=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--polyline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),t.vertices&&t.vertices.length&&s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},s.createElement("polyline",{fill:"none",stroke:"transparent",strokeWidth:f||1,points:t.vertices.map((function(e){return"".concat(e.x-c[0],",").concat(c[3]-e.y)})).join(" ")})),e.slot.children)}))},ze=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o),c=t.rect,u=c[2]-c[0],d=c[3]-c[1],f=t.borderStyle.width;return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--square","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),s.createElement("svg",{height:"".concat(d,"px"),preserveAspectRatio:"none",version:"1.1",viewBox:"0 0 ".concat(u," ").concat(d),width:"".concat(u,"px")},s.createElement("rect",{height:d-f,fill:"none",stroke:"transparent",strokeWidth:f||1,x:f/2,y:f/2,width:u-f})),e.slot.children)}))},Be=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--squiggly","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},He=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--stamp","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ue=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--strike-out","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},We=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M.5,16.5a1,1,0,0,0,1,1h2v4l4-4h15a1,1,0,0,0,1-1V3.5a1,1,0,0,0-1-1H1.5a1,1,0,0,0-1,1Z"}),s.createElement("path",{d:"M7.25,9.75A.25.25,0,1,1,7,10a.25.25,0,0,1,.25-.25"}),s.createElement("path",{d:"M12,9.75a.25.25,0,1,1-.25.25A.25.25,0,0,1,12,9.75"}),s.createElement("path",{d:"M16.75,9.75a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"}))},qe=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M0.500 12.001 A11.500 11.500 0 1 0 23.500 12.001 A11.500 11.500 0 1 0 0.500 12.001 Z"}),s.createElement("path",{d:"M6.000 12.001 A6.000 6.000 0 1 0 18.000 12.001 A6.000 6.000 0 1 0 6.000 12.001 Z"}),s.createElement("path",{d:"M21.423 5.406L17.415 9.414"}),s.createElement("path",{d:"M14.587 6.585L18.607 2.565"}),s.createElement("path",{d:"M5.405 21.424L9.413 17.416"}),s.createElement("path",{d:"M6.585 14.588L2.577 18.596"}),s.createElement("path",{d:"M18.602 21.419L14.595 17.412"}),s.createElement("path",{d:"M17.419 14.58L21.428 18.589"}),s.createElement("path",{d:"M2.582 5.399L6.588 9.406"}),s.createElement("path",{d:"M9.421 6.581L5.412 2.572"}))},Ve=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M4.000 18.500 A1.500 1.500 0 1 0 7.000 18.500 A1.500 1.500 0 1 0 4.000 18.500 Z"}),s.createElement("path",{d:"M20.5.5l-9.782,9.783a7,7,0,1,0,3,3L17,10h1.5V8.5L19,8h1.5V6.5L21,6h1.5V4.5l1-1V.5Z"}))},Ke=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M2.000 2.500 L22.000 2.500 L22.000 23.500 L2.000 23.500 Z"}),s.createElement("path",{d:"M6 4.5L6 0.5"}),s.createElement("path",{d:"M18 4.5L18 0.5"}),s.createElement("path",{d:"M10 4.5L10 0.5"}),s.createElement("path",{d:"M14 4.5L14 0.5"}))},Xe=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M17.5 0.498L17.5 23.498"}),s.createElement("path",{d:"M10.5 0.498L10.5 23.498"}),s.createElement("path",{d:"M23.5.5H6.5a6,6,0,0,0,0,12h4"}))},Ye=function(){return s.createElement(y,{size:16},s.createElement("path",{d:"M2.5 22.995L12 6.005 21.5 22.995 2.5 22.995z"}))},Je=function(e){var n=e.annotation,r=e.childAnnotation,a=e.page,i=e.viewport,o=!1===n.hasPopup,l=ke(n),c=be(n),u=!!(n.hasPopup||l||c),d=n.name?n.name.toLowerCase():"";return s.createElement(Pe,{annotation:n,hasPopup:o,ignoreBorder:!1,isRenderable:u,page:a,viewport:i},(function(e){return s.createElement(s.Fragment,null,s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--text","data-annotation-id":n.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),d&&s.createElement("div",{className:"rpv-core__annotation-text-icon"},"check"===d&&s.createElement(_,null),"comment"===d&&s.createElement(We,null),"help"===d&&s.createElement(qe,null),"insert"===d&&s.createElement(Ye,null),"key"===d&&s.createElement(Ve,null),"note"===d&&s.createElement(Ke,null),("newparagraph"===d||"paragraph"===d)&&s.createElement(Xe,null)),e.slot.children),r&&r.annotationType===t.JJ.Popup&&e.popup.opened&&s.createElement(Fe,{annotation:r,page:a,viewport:i}))}))},Qe=function(e){var t=e.annotation,n=e.page,r=e.viewport,a=!1===t.hasPopup,i=ke(t),o=be(t),l=!!(t.hasPopup||i||o);return s.createElement(Pe,{annotation:t,hasPopup:a,ignoreBorder:!0,isRenderable:l,page:n,viewport:r},(function(e){return s.createElement("div",h({},e.slot.attrs,{className:"rpv-core__annotation rpv-core__annotation--underline","data-annotation-id":t.id,onClick:e.popup.toggleOnClick,onMouseEnter:e.popup.openOnHover,onMouseLeave:e.popup.closeOnHover}),e.slot.children)}))},Ze=function(e){var n=e.annotations,r=e.doc,a=e.outlines,i=e.page,o=e.pageIndex,l=e.plugins,c=e.rotation,u=e.scale,d=e.onExecuteNamedAction,h=e.onJumpFromLinkAnnotation,f=e.onJumpToDest,p=s.useRef(),v=i.getViewport({rotation:c,scale:u}).clone({dontFlip:!0}),m=n.filter((function(e){return!e.parentId}));return g((function(){var e=p.current;e&&l.forEach((function(t){t.onAnnotationLayerRender&&t.onAnnotationLayerRender({annotations:m,container:e,pageIndex:o,rotation:c,scale:u})}))}),[]),s.createElement("div",{ref:p,className:"rpv-core__annotation-layer","data-testid":"core__annotation-layer-".concat(o)},m.map((function(e){var l=n.find((function(t){return t.parentId===e.id}));switch(e.annotationType){case t.JJ.Caret:return s.createElement(xe,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Circle:return s.createElement(Ae,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.FileAttachment:return s.createElement(Ce,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.FreeText:return s.createElement(Ee,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Highlight:return s.createElement(Te,{key:e.id,annotation:e,childAnnotation:l,page:i,viewport:v});case t.JJ.Ink:return s.createElement(Me,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Line:return s.createElement(Re,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Link:return s.createElement(Ne,{key:e.id,annotation:e,annotationContainerRef:p,doc:r,outlines:a,page:i,pageIndex:o,scale:u,viewport:v,onExecuteNamedAction:d,onJumpFromLinkAnnotation:h,onJumpToDest:f});case t.JJ.Polygon:return s.createElement(Ge,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Polyline:return s.createElement(je,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Popup:return s.createElement(Fe,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Square:return s.createElement(ze,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Squiggly:return s.createElement(Be,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Stamp:return s.createElement(He,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.StrikeOut:return s.createElement(Ue,{key:e.id,annotation:e,page:i,viewport:v});case t.JJ.Text:return s.createElement(Je,{key:e.id,annotation:e,childAnnotation:l,page:i,viewport:v});case t.JJ.Underline:return s.createElement(Qe,{key:e.id,annotation:e,page:i,viewport:v});default:return s.createElement(s.Fragment,{key:e.id})}})))},$e=function(e){var t=e.page,n=e.renderAnnotations,r=I(),a=s.useState({loading:!0,annotations:[]}),i=a[0],o=a[1];return s.useEffect((function(){t.getAnnotations({intent:"display"}).then((function(e){r.current&&o({loading:!1,annotations:e})}))}),[]),i.loading?s.createElement(s.Fragment,null):n(i.annotations)},et=function(e){var t=e.doc,n=e.outlines,r=e.page,a=e.pageIndex,i=e.plugins,o=e.rotation,l=e.scale,c=e.onExecuteNamedAction,u=e.onJumpFromLinkAnnotation,d=e.onJumpToDest;return s.createElement($e,{page:r,renderAnnotations:function(e){return s.createElement(Ze,{annotations:e,doc:t,outlines:n,page:r,pageIndex:a,plugins:i,rotation:o,scale:l,onExecuteNamedAction:c,onJumpFromLinkAnnotation:u,onJumpToDest:d})}})},tt=function(e,t){var n=e%t;return 0===n?e:Math.floor(e-n)},nt=function(e){var n=e.canvasLayerRef,r=e.height,a=e.page,i=e.pageIndex,o=e.plugins,l=e.rotation,c=e.scale,u=e.width,d=e.onRenderCanvasCompleted,h=s.useRef();return g((function(){var e=h.current;e&&e.cancel();var r=n.current;r.removeAttribute("data-testid"),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:r,pageIndex:i,rotation:l,scale:c,status:t.B1.PreRender})}));var s=a.getViewport({rotation:l,scale:c}),u=window.devicePixelRatio||1,f=Math.sqrt(16777216/(s.width*s.height)),p=u>f;p?r.style.transform="scale(1, 1)":r.style.removeProperty("transform");var v=Math.min(f,u),g=function(e,t){var n,r;if(Math.floor(e)===e)return[e,1];var a=1/e;if(a>8)return[1,8];if(Math.floor(a)===a)return[1,a];for(var i=e>1?a:e,o=0,s=1,l=1,c=1;;){var u=o+l,d=s+c;if(d>8)break;i<=u/d?(l=(n=[u,d])[0],c=n[1]):(o=(r=[u,d])[0],s=r[1])}return i<(o/s+l/c)/2?i===e?[o,s]:[s,o]:i===e?[l,c]:[c,l]}(v),m=g[0],y=g[1];r.width=tt(s.width*v,m),r.height=tt(s.height*v,m),r.style.width="".concat(tt(s.width,y),"px"),r.style.height="".concat(tt(s.height,y),"px"),r.hidden=!0;var _=r.getContext("2d",{alpha:!1}),b=p||1!==u?[v,0,0,v,0,0]:null;return h.current=a.render({canvasContext:_,transform:b,viewport:s}),h.current.promise.then((function(){r.hidden=!1,r.setAttribute("data-testid","core__canvas-layer-".concat(i)),o.forEach((function(e){e.onCanvasLayerRender&&e.onCanvasLayerRender({ele:r,pageIndex:i,rotation:l,scale:c,status:t.B1.DidRender})})),d()}),(function(){d()})),function(){r&&(r.width=0,r.height=0)}}),[]),s.createElement("div",{className:"rpv-core__canvas-layer",style:{height:"".concat(r,"px"),width:"".concat(u,"px")}},s.createElement("canvas",{ref:n}))},rt=function(e){var t=e.height,n=e.page,r=e.rotation,a=e.scale,i=e.width,o=s.useRef();return g((function(){var e=o.current,s=n.getViewport({rotation:r,scale:a});n.getOperatorList().then((function(r){!function(){var e=o.current;e&&(e.innerHTML="")}(),new l.SVGGraphics(n.commonObjs,n.objs).getSVG(r,s).then((function(n){n.style.height="".concat(t,"px"),n.style.width="".concat(i,"px"),e.appendChild(n)}))}))}),[]),s.createElement("div",{className:"rpv-core__svg-layer",ref:o})},at=function(e){var n=e.containerRef,r=e.page,a=e.pageIndex,i=e.plugins,o=e.rotation,c=e.scale,u=e.onRenderTextCompleted,d=s.useRef(),h=function(){var e=n.current;e&&([].slice.call(e.querySelectorAll(".rpv-core__text-layer-text")).forEach((function(t){return e.removeChild(t)})),[].slice.call(e.querySelectorAll('br[role="presentation"]')).forEach((function(t){return e.removeChild(t)})))};return g((function(){var e=d.current;e&&e.cancel();var s=n.current;if(s){s.removeAttribute("data-testid");var f=r.getViewport({rotation:o,scale:c});return i.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:a,scale:c,status:t.B1.PreRender})})),r.getTextContent().then((function(e){h(),d.current=l.renderTextLayer({container:s,textContent:e,textContentSource:e,viewport:f}),d.current.promise.then((function(){s.setAttribute("data-testid","core__text-layer-".concat(a)),[].slice.call(s.children).forEach((function(e){e.classList.contains("rpv-core__text-layer-text--not")||e.classList.add("rpv-core__text-layer-text")})),i.forEach((function(e){e.onTextLayerRender&&e.onTextLayerRender({ele:s,pageIndex:a,scale:c,status:t.B1.DidRender})})),u()}),(function(){s.removeAttribute("data-testid"),u()}))})),function(){var e;h(),null===(e=d.current)||void 0===e||e.cancel()}}}),[]),s.createElement("div",{className:"rpv-core__text-layer",ref:n})},it=function(e){var n=e.doc,r=e.measureRef,a=e.outlines,i=e.pageIndex,o=e.pageRotation,l=e.pageSize,c=e.plugins,u=e.renderPage,d=e.renderQueueKey,h=e.rotation,f=e.scale,p=e.shouldRender,g=e.viewMode,m=e.onExecuteNamedAction,y=e.onJumpFromLinkAnnotation,_=e.onJumpToDest,b=e.onRenderCompleted,S=e.onRotatePage,w=I(),P=s.useState(null),x=P[0],A=P[1],C=s.useState(!1),E=C[0],F=C[1],T=s.useState(!1),M=T[0],R=T[1],O=s.useRef(),L=s.useRef(),D=Math.abs(h+o)%180==0,N=l.pageWidth*f,G=l.pageHeight*f,j=D?N:G,z=D?G:N,B=(l.rotation+h+o)%360,H=s.useRef(0),U=u||function(e){return s.createElement(s.Fragment,null,e.canvasLayer.children,e.textLayer.children,e.annotationLayer.children)};return s.useEffect((function(){A(null),F(!1),R(!1)}),[o,h,f]),s.useEffect((function(){p&&w.current&&!x&&ve(n,i).then((function(e){w.current&&(H.current=d,A(e))}))}),[p,x]),s.useEffect((function(){E&&M&&(d!==H.current?(A(null),F(!1),R(!1)):b(i))}),[E,M]),s.createElement("div",{className:v({"rpv-core__page-layer":!0,"rpv-core__page-layer--dual":g===t.wO.DualPage,"rpv-core__page-layer--dual-cover":g===t.wO.DualPageWithCover,"rpv-core__page-layer--single":g===t.wO.SinglePage}),"data-testid":"core__page-layer-".concat(i),ref:r,style:{height:"".concat(z,"px"),width:"".concat(j,"px")}},x?s.createElement(s.Fragment,null,U({annotationLayer:{attrs:{},children:s.createElement(et,{doc:n,outlines:a,page:x,pageIndex:i,plugins:c,rotation:B,scale:f,onExecuteNamedAction:m,onJumpFromLinkAnnotation:y,onJumpToDest:_})},canvasLayer:{attrs:{},children:s.createElement(nt,{canvasLayerRef:O,height:z,page:x,pageIndex:i,plugins:c,rotation:B,scale:f,width:j,onRenderCanvasCompleted:function(){w.current&&F(!0)}})},canvasLayerRendered:E,doc:n,height:z,pageIndex:i,rotation:B,scale:f,svgLayer:{attrs:{},children:s.createElement(rt,{height:z,page:x,rotation:B,scale:f,width:j})},textLayer:{attrs:{},children:s.createElement(at,{containerRef:L,page:x,pageIndex:i,plugins:c,rotation:B,scale:f,onRenderTextCompleted:function(){w.current&&R(!0)}})},textLayerRendered:M,width:j,markRendered:b,onRotatePage:function(e){return S(i,e)}}),c.map((function(e,t){return e.renderPageLayer?s.createElement(s.Fragment,{key:t},e.renderPageLayer({canvasLayerRef:O,canvasLayerRendered:E,doc:n,height:z,pageIndex:i,rotation:B,scale:f,textLayerRef:L,textLayerRendered:M,width:j})):s.createElement(s.Fragment,{key:t})}))):s.createElement(k,{testId:"core__page-layer-loading-".concat(i)}))},ot=function(e,t){var n=t.rect;return e.height!==n.height||e.width!==n.width?n:e};!function(e){e.Horizontal="Horizontal",e.Vertical="Vertical",e.Both="Both"}(we||(we={}));var st=function(e){return 1-Math.pow(1-e,4)},lt=1e-4,ct={left:0,top:0},ut={capture:!1,passive:!0},dt=function(e,t,n){return Math.max(e,Math.min(n,t))},ht=function(e,n){if(n!==t.wO.DualPageWithCover)return 0;if(!function(e){var t=e.length;if(1===t)return!1;for(var n=1;nn))return a;t=a-1}}return e>0?e-1:0}(0,i,a,(function(n){switch(e){case we.Horizontal:return t[n].start.left;case we.Both:case we.Vertical:default:return t[n].start.top}}));if(e===we.Both)for(var s=t[o].start.top;o-1>=0&&t[o-1].start.top===s&&t[o-1].start.left>=r.left;)o--;for(var l=o;l<=i;){var c={top:t[l].start.top-r.top,left:t[l].start.left-r.left},u={height:n.height-c.top,width:n.width-c.left};if(e===we.Horizontal&&u.width<0)break;if(e===we.Vertical&&u.height<0)break;if(e===we.Both&&(u.width<0||u.height<0))break;l++}return{start:o,end:l}}(_,T,w,k),n=e.start,r=e.end,i=n+C.slice(dt(0,a,n),dt(0,a,r)).reduce((function(e,t,n,r){return t>r[e]?n:e}),0),s=i=dt(0,a-1,i),l=o({endPage:r,numPages:a,startPage:n}),c=l.startPage,d=l.endPage;switch(c=Math.max(c,0),d=Math.min(d,a-1),u){case t.wO.DualPageWithCover:i>0&&(s=i%2==1?i:i-1),c=0===c?0:c%2==1?c:c-1,a-(d=d%2==1?d-1:d)<=2&&(d=a-1);break;case t.wO.DualPage:s=i%2==0?i:i-1,c=c%2==0?c:c-1,d=d%2==1?d:d-1;break;case t.wO.SinglePage:default:s=i}return{startPage:c,endPage:d,maxVisbilityIndex:s}}),[T,w,k,u,C]),I=R.startPage,O=R.endPage,L=R.maxVisbilityIndex,D=s.useMemo((function(){for(var e=[],t=function(t){var n=T[t],r=h(h({},n),{visibility:void 0!==C[t]?C[t]:-1,measureRef:function(e){e&&(e.setAttribute(_t,"".concat(t)),F.observe(e))}});e.push(r)},n=I;n<=O;n++)t(n);return e}),[I,O,C,T]),N=s.useCallback((function(e,r){var i=P.current.measurements[dt(0,a-1,e)],o=m.current===t.Gd.Page?yt:r;return i?S({left:o.left+i.start.left,top:o.top+i.start.top},n):Promise.resolve()}),[S,n]),G=s.useCallback((function(e,n){var r=P.current.measurements,a=r[e].start,i=r.find((function(e){return e.start.top-a.top>1e-12}));if(!i)return Promise.resolve();var o=i.index;switch(y.current){case t.wO.DualPage:o=o%2==0?o:o+1;break;case t.wO.DualPageWithCover:o=o%2==1?o:o+1}return N(o,n)}),[]),j=s.useCallback((function(e,n){for(var r=P.current.measurements,i=r[e].start,o=e,s=!1,l=a-1;l>=0;l--)if(i.top-r[l].start.top>1e-12){s=!0,o=r[l].index;break}if(!s)return Promise.resolve();switch(y.current){case t.wO.DualPage:o=o%2==0?o:o-1;break;case t.wO.DualPageWithCover:o=o%2==0?o-1:o}return o===e&&(o=e-1),N(o,n)}),[]),z=s.useCallback((function(e,n){if(y.current===t.wO.DualPageWithCover||y.current===t.wO.DualPage)return G(e,n);switch(m.current){case t.Gd.Wrapped:return G(e,n);case t.Gd.Horizontal:case t.Gd.Vertical:default:return N(e+1,n)}}),[]),B=s.useCallback((function(e,n){if(y.current===t.wO.DualPageWithCover||y.current===t.wO.DualPage)return j(e,n);switch(m.current){case t.Gd.Wrapped:return j(e,n);case t.Gd.Horizontal:case t.Gd.Vertical:default:return N(e-1,n)}}),[]),H=s.useCallback((function(){return function(e,n){switch(n){case t.Gd.Horizontal:return{position:"relative",height:"100%",width:"".concat(e.width,"px")};case t.Gd.Vertical:default:return{position:"relative",height:"".concat(e.height,"px"),width:"100%"}}}(M,m.current)}),[M]),U=s.useCallback((function(e){return function(e,n,r){return r!==t.Gd.Page?{}:{height:"".concat(n.height,"px"),width:"100%",position:"absolute",top:0,transform:"translateY(".concat(e.start.top,"px)")}}(e,w,m.current)}),[w]),W=s.useCallback((function(e){return function(e,n,r,a,i){var o,s,l,c,u,d,h,f=n?"right":"left",p=n?-1:1,v=r.length,g=e.start.left*p,m=e.size,y=m.height,_=m.width;if(a===t.wO.DualPageWithCover){var b=i===t.Gd.Page?0:e.start.top;return 0===e.index||v%2==0&&e.index===v-1?((o={height:"".concat(y,"px"),minWidth:"".concat(ht(r,a),"px"),width:"100%"})[f]=0,o.position="absolute",o.top=0,o.transform="translate(".concat(g,"px, ").concat(b,"px)"),o):((s={height:"".concat(y,"px"),width:"".concat(_,"px")})[f]=0,s.position="absolute",s.top=0,s.transform="translate(".concat(g,"px, ").concat(b,"px)"),s)}if(a===t.wO.DualPage)return(l={height:"".concat(y,"px"),width:"".concat(_,"px")})[f]=0,l.position="absolute",l.top=0,l.transform="translate(".concat(g,"px, ").concat(i===t.Gd.Page?0:e.start.top,"px)"),l;switch(i){case t.Gd.Horizontal:return(c={height:"100%",width:"".concat(_,"px")})[f]=0,c.position="absolute",c.top=0,c.transform="translateX(".concat(g,"px)"),c;case t.Gd.Page:return(u={height:"".concat(y,"px"),width:"".concat(_,"px")})[f]=0,u.position="absolute",u.top=0,u;case t.Gd.Wrapped:return(d={height:"".concat(y,"px"),width:"".concat(_,"px")})[f]=0,d.position="absolute",d.top=0,d.transform="translate(".concat(g,"px, ").concat(e.start.top,"px)"),d;case t.Gd.Vertical:default:return(h={height:"".concat(y,"px"),width:"100%"})[f]=0,h.position="absolute",h.top=0,h.transform="translateY(".concat(e.start.top,"px)"),h}}(e,r,l,y.current,m.current)}),[r,l]),q=s.useCallback((function(e,n){var r=P.current,i=r.measurements,o=r.scrollOffset,s=i[dt(0,a-1,n)];if(s){var l=m.current===t.Gd.Page?{left:s.start.left,top:s.start.top}:{left:o.left*e,top:o.top*e};return S(l,!1)}return Promise.resolve()}),[]);return s.useEffect((function(){return function(){F.disconnect()}}),[]),{boundingClientRect:w,isSmoothScrolling:f,startPage:I,endPage:O,maxVisbilityIndex:L,virtualItems:D,getContainerStyles:H,getItemContainerStyles:U,getItemStyles:W,scrollToItem:N,scrollToNextItem:z,scrollToPreviousItem:B,zoom:q}},St=function(e,n,r,a,i,o){var s=r;switch(!0){case i===t.wO.DualPageWithCover&&o>=3:case i===t.wO.DualPage&&o>=3:s=2*r;break;default:s=r}switch(a){case t.SpecialZoomLevel.ActualSize:return 1;case t.SpecialZoomLevel.PageFit:return Math.min((e.clientWidth-17)/s,(e.clientHeight-16)/n);case t.SpecialZoomLevel.PageWidth:return(e.clientWidth-17)/s}},wt=function e(t){var n=[];return t.map((function(t){n=n.concat(t).concat(function(t){var n=[];return t.items&&t.items.length>0&&(n=n.concat(e(t.items))),n}(t))})),n},Pt={capture:!1,passive:!0},xt={height:0,width:0},At={height:0,width:0},Ct=function(e){var n=e.getCurrentPage,r=e.getCurrentScrollMode,a=e.jumpToPage,i=e.targetRef,o=s.useState(t.Fi.Normal),l=o[0],c=o[1],u=function(){var e=s.useState(xt),t=e[0],n=e[1],r=R((function(){n({height:window.innerHeight,width:window.innerWidth})}),100);return g((function(){return window.addEventListener("resize",r,Pt),function(){window.removeEventListener("resize",r,Pt)}}),[]),t}(),d=s.useState(At),h=d[0],f=d[1],p=s.useRef(At),v=s.useRef(n()),m=s.useRef(At),y=s.useState(i.current),_=y[0],b=y[1],k=s.useRef();g((function(){i.current!==_&&b(i.current)}),[]),g((function(){if(_){var e=new ResizeObserver((function(e){e.forEach((function(e){var t=e.target.getBoundingClientRect(),n=t.height,r=t.width;f({height:n,width:r})}))}));return e.observe(_),function(){e.unobserve(_),e.disconnect()}}}),[_]);var S=s.useCallback((function(e){var n=M();return n&&n!==e?(c(t.Fi.Normal),T(n)):Promise.resolve()}),[]),w=s.useCallback((function(e){e&&F()&&(b(e),S(e).then((function(){k.current=e,c(t.Fi.Entering),function(e){C&&e[E.RequestFullScreen]()}(e)})))}),[]),P=s.useCallback((function(){M()&&(c(t.Fi.Exitting),T(document))}),[]),x=s.useCallback((function(){_&&M()!==_&&c(t.Fi.Exitting)}),[_]);return s.useEffect((function(){switch(l){case t.Fi.Entering:k.current&&(k.current.style.backgroundColor="var(--rpv-core__full-screen-target-background-color)"),v.current=n(),p.current={height:window.innerHeight,width:window.innerWidth};break;case t.Fi.Entered:r()===t.Gd.Page?a(v.current).then((function(){c(t.Fi.EnteredCompletely)})):c(t.Fi.EnteredCompletely);break;case t.Fi.Exitting:k.current&&(k.current.style.backgroundColor="",k.current=null),v.current=n();break;case t.Fi.Exited:c(t.Fi.Normal),r()===t.Gd.Page&&a(v.current)}}),[l]),s.useEffect((function(){if(l!==t.Fi.Normal)return l===t.Fi.Entering&&u.height===h.height&&u.width===h.width&&u.height>0&&u.width>0&&(0===m.current.height||u.height==m.current.height)?(m.current={height:window.innerHeight,width:window.innerWidth},void c(t.Fi.Entered)):void(l===t.Fi.Exitting&&p.current.height===u.height&&p.current.width===u.width&&u.height>0&&u.width>0&&c(t.Fi.Exited))}),[l,u,h]),s.useEffect((function(){var e;return e=x,C&&document.addEventListener(E.FullScreenChange,e),function(){!function(e){C&&document.removeEventListener(E.FullScreenChange,e)}(x)}}),[_]),{enterFullScreenMode:w,exitFullScreenMode:P,fullScreenMode:l}},Et={buildPageStyles:function(){return{}},transformSize:function(e){return e.size}},Ft={left:0,top:0},Tt=function(e){var n=e.currentFile,r=e.defaultScale,a=e.doc,i=e.enableSmoothScroll,o=e.initialPage,l=e.initialRotation,c=e.initialScale,u=e.pageLayout,d=e.pageSizes,f=e.plugins,m=e.renderPage,y=e.scrollMode,_=e.setRenderRange,b=e.viewMode,k=e.viewerState,S=e.onDocumentLoad,w=e.onOpenFile,P=e.onPageChange,x=e.onRotate,A=e.onRotatePage,C=e.onZoom,E=a.numPages,F=a.loadingTask.docId,T=s.useContext(j).l10n,M=s.useContext(p),L=M.direction===t.m5.RightToLeft,D=s.useRef(),G=s.useRef(),z=s.useState(o),B=z[0],H=z[1],U=s.useRef(null),W=function(e){var t,n=e.getCurrentPage,r=(t=s.useRef([]),s.useEffect((function(){return function(){t.current=[]}}),[]),{push:function(e){var n=t.current;n.length+1>50&&n.shift(),n.push(e),t.current=n},map:function(e){return t.current.map((function(t){return e(t)}))},pop:function(){var e=t.current;if(0===e.length)return null;var n=e.pop();return t.current=e,n}}),a=function(e){var t=s.useRef([]);return s.useEffect((function(){return function(){t.current=[]}}),[]),{dequeue:function(){var e=t.current;if(0===e.length)return null;var n=e.shift();return t.current=e,n||null},enqueue:function(e){var n=t.current;n.length+1>50&&n.pop(),t.current=[e].concat(n)},map:function(e){return t.current.map((function(t){return e(t)}))}}}(),i=s.useCallback((function(e){r.push(e)}),[]);return{getNextDestination:function e(){var t=a.dequeue();return t&&r.push(t),t&&t.pageIndex===n()?e():t},getPreviousDestination:function e(){var t=r.pop();return t&&a.enqueue(t),t&&t.pageIndex===n()?e():t},markVisitedDestination:i}}({getCurrentPage:function(){return ye.current.pageIndex}}),q=s.useState(l),V=q[0],K=q[1],X=O(V),Y=s.useState(!1),J=Y[0],Q=Y[1],Z=s.useState(new Map),$=Z[0],ee=Z[1],te=s.useState(y),ne=te[0],re=te[1],ae=O(ne),ie=s.useState(b),oe=ie[0],se=ie[1],le=O(oe),ue=function(e){var t=I(),n=s.useState([]),r=n[0],a=n[1];return s.useEffect((function(){e.getOutline().then((function(e){if(t.current&&null!==e){var n=wt(e);a(n)}}))}),[]),r}(a),fe=s.useState(c),pe=fe[0],ge=fe[1],me=O(pe),ye=s.useRef(k),_e=s.useRef("string"==typeof r?r:null),be=s.useRef(-1),ke=s.useRef(-1),Se=s.useRef(o),we=Ct({getCurrentPage:function(){return ye.current.pageIndex},getCurrentScrollMode:function(){return ye.current.scrollMode},jumpToPage:function(e){return We(e)},targetRef:G}),Pe=s.useState(-1),xe=Pe[0],Ae=Pe[1],Ce=s.useState(0),Ee=Ce[0],Fe=Ce[1],Te=N({doc:a});s.useEffect((function(){return function(){de.clear(),he.clear()}}),[F]);var Me=s.useMemo((function(){return Object.assign({},Et,u)}),[]),Re=s.useMemo((function(){return Array(E).fill(0).map((function(e,t){var n=[d[t].pageHeight,d[t].pageWidth],r=Math.abs(V)%180==0?{height:n[0],width:n[1]}:{height:n[1],width:n[0]},a={height:r.height*pe,width:r.width*pe};return Me.transformSize({numPages:E,pageIndex:t,size:a})}))}),[V,pe]),Ie=kt({enableSmoothScroll:i,isRtl:L,numberOfItems:E,parentRef:G,scrollMode:ne,setRenderRange:_,sizes:Re,viewMode:oe}),Oe=R((function(){!_e.current||ye.current.fullScreenMode!==t.Fi.Normal||o>0&&Se.current===o||Qe(_e.current)}),200);!function(e){var t=e.targetRef,n=e.onResize;g((function(){var e=new ResizeObserver((function(e){e.forEach((function(e){n(e.target)}))})),r=t.current;if(r)return e.observe(r),function(){e.unobserve(r)}}),[])}({targetRef:G,onResize:Oe});var Le=function(e){var t=e;f.forEach((function(e){e.onViewerStateChange&&(t=e.onViewerStateChange(t))})),ye.current=t},De=function(){return G.current},Ne=function(){return ye.current},Ge=s.useCallback((function(e){W.markVisitedDestination(e)}),[]),je=s.useCallback((function(e){var n=e.pageIndex,r=e.bottomOffset,i=e.leftOffset,o=e.scaleTo,s=G.current,l=ye.current;return s&&l?new Promise((function(e,c){ve(a,n).then((function(a){var c=a.getViewport({scale:1}),u=0,h=("function"==typeof r?r(c.width,c.height):r)||0,f=("function"==typeof i?i(c.width,c.height):i)||0,p=l.scale;switch(o){case t.SpecialZoomLevel.PageFit:u=0,f=0,Qe(t.SpecialZoomLevel.PageFit);break;case t.SpecialZoomLevel.PageWidth:p=St(s,d[n].pageHeight,d[n].pageWidth,t.SpecialZoomLevel.PageWidth,b,E),u=(c.height-h)*p,f*=p,Qe(p);break;default:u=(c.height-h)*p,f*=p}switch(l.scrollMode){case t.Gd.Horizontal:Ie.scrollToItem(n,{left:f,top:0}).then((function(){e()}));break;case t.Gd.Vertical:default:Ie.scrollToItem(n,{left:0,top:u}).then((function(){e()}))}}))})):Promise.resolve()}),[]),ze=s.useCallback((function(e){return W.markVisitedDestination(e),je(e)}),[]),Be=s.useCallback((function(){var e=W.getNextDestination();return e?je(e):Promise.resolve()}),[]),He=s.useCallback((function(){var e=W.getPreviousDestination();return e?je(e):Promise.resolve()}),[]),Ue=s.useCallback((function(){return Ie.scrollToNextItem(ye.current.pageIndex,Ft)}),[]),We=s.useCallback((function(e){return 0<=e&&e=E)){var r=d[n].pageHeight,i=d[n].pageWidth,o=t?"string"==typeof e?St(t,r,i,e,ye.current.viewMode,E):e:1;_e.current="string"==typeof e?e:null,o!==ye.current.scale&&(Fe((function(e){return e+1})),Te.markNotRendered(),ge(o),C({doc:a,scale:o}),Le(h(h({},ye.current),{scale:o})))}}),[]),Ze=s.useCallback((function(e){we.enterFullScreenMode(e)}),[]),$e=s.useCallback((function(){we.exitFullScreenMode()}),[]);s.useEffect((function(){Le(h(h({},ye.current),{fullScreenMode:we.fullScreenMode}))}),[we.fullScreenMode]),s.useEffect((function(){var e={enterFullScreenMode:Ze,exitFullScreenMode:$e,getPagesContainer:De,getViewerState:Ne,jumpToDestination:ze,jumpToNextDestination:Be,jumpToPreviousDestination:He,jumpToNextPage:Ue,jumpToPreviousPage:qe,jumpToPage:We,openFile:Ve,rotate:Ke,rotatePage:Xe,setViewerState:Le,switchScrollMode:Ye,switchViewMode:Je,zoom:Qe};return f.forEach((function(t){t.install&&t.install(e)})),function(){f.forEach((function(t){t.uninstall&&t.uninstall(e)}))}}),[F]),s.useEffect((function(){S({doc:a,file:n}),f.forEach((function(e){e.onDocumentLoad&&e.onDocumentLoad({doc:a,file:n})}))}),[F]);var et,tt,nt,rt=Ie.boundingClientRect;et=function(){o&&We(o)},tt=rt.height>0&&rt.width>0,nt=s.useRef(!1),g((function(){tt&&!nt.current&&(nt.current=!0,et())}),[et,tt]),g((function(){var e=ye.current.pageIndex;e>-1&&ae!==ne&&Ie.scrollToItem(e,Ft).then((function(){we.fullScreenMode===t.Fi.EnteredCompletely&&(i||Te.markNotRendered(),be.current=-1)}))}),[ne]),g((function(){var e=ye.current.pageIndex;e>-1&&X!==V&&Ie.scrollToItem(e,Ft)}),[V]),g((function(){0!=me&&me!=ye.current.scale&&Ie.zoom(ye.current.scale/me,ye.current.pageIndex).then((function(){we.fullScreenMode===t.Fi.EnteredCompletely&&(ke.current=-1)}))}),[pe]),g((function(){if(le!==ye.current.viewMode){var e=Ie.startPage,t=Ie.endPage,n=Ie.virtualItems;Te.markNotRendered(),Te.setRange(e,t);for(var r=function(e){var t=n.find((function(t){return t.index===e}));t&&Te.setVisibility(e,t.visibility)},a=e;a<=t;a++)r(a);ot()}}),[oe]),g((function(){var e=ye.current.pageIndex;e>-1&&le!==oe&&Ie.scrollToItem(e,Ft)}),[oe]),g((function(){var e=ye.current.pageIndex;e>0&&e===o&&Se.current===o&&_e.current&&(Se.current=-1,Qe(_e.current))}),[B]),s.useEffect((function(){Ie.isSmoothScrolling||null!==U.current&&U.current===B||(U.current=B,P({currentPage:B,doc:a}))}),[B,Ie.isSmoothScrolling]),s.useEffect((function(){we.fullScreenMode===t.Fi.Entering&&ye.current.scrollMode===t.Gd.Page&&(be.current=ye.current.pageIndex),we.fullScreenMode===t.Fi.EnteredCompletely&&ye.current.scrollMode===t.Gd.Page&&i&&(be.current=-1),we.fullScreenMode===t.Fi.EnteredCompletely&&_e.current&&(ke.current=ye.current.pageIndex,Qe(_e.current))}),[we.fullScreenMode]),s.useEffect((function(){if(we.fullScreenMode!==t.Fi.Entering&&we.fullScreenMode!==t.Fi.Exitting&&!Ie.isSmoothScrolling){var e=Ie.startPage,n=Ie.endPage,r=Ie.maxVisbilityIndex,a=Ie.virtualItems,i=r,o=we.fullScreenMode===t.Fi.Entered||we.fullScreenMode===t.Fi.EnteredCompletely;if(!(o&&i!==be.current&&be.current>-1||o&&i!==ke.current&&ke.current>-1)){H(i),Le(h(h({},ye.current),{pageIndex:i})),Te.setRange(e,n);for(var s=function(e){var t=a.find((function(t){return t.index===e}));t&&Te.setVisibility(e,t.visibility)},l=e;l<=n;l++)s(l);ot()}}}),[Ie.startPage,Ie.endPage,Ie.isSmoothScrolling,Ie.maxVisbilityIndex,we.fullScreenMode,J,V,pe]);var at=s.useCallback((function(e){Te.markRendered(e),ot()}),[Ee]),ot=function(){var e=Te.getHighestPriorityPage();e>-1&&Te.isInRange(e)&&(Te.markRendering(e),Ae(e))},st=function(e){var t=B-1,n=B+1;switch(e){case"FirstPage":We(0);break;case"LastPage":We(E-1);break;case"NextPage":n=0&&We(t)}},lt=s.useCallback((function(){var e=Ie.virtualItems,n=[];switch(oe){case t.wO.DualPage:n=ce(e,2);break;case t.wO.DualPageWithCover:e.length&&(n=0===e[0].index?[[e[0]]].concat(ce(e.slice(1),2)):ce(e,2));break;case t.wO.SinglePage:default:n=ce(e,1)}var r=T&&T.core?T.core.pageLabel:"Page {{pageIndex}}",i={attrs:{className:"rpv-core__inner-container","data-testid":"core__inner-container",ref:D,style:{height:"100%"}},children:s.createElement(s.Fragment,null),subSlot:{attrs:{"data-testid":"core__inner-pages",className:v({"rpv-core__inner-pages":!0,"rpv-core__inner-pages--horizontal":ne===t.Gd.Horizontal,"rpv-core__inner-pages--rtl":L,"rpv-core__inner-pages--single":ne===t.Gd.Page,"rpv-core__inner-pages--vertical":ne===t.Gd.Vertical,"rpv-core__inner-pages--wrapped":ne===t.Gd.Wrapped}),ref:G,style:{height:"100%",position:"relative"}},children:s.createElement("div",{"data-testid":"core__inner-current-page-".concat(B),style:Object.assign({"--scale-factor":pe},Ie.getContainerStyles())},n.map((function(e){return s.createElement("div",{className:v({"rpv-core__inner-page-container":!0,"rpv-core__inner-page-container--single":ne===t.Gd.Page}),style:Ie.getItemContainerStyles(e[0]),key:"".concat(e[0].index,"-").concat(oe)},e.map((function(e){var n=oe===t.wO.DualPageWithCover&&(0===e.index||E%2==0&&e.index===E-1);return s.createElement("div",{"aria-label":r.replace("{{pageIndex}}","".concat(e.index+1)),className:v({"rpv-core__inner-page":!0,"rpv-core__inner-page--dual-even":oe===t.wO.DualPage&&e.index%2==0,"rpv-core__inner-page--dual-odd":oe===t.wO.DualPage&&e.index%2==1,"rpv-core__inner-page--dual-cover":n,"rpv-core__inner-page--dual-cover-even":oe===t.wO.DualPageWithCover&&!n&&e.index%2==0,"rpv-core__inner-page--dual-cover-odd":oe===t.wO.DualPageWithCover&&!n&&e.index%2==1,"rpv-core__inner-page--single":oe===t.wO.SinglePage&&ne===t.Gd.Page}),role:"region",key:"".concat(e.index,"-").concat(oe),style:Object.assign({},Ie.getItemStyles(e),Me.buildPageStyles({numPages:E,pageIndex:e.index,scrollMode:ne,viewMode:oe}))},s.createElement(it,{doc:a,measureRef:e.measureRef,outlines:ue,pageIndex:e.index,pageRotation:$.has(e.index)?$.get(e.index):0,pageSize:d[e.index],plugins:f,renderPage:m,renderQueueKey:Ee,rotation:V,scale:pe,shouldRender:xe===e.index,viewMode:oe,onExecuteNamedAction:st,onJumpFromLinkAnnotation:Ge,onJumpToDest:ze,onRenderCompleted:at,onRotatePage:Xe}))})))})))}};return f.forEach((function(e){e.renderViewer&&(i=e.renderViewer({containerRef:D,doc:a,pagesContainerRef:G,pagesRotation:$,pageSizes:d,rotation:V,slot:i,themeContext:M,jumpToPage:We,openFile:Ve,rotate:Ke,rotatePage:Xe,switchScrollMode:Ye,switchViewMode:Je,zoom:Qe}))})),i}),[f,Ie]),ct=s.useCallback((function(e){return s.createElement("div",h({},e.attrs,{style:e.attrs&&e.attrs.style?e.attrs.style:{}}),e.children,e.subSlot&&ct(e.subSlot))}),[]);return ct(lt())},Mt=[.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],Rt=function(e){var n=e.defaultScale,r=e.doc,a=e.render,i=e.scrollMode,o=e.viewMode,l=s.useRef(),c=s.useState({pageSizes:[],scale:0}),u=c[0],d=c[1];return s.useLayoutEffect((function(){var e=Array(r.numPages).fill(0).map((function(e,t){return new Promise((function(e,n){ve(r,t).then((function(t){var n=t.getViewport({scale:1});e({pageHeight:n.height,pageWidth:n.width,rotation:n.rotation})}))}))}));Promise.all(e).then((function(e){var a=l.current;if(a&&0!==e.length){var s=e[0].pageWidth,c=e[0].pageHeight,u=a.parentElement,h=(u.clientWidth-45)/s,f=(u.clientHeight-45)/c,p=h;switch(i){case t.Gd.Horizontal:p=Math.min(h,f);break;case t.Gd.Vertical:default:p=h}var v,g,m=n?"string"==typeof n?St(u,c,s,n,o,r.numPages):n:(v=p,-1===(g=Mt.findIndex((function(e){return e>=v})))||0===g?v:Mt[g-1]);d({pageSizes:e,scale:m})}}))}),[r.loadingTask.docId]),0===u.pageSizes.length||0===u.scale?s.createElement("div",{className:"rpv-core__page-size-calculator","data-testid":"core__page-size-calculating",ref:l},s.createElement(k,null)):a(u.pageSizes,u.scale)},It=function(){},Ot=function(e){function t(t,n){var r=e.call(this)||this;return r.verifyPassword=t,r.passwordStatus=n,r}return u(t,e),t}(It),Lt=function(e){var n=e.passwordStatus,r=e.renderProtectedView,a=e.verifyPassword,i=e.onDocumentAskPassword,o=s.useContext(j).l10n,l=s.useState(""),c=l[0],u=l[1],d=s.useContext(p).direction===t.m5.RightToLeft,h=function(){return a(c)};return s.useEffect((function(){i&&i({verifyPassword:a})}),[]),r?r({passwordStatus:n,verifyPassword:a}):s.createElement("div",{className:"rpv-core__asking-password-wrapper"},s.createElement("div",{className:v({"rpv-core__asking-password":!0,"rpv-core__asking-password--rtl":d})},s.createElement("div",{className:"rpv-core__asking-password-message"},n===t.Fn.RequiredPassword&&o.core.askingPassword.requirePasswordToOpen,n===t.Fn.WrongPassword&&o.core.wrongPassword.tryAgain),s.createElement("div",{className:"rpv-core__asking-password-body"},s.createElement("div",{className:v({"rpv-core__asking-password-input":!0,"rpv-core__asking-password-input--ltr":!d,"rpv-core__asking-password-input--rtl":d})},s.createElement(S,{testId:"core__asking-password-input",type:"password",value:c,onChange:u,onKeyDown:function(e){"Enter"===e.key&&h()}})),s.createElement(b,{onClick:h},o.core.askingPassword.submit))))},Dt=function(e){function t(t){var n=e.call(this)||this;return n.doc=t,n}return u(t,e),t}(It),Nt=function(e){function t(t){var n=e.call(this)||this;return n.error=t,n}return u(t,e),t}(It),Gt=function(e){function t(t){var n=e.call(this)||this;return n.percentages=t,n}return u(t,e),t}(It),jt=function(e){var n=e.characterMap,r=e.file,a=e.httpHeaders,i=e.render,o=e.renderError,c=e.renderLoader,u=e.renderProtectedView,d=e.transformGetDocumentParams,h=e.withCredentials,f=e.onDocumentAskPassword,g=s.useContext(p).direction===t.m5.RightToLeft,m=s.useState(new Gt(0)),y=m[0],_=m[1],b=s.useRef(""),S=I();return s.useEffect((function(){b.current="",_(new Gt(0));var e=new l.PDFWorker({name:"PDFWorker_".concat(Date.now())}),i=Object.assign({httpHeaders:a,withCredentials:h,worker:e},"string"==typeof r?{url:r}:{data:r},n?{cMapUrl:n.url,cMapPacked:n.isCompressed}:{}),o=d?d(i):i,s=l.getDocument(o);return s.onPassword=function(e,n){switch(n){case l.PasswordResponses.NEED_PASSWORD:S.current&&_(new Ot(e,t.Fn.RequiredPassword));break;case l.PasswordResponses.INCORRECT_PASSWORD:S.current&&_(new Ot(e,t.Fn.WrongPassword))}},s.onProgress=function(e){var t=e.total>0?Math.min(100,100*e.loaded/e.total):100;S.current&&""===b.current&&_(new Gt(t))},s.promise.then((function(e){b.current=e.loadingTask.docId,S.current&&_(new Dt(e))}),(function(t){return S.current&&!e.destroyed&&_(new Nt({message:t.message||"Cannot load document",name:t.name}))})),function(){s.destroy(),e.destroy()}}),[r]),y instanceof Ot?s.createElement(Lt,{passwordStatus:y.passwordStatus,renderProtectedView:u,verifyPassword:y.verifyPassword,onDocumentAskPassword:f}):y instanceof Dt?i(y.doc):y instanceof Nt?o?o(y.error):s.createElement("div",{className:v({"rpv-core__doc-error":!0,"rpv-core__doc-error--rtl":g})},s.createElement("div",{className:"rpv-core__doc-error-text"},y.error.message)):s.createElement("div",{"data-testid":"core__doc-loading",className:v({"rpv-core__doc-loading":!0,"rpv-core__doc-loading--rtl":g})},c?c(y.percentages):s.createElement(k,null))},zt=function(e){return{startPage:e.startPage-3,endPage:e.endPage+3}};t.Viewer=function(e){var n=e.characterMap,r=e.defaultScale,a=e.enableSmoothScroll,i=void 0===a||a,o=e.fileUrl,l=e.httpHeaders,c=void 0===l?{}:l,u=e.initialPage,d=void 0===u?0:u,h=e.pageLayout,f=e.initialRotation,v=void 0===f?0:f,g=e.localization,y=e.plugins,_=void 0===y?[]:y,b=e.renderError,k=e.renderLoader,S=e.renderPage,w=e.renderProtectedView,P=e.scrollMode,x=void 0===P?t.Gd.Vertical:P,A=e.setRenderRange,C=void 0===A?zt:A,E=e.transformGetDocumentParams,F=e.theme,T=void 0===F?{direction:t.m5.LeftToRight,theme:"light"}:F,M=e.viewMode,R=void 0===M?t.wO.SinglePage:M,I=e.withCredentials,L=void 0!==I&&I,D=e.onDocumentAskPassword,N=e.onDocumentLoad,z=void 0===N?function(){}:N,B=e.onPageChange,H=void 0===B?function(){}:B,U=e.onRotate,W=void 0===U?function(){}:U,q=e.onRotatePage,V=void 0===q?function(){}:q,K=e.onSwitchTheme,X=void 0===K?function(){}:K,Y=e.onZoom,J=void 0===Y?function(){}:Y,Q=s.useState({data:o,name:"string"==typeof o?o:"",shouldLoad:!1}),Z=Q[0],$=Q[1],ee=function(e,t){$({data:t,name:e,shouldLoad:!0})},te=s.useState(!1),ne=te[0],re=te[1],ae=O(Z);s.useEffect((function(){var e,t,n,r;e=ae.data,r=typeof(t=o),"string"===(n=typeof e)&&"string"===r&&e===t||"object"===n&&"object"===r&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))||$({data:o,name:"string"==typeof o?o:"",shouldLoad:ne})}),[o,ne]);var ie=m({onVisibilityChanged:function(e){re(e.isVisible),e.isVisible&&$((function(e){return Object.assign({},e,{shouldLoad:!0})}))}}),oe="string"==typeof T?{direction:t.m5.LeftToRight,theme:T}:T,se=s.useState(g||G),le=se[0],ce=se[1],ue={l10n:le,setL10n:ce},de=Object.assign({},{direction:oe.direction},function(e,t){var n=s.useMemo((function(){return"auto"===e?"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}),[]),r=s.useState(n),a=r[0],i=r[1],o=O(a);return s.useEffect((function(){if("auto"===e){var t=window.matchMedia("(prefers-color-scheme: dark)"),n=function(e){i(e.matches?"dark":"light")};return t.addEventListener("change",n),function(){return t.removeEventListener("change",n)}}}),[]),s.useEffect((function(){a!==o&&t&&t(a)}),[a]),s.useEffect((function(){e!==a&&i(e)}),[e]),{currentTheme:a,setCurrentTheme:i}}(oe.theme||"light",X));return s.useEffect((function(){g&&ce(g)}),[g]),s.createElement(j.Provider,{value:ue},s.createElement(p.Provider,{value:de},s.createElement("div",{ref:ie,className:"rpv-core__viewer rpv-core__viewer--".concat(de.currentTheme),"data-testid":"core__viewer",style:{height:"100%",width:"100%"}},Z.shouldLoad&&s.createElement(jt,{characterMap:n,file:Z.data,httpHeaders:c,render:function(e){return s.createElement(Rt,{defaultScale:r,doc:e,render:function(n,a){return s.createElement(Tt,{currentFile:{data:Z.data,name:Z.name},defaultScale:r,doc:e,enableSmoothScroll:i,initialPage:d,initialRotation:v,initialScale:a,pageLayout:h,pageSizes:n,plugins:_,renderPage:S,scrollMode:x,setRenderRange:C,viewMode:R,viewerState:{file:Z,fullScreenMode:t.Fi.Normal,pageIndex:-1,pageHeight:n[0].pageHeight,pageWidth:n[0].pageWidth,pagesRotation:new Map,rotation:v,scale:a,scrollMode:x,viewMode:R},onDocumentLoad:z,onOpenFile:ee,onPageChange:H,onRotate:W,onRotatePage:V,onZoom:J})},scrollMode:x,viewMode:R})},renderError:b,renderLoader:k,renderProtectedView:w,transformGetDocumentParams:E,withCredentials:L,onDocumentAskPassword:D}))))},t.Worker=function(e){var t=e.children,n=e.workerUrl;return l.GlobalWorkerOptions.workerSrc=n,s.createElement(s.Fragment,null,t)}},9853:function(e,t,n){"use strict";e.exports=n(9598)},3661:function(module,__unused_webpack_exports,__webpack_require__){var _classStaticPrivateMethodGet=__webpack_require__(5764).default,_objectSpread=__webpack_require__(2122).default,_get=__webpack_require__(1588).default,_getPrototypeOf=__webpack_require__(3808).default,_defineProperty=__webpack_require__(8416).default,_assertThisInitialized=__webpack_require__(6115).default,_classPrivateMethodInitSpec=__webpack_require__(1860).default,_classPrivateMethodGet=__webpack_require__(4467).default,_regeneratorRuntime=__webpack_require__(7061).default,_classPrivateFieldInitSpec=__webpack_require__(9159).default,_classPrivateFieldSet=__webpack_require__(5661).default,_classPrivateFieldGet=__webpack_require__(468).default,_classStaticPrivateFieldSpecSet=__webpack_require__(2306).default,_classStaticPrivateFieldSpecGet=__webpack_require__(1280).default,_asyncToGenerator=__webpack_require__(7156).default,_toConsumableArray=__webpack_require__(861).default,_slicedToArray=__webpack_require__(7424).default,_createForOfIteratorHelper=__webpack_require__(4704).default,_createClass=__webpack_require__(9728).default,_classCallCheck=__webpack_require__(6690).default,_inherits=__webpack_require__(1655).default,_createSuper=__webpack_require__(6389).default,factory;globalThis,factory=function(){return function(){"use strict";var __webpack_modules__=[,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=function(e,t){e||i(t)},t.bytesToString=function(e){"object"===typeof e&&null!==e&&void 0!==e.length||i("Invalid argument for bytesToString");var t=e.length,n=8192;if(t1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;try{if(n&&"string"===typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){var r=e.match(/\./g);r&&r.length>=2&&(e="http://".concat(e))}if(n.tryConvertEncoding)try{e=b(e)}catch(i){}}var a=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch(i){}return null},t.getModificationDate=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getVerbosityLevel=function(){return r},t.info=function(e){r>=n.INFOS&&console.log("Info: ".concat(e))},t.isArrayBuffer=function(e){return"object"===typeof e&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=v,t.stringToPDFString=function(e){var t;if(e[0]>="\xef"&&("\xfe"===e[0]&&"\xff"===e[1]?t="utf-16be":"\xff"===e[0]&&"\xfe"===e[1]?t="utf-16le":"\xef"===e[0]&&"\xbb"===e[1]&&"\xbf"===e[2]&&(t="utf-8"),t))try{var n=new TextDecoder(t,{fatal:!0}),r=v(e);return n.decode(r)}catch(c){a('stringToPDFString: "'.concat(c,'".'))}for(var i=[],o=0,s=e.length;o=n.WARNINGS&&console.log("Warning: ".concat(e))}function i(e){throw new Error(e)}function o(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}var s=function(){function e(t,n){this.constructor===e&&i("Cannot initialize BaseException."),this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();t.BaseException=s;var l=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var a;return _classCallCheck(this,n),(a=t.call(this,e,"PasswordException")).code=r,a}return _createClass(n)}(s);t.PasswordException=l;var c=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var a;return _classCallCheck(this,n),(a=t.call(this,e,"UnknownErrorException")).details=r,a}return _createClass(n)}(s);t.UnknownErrorException=c;var u=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,"InvalidPDFException")}return _createClass(n)}(s);t.InvalidPDFException=u;var d=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,"MissingPDFException")}return _createClass(n)}(s);t.MissingPDFException=d;var h=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var a;return _classCallCheck(this,n),(a=t.call(this,e,"UnexpectedResponseException")).status=r,a}return _createClass(n)}(s);t.UnexpectedResponseException=h;var f=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,"FormatError")}return _createClass(n)}(s);t.FormatError=f;var p=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,"AbortException")}return _createClass(n)}(s);function v(e){"string"!==typeof e&&i("Invalid argument for stringToBytes");for(var t=e.length,n=new Uint8Array(t),r=0;re[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}},{key:"intersect",value:function(e,t){var n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;var a=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),i=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return a>i?null:[n,a,r,i]}},{key:"bezierBoundingBox",value:function(e,t,n,r,a,i,o,s){for(var l,c,u,d,h,f,p,v,g=[],m=[[],[]],y=0;y<2;++y)if(0===y?(c=6*e-12*n+6*a,l=-3*e+9*n-9*a+3*o,u=3*n-3*e):(c=6*t-12*r+6*i,l=-3*t+9*r-9*i+3*s,u=3*r-3*t),Math.abs(l)<1e-12){if(Math.abs(c)<1e-12)continue;0<(d=-u/c)&&d<1&&g.push(d)}else p=c*c-4*u*l,v=Math.sqrt(p),p<0||(0<(h=(-c+v)/(2*l))&&h<1&&g.push(h),0<(f=(-c-v)/(2*l))&&f<1&&g.push(f));for(var _,b=g.length,k=b;b--;)_=1-(d=g[b]),m[0][b]=_*_*_*e+3*_*_*d*n+3*_*d*d*a+d*d*d*o,m[1][b]=_*_*_*t+3*_*_*d*r+3*_*d*d*i+d*d*d*s;return m[0][k]=e,m[1][k]=t,m[0][k+1]=o,m[1][k+1]=s,m[0].length=m[1].length=k+2,[Math.min.apply(Math,_toConsumableArray(m[0])),Math.min.apply(Math,_toConsumableArray(m[1])),Math.max.apply(Math,_toConsumableArray(m[0])),Math.max.apply(Math,_toConsumableArray(m[1]))]}}]),e}();t.Util=y;var _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function b(e){return decodeURIComponent(escape(e))}},function(__unused_webpack_module,exports,__w_pdfjs_require__){Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_is_node=__w_pdfjs_require__(10),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_xfa_text=__w_pdfjs_require__(19),DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;var DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;var DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){var _w_pdfjs_require__=__w_pdfjs_require__(20),NodeCanvasFactory=_w_pdfjs_require__.NodeCanvasFactory,NodeCMapReaderFactory=_w_pdfjs_require__.NodeCMapReaderFactory,NodeStandardFontDataFactory=_w_pdfjs_require__.NodeStandardFontDataFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory=NodeCanvasFactory,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=NodeCMapReaderFactory,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=NodeStandardFontDataFactory}if(_is_node.isNodeJS){var _w_pdfjs_require__2=__w_pdfjs_require__(21),PDFNodeStream=_w_pdfjs_require__2.PDFNodeStream;createPDFNetworkStream=function(e){return new PDFNodeStream(e)}}else{var _w_pdfjs_require__3=__w_pdfjs_require__(24),PDFNetworkStream=_w_pdfjs_require__3.PDFNetworkStream,_w_pdfjs_require__4=__w_pdfjs_require__(25),PDFFetchStream=_w_pdfjs_require__4.PDFFetchStream;createPDFNetworkStream=function(e){return(0,_display_utils.isValidFetchUrl)(e.url)?new PDFFetchStream(e):new PDFNetworkStream(e)}}function getDocument(e){var t,n;if("string"===typeof e||e instanceof URL)e={url:e};else if((0,_util.isArrayBuffer)(e))e={data:e};else if(e instanceof PDFDataRangeTransport)(0,_display_utils.deprecated)("`PDFDataRangeTransport`-instance, please use a parameter object with `range`-property instead."),e={range:e};else if("object"!==typeof e)throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");var r=new PDFDocumentLoadingTask,a=e.url?getUrlProp(e.url):null,i=e.data?getDataProp(e.data):null,o=e.httpHeaders||null,s=!0===e.withCredentials,l=null!==(t=e.password)&&void 0!==t?t:null,c=e.range instanceof PDFDataRangeTransport?e.range:null,u=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE,d=e.worker instanceof PDFWorker?e.worker:null,h=e.verbosity,f="string"!==typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,p="string"===typeof e.cMapUrl?e.cMapUrl:null,v=!1!==e.cMapPacked,g=e.CMapReaderFactory||DefaultCMapReaderFactory,m="string"===typeof e.standardFontDataUrl?e.standardFontDataUrl:null,y=e.StandardFontDataFactory||DefaultStandardFontDataFactory,_=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,k=!1!==e.isEvalSupported,S="boolean"===typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_is_node.isNodeJS,w="boolean"===typeof e.disableFontFace?e.disableFontFace:_is_node.isNodeJS,P=!0===e.fontExtraProperties,x=!0===e.enableXfa,A=e.ownerDocument||globalThis.document,C=!0===e.disableRange,E=!0===e.disableStream,F=!0===e.disableAutoFetch,T=!0===e.pdfBug,M=c?c.length:null!==(n=e.length)&&void 0!==n?n:NaN,R="boolean"===typeof e.useSystemFonts?e.useSystemFonts:!_is_node.isNodeJS&&!w,I="boolean"===typeof e.useWorkerFetch?e.useWorkerFetch:g===_display_utils.DOMCMapReaderFactory&&y===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI);(0,_util.setVerbosityLevel)(h);var O=I?null:{cMapReaderFactory:new g({baseUrl:p,isCompressed:v}),standardFontDataFactory:new y({baseUrl:m})};if(!d){var L={verbosity:h,port:_worker_options.GlobalWorkerOptions.workerPort};d=L.port?PDFWorker.fromPort(L):new PDFWorker(L),r._worker=d}var D=r.docId,N={docId:D,apiVersion:"3.4.120",data:i,password:l,disableAutoFetch:F,rangeChunkSize:u,length:M,docBaseUrl:f,enableXfa:x,evaluatorOptions:{maxImageSize:b,disableFontFace:w,ignoreErrors:_,isEvalSupported:k,isOffscreenCanvasSupported:S,fontExtraProperties:P,useSystemFonts:R,cMapUrl:I?p:null,standardFontDataUrl:I?m:null}},G={ignoreErrors:_,isEvalSupported:k,disableFontFace:w,fontExtraProperties:P,enableXfa:x,ownerDocument:A,disableAutoFetch:F,pdfBug:T,styleElement:null};return d.promise.then((function(){if(r.destroyed)throw new Error("Loading aborted");var e=_fetchDocument(d,N),t=new Promise((function(e){var t;c?t=new _transport_stream.PDFDataTransportStream({length:M,initialData:c.initialData,progressiveDone:c.progressiveDone,contentDispositionFilename:c.contentDispositionFilename,disableRange:C,disableStream:E},c):i||(t=createPDFNetworkStream({url:a,length:M,httpHeaders:o,withCredentials:s,rangeChunkSize:u,disableRange:C,disableStream:E})),e(t)}));return Promise.all([e,t]).then((function(e){var t=_slicedToArray(e,2),n=t[0],a=t[1];if(r.destroyed)throw new Error("Loading aborted");var i=new _message_handler.MessageHandler(D,n,d.port),o=new WorkerTransport(i,r,a,G,O);r._transport=o,i.send("Ready",null)}))})).catch(r._capability.reject),r}function _fetchDocument(e,t){return _fetchDocument2.apply(this,arguments)}function _fetchDocument2(){return(_fetchDocument2=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.destroyed){e.next=2;break}throw new Error("Worker was destroyed");case 2:return e.next=4,t.messageHandler.sendWithPromise("GetDocRequest",n,n.data?[n.data.buffer]:null);case 4:if(r=e.sent,!t.destroyed){e.next=7;break}throw new Error("Worker was destroyed");case 7:return e.abrupt("return",r);case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function getUrlProp(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch(t){if(_is_node.isNodeJS&&"string"===typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(e){if(_is_node.isNodeJS&&"undefined"!==typeof Buffer&&e instanceof Buffer)return(0,_display_utils.deprecated)("Please provide binary data as `Uint8Array`, rather than `Buffer`."),new Uint8Array(e);if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"===typeof e)return(0,_util.stringToBytes)(e);if("object"===typeof e&&!isNaN(null===e||void 0===e?void 0:e.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}var _onUnsupportedFeature=new WeakMap,PDFDocumentLoadingTask=function(){function e(){var t,n;_classCallCheck(this,e),_classPrivateFieldInitSpec(this,_onUnsupportedFeature,{writable:!0,value:null}),this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d".concat((_classStaticPrivateFieldSpecSet(e,e,_docId,(t=_classStaticPrivateFieldSpecGet(e,e,_docId),n=t++,t)),n)),this.destroyed=!1,this.onPassword=null,this.onProgress=null}return _createClass(e,[{key:"onUnsupportedFeature",get:function(){return _classPrivateFieldGet(this,_onUnsupportedFeature)},set:function(e){(0,_display_utils.deprecated)("The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future."),_classPrivateFieldSet(this,_onUnsupportedFeature,e)}},{key:"promise",get:function(){return this._capability.promise}},{key:"destroy",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.destroyed=!0,e.next=3,null===(t=this._transport)||void 0===t?void 0:t.destroy();case 3:this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()}]),e}(),_docId={writable:!0,value:0};exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;var PDFDataRangeTransport=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,e),this.length=t,this.initialData=n,this.progressiveDone=r,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}return _createClass(e,[{key:"addRangeListener",value:function(e){this._rangeListeners.push(e)}},{key:"addProgressListener",value:function(e){this._progressListeners.push(e)}},{key:"addProgressiveReadListener",value:function(e){this._progressiveReadListeners.push(e)}},{key:"addProgressiveDoneListener",value:function(e){this._progressiveDoneListeners.push(e)}},{key:"onDataRange",value:function(e,t){var n,r=_createForOfIteratorHelper(this._rangeListeners);try{for(r.s();!(n=r.n()).done;)(0,n.value)(e,t)}catch(a){r.e(a)}finally{r.f()}}},{key:"onDataProgress",value:function(e,t){var n=this;this._readyCapability.promise.then((function(){var r,a=_createForOfIteratorHelper(n._progressListeners);try{for(a.s();!(r=a.n()).done;)(0,r.value)(e,t)}catch(i){a.e(i)}finally{a.f()}}))}},{key:"onDataProgressiveRead",value:function(e){var t=this;this._readyCapability.promise.then((function(){var n,r=_createForOfIteratorHelper(t._progressiveReadListeners);try{for(r.s();!(n=r.n()).done;)(0,n.value)(e)}catch(a){r.e(a)}finally{r.f()}}))}},{key:"onDataProgressiveDone",value:function(){var e=this;this._readyCapability.promise.then((function(){var t,n=_createForOfIteratorHelper(e._progressiveDoneListeners);try{for(n.s();!(t=n.n()).done;)(0,t.value)()}catch(r){n.e(r)}finally{n.f()}}))}},{key:"transportReady",value:function(){this._readyCapability.resolve()}},{key:"requestDataRange",value:function(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}},{key:"abort",value:function(){}}]),e}();exports.PDFDataRangeTransport=PDFDataRangeTransport;var PDFDocumentProxy=function(){function e(t,n){_classCallCheck(this,e),this._pdfInfo=t,this._transport=n}return _createClass(e,[{key:"annotationStorage",get:function(){return this._transport.annotationStorage}},{key:"numPages",get:function(){return this._pdfInfo.numPages}},{key:"fingerprints",get:function(){return this._pdfInfo.fingerprints}},{key:"isPureXfa",get:function(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}},{key:"allXfaHtml",get:function(){return this._transport._htmlForXfa}},{key:"getPage",value:function(e){return this._transport.getPage(e)}},{key:"getPageIndex",value:function(e){return this._transport.getPageIndex(e)}},{key:"getDestinations",value:function(){return this._transport.getDestinations()}},{key:"getDestination",value:function(e){return this._transport.getDestination(e)}},{key:"getPageLabels",value:function(){return this._transport.getPageLabels()}},{key:"getPageLayout",value:function(){return this._transport.getPageLayout()}},{key:"getPageMode",value:function(){return this._transport.getPageMode()}},{key:"getViewerPreferences",value:function(){return this._transport.getViewerPreferences()}},{key:"getOpenAction",value:function(){return this._transport.getOpenAction()}},{key:"getAttachments",value:function(){return this._transport.getAttachments()}},{key:"getJavaScript",value:function(){return this._transport.getJavaScript()}},{key:"getJSActions",value:function(){return this._transport.getDocJSActions()}},{key:"getOutline",value:function(){return this._transport.getOutline()}},{key:"getOptionalContentConfig",value:function(){return this._transport.getOptionalContentConfig()}},{key:"getPermissions",value:function(){return this._transport.getPermissions()}},{key:"getMetadata",value:function(){return this._transport.getMetadata()}},{key:"getMarkInfo",value:function(){return this._transport.getMarkInfo()}},{key:"getData",value:function(){return this._transport.getData()}},{key:"saveDocument",value:function(){return this._transport.saveDocument()}},{key:"getDownloadInfo",value:function(){return this._transport.downloadInfoCapability.promise}},{key:"cleanup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(e||this.isPureXfa)}},{key:"destroy",value:function(){return this.loadingTask.destroy()}},{key:"loadingParams",get:function(){return this._transport.loadingParams}},{key:"loadingTask",get:function(){return this._transport.loadingTask}},{key:"getFieldObjects",value:function(){return this._transport.getFieldObjects()}},{key:"hasJSActions",value:function(){return this._transport.hasJSActions()}},{key:"getCalculationOrderIds",value:function(){return this._transport.getCalculationOrderIds()}}]),e}();exports.PDFDocumentProxy=PDFDocumentProxy;var PDFPageProxy=function(){function e(t,n,r,a){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];_classCallCheck(this,e),this._pageIndex=t,this._pageInfo=n,this._ownerDocument=a,this._transport=r,this._stats=i?new _display_utils.StatTimer:null,this._pdfBug=i,this.commonObjs=r.commonObjs,this.objs=new PDFObjects,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this.destroyed=!1}return _createClass(e,[{key:"pageNumber",get:function(){return this._pageIndex+1}},{key:"rotate",get:function(){return this._pageInfo.rotate}},{key:"ref",get:function(){return this._pageInfo.ref}},{key:"userUnit",get:function(){return this._pageInfo.userUnit}},{key:"view",get:function(){return this._pageInfo.view}},{key:"getViewport",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.scale,n=e.rotation,r=void 0===n?this.rotate:n,a=e.offsetX,i=void 0===a?0:a,o=e.offsetY,s=void 0===o?0:o,l=e.dontFlip,c=void 0!==l&&l;return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:r,offsetX:i,offsetY:s,dontFlip:c})}},{key:"getAnnotations",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).intent,t=void 0===e?"display":e,n=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,n.renderingIntent)}},{key:"getJSActions",value:function(){return this._transport.getPageJSActions(this._pageIndex)}},{key:"isPureXfa",get:function(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}},{key:"getXfa",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null);case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(e){var t,n,r=this,a=e.canvasContext,i=e.viewport,o=e.intent,s=void 0===o?"display":o,l=e.annotationMode,c=void 0===l?_util.AnnotationMode.ENABLE:l,u=e.transform,d=void 0===u?null:u,h=e.canvasFactory,f=void 0===h?null:h,p=e.background,v=void 0===p?null:p,g=e.optionalContentConfigPromise,m=void 0===g?null:g,y=e.annotationCanvasMap,_=void 0===y?null:y,b=e.pageColors,k=void 0===b?null:b,S=e.printAnnotationStorage,w=void 0===S?null:S;null===(t=this._stats)||void 0===t||t.time("Overall");var P=this._transport.getRenderingIntent(s,c,w);this.pendingCleanup=!1,m||(m=this._transport.getOptionalContentConfig());var x=this._intentStates.get(P.cacheKey);x||(x=Object.create(null),this._intentStates.set(P.cacheKey,x)),x.streamReaderCancelTimeout&&(clearTimeout(x.streamReaderCancelTimeout),x.streamReaderCancelTimeout=null);var A,C=f||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),E=!!(P.renderingIntent&_util.RenderingIntentFlag.PRINT);x.displayReadyCapability||(x.displayReadyCapability=(0,_util.createPromiseCapability)(),x.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(A=this._stats)||void 0===A||A.time("Page Request"),this._pumpOperatorList(P));var F=function(e){var t,n;x.renderTasks.delete(T),(r.cleanupAfterRender||E)&&(r.pendingCleanup=!0),r._tryCleanup(),e?(T.capability.reject(e),r._abortOperatorList({intentState:x,reason:e instanceof Error?e:new Error(e)})):T.capability.resolve(),null===(t=r._stats)||void 0===t||t.timeEnd("Rendering"),null===(n=r._stats)||void 0===n||n.timeEnd("Overall")},T=new InternalRenderTask({callback:F,params:{canvasContext:a,viewport:i,transform:d,background:v},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:_,operatorList:x.operatorList,pageIndex:this._pageIndex,canvasFactory:C,useRequestAnimationFrame:!E,pdfBug:this._pdfBug,pageColors:k});((n=x).renderTasks||(n.renderTasks=new Set)).add(T);var M=T.task;return Promise.all([x.displayReadyCapability.promise,m]).then((function(e){var t,n=_slicedToArray(e,2),a=n[0],i=n[1];r.pendingCleanup?F():(null===(t=r._stats)||void 0===t||t.time("Rendering"),T.initializeGraphics({transparency:a,optionalContentConfig:i}),T.operatorListChanged())})).catch(F),M}},{key:"getOperatorList",value:function(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=r.intent,i=void 0===a?"display":a,o=r.annotationMode,s=void 0===o?_util.AnnotationMode.ENABLE:o,l=r.printAnnotationStorage,c=void 0===l?null:l,u=this._transport.getRenderingIntent(i,s,c,!0),d=this._intentStates.get(u.cacheKey);return d||(d=Object.create(null),this._intentStates.set(u.cacheKey,d)),d.opListReadCapability||((e=Object.create(null)).operatorListChanged=function(){d.operatorList.lastChunk&&(d.opListReadCapability.resolve(d.operatorList),d.renderTasks.delete(e))},d.opListReadCapability=(0,_util.createPromiseCapability)(),((t=d).renderTasks||(t.renderTasks=new Set)).add(e),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(n=this._stats)||void 0===n||n.time("Page Request"),this._pumpOperatorList(u)),d.opListReadCapability.promise}},{key:"streamTextContent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.disableCombineTextItems,n=void 0!==t&&t,r=e.includeMarkedContent,a=void 0!==r&&r;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==n,includeMarkedContent:!0===a},{highWaterMark:100,size:function(e){return e.items.length}})}},{key:"getTextContent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((function(e){return _xfa_text.XfaText.textContent(e)}));var t=this.streamTextContent(e);return new Promise((function(e,n){var r=t.getReader(),a={items:[],styles:Object.create(null)};!function t(){r.read().then((function(n){var r,i=n.value;n.done?e(a):(Object.assign(a.styles,i.styles),(r=a.items).push.apply(r,_toConsumableArray(i.items)),t())}),n)}()}))}},{key:"getStructTree",value:function(){return this._transport.getStructTree(this._pageIndex)}},{key:"_destroy",value:function(){this.destroyed=!0;var e,t=[],n=_createForOfIteratorHelper(this._intentStates.values());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability){var a,i=_createForOfIteratorHelper(r.renderTasks);try{for(i.s();!(a=i.n()).done;){var o=a.value;t.push(o.completed),o.cancel()}}catch(s){i.e(s)}finally{i.f()}}}}catch(s){n.e(s)}finally{n.f()}return this.objs.clear(),this.pendingCleanup=!1,Promise.all(t)}},{key:"cleanup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.pendingCleanup=!0,this._tryCleanup(e)}},{key:"_tryCleanup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pendingCleanup)return!1;var t,n=_createForOfIteratorHelper(this._intentStates.values());try{for(n.s();!(t=n.n()).done;){var r=t.value,a=r.renderTasks,i=r.operatorList;if(a.size>0||!i.lastChunk)return!1}}catch(o){n.e(o)}finally{n.f()}return this._intentStates.clear(),this.objs.clear(),e&&this._stats&&(this._stats=new _display_utils.StatTimer),this.pendingCleanup=!1,!0}},{key:"_startRenderPage",value:function(e,t){var n,r,a=this._intentStates.get(t);a&&(null===(n=this._stats)||void 0===n||n.timeEnd("Page Request"),null===(r=a.displayReadyCapability)||void 0===r||r.resolve(e))}},{key:"_renderPageChunk",value:function(e,t){for(var n=0,r=e.length;n0)return;if(r instanceof _display_utils.RenderingCancelledException){var o=RENDERING_CANCELLED_TIMEOUT;return r.extraDelay>0&&r.extraDelay<1e3&&(o+=r.extraDelay),void(n.streamReaderCancelTimeout=setTimeout((function(){n.streamReaderCancelTimeout=null,t._abortOperatorList({intentState:n,reason:r,force:!0})}),o))}}if(n.streamReader.cancel(new _util.AbortException(r.message)).catch((function(){})),n.streamReader=null,!this._transport.destroyed){var s,l=_createForOfIteratorHelper(this._intentStates);try{for(l.s();!(s=l.n()).done;){var c=_slicedToArray(s.value,2),u=c[0];if(c[1]===n){this._intentStates.delete(u);break}}}catch(d){l.e(d)}finally{l.f()}this.cleanup()}}}},{key:"stats",get:function(){return this._stats}}]),e}();exports.PDFPageProxy=PDFPageProxy;var _listeners=new WeakMap,_deferred=new WeakMap,LoopbackPort=function(){function e(){_classCallCheck(this,e),_classPrivateFieldInitSpec(this,_listeners,{writable:!0,value:new Set}),_classPrivateFieldInitSpec(this,_deferred,{writable:!0,value:Promise.resolve()})}return _createClass(e,[{key:"postMessage",value:function(e,t){var n=this,r={data:structuredClone(e,t)};_classPrivateFieldGet(this,_deferred).then((function(){var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(n,_listeners));try{for(t.s();!(e=t.n()).done;)e.value.call(n,r)}catch(a){t.e(a)}finally{t.f()}}))}},{key:"addEventListener",value:function(e,t){_classPrivateFieldGet(this,_listeners).add(t)}},{key:"removeEventListener",value:function(e,t){_classPrivateFieldGet(this,_listeners).delete(t)}},{key:"terminate",value:function(){_classPrivateFieldGet(this,_listeners).clear()}}]),e}();exports.LoopbackPort=LoopbackPort;var PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"===typeof document){var _document,pdfjsFilePath=null===(_document=document)||void 0===_document||null===(_document=_document.currentScript)||void 0===_document?void 0:_document.src;pdfjsFilePath&&(PDFWorkerUtil.fallbackWorkerSrc=pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){var n;try{if(!(n=new URL(e)).origin||"null"===n.origin)return!1}catch(a){return!1}var r=new URL(t,n);return n.origin===r.origin},PDFWorkerUtil.createCDNWrapper=function(e){var t='importScripts("'.concat(e,'");');return URL.createObjectURL(new Blob([t]))};var PDFWorker=function(){function PDFWorker(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,n=void 0===t?null:t,r=e.port,a=void 0===r?null:r,i=e.verbosity,o=void 0===i?(0,_util.getVerbosityLevel)():i;if(_classCallCheck(this,PDFWorker),a&&_classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).has(a))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=n,this.destroyed=!1,this.verbosity=o,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,a)return _classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).set(a,this),void this._initializeFromPort(a);this._initialize()}return _createClass(PDFWorker,[{key:"promise",get:function(){return this._readyCapability.promise}},{key:"port",get:function(){return this._port}},{key:"messageHandler",get:function(){return this._messageHandler}},{key:"_initializeFromPort",value:function(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}},{key:"_initialize",value:function(){var e=this;if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){var t=PDFWorker.workerSrc;try{PDFWorkerUtil.isSameOrigin(window.location.href,t)||(t=PDFWorkerUtil.createCDNWrapper(new URL(t,window.location).href));var n=new Worker(t),r=new _message_handler.MessageHandler("main","worker",n),a=function(){n.removeEventListener("error",i),r.destroy(),n.terminate(),e.destroyed?e._readyCapability.reject(new Error("Worker was destroyed")):e._setupFakeWorker()},i=function(){e._webWorker||a()};n.addEventListener("error",i),r.on("test",(function(t){n.removeEventListener("error",i),e.destroyed?a():t?(e._messageHandler=r,e._port=n,e._webWorker=n,e._readyCapability.resolve(),r.send("configure",{verbosity:e.verbosity})):(e._setupFakeWorker(),r.destroy(),n.terminate())})),r.on("ready",(function(t){if(n.removeEventListener("error",i),e.destroyed)a();else try{o()}catch(r){e._setupFakeWorker()}}));var o=function(){var e=new Uint8Array;r.send("test",e,[e.buffer])};return void o()}catch(s){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}},{key:"_setupFakeWorker",value:function(){var e=this;PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((function(t){if(e.destroyed)e._readyCapability.reject(new Error("Worker was destroyed"));else{var n=new LoopbackPort;e._port=n;var r="fake".concat(PDFWorkerUtil.fakeWorkerId++),a=new _message_handler.MessageHandler(r+"_worker",r,n);t.setup(a,n);var i=new _message_handler.MessageHandler(r,r+"_worker",n);e._messageHandler=i,e._readyCapability.resolve(),i.send("configure",{verbosity:e.verbosity})}})).catch((function(t){e._readyCapability.reject(new Error('Setting up fake worker failed: "'.concat(t.message,'".')))}))}},{key:"destroy",value:function(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),_classStaticPrivateFieldSpecGet(PDFWorker,PDFWorker,_workerPorts).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}}],[{key:"fromPort",value:function(e){if(null===e||void 0===e||!e.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return _classStaticPrivateFieldSpecGet(this,PDFWorker,_workerPorts).has(e.port)?_classStaticPrivateFieldSpecGet(this,PDFWorker,_workerPorts).get(e.port):new PDFWorker(e)}},{key:"workerSrc",get:function(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}},{key:"_mainThreadWorkerMessageHandler",get:function(){try{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.WorkerMessageHandler)||null}catch(t){return null}}},{key:"_setupFakeWorkerGlobal",get:function get(){var _this13=this,loader=function(){var _ref15=_asyncToGenerator(_regeneratorRuntime().mark((function _callee3(){var mainWorkerMessageHandler,worker;return _regeneratorRuntime().wrap((function _callee3$(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(mainWorkerMessageHandler=_this13._mainThreadWorkerMessageHandler,!mainWorkerMessageHandler){_context3.next=3;break}return _context3.abrupt("return",mainWorkerMessageHandler);case 3:if(!_is_node.isNodeJS){_context3.next=6;break}return worker=eval("require")(_this13.workerSrc),_context3.abrupt("return",worker.WorkerMessageHandler);case 6:return _context3.next=8,(0,_display_utils.loadScript)(_this13.workerSrc);case 8:return _context3.abrupt("return",window.pdfjsWorker.WorkerMessageHandler);case 9:case"end":return _context3.stop()}}),_callee3)})));return function(){return _ref15.apply(this,arguments)}}();return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}]),PDFWorker}(),_workerPorts={writable:!0,value:new WeakMap};exports.PDFWorker=PDFWorker;var _methodPromises=new WeakMap,_pageCache=new WeakMap,_pagePromises=new WeakMap,_cacheSimpleMethod=new WeakSet,WorkerTransport=function(){function e(t,n,r,a,i){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,_cacheSimpleMethod),_classPrivateFieldInitSpec(this,_methodPromises,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,_pageCache,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,_pagePromises,{writable:!0,value:new Map}),this.messageHandler=t,this.loadingTask=n,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this._params=a,this.cMapReaderFactory=null===i||void 0===i?void 0:i.cMapReaderFactory,this.standardFontDataFactory=null===i||void 0===i?void 0:i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}return _createClass(e,[{key:"annotationStorage",get:function(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}},{key:"getRenderingIntent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_util.AnnotationMode.ENABLE,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=_util.RenderingIntentFlag.DISPLAY,i=null;switch(e){case"any":a=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":a=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)("getRenderingIntent - invalid intent: ".concat(e))}switch(t){case _util.AnnotationMode.DISABLE:a+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:a+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i=((a+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE)&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)("getRenderingIntent - invalid annotationMode: ".concat(t))}return r&&(a+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:a,cacheKey:"".concat(a,"_").concat(_annotation_storage.AnnotationStorage.getHash(i)),annotationStorageMap:i}}},{key:"destroy",value:function(){var e=this;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));var t,n=[],r=_createForOfIteratorHelper(_classPrivateFieldGet(this,_pageCache).values());try{for(r.s();!(t=r.n()).done;){var a=t.value;n.push(a._destroy())}}catch(o){r.e(o)}finally{r.f()}_classPrivateFieldGet(this,_pageCache).clear(),_classPrivateFieldGet(this,_pagePromises).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();var i=this.messageHandler.sendWithPromise("Terminate",null);return n.push(i),Promise.all(n).then((function(){e.commonObjs.clear(),e.fontLoader.clear(),_classPrivateFieldGet(e,_methodPromises).clear(),e._networkStream&&e._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),e.messageHandler&&(e.messageHandler.destroy(),e.messageHandler=null),e.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}},{key:"setupMessageHandler",value:function(){var e=this,t=this.messageHandler,n=this.loadingTask;t.on("GetReader",(function(t,n){(0,_util.assert)(e._networkStream,"GetReader - no `IPDFStream` instance available."),e._fullReader=e._networkStream.getFullReader(),e._fullReader.onProgress=function(t){e._lastProgress={loaded:t.loaded,total:t.total}},n.onPull=function(){e._fullReader.read().then((function(e){var t=e.value;e.done?n.close():((0,_util.assert)(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(t),1,[t]))})).catch((function(e){n.error(e)}))},n.onCancel=function(t){e._fullReader.cancel(t),n.ready.catch((function(t){if(!e.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(function(t){var r=(0,_util.createPromiseCapability)(),a=e._fullReader;return a.headersReady.then((function(){var t;a.isStreamingSupported&&a.isRangeSupported||(e._lastProgress&&(null===(t=n.onProgress)||void 0===t||t.call(n,e._lastProgress)),a.onProgress=function(e){var t;null===(t=n.onProgress)||void 0===t||t.call(n,{loaded:e.loaded,total:e.total})});r.resolve({isStreamingSupported:a.isStreamingSupported,isRangeSupported:a.isRangeSupported,contentLength:a.contentLength})}),r.reject),r.promise})),t.on("GetRangeReader",(function(t,n){(0,_util.assert)(e._networkStream,"GetRangeReader - no `IPDFStream` instance available.");var r=e._networkStream.getRangeReader(t.begin,t.end);r?(n.onPull=function(){r.read().then((function(e){var t=e.value;e.done?n.close():((0,_util.assert)(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(t),1,[t]))})).catch((function(e){n.error(e)}))},n.onCancel=function(t){r.cancel(t),n.ready.catch((function(t){if(!e.destroyed)throw t}))}):n.close()})),t.on("GetDoc",(function(t){var r=t.pdfInfo;e._numPages=r.numPages,e._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,n._capability.resolve(new PDFDocumentProxy(r,e))})),t.on("DocException",(function(e){var t;switch(e.name){case"PasswordException":t=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":t=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":t=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":t=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":t=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}n._capability.reject(t)})),t.on("PasswordRequest",(function(t){if(e._passwordCapability=(0,_util.createPromiseCapability)(),n.onPassword)try{n.onPassword((function(t){t instanceof Error?e._passwordCapability.reject(t):e._passwordCapability.resolve({password:t})}),t.code)}catch(r){e._passwordCapability.reject(r)}else e._passwordCapability.reject(new _util.PasswordException(t.message,t.code));return e._passwordCapability.promise})),t.on("DataLoaded",(function(t){var r;null===(r=n.onProgress)||void 0===r||r.call(n,{loaded:t.length,total:t.length}),e.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(function(t){e.destroyed||_classPrivateFieldGet(e,_pageCache).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(function(n){var r,a=_slicedToArray(n,3),i=a[0],o=a[1],s=a[2];if(!e.destroyed&&!e.commonObjs.has(i))switch(o){case"Font":var l=e._params;if("error"in s){var c=s.error;(0,_util.warn)("Error during font loading: ".concat(c)),e.commonObjs.resolve(i,c);break}var u=null;l.pdfBug&&null!==(r=globalThis.FontInspector)&&void 0!==r&&r.enabled&&(u={registerFont:function(e,t){globalThis.FontInspector.fontAdded(e,t)}});var d=new _font_loader.FontFaceObject(s,{isEvalSupported:l.isEvalSupported,disableFontFace:l.disableFontFace,ignoreErrors:l.ignoreErrors,onUnsupportedFeature:e._onUnsupportedFeature.bind(e),fontRegistry:u});e.fontLoader.bind(d).catch((function(e){return t.sendWithPromise("FontFallback",{id:i})})).finally((function(){!l.fontExtraProperties&&d.data&&(d.data=null),e.commonObjs.resolve(i,d)}));break;case"FontPath":case"Image":e.commonObjs.resolve(i,s);break;default:throw new Error("Got unknown common object type ".concat(o))}})),t.on("obj",(function(t){var n=_slicedToArray(t,4),r=n[0],a=n[1],i=n[2],o=n[3];if(!e.destroyed){var s=_classPrivateFieldGet(e,_pageCache).get(a);if(!s.objs.has(r))switch(i){case"Image":var l;if(s.objs.resolve(r,o),o)(o.bitmap?o.width*o.height*4:(null===(l=o.data)||void 0===l?void 0:l.length)||0)>8e6&&(s.cleanupAfterRender=!0);break;case"Pattern":s.objs.resolve(r,o);break;default:throw new Error("Got unknown object type ".concat(i))}}})),t.on("DocProgress",(function(t){var r;e.destroyed||null===(r=n.onProgress)||void 0===r||r.call(n,{loaded:t.loaded,total:t.total})})),t.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),t.on("FetchBuiltInCMap",(function(t){return e.destroyed?Promise.reject(new Error("Worker was destroyed.")):e.cMapReaderFactory?e.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))})),t.on("FetchStandardFontData",(function(t){return e.destroyed?Promise.reject(new Error("Worker was destroyed.")):e.standardFontDataFactory?e.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))}))}},{key:"_onUnsupportedFeature",value:function(e){var t,n,r=e.featureId;this.destroyed||null===(t=(n=this.loadingTask).onUnsupportedFeature)||void 0===t||t.call(n,r)}},{key:"getData",value:function(){return this.messageHandler.sendWithPromise("GetData",null)}},{key:"saveDocument",value:function(){var e,t,n=this;return this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:null!==(e=null===(t=this._fullReader)||void 0===t?void 0:t.filename)&&void 0!==e?e:null}).finally((function(){n.annotationStorage.resetModified()}))}},{key:"getPage",value:function(e){var t=this;if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));var n=e-1,r=_classPrivateFieldGet(this,_pagePromises).get(n);if(r)return r;var a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:n}).then((function(e){if(t.destroyed)throw new Error("Transport destroyed");var r=new PDFPageProxy(n,e,t,t._params.ownerDocument,t._params.pdfBug);return _classPrivateFieldGet(t,_pageCache).set(n,r),r}));return _classPrivateFieldGet(this,_pagePromises).set(n,a),a}},{key:"getPageIndex",value:function(e){return"object"!==typeof e||null===e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen})}},{key:"getAnnotations",value:function(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}},{key:"getFieldObjects",value:function(){return _classPrivateMethodGet(this,_cacheSimpleMethod,_cacheSimpleMethod2).call(this,"GetFieldObjects")}},{key:"hasJSActions",value:function(){return _classPrivateMethodGet(this,_cacheSimpleMethod,_cacheSimpleMethod2).call(this,"HasJSActions")}},{key:"getCalculationOrderIds",value:function(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}},{key:"getDestinations",value:function(){return this.messageHandler.sendWithPromise("GetDestinations",null)}},{key:"getDestination",value:function(e){return"string"!==typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}},{key:"getPageLabels",value:function(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}},{key:"getPageLayout",value:function(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}},{key:"getPageMode",value:function(){return this.messageHandler.sendWithPromise("GetPageMode",null)}},{key:"getViewerPreferences",value:function(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}},{key:"getOpenAction",value:function(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}},{key:"getAttachments",value:function(){return this.messageHandler.sendWithPromise("GetAttachments",null)}},{key:"getJavaScript",value:function(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}},{key:"getDocJSActions",value:function(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}},{key:"getPageJSActions",value:function(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}},{key:"getStructTree",value:function(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}},{key:"getOutline",value:function(){return this.messageHandler.sendWithPromise("GetOutline",null)}},{key:"getOptionalContentConfig",value:function(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((function(e){return new _optional_content_config.OptionalContentConfig(e)}))}},{key:"getPermissions",value:function(){return this.messageHandler.sendWithPromise("GetPermissions",null)}},{key:"getMetadata",value:function(){var e=this,t="GetMetadata",n=_classPrivateFieldGet(this,_methodPromises).get(t);if(n)return n;var r=this.messageHandler.sendWithPromise(t,null).then((function(t){var n,r,a,i;return{info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:null!==(n=null===(r=e._fullReader)||void 0===r?void 0:r.filename)&&void 0!==n?n:null,contentLength:null!==(a=null===(i=e._fullReader)||void 0===i?void 0:i.contentLength)&&void 0!==a?a:null}}));return _classPrivateFieldGet(this,_methodPromises).set(t,r),r}},{key:"getMarkInfo",value:function(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}},{key:"startCleanup",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],!this.destroyed){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.messageHandler.sendWithPromise("Cleanup",null);case 5:n=_createForOfIteratorHelper(_classPrivateFieldGet(this,_pageCache).values()),e.prev=6,n.s();case 8:if((r=n.n()).done){e.next=15;break}if((a=r.value).cleanup()){e.next=13;break}throw new Error("startCleanup: Page ".concat(a.pageNumber," is currently rendering."));case 13:e.next=8;break;case 15:e.next=20;break;case 17:e.prev=17,e.t0=e.catch(6),n.e(e.t0);case 20:return e.prev=20,n.f(),e.finish(20);case 23:this.commonObjs.clear(),t||this.fontLoader.clear(),_classPrivateFieldGet(this,_methodPromises).clear();case 26:case"end":return e.stop()}}),e,this,[[6,17,20,23]])})));return function(){return e.apply(this,arguments)}}()},{key:"loadingParams",get:function(){var e=this._params,t=e.disableAutoFetch,n=e.enableXfa;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:n})}}]),e}();function _cacheSimpleMethod2(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=_classPrivateFieldGet(this,_methodPromises).get(e);if(n)return n;var r=this.messageHandler.sendWithPromise(e,t);return _classPrivateFieldGet(this,_methodPromises).set(e,r),r}var _objs=new WeakMap,_ensureObj=new WeakSet,PDFObjects=function(){function e(){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,_ensureObj),_classPrivateFieldInitSpec(this,_objs,{writable:!0,value:Object.create(null)})}return _createClass(e,[{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){var n=_classPrivateMethodGet(this,_ensureObj,_ensureObj2).call(this,e);return n.capability.promise.then((function(){return t(n.data)})),null}var r=_classPrivateFieldGet(this,_objs)[e];if(null===r||void 0===r||!r.capability.settled)throw new Error("Requesting object that isn't resolved yet ".concat(e,"."));return r.data}},{key:"has",value:function(e){var t=_classPrivateFieldGet(this,_objs)[e];return(null===t||void 0===t?void 0:t.capability.settled)||!1}},{key:"resolve",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=_classPrivateMethodGet(this,_ensureObj,_ensureObj2).call(this,e);n.data=t,n.capability.resolve()}},{key:"clear",value:function(){for(var e in _classPrivateFieldGet(this,_objs)){var t,n=_classPrivateFieldGet(this,_objs)[e].data;null===n||void 0===n||null===(t=n.bitmap)||void 0===t||t.close()}_classPrivateFieldSet(this,_objs,Object.create(null))}}]),e}();function _ensureObj2(e){var t=_classPrivateFieldGet(this,_objs)[e];return t||(_classPrivateFieldGet(this,_objs)[e]={capability:(0,_util.createPromiseCapability)(),data:null})}var _internalRenderTask=new WeakMap,RenderTask=function(){function e(t){_classCallCheck(this,e),_classPrivateFieldInitSpec(this,_internalRenderTask,{writable:!0,value:null}),_classPrivateFieldSet(this,_internalRenderTask,t),this.onContinue=null}return _createClass(e,[{key:"promise",get:function(){return _classPrivateFieldGet(this,_internalRenderTask).capability.promise}},{key:"cancel",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;_classPrivateFieldGet(this,_internalRenderTask).cancel(null,e)}},{key:"separateAnnots",get:function(){var e=_classPrivateFieldGet(this,_internalRenderTask).operatorList.separateAnnots;if(!e)return!1;var t=_classPrivateFieldGet(this,_internalRenderTask).annotationCanvasMap;return e.form||e.canvas&&(null===t||void 0===t?void 0:t.size)>0}}]),e}();exports.RenderTask=RenderTask;var InternalRenderTask=function(){function e(t){var n=t.callback,r=t.params,a=t.objs,i=t.commonObjs,o=t.annotationCanvasMap,s=t.operatorList,l=t.pageIndex,c=t.canvasFactory,u=t.useRequestAnimationFrame,d=void 0!==u&&u,h=t.pdfBug,f=void 0!==h&&h,p=t.pageColors,v=void 0===p?null:p;_classCallCheck(this,e),this.callback=n,this.params=r,this.objs=a,this.commonObjs=i,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=l,this.canvasFactory=c,this._pdfBug=f,this.pageColors=v,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===d&&"undefined"!==typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=r.canvasContext.canvas}return _createClass(e,[{key:"completed",get:function(){return this.capability.promise.catch((function(){}))}},{key:"initializeGraphics",value:function(t){var n,r,a=t.transparency,i=void 0!==a&&a,o=t.optionalContentConfig;if(!this.cancelled){if(this._canvas){if(_classStaticPrivateFieldSpecGet(e,e,_canvasInUse).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");_classStaticPrivateFieldSpecGet(e,e,_canvasInUse).add(this._canvas)}this._pdfBug&&null!==(n=globalThis.StepperManager)&&void 0!==n&&n.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());var s=this.params,l=s.canvasContext,c=s.viewport,u=s.transform,d=s.background;this.gfx=new _canvas.CanvasGraphics(l,this.commonObjs,this.objs,this.canvasFactory,{optionalContentConfig:o},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:u,viewport:c,transparency:i,background:d}),this.operatorListIdx=0,this.graphicsReady=!0,null===(r=this.graphicsReadyCallback)||void 0===r||r.call(this)}}},{key:"cancel",value:function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),this._canvas&&_classStaticPrivateFieldSpecGet(e,e,_canvasInUse).delete(this._canvas),this.callback(n||new _display_utils.RenderingCancelledException("Rendering cancelled, page ".concat(this._pageIndex+1),"canvas",r))}},{key:"operatorListChanged",value:function(){var e;this.graphicsReady?(null===(e=this.stepper)||void 0===e||e.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}},{key:"_continue",value:function(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}},{key:"_scheduleNext",value:function(){var e=this;this._useRequestAnimationFrame?window.requestAnimationFrame((function(){e._nextBound().catch(e._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}},{key:"_next",value:function(){var t=_asyncToGenerator(_regeneratorRuntime().mark((function t(){return _regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.cancelled){t.next=2;break}return t.abrupt("return");case 2:this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&_classStaticPrivateFieldSpecGet(e,e,_canvasInUse).delete(this._canvas),this.callback()));case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}()}]),e}(),_canvasInUse={writable:!0,value:new WeakSet},version="3.4.120";exports.version=version;var build="af6414988";exports.build=build},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var r=n(1),a=n(4),i=n(8),o=new WeakMap,s=new WeakMap,l=new WeakSet,c=function(){function e(){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,l),_classPrivateFieldInitSpec(this,o,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,s,{writable:!0,value:new Map}),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}return _createClass(e,[{key:"getValue",value:function(e,t){var n=_classPrivateFieldGet(this,s).get(e);return void 0===n?t:Object.assign(t,n)}},{key:"getRawValue",value:function(e){return _classPrivateFieldGet(this,s).get(e)}},{key:"remove",value:function(e){if(_classPrivateFieldGet(this,s).delete(e),0===_classPrivateFieldGet(this,s).size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){var t,n=_createForOfIteratorHelper(_classPrivateFieldGet(this,s).values());try{for(n.s();!(t=n.n()).done;)if(t.value instanceof a.AnnotationEditor)return}catch(r){n.e(r)}finally{n.f()}this.onAnnotationEditor(null)}}},{key:"setValue",value:function(e,t){var n=_classPrivateFieldGet(this,s).get(e),r=!1;if(void 0!==n)for(var i=0,o=Object.entries(t);i0?(0,r.objectFromMap)(_classPrivateFieldGet(this,s)):null}},{key:"setAll",value:function(e){for(var t=0,n=Object.entries(e);t0&&void 0!==arguments[0]?arguments[0]:128;_classCallCheck(this,e),_classPrivateFieldInitSpec(this,s,{writable:!0,value:[]}),_classPrivateFieldInitSpec(this,l,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,c,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,u,{writable:!0,value:-1}),_classPrivateFieldSet(this,c,t)}return _createClass(e,[{key:"add",value:function(e){var t=e.cmd,n=e.undo,r=e.mustExec,a=e.type,i=void 0===a?NaN:a,o=e.overwriteIfSameType,d=void 0!==o&&o,h=e.keepUndo,f=void 0!==h&&h;if(r&&t(),!_classPrivateFieldGet(this,l)){var p={cmd:t,undo:n,type:i};if(-1===_classPrivateFieldGet(this,u))return _classPrivateFieldGet(this,s).length>0&&(_classPrivateFieldGet(this,s).length=0),_classPrivateFieldSet(this,u,0),void _classPrivateFieldGet(this,s).push(p);if(d&&_classPrivateFieldGet(this,s)[_classPrivateFieldGet(this,u)].type===i)return f&&(p.undo=_classPrivateFieldGet(this,s)[_classPrivateFieldGet(this,u)].undo),void(_classPrivateFieldGet(this,s)[_classPrivateFieldGet(this,u)]=p);var v=_classPrivateFieldGet(this,u)+1;v===_classPrivateFieldGet(this,c)?_classPrivateFieldGet(this,s).splice(0,1):(_classPrivateFieldSet(this,u,v),v<_classPrivateFieldGet(this,s).length&&_classPrivateFieldGet(this,s).splice(v)),_classPrivateFieldGet(this,s).push(p)}}},{key:"undo",value:function(){-1!==_classPrivateFieldGet(this,u)&&(_classPrivateFieldSet(this,l,!0),_classPrivateFieldGet(this,s)[_classPrivateFieldGet(this,u)].undo(),_classPrivateFieldSet(this,l,!1),_classPrivateFieldSet(this,u,_classPrivateFieldGet(this,u)-1))}},{key:"redo",value:function(){_classPrivateFieldGet(this,u)<_classPrivateFieldGet(this,s).length-1&&(_classPrivateFieldSet(this,u,_classPrivateFieldGet(this,u)+1),_classPrivateFieldSet(this,l,!0),_classPrivateFieldGet(this,s)[_classPrivateFieldGet(this,u)].cmd(),_classPrivateFieldSet(this,l,!1))}},{key:"hasSomethingToUndo",value:function(){return-1!==_classPrivateFieldGet(this,u)}},{key:"hasSomethingToRedo",value:function(){return _classPrivateFieldGet(this,u)<_classPrivateFieldGet(this,s).length-1}},{key:"destroy",value:function(){_classPrivateFieldSet(this,s,null)}}]),e}();t.CommandManager=d;var h=new WeakSet,f=function(){function e(t){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,h),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;var n,a=r.FeatureTest.platform.isMac,i=_createForOfIteratorHelper(t);try{for(i.s();!(n=i.n()).done;){var o,s=_slicedToArray(n.value,2),l=s[0],c=s[1],u=_createForOfIteratorHelper(l);try{for(u.s();!(o=u.n()).done;){var d=o.value,f=d.startsWith("mac+");a&&f?(this.callbacks.set(d.slice(4),c),this.allKeys.add(d.split("+").at(-1))):a||f||(this.callbacks.set(d,c),this.allKeys.add(d.split("+").at(-1)))}}catch(p){u.e(p)}finally{u.f()}}}catch(p){i.e(p)}finally{i.f()}}return _createClass(e,[{key:"exec",value:function(e,t){if(this.allKeys.has(t.key)){var n=this.callbacks.get(_classPrivateMethodGet(this,h,p).call(this,t));n&&(n.bind(e)(),t.stopPropagation(),t.preventDefault())}}}]),e}();function p(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);var t=this.buffer.join("+");return this.buffer.length=0,t}t.KeyboardManager=f;var v=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"_colors",get:function(){var e=new Map([["CanvasText",null],["Canvas",null]]);return(0,a.getColorValues)(e),(0,r.shadow)(this,"_colors",e)}},{key:"convert",value:function(t){var n=(0,a.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return n;var r,i=_createForOfIteratorHelper(this._colors);try{for(i.s();!(r=i.n()).done;){var o=_slicedToArray(r.value,2),s=o[0];if(o[1].every((function(e,t){return e===n[t]})))return e._colorsMapping.get(s)}}catch(l){i.e(l)}finally{i.f()}return n}},{key:"getHexCode",value:function(e){var t,n=this._colors.get(e);return n?(t=r.Util).makeHexColor.apply(t,_toConsumableArray(n)):e}}]),e}();_defineProperty(v,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]])),t.ColorManager=v;var g=new WeakMap,m=new WeakMap,y=new WeakMap,_=new WeakMap,b=new WeakMap,k=new WeakMap,S=new WeakMap,w=new WeakMap,P=new WeakMap,x=new WeakMap,A=new WeakMap,C=new WeakMap,E=new WeakMap,F=new WeakMap,T=new WeakMap,M=new WeakMap,R=new WeakMap,I=new WeakMap,O=new WeakMap,L=new WeakMap,D=new WeakMap,N=new WeakMap,G=new WeakMap,j=new WeakSet,z=new WeakSet,B=new WeakSet,H=new WeakSet,U=new WeakSet,W=new WeakSet,q=new WeakSet,V=new WeakSet,K=new WeakSet,X=new WeakSet,Y=new WeakSet,J=function(){function e(t,n,i){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,Y),_classPrivateMethodInitSpec(this,X),_classPrivateMethodInitSpec(this,K),_classPrivateMethodInitSpec(this,V),_classPrivateMethodInitSpec(this,q),_classPrivateMethodInitSpec(this,W),_classPrivateMethodInitSpec(this,U),_classPrivateMethodInitSpec(this,H),_classPrivateMethodInitSpec(this,B),_classPrivateMethodInitSpec(this,z),_classPrivateMethodInitSpec(this,j),_classPrivateFieldInitSpec(this,g,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,m,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,y,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,_,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,b,{writable:!0,value:new d}),_classPrivateFieldInitSpec(this,k,{writable:!0,value:0}),_classPrivateFieldInitSpec(this,S,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,w,{writable:!0,value:new Set}),_classPrivateFieldInitSpec(this,P,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,x,{writable:!0,value:new o}),_classPrivateFieldInitSpec(this,A,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,C,{writable:!0,value:r.AnnotationEditorType.NONE}),_classPrivateFieldInitSpec(this,E,{writable:!0,value:new Set}),_classPrivateFieldInitSpec(this,F,{writable:!0,value:this.copy.bind(this)}),_classPrivateFieldInitSpec(this,T,{writable:!0,value:this.cut.bind(this)}),_classPrivateFieldInitSpec(this,M,{writable:!0,value:this.paste.bind(this)}),_classPrivateFieldInitSpec(this,R,{writable:!0,value:this.keydown.bind(this)}),_classPrivateFieldInitSpec(this,I,{writable:!0,value:this.onEditingAction.bind(this)}),_classPrivateFieldInitSpec(this,O,{writable:!0,value:this.onPageChanging.bind(this)}),_classPrivateFieldInitSpec(this,L,{writable:!0,value:this.onScaleChanging.bind(this)}),_classPrivateFieldInitSpec(this,D,{writable:!0,value:this.onRotationChanging.bind(this)}),_classPrivateFieldInitSpec(this,N,{writable:!0,value:{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1}}),_classPrivateFieldInitSpec(this,G,{writable:!0,value:null}),_classPrivateFieldSet(this,G,t),_classPrivateFieldSet(this,P,n),_classPrivateFieldGet(this,P)._on("editingaction",_classPrivateFieldGet(this,I)),_classPrivateFieldGet(this,P)._on("pagechanging",_classPrivateFieldGet(this,O)),_classPrivateFieldGet(this,P)._on("scalechanging",_classPrivateFieldGet(this,L)),_classPrivateFieldGet(this,P)._on("rotationchanging",_classPrivateFieldGet(this,D)),_classPrivateFieldSet(this,_,i),this.viewParameters={realScale:a.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}return _createClass(e,[{key:"destroy",value:function(){_classPrivateMethodGet(this,z,Z).call(this),_classPrivateFieldGet(this,P)._off("editingaction",_classPrivateFieldGet(this,I)),_classPrivateFieldGet(this,P)._off("pagechanging",_classPrivateFieldGet(this,O)),_classPrivateFieldGet(this,P)._off("scalechanging",_classPrivateFieldGet(this,L)),_classPrivateFieldGet(this,P)._off("rotationchanging",_classPrivateFieldGet(this,D));var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,y).values());try{for(t.s();!(e=t.n()).done;)e.value.destroy()}catch(n){t.e(n)}finally{t.f()}_classPrivateFieldGet(this,y).clear(),_classPrivateFieldGet(this,m).clear(),_classPrivateFieldGet(this,w).clear(),_classPrivateFieldSet(this,g,null),_classPrivateFieldGet(this,E).clear(),_classPrivateFieldGet(this,b).destroy()}},{key:"onPageChanging",value:function(e){var t=e.pageNumber;_classPrivateFieldSet(this,k,t-1)}},{key:"focusMainContainer",value:function(){_classPrivateFieldGet(this,G).focus()}},{key:"addShouldRescale",value:function(e){_classPrivateFieldGet(this,w).add(e)}},{key:"removeShouldRescale",value:function(e){_classPrivateFieldGet(this,w).delete(e)}},{key:"onScaleChanging",value:function(e){var t=e.scale;this.commitOrRemove(),this.viewParameters.realScale=t*a.PixelsPerInch.PDF_TO_CSS_UNITS;var n,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,w));try{for(r.s();!(n=r.n()).done;)n.value.onScaleChanging()}catch(i){r.e(i)}finally{r.f()}}},{key:"onRotationChanging",value:function(e){var t=e.pagesRotation;this.commitOrRemove(),this.viewParameters.rotation=t}},{key:"addToAnnotationStorage",value:function(e){e.isEmpty()||!_classPrivateFieldGet(this,_)||_classPrivateFieldGet(this,_).has(e.id)||_classPrivateFieldGet(this,_).setValue(e.id,e)}},{key:"copy",value:function(e){if(e.preventDefault(),_classPrivateFieldGet(this,g)&&_classPrivateFieldGet(this,g).commitOrRemove(),this.hasSelection){var t,n=[],r=_createForOfIteratorHelper(_classPrivateFieldGet(this,E));try{for(r.s();!(t=r.n()).done;){var a=t.value;a.isEmpty()||n.push(a.serialize())}}catch(i){r.e(i)}finally{r.f()}0!==n.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(n))}}},{key:"cut",value:function(e){this.copy(e),this.delete()}},{key:"paste",value:function(e){var t=this;e.preventDefault();var n=e.clipboardData.getData("application/pdfjs");if(n){try{n=JSON.parse(n)}catch(u){return void(0,r.warn)('paste: "'.concat(u.message,'".'))}if(Array.isArray(n)){this.unselectAll();var a=_classPrivateFieldGet(this,y).get(_classPrivateFieldGet(this,k));try{var i,o=[],s=_createForOfIteratorHelper(n);try{for(s.s();!(i=s.n()).done;){var l=i.value,c=a.deserialize(l);if(!c)return;o.push(c)}}catch(d){s.e(d)}finally{s.f()}this.addCommands({cmd:function(){for(var e=0,n=o;e1&&void 0!==arguments[1]&&arguments[1];if(!t){var n=e.split(/[#?]/,1);e=_slicedToArray(n,1)[0]}return e.substring(e.lastIndexOf("/")+1)},t.getPdfFilenameFromUrl=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!==typeof e)return t;if(p(e))return(0,a.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;var n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e),i=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(i&&(i=i[0]).includes("%"))try{i=n.exec(decodeURIComponent(i))[0]}catch(o){}return i||t},t.getRGB=_,t.getXfaPageViewport=function(e,t){var n=t.scale,r=void 0===n?1:n,a=t.rotation,i=void 0===a?0:a,o=e.attributes.style,s=o.width,l=o.height,c=[0,0,parseInt(s),parseInt(l)];return new h({viewBox:c,scale:r,rotation:i})},t.isDataScheme=p,t.isPdfFile=function(e){return"string"===typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=m,t.loadScript=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise((function(n,r){var a=document.createElement("script");a.src=e,a.onload=function(e){t&&a.remove(),n(e)},a.onerror=function(){r(new Error("Cannot load script at: ".concat(a.src)))},(document.head||document.documentElement).append(a)}))},t.setLayerDimensions=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(t instanceof h){var a=t.rawDims,i=a.pageWidth,o=a.pageHeight,s=e.style,l="calc(var(--scale-factor) * ".concat(i,"px)"),c="calc(var(--scale-factor) * ".concat(o,"px)");n&&t.rotation%180!==0?(s.width=c,s.height=l):(s.width=l,s.height=c)}r&&e.setAttribute("data-main-rotation",t.rotation)};var r=n(7),a=n(1);t.AnnotationPrefix="pdfjs_internal_id_";var i=_createClass((function e(){_classCallCheck(this,e)}));_defineProperty(i,"CSS",96),_defineProperty(i,"PDF",72),_defineProperty(i,"PDF_TO_CSS_UNITS",i.CSS/i.PDF),t.PixelsPerInch=i;var o=function(e){_inherits(n,e);var t=_createSuper(n);function n(){var e,r=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).ownerDocument,a=void 0===r?globalThis.document:r;return _classCallCheck(this,n),(e=t.call(this))._document=a,e}return _createClass(n,[{key:"_createCanvas",value:function(e,t){var n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}]),n}(r.BaseCanvasFactory);function s(e){return l.apply(this,arguments)}function l(){return l=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r,i=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],!m(t,document.baseURI)){e.next=21;break}return e.next=4,fetch(t);case 4:if((r=e.sent).ok){e.next=7;break}throw new Error(r.statusText);case 7:if(!n){e.next=15;break}return e.t1=Uint8Array,e.next=11,r.arrayBuffer();case 11:e.t2=e.sent,e.t0=new e.t1(e.t2),e.next=20;break;case 15:return e.t3=a.stringToBytes,e.next=18,r.text();case 18:e.t4=e.sent,e.t0=(0,e.t3)(e.t4);case 20:return e.abrupt("return",e.t0);case 21:return e.abrupt("return",new Promise((function(e,r){var i=new XMLHttpRequest;i.open("GET",t,!0),n&&(i.responseType="arraybuffer"),i.onreadystatechange=function(){if(i.readyState===XMLHttpRequest.DONE){var t;if((200===i.status||0===i.status)&&(n&&i.response?t=new Uint8Array(i.response):!n&&i.responseText&&(t=(0,a.stringToBytes)(i.responseText)),t))return void e(t);r(new Error(i.statusText))}},i.send(null)})));case 22:case"end":return e.stop()}}),e)}))),l.apply(this,arguments)}t.DOMCanvasFactory=o;var c=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_fetchData",value:function(e,t){return s(e,this.isCompressed).then((function(e){return{cMapData:e,compressionType:t}}))}}]),n}(r.BaseCMapReaderFactory);t.DOMCMapReaderFactory=c;var u=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_fetchData",value:function(e){return s(e,!0)}}]),n}(r.BaseStandardFontDataFactory);t.DOMStandardFontDataFactory=u;var d=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_createSVG",value:function(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}]),n}(r.BaseSVGFactory);t.DOMSVGFactory=d;var h=function(){function e(t){var n=t.viewBox,r=t.scale,a=t.rotation,i=t.offsetX,o=void 0===i?0:i,s=t.offsetY,l=void 0===s?0:s,c=t.dontFlip,u=void 0!==c&&c;_classCallCheck(this,e),this.viewBox=n,this.scale=r,this.rotation=a,this.offsetX=o,this.offsetY=l;var d,h,f,p,v,g,m,y,_=(n[2]+n[0])/2,b=(n[3]+n[1])/2;switch((a%=360)<0&&(a+=360),a){case 180:d=-1,h=0,f=0,p=1;break;case 90:d=0,h=1,f=1,p=0;break;case 270:d=0,h=-1,f=-1,p=0;break;case 0:d=1,h=0,f=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}u&&(f=-f,p=-p),0===d?(v=Math.abs(b-n[1])*r+o,g=Math.abs(_-n[0])*r+l,m=(n[3]-n[1])*r,y=(n[2]-n[0])*r):(v=Math.abs(_-n[0])*r+o,g=Math.abs(b-n[1])*r+l,m=(n[2]-n[0])*r,y=(n[3]-n[1])*r),this.transform=[d*r,h*r,f*r,p*r,v-d*r*_-f*r*b,g-h*r*_-p*r*b],this.width=m,this.height=y}return _createClass(e,[{key:"rawDims",get:function(){var e=this.viewBox;return(0,a.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}},{key:"clone",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.scale,r=void 0===n?this.scale:n,a=t.rotation,i=void 0===a?this.rotation:a,o=t.offsetX,s=void 0===o?this.offsetX:o,l=t.offsetY,c=void 0===l?this.offsetY:l,u=t.dontFlip,d=void 0!==u&&u;return new e({viewBox:this.viewBox.slice(),scale:r,rotation:i,offsetX:s,offsetY:c,dontFlip:d})}},{key:"convertToViewportPoint",value:function(e,t){return a.Util.applyTransform([e,t],this.transform)}},{key:"convertToViewportRectangle",value:function(e){var t=a.Util.applyTransform([e[0],e[1]],this.transform),n=a.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}},{key:"convertToPdfPoint",value:function(e,t){return a.Util.applyInverseTransform([e,t],this.transform)}}]),e}();t.PageViewport=h;var f=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r){var a,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return _classCallCheck(this,n),(a=t.call(this,e,"RenderingCancelledException")).type=r,a.extraDelay=i,a}return _createClass(n)}(a.BaseException);function p(e){for(var t=e.length,n=0;n=1&&r<=12?r-1:0;var a=parseInt(t[3],10);a=a>=1&&a<=31?a:1;var i=parseInt(t[4],10);i=i>=0&&i<=23?i:0;var o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;var s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;var l=t[7]||"Z",c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;var u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===l?(i+=c,o+=u):"+"===l&&(i-=c,o-=u),new Date(Date.UTC(n,r,a,i,o,s))}}]),e}();function _(e){if(e.startsWith("#")){var t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((function(e){return parseInt(e)})):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((function(e){return parseInt(e)})).slice(0,3):((0,a.warn)('Not a valid color format: "'.concat(e,'"')),[0,0,0])}t.PDFDateString=y},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var r=n(1),a=function(){function e(){_classCallCheck(this,e),this.constructor===e&&(0,r.unreachable)("Cannot initialize BaseCanvasFactory.")}return _createClass(e,[{key:"create",value:function(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");var n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d")}}},{key:"reset",value:function(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}},{key:"destroy",value:function(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}},{key:"_createCanvas",value:function(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}]),e}();t.BaseCanvasFactory=a;var i=function(){function e(t){var n=t.baseUrl,a=void 0===n?null:n,i=t.isCompressed,o=void 0===i||i;_classCallCheck(this,e),this.constructor===e&&(0,r.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=a,this.isCompressed=o}return _createClass(e,[{key:"fetch",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,a,i,o=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.name,this.baseUrl){e.next=3;break}throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');case 3:if(n){e.next=5;break}throw new Error("CMap name must be specified.");case 5:return a=this.baseUrl+n+(this.isCompressed?".bcmap":""),i=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE,e.abrupt("return",this._fetchData(a,i).catch((function(e){throw new Error("Unable to load ".concat(o.isCompressed?"binary ":"","CMap at: ").concat(a))})));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchData",value:function(e,t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}]),e}();t.BaseCMapReaderFactory=i;var o=function(){function e(t){var n=t.baseUrl,a=void 0===n?null:n;_classCallCheck(this,e),this.constructor===e&&(0,r.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=a}return _createClass(e,[{key:"fetch",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.filename,this.baseUrl){e.next=3;break}throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');case 3:if(n){e.next=5;break}throw new Error("Font filename must be specified.");case 5:return r="".concat(this.baseUrl).concat(n),e.abrupt("return",this._fetchData(r).catch((function(e){throw new Error("Unable to load font data at: ".concat(r))})));case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchData",value:function(e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}]),e}();t.BaseStandardFontDataFactory=o;var s=function(){function e(){_classCallCheck(this,e),this.constructor===e&&(0,r.unreachable)("Cannot initialize BaseSVGFactory.")}return _createClass(e,[{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");var r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width","".concat(e,"px")),r.setAttribute("height","".concat(t,"px"))),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox","0 0 ".concat(e," ").concat(t)),r}},{key:"createElement",value:function(e){if("string"!==typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}},{key:"_createSVG",value:function(e){(0,r.unreachable)("Abstract method `_createSVG` called.")}}]),e}();t.BaseSVGFactory=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var r=n(1),a=3285377520,i=4294901760,o=65535,s=function(){function e(t){_classCallCheck(this,e),this.h1=t?4294967295&t:a,this.h2=t?4294967295&t:a}return _createClass(e,[{key:"update",value:function(e){var t,n;if("string"===typeof e){t=new Uint8Array(2*e.length),n=0;for(var a=0,s=e.length;a>>8,t[n++]=255&l)}}else{if(!(0,r.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");n=(t=e.slice()).byteLength}for(var c=n>>2,u=n-4*c,d=new Uint32Array(t.buffer,0,c),h=0,f=0,p=this.h1,v=this.h2,g=3432918353,m=461845907,y=11601,_=13715,b=0;b>>17)*m&i|h*_&o)<<13|p>>>19)+3864292196:v=5*(v=(v^=f=(f=(f=(f=d[b])*g&i|f*y&o)<<15|f>>>17)*m&i|f*_&o)<<13|v>>>19)+3864292196;switch(h=0,u){case 3:h^=t[4*c+2]<<16;case 2:h^=t[4*c+1]<<8;case 1:h=(h=(h=(h^=t[4*c])*g&i|h*y&o)<<15|h>>>17)*m&i|h*_&o,1&c?p^=h:v^=h}this.h1=p,this.h2=v}},{key:"hexdigest",value:function(){var e=this.h1,t=this.h2;return e=3981806797*(e^=t>>>1)&i|36045*e&o,e=444984403*(e^=(t=4283543511*t&i|(2950163797*(t<<16|e>>>16)&i)>>>16)>>>1)&i|60499*e&o,((e^=(t=3301882366*t&i|(3120437893*(t<<16|e>>>16)&i)>>>16)>>>1)>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}]),e}();t.MurmurHash3_64=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1),a=n(10),i=function(){function e(t){var n=t.onUnsupportedFeature,r=t.ownerDocument,a=void 0===r?globalThis.document:r;t.styleElement,_classCallCheck(this,e),this._onUnsupportedFeature=n,this._document=a,this.nativeFontFaces=[],this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}return _createClass(e,[{key:"addNativeFontFace",value:function(e){this.nativeFontFaces.push(e),this._document.fonts.add(e)}},{key:"insertRule",value:function(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));var t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}},{key:"clear",value:function(){var e,t=_createForOfIteratorHelper(this.nativeFontFaces);try{for(t.s();!(e=t.n()).done;){var n=e.value;this._document.fonts.delete(n)}}catch(r){t.e(r)}finally{t.f()}this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}},{key:"bind",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var n,a,i=this;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.attached&&!t.missingFile){e.next=2;break}return e.abrupt("return");case 2:if(t.attached=!0,!this.isFontLoadingAPISupported){e.next=19;break}if(!(n=t.createNativeFontFace())){e.next=18;break}return this.addNativeFontFace(n),e.prev=7,e.next=10,n.loaded;case 10:e.next=18;break;case 12:throw e.prev=12,e.t0=e.catch(7),this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,r.warn)("Failed to load font '".concat(n.family,"': '").concat(e.t0,"'.")),t.disableFontFace=!0,e.t0;case 18:return e.abrupt("return");case 19:if(!(a=t.createFontFaceRule())){e.next=26;break}if(this.insertRule(a),!this.isSyncFontLoadingSupported){e.next=24;break}return e.abrupt("return");case 24:return e.next=26,new Promise((function(e){var n=i._queueLoadingCallback(e);i._prepareFontLoadEvent(t,n)}));case 26:case"end":return e.stop()}}),e,this,[[7,12]])})));return function(t){return e.apply(this,arguments)}}()},{key:"isFontLoadingAPISupported",get:function(){var e,t=!(null===(e=this._document)||void 0===e||!e.fonts);return(0,r.shadow)(this,"isFontLoadingAPISupported",t)}},{key:"isSyncFontLoadingSupported",get:function(){var e=!1;return(a.isNodeJS||"undefined"!==typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,r.shadow)(this,"isSyncFontLoadingSupported",e)}},{key:"_queueLoadingCallback",value:function(e){var t=this.loadingRequests,n={done:!1,complete:function(){for((0,r.assert)(!n.done,"completeRequest() cannot be called twice."),n.done=!0;t.length>0&&t[0].done;){var e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(n),n}},{key:"_loadTestFont",get:function(){var e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,r.shadow)(this,"_loadTestFont",e)}},{key:"_prepareFontLoadEvent",value:function(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function a(e,t,n,r){return e.substring(0,t)+r+e.substring(t+n)}var i,o,s=this._document.createElement("canvas");s.width=1,s.height=1;var l=s.getContext("2d"),c=0,u="lt".concat(Date.now()).concat(this.loadTestFontId++),d=this._loadTestFont,h=1482184792,f=n(d=a(d,976,u.length,u),16);for(i=0,o=u.length-3;i30)return(0,r.warn)("Load test font never loaded."),void n();l.font="30px "+t,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(u,(function(){g.remove(),t.complete()}))}}]),e}();t.FontLoader=i;var o=function(){function e(t,n){var r=n.isEvalSupported,a=void 0===r||r,i=n.disableFontFace,o=void 0!==i&&i,s=n.ignoreErrors,l=void 0!==s&&s,c=n.onUnsupportedFeature,u=n.fontRegistry,d=void 0===u?null:u;for(var h in _classCallCheck(this,e),this.compiledGlyphs=Object.create(null),t)this[h]=t[h];this.isEvalSupported=!1!==a,this.disableFontFace=!0===o,this.ignoreErrors=!0===l,this._onUnsupportedFeature=c,this.fontRegistry=d}return _createClass(e,[{key:"createNativeFontFace",value:function(){var e,t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){var n={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(n.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),t=new FontFace(this.cssFontInfo.fontFamily,this.data,n)}else t=new FontFace(this.loadedName,this.data,{});return null===(e=this.fontRegistry)||void 0===e||e.registerFont(this),t}},{key:"createFontFaceRule",value:function(){var e;if(!this.data||this.disableFontFace)return null;var t,n=(0,r.bytesToString)(this.data),a="url(data:".concat(this.mimetype,";base64,").concat(btoa(n),");");if(this.cssFontInfo){var i="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(i+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),t='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(i,"src:").concat(a,"}")}else t='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(a,"}");return null===(e=this.fontRegistry)||void 0===e||e.registerFont(this,a),t}},{key:"getPathGenerator",value:function(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];var n;try{n=e.get(this.loadedName+"_path_"+t)}catch(c){if(!this.ignoreErrors)throw c;return this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,r.warn)('getPathGenerator - ignoring character: "'.concat(c,'".')),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){var a,i=[],o=_createForOfIteratorHelper(n);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=void 0!==s.args?s.args.join(","):"";i.push("c.",s.cmd,"(",l,");\n")}}catch(u){o.e(u)}finally{o.f()}return this.compiledGlyphs[t]=new Function("c","size",i.join(""))}return this.compiledGlyphs[t]=function(e,t){var r,a=_createForOfIteratorHelper(n);try{for(a.s();!(r=a.n()).done;){var i=r.value;"scale"===i.cmd&&(i.args=[t,-t]),e[i.cmd].apply(e,i.args)}}catch(u){a.e(u)}finally{a.f()}}}}]),e}();t.FontFaceObject=o},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeJS=void 0;var n="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(1),a=n(6),i=n(12),o=n(13),s=4096,l=16,c=function(){function e(t){_classCallCheck(this,e),this.canvasFactory=t,this.cache=Object.create(null)}return _createClass(e,[{key:"getCanvas",value:function(e,t,n){var r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,n)):(r=this.canvasFactory.create(t,n),this.cache[e]=r),r}},{key:"delete",value:function(e){delete this.cache[e]}},{key:"clear",value:function(){for(var e in this.cache){var t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}]),e}();function u(e,t,n,r,i,o,s,l,c,u){var d=(0,a.getCurrentTransform)(e),h=_slicedToArray(d,6),f=h[0],p=h[1],v=h[2],g=h[3],m=h[4],y=h[5];if(0===p&&0===v){var _=s*f+m,b=Math.round(_),k=l*g+y,S=Math.round(k),w=(s+c)*f+m,P=Math.abs(Math.round(w)-b)||1,x=(l+u)*g+y,A=Math.abs(Math.round(x)-S)||1;return e.setTransform(Math.sign(f),0,0,Math.sign(g),b,S),e.drawImage(t,n,r,i,o,0,0,P,A),e.setTransform(f,p,v,g,m,y),[P,A]}if(0===f&&0===g){var C=l*v+m,E=Math.round(C),F=s*p+y,T=Math.round(F),M=(l+u)*v+m,R=Math.abs(Math.round(M)-E)||1,I=(s+c)*p+y,O=Math.abs(Math.round(I)-T)||1;return e.setTransform(0,Math.sign(p),Math.sign(v),0,E,T),e.drawImage(t,n,r,i,o,0,0,O,R),e.setTransform(f,p,v,g,m,y),[O,R]}return e.drawImage(t,n,r,i,o,s,l,c,u),[Math.hypot(f,p)*c,Math.hypot(v,g)*u]}var d=function(){function e(t,n){_classCallCheck(this,e),this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=r.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,t,n])}return _createClass(e,[{key:"clone",value:function(){var e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}},{key:"setCurrentPoint",value:function(e,t){this.x=e,this.y=t}},{key:"updatePathMinMax",value:function(e,t,n){var a=r.Util.applyTransform([t,n],e),i=_slicedToArray(a,2);t=i[0],n=i[1],this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}},{key:"updateRectMinMax",value:function(e,t){var n=r.Util.applyTransform(t,e),a=r.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,n[0],a[0]),this.minY=Math.min(this.minY,n[1],a[1]),this.maxX=Math.max(this.maxX,n[0],a[0]),this.maxY=Math.max(this.maxY,n[1],a[1])}},{key:"updateScalingPathMinMax",value:function(e,t){r.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}},{key:"updateCurvePathMinMax",value:function(e,t,n,a,i,o,s,l,c,u){var d=r.Util.bezierBoundingBox(t,n,a,i,o,s,l,c);if(u)return u[0]=Math.min(u[0],d[0],d[2]),u[1]=Math.max(u[1],d[0],d[2]),u[2]=Math.min(u[2],d[1],d[3]),void(u[3]=Math.max(u[3],d[1],d[3]));this.updateRectMinMax(e,d)}},{key:"getPathBoundingBox",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[this.minX,this.minY,this.maxX,this.maxY];if(e===i.PathType.STROKE){t||(0,r.unreachable)("Stroke bounding box must include transform.");var a=r.Util.singularValueDecompose2dScale(t),o=a[0]*this.lineWidth/2,s=a[1]*this.lineWidth/2;n[0]-=o,n[1]-=s,n[2]+=o,n[3]+=s}return n}},{key:"updateClipFromPath",value:function(){var e=r.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}},{key:"isEmptyClip",value:function(){return this.minX===1/0}},{key:"startNewPathAndClipBox",value:function(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}},{key:"getClippedPathBoundingBox",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}]),e}();function h(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!==typeof ImageData&&t instanceof ImageData)e.putImageData(t,0,0);else{var a,i,o,s,c,u,d,h,f,p=t.height,v=t.width,g=p%l,m=(p-g)/l,y=0===g?m:m+1,_=e.createImageData(v,l),b=0,k=t.data,S=_.data;if(n)switch(n.length){case 1:u=n[0],d=n[0],h=n[0],f=n[0];break;case 4:u=n[0],d=n[1],h=n[2],f=n[3]}if(t.kind===r.ImageKind.GRAYSCALE_1BPP){var w=k.byteLength,P=new Uint32Array(S.buffer,0,S.byteLength>>2),x=P.length,A=v+7>>3,C=4294967295,E=r.FeatureTest.isLittleEndian?4278190080:255;if(f&&255===f[0]&&0===f[255]){var F=[E,C];C=F[0],E=F[1]}for(i=0;iA?v:8*T-7,I=-8&R,O=0,L=0;M>=1}for(;a=m&&(c=v*(s=g)),a=0,o=c;o--;)S[a++]=k[b++],S[a++]=k[b++],S[a++]=k[b++],S[a++]=255;if(j)for(var z=0;z>8,e[i-2]=e[i-2]*o+n*s>>8,e[i-1]=e[i-1]*o+r*s>>8}}}function m(e,t,n){for(var r=e.length,a=3;a>8]>>8:t[a]*i>>16}}function _(e,t,n,r){var a=r[0],i=r[1],o=r[2]-a,s=r[3]-i;0!==o&&0!==s&&(function(e,t,n,r,a,i,o,s,l,c,u){var d,h=!!i,f=h?i[0]:0,p=h?i[1]:0,v=h?i[2]:0;d="Luminosity"===a?y:m;for(var _=Math.min(r,Math.ceil(1048576/n)),b=0;b1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}},{key:"beginDrawing",value:function(e){var t,n,r=e.transform,i=e.viewport,o=e.transparency,s=void 0!==o&&o,l=e.background,c=void 0===l?null:l,u=this.ctx.canvas.width,d=this.ctx.canvas.height,h=c||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;var f=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;var p,g,m=this.backgroundColor=this.ctx.fillStyle;if(this.ctx.fillStyle=h,p="string"===typeof(g=this.ctx.fillStyle)&&/^#[0-9A-Fa-f]{6}$/.test(g),"#000000"===f&&"#ffffff"===m||f===m||!p)this.foregroundColor=this.backgroundColor=null;else{var y=(0,a.getRGB)(g),_=_slicedToArray(y,3),b=_[0],k=_[1],S=_[2],w=function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)},P=Math.round(.2126*w(b)+.7152*w(k)+.0722*w(S));this.selectColor=function(e,t,n){var r=.2126*w(e)+.7152*w(t)+.0722*w(n);return Math.round(r)===P?m:f}}}if(this.ctx.fillStyle=this.backgroundColor||h,this.ctx.fillRect(0,0,u,d),this.ctx.restore(),s){var x,A=this.cachedCanvases.getCanvas("transparent",u,d);this.compositeCtx=this.ctx,this.transparentCanvas=A.canvas,this.ctx=A.context,this.ctx.save(),(x=this.ctx).transform.apply(x,_toConsumableArray((0,a.getCurrentTransform)(this.compositeCtx)))}this.ctx.save(),v(this.ctx,this.foregroundColor),r&&((n=this.ctx).transform.apply(n,_toConsumableArray(r)),this.outputScaleX=r[0],this.outputScaleY=r[0]),(t=this.ctx).transform.apply(t,_toConsumableArray(i.transform)),this.viewportScale=i.scale,this.baseTransform=(0,a.getCurrentTransform)(this.ctx)}},{key:"executeOperatorList",value:function(e,t,n,a){var i=e.argsArray,o=e.fnArray,s=t||0,l=i.length;if(l===s)return s;for(var c,u=l-s>10&&"function"===typeof n,d=u?Date.now()+15:0,h=0,f=this.commonObjs,p=this.objs;;){if(void 0!==a&&s===a.nextBreakPoint)return a.breakIt(s,n),s;if((c=o[s])!==r.OPS.dependency)this[c].apply(this,i[s]);else{var v,g=_createForOfIteratorHelper(i[s]);try{for(g.s();!(v=g.n()).done;){var m=v.value,y=m.startsWith("g_")?f:p;if(!y.has(m))return y.get(m,n),s}}catch(_){g.e(_)}finally{g.f()}}if(++s===l)return s;if(u&&++h>10){if(Date.now()>d)return n(),s;h=0}}}},{key:"endDrawing",value:function(){_classPrivateMethodGet(this,x,C).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();var e,t=_createForOfIteratorHelper(this._cachedBitmapsMap.values());try{for(t.s();!(e=t.n()).done;){var n,r=e.value,a=_createForOfIteratorHelper(r.values());try{for(a.s();!(n=a.n()).done;){var i=n.value;"undefined"!==typeof HTMLCanvasElement&&i instanceof HTMLCanvasElement&&(i.width=i.height=0)}}catch(o){a.e(o)}finally{a.f()}r.clear()}}catch(o){t.e(o)}finally{t.f()}this._cachedBitmapsMap.clear()}},{key:"_scaleImage",value:function(e,t){for(var n,r,a=e.width,i=e.height,o=Math.max(Math.hypot(t[0],t[1]),1),s=Math.max(Math.hypot(t[2],t[3]),1),l=a,c=i,u="prescale1";o>2&&l>1||s>2&&c>1;){var d=l,h=c;o>2&&l>1&&(o/=l/(d=Math.ceil(l/2))),s>2&&c>1&&(s/=c/(h=Math.ceil(c/2))),(r=(n=this.cachedCanvases.getCanvas(u,d,h)).context).clearRect(0,0,d,h),r.drawImage(e,0,0,l,c,0,0,d,h),e=n.canvas,l=d,c=h,u="prescale1"===u?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}},{key:"_createMaskCanvas",value:function(e){var t,n,o,s,l=this.ctx,c=e.width,d=e.height,h=this.current.fillColor,p=this.current.patternFill,v=(0,a.getCurrentTransform)(l);if((e.bitmap||e.data)&&e.count>1){var g=e.bitmap||e.data.buffer;n=JSON.stringify(p?v:[v.slice(0,4),h]),(t=this._cachedBitmapsMap.get(g))||(t=new Map,this._cachedBitmapsMap.set(g,t));var m=t.get(n);if(m&&!p)return{canvas:m,offsetX:Math.round(Math.min(v[0],v[2])+v[4]),offsetY:Math.round(Math.min(v[1],v[3])+v[5])};o=m}o||f((s=this.cachedCanvases.getCanvas("maskCanvas",c,d)).context,e);var y=r.Util.transform(v,[1/c,0,0,-1/d,0,0]);y=r.Util.transform(y,[1,0,0,1,0,-d]);var _=r.Util.applyTransform([0,0],y),k=r.Util.applyTransform([c,d],y),S=r.Util.normalizeRect([_[0],_[1],k[0],k[1]]),w=Math.round(S[2]-S[0])||1,P=Math.round(S[3]-S[1])||1,x=this.cachedCanvases.getCanvas("fillCanvas",w,P),A=x.context,C=Math.min(_[0],k[0]),E=Math.min(_[1],k[1]);A.translate(-C,-E),A.transform.apply(A,_toConsumableArray(y)),o||(o=(o=this._scaleImage(s.canvas,(0,a.getCurrentTransformInverse)(A))).img,t&&p&&t.set(n,o)),A.imageSmoothingEnabled=b((0,a.getCurrentTransform)(A),e.interpolate),u(A,o,0,0,o.width,o.height,0,0,c,d),A.globalCompositeOperation="source-in";var F=r.Util.transform((0,a.getCurrentTransformInverse)(A),[1,0,0,1,-C,-E]);return A.fillStyle=p?h.getPattern(l,this,F,i.PathType.FILL):h,A.fillRect(0,0,c,d),t&&!p&&(this.cachedCanvases.delete("fillCanvas"),t.set(n,x.canvas)),{canvas:x.canvas,offsetX:Math.round(C),offsetY:Math.round(E)}}},{key:"setLineWidth",value:function(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=e,this.ctx.lineWidth=e}},{key:"setLineCap",value:function(e){this.ctx.lineCap=k[e]}},{key:"setLineJoin",value:function(e){this.ctx.lineJoin=S[e]}},{key:"setMiterLimit",value:function(e){this.ctx.miterLimit=e}},{key:"setDash",value:function(e,t){var n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)}},{key:"setRenderingIntent",value:function(e){}},{key:"setFlatness",value:function(e){}},{key:"setGState",value:function(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var r=_slicedToArray(t.value,2),a=r[0],i=r[1];switch(a){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=i}}}catch(o){n.e(o)}finally{n.f()}}},{key:"inSMaskMode",get:function(){return!!this.suspendedCtx}},{key:"checkSMaskState",value:function(){var e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}},{key:"beginSMaskMode",value:function(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");var e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;var i=this.ctx;i.setTransform.apply(i,_toConsumableArray((0,a.getCurrentTransform)(this.suspendedCtx))),p(this.suspendedCtx,i),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=function(){e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,a,i,o){t.transform(e,n,r,a,i,o),this.__originalTransform(e,n,r,a,i,o)},e.setTransform=function(e,n,r,a,i,o){t.setTransform(e,n,r,a,i,o),this.__originalSetTransform(e,n,r,a,i,o)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,a,i,o){t.bezierCurveTo(e,n,r,a,i,o),this.__originalBezierCurveTo(e,n,r,a,i,o)},e.rect=function(e,n,r,a){t.rect(e,n,r,a),this.__originalRect(e,n,r,a)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(i,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}},{key:"endSMaskMode",value:function(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),p(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}},{key:"compose",value:function(e){if(this.current.activeSMask){e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];var t=this.current.activeSMask;_(this.suspendedCtx,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}}},{key:"save",value:function(){this.inSMaskMode?(p(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();var e=this.current;this.stateStack.push(e),this.current=e.clone()}},{key:"restore",value:function(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),p(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}},{key:"transform",value:function(e,t,n,r,a,i){this.ctx.transform(e,t,n,r,a,i),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}},{key:"constructPath",value:function(e,t,n){for(var i,o,s=this.ctx,l=this.current,c=l.x,u=l.y,d=(0,a.getCurrentTransform)(s),h=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],f=h?n.slice(0):null,p=0,v=0,g=e.length;p0&&void 0!==arguments[0])||arguments[0],t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"===typeof n&&null!==n&&void 0!==n&&n.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,(0,a.getCurrentTransformInverse)(t),i.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}},{key:"closeStroke",value:function(){this.closePath(),this.stroke()}},{key:"fill",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.ctx,n=this.current.fillColor,r=!1;this.current.patternFill&&(t.save(),t.fillStyle=n.getPattern(t,this,(0,a.getCurrentTransformInverse)(t),i.PathType.FILL),r=!0);var o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),r&&t.restore(),e&&this.consumePath(o)}},{key:"eoFill",value:function(){this.pendingEOFill=!0,this.fill()}},{key:"fillStroke",value:function(){this.fill(!1),this.stroke(!1),this.consumePath()}},{key:"eoFillStroke",value:function(){this.pendingEOFill=!0,this.fillStroke()}},{key:"closeFillStroke",value:function(){this.closePath(),this.fillStroke()}},{key:"closeEOFillStroke",value:function(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}},{key:"endPath",value:function(){this.consumePath()}},{key:"clip",value:function(){this.pendingClip=w}},{key:"eoClip",value:function(){this.pendingClip=P}},{key:"beginText",value:function(){this.current.textMatrix=r.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}},{key:"endText",value:function(){var e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();var n,r=_createForOfIteratorHelper(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;t.setTransform.apply(t,_toConsumableArray(a.transform)),t.translate(a.x,a.y),a.addToPath(t,a.fontSize)}}catch(i){r.e(i)}finally{r.f()}t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}},{key:"setCharSpacing",value:function(e){this.current.charSpacing=e}},{key:"setWordSpacing",value:function(e){this.current.wordSpacing=e}},{key:"setHScale",value:function(e){this.current.textHScale=e/100}},{key:"setLeading",value:function(e){this.current.leading=-e}},{key:"setFont",value:function(e,t){var n=this.commonObjs.get(e),a=this.current;if(!n)throw new Error("Can't find font for ".concat(e));if(a.fontMatrix=n.fontMatrix||r.FONT_IDENTITY_MATRIX,0!==a.fontMatrix[0]&&0!==a.fontMatrix[3]||(0,r.warn)("Invalid font matrix for font "+e),t<0?(t=-t,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=t,!n.isType3Font){var i=n.loadedName||"sans-serif",o="normal";n.black?o="900":n.bold&&(o="bold");var s=n.italic?"italic":"normal",l='"'.concat(i,'", ').concat(n.fallbackName),c=t;t<16?c=16:t>100&&(c=100),this.current.fontSizeScale=t/c,this.ctx.font="".concat(s," ").concat(o," ").concat(c,"px ").concat(l)}}},{key:"setTextRenderingMode",value:function(e){this.current.textRenderingMode=e}},{key:"setTextRise",value:function(e){this.current.textRise=e}},{key:"moveText",value:function(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}},{key:"setLeadingMoveText",value:function(e,t){this.setLeading(-t),this.moveText(e,t)}},{key:"setTextMatrix",value:function(e,t,n,r,a,i){this.current.textMatrix=[e,t,n,r,a,i],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}},{key:"nextLine",value:function(){this.moveText(0,this.current.leading)}},{key:"paintChar",value:function(e,t,n,i){var o,s=this.ctx,l=this.current,c=l.font,u=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,h=u&r.TextRenderingMode.FILL_STROKE_MASK,f=!!(u&r.TextRenderingMode.ADD_TO_PATH_FLAG),p=l.patternFill&&!c.missingFile;(c.disableFontFace||f||p)&&(o=c.getPathGenerator(this.commonObjs,e)),c.disableFontFace||p?(s.save(),s.translate(t,n),s.beginPath(),o(s,d),i&&s.setTransform.apply(s,_toConsumableArray(i)),h!==r.TextRenderingMode.FILL&&h!==r.TextRenderingMode.FILL_STROKE||s.fill(),h!==r.TextRenderingMode.STROKE&&h!==r.TextRenderingMode.FILL_STROKE||s.stroke(),s.restore()):(h!==r.TextRenderingMode.FILL&&h!==r.TextRenderingMode.FILL_STROKE||s.fillText(e,t,n),h!==r.TextRenderingMode.STROKE&&h!==r.TextRenderingMode.FILL_STROKE||s.strokeText(e,t,n)),f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,a.getCurrentTransform)(s),x:t,y:n,fontSize:d,addToPath:o})}},{key:"isFontSubpixelAAEnabled",get:function(){var e=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10).context;e.scale(1.5,1),e.fillText("I",0,10);for(var t=e.getImageData(0,0,10,10).data,n=!1,a=3;a0&&t[a]<255){n=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",n)}},{key:"showText",value:function(e){var t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);var o=t.fontSize;if(0!==o){var s,l=this.ctx,c=t.fontSizeScale,u=t.charSpacing,d=t.wordSpacing,h=t.fontDirection,f=t.textHScale*h,p=e.length,v=n.vertical,g=v?1:-1,m=n.defaultVMetrics,y=o*t.fontMatrix[0],_=t.textRenderingMode===r.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;if(l.save(),l.transform.apply(l,_toConsumableArray(t.textMatrix)),l.translate(t.x,t.y+t.textRise),h>0?l.scale(f,-1):l.scale(f,1),t.patternFill){l.save();var b=t.fillColor.getPattern(l,this,(0,a.getCurrentTransformInverse)(l),i.PathType.FILL);s=(0,a.getCurrentTransform)(l),l.restore(),l.fillStyle=b}var k=t.lineWidth,S=t.textMatrixScale;if(0===S||0===k){var w=t.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;w!==r.TextRenderingMode.STROKE&&w!==r.TextRenderingMode.FILL_STROKE||(k=this.getSinglePixelWidth())}else k/=S;if(1!==c&&(l.scale(c,c),k/=c),l.lineWidth=k,n.isInvalidPDFjsFont){var P,x=[],A=0,C=_createForOfIteratorHelper(e);try{for(C.s();!(P=C.n()).done;){var E=P.value;x.push(E.unicode),A+=E.width}}catch(V){C.e(V)}finally{C.f()}return l.fillText(x.join(""),0,0),t.x+=A*y*f,l.restore(),void this.compose()}var F,T=0;for(F=0;F0){var H=1e3*l.measureText(O).width/o*c;if(G1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(e)?t=this.cachedPatterns.get(e):(t=(0,i.getShadingPattern)(this.objs.get(e)),this.cachedPatterns.set(e,t)),n&&(t.matrix=n),t}},{key:"shadingFill",value:function(e){if(this.contentVisible){var t=this.ctx;this.save();var n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,(0,a.getCurrentTransformInverse)(t),i.PathType.SHADING);var o=(0,a.getCurrentTransformInverse)(t);if(o){var s=t.canvas,l=s.width,c=s.height,u=r.Util.applyTransform([0,0],o),d=r.Util.applyTransform([0,c],o),h=r.Util.applyTransform([l,0],o),f=r.Util.applyTransform([l,c],o),p=Math.min(u[0],d[0],h[0],f[0]),v=Math.min(u[1],d[1],h[1],f[1]),g=Math.max(u[0],d[0],h[0],f[0]),m=Math.max(u[1],d[1],h[1],f[1]);this.ctx.fillRect(p,v,g-p,m-v)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}}},{key:"beginInlineImage",value:function(){(0,r.unreachable)("Should not call beginInlineImage")}},{key:"beginImageData",value:function(){(0,r.unreachable)("Should not call beginImageData")}},{key:"paintFormXObjectBegin",value:function(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform.apply(this,_toConsumableArray(e)),this.baseTransform=(0,a.getCurrentTransform)(this.ctx),t)){var n=t[2]-t[0],r=t[3]-t[1];this.ctx.rect(t[0],t[1],n,r),this.current.updateRectMinMax((0,a.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}},{key:"paintFormXObjectEnd",value:function(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}},{key:"beginGroup",value:function(e){if(this.contentVisible){this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);var t=this.ctx;e.isolated||(0,r.info)("TODO: Support non-isolated groups."),e.knockout&&(0,r.warn)("Knockout groups not supported.");var n=(0,a.getCurrentTransform)(t);if(e.matrix&&t.transform.apply(t,_toConsumableArray(e.matrix)),!e.bbox)throw new Error("Bounding box is required.");var i=r.Util.getAxialAlignedBoundingBox(e.bbox,(0,a.getCurrentTransform)(t)),o=[0,0,t.canvas.width,t.canvas.height];i=r.Util.intersect(i,o)||[0,0,0,0];var l=Math.floor(i[0]),c=Math.floor(i[1]),u=Math.max(Math.ceil(i[2])-l,1),d=Math.max(Math.ceil(i[3])-c,1),h=1,f=1;u>s&&(h=u/s,u=s),d>s&&(f=d/s,d=s),this.current.startNewPathAndClipBox([0,0,u,d]);var v="groupAt"+this.groupLevel;e.smask&&(v+="_smask_"+this.smaskCounter++%2);var g=this.cachedCanvases.getCanvas(v,u,d),m=g.context;m.scale(1/h,1/f),m.translate(-l,-c),m.transform.apply(m,_toConsumableArray(n)),e.smask?this.smaskStack.push({canvas:g.canvas,context:m,offsetX:l,offsetY:c,scaleX:h,scaleY:f,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(l,c),t.scale(h,f),t.save()),p(t,m),this.ctx=m,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}}},{key:"endGroup",value:function(e){if(this.contentVisible){this.groupLevel--;var t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{var i;this.ctx.restore();var o=(0,a.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),(i=this.ctx).setTransform.apply(i,_toConsumableArray(o));var s=r.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],o);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(s)}}}},{key:"beginAnnotation",value:function(e,t,n,i,o){var s;if(_classPrivateMethodGet(this,x,C).call(this),v(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&(s=this.ctx).setTransform.apply(s,_toConsumableArray(this.baseTransform)),Array.isArray(t)&&4===t.length){var l=t[2]-t[0],c=t[3]-t[1];if(o&&this.annotationCanvasMap){(n=n.slice())[4]-=t[0],n[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=l,t[3]=c;var u=r.Util.singularValueDecompose2dScale((0,a.getCurrentTransform)(this.ctx)),h=_slicedToArray(u,2),f=h[0],p=h[1],g=this.viewportScale,m=Math.ceil(l*this.outputScaleX*g),y=Math.ceil(c*this.outputScaleY*g);this.annotationCanvas=this.canvasFactory.create(m,y);var _=this.annotationCanvas,b=_.canvas,k=_.context;this.annotationCanvasMap.set(e,b),this.annotationCanvas.savedCtx=this.ctx,this.ctx=k,this.ctx.setTransform(f,0,0,-p,0,c*p),v(this.ctx,this.foregroundColor)}else v(this.ctx,this.foregroundColor),this.ctx.rect(t[0],t[1],l,c),this.ctx.clip(),this.endPath()}this.current=new d(this.ctx.canvas.width,this.ctx.canvas.height),this.transform.apply(this,_toConsumableArray(n)),this.transform.apply(this,_toConsumableArray(i))}},{key:"endAnnotation",value:function(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}},{key:"paintImageMaskXObject",value:function(e){if(this.contentVisible){var t=e.count;(e=this.getObject(e.data,e)).count=t;var n=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(e){var t=e.width,n=e.height;if(t>1e3||n>1e3)return null;var r,a,i,o,s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=t+1,c=new Uint8Array(l*(n+1)),u=t+7&-8,d=new Uint8Array(u*n),h=0,f=_createForOfIteratorHelper(e.data);try{for(f.s();!(o=f.n()).done;)for(var p=o.value,v=128;v>0;)d[h++]=p&v?0:255,v>>=1}catch(A){f.e(A)}finally{f.f()}var g=0;for(0!==d[h=0]&&(c[0]=1,++g),a=1;a>2)+(d[h+1]?4:0)+(d[h-u+1]?8:0)]&&(c[i+a]=s[m],++g),h++;if(d[h-u]!==d[h]&&(c[i+a]=d[h]?2:4,++g),g>1e3)return null}for(i=r*l,0!==d[h=u*(n-1)]&&(c[i]=8,++g),a=1;a1e3)return null;var y=new Int32Array([0,l,-1,0,-l,0,0,0,1]),_=new Path2D;for(r=0;g&&r<=n;r++){for(var b=r*l,k=b+t;b>4,c[b]&=w>>2|w<<2),_.lineTo(b%l,b/l|0),c[b]||--g}while(S!==b);--r}}return d=null,c=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(_),e.beginPath(),e.restore()}}(e)),r.compiled))r.compiled(n);else{var a=this._createMaskCanvas(e),i=a.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(i,a.offsetX,a.offsetY),n.restore(),this.compose()}}}},{key:"paintImageMaskXObjectRepeat",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0;if(this.contentVisible){e=this.getObject(e.data,e);var l=this.ctx;l.save();var c=(0,a.getCurrentTransform)(l);l.transform(t,n,i,o,0,0);var u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]);for(var d=0,h=s.length;dh?d/h:1,t=u>h?u/h:1}}this._cachedScaleForStroking=[e,t]}return this._cachedScaleForStroking}},{key:"rescaleAndStroke",value:function(e){var t=this.ctx,n=this.current.lineWidth,r=this.getScaleForStroking(),i=_slicedToArray(r,2),o=i[0],s=i[1];if(t.lineWidth=n||1,1!==o||1!==s){var l,c,u;e&&(l=(0,a.getCurrentTransform)(t),c=t.getLineDash().slice(),u=t.lineDashOffset),t.scale(o,s);var d=Math.max(o,s);t.setLineDash(t.getLineDash().map((function(e){return e/d}))),t.lineDashOffset/=d,t.stroke(),e&&(t.setTransform.apply(t,_toConsumableArray(l)),t.setLineDash(c),t.lineDashOffset=u)}else t.stroke()}},{key:"isContentVisible",value:function(){for(var e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}]),e}();function C(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}for(var E in t.CanvasGraphics=A,r.OPS)void 0!==A.prototype[E]&&(A.prototype[r.OPS[E]]=A.prototype[E])},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new l(e);case"Mesh":return new d(e);case"Dummy":return new h}throw new Error("Unknown IR type: ".concat(e[0]))};var r=n(1),a=n(6),i={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function o(e,t){if(t){var n=t[2]-t[0],r=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],n,r),e.clip(a)}}t.PathType=i;var s=function(){function e(){_classCallCheck(this,e),this.constructor===e&&(0,r.unreachable)("Cannot initialize BaseShadingPattern.")}return _createClass(e,[{key:"getPattern",value:function(){(0,r.unreachable)("Abstract method `getPattern` called.")}}]),e}(),l=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;return _classCallCheck(this,n),(r=t.call(this))._type=e[1],r._bbox=e[2],r._colorStops=e[3],r._p0=e[4],r._p1=e[5],r._r0=e[6],r._r1=e[7],r.matrix=null,r}return _createClass(n,[{key:"_createGradient",value:function(e){var t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));var n,r=_createForOfIteratorHelper(this._colorStops);try{for(r.s();!(n=r.n()).done;){var a=n.value;t.addColorStop(a[0],a[1])}}catch(i){r.e(i)}finally{r.f()}return t}},{key:"getPattern",value:function(e,t,n,s){var l;if(s===i.STROKE||s===i.FILL){var c=t.current.getClippedPathBoundingBox(s,(0,a.getCurrentTransform)(e))||[0,0,0,0],u=Math.ceil(c[2]-c[0])||1,d=Math.ceil(c[3]-c[1])||1,h=t.cachedCanvases.getCanvas("pattern",u,d,!0),f=h.context;f.clearRect(0,0,f.canvas.width,f.canvas.height),f.beginPath(),f.rect(0,0,f.canvas.width,f.canvas.height),f.translate(-c[0],-c[1]),n=r.Util.transform(n,[1,0,0,1,c[0],c[1]]),f.transform.apply(f,_toConsumableArray(t.baseTransform)),this.matrix&&f.transform.apply(f,_toConsumableArray(this.matrix)),o(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),l=e.createPattern(h.canvas,"no-repeat");var p=new DOMMatrix(n);l.setTransform(p)}else o(e,this._bbox),l=this._createGradient(e);return l}}]),n}(s);function c(e,t,n,r,a,i,o,s){var l,c=t.coords,u=t.colors,d=e.data,h=4*e.width;c[n+1]>c[r+1]&&(l=n,n=r,r=l,l=i,i=o,o=l),c[r+1]>c[a+1]&&(l=r,r=a,a=l,l=o,o=s,s=l),c[n+1]>c[r+1]&&(l=n,n=r,r=l,l=i,i=o,o=l);var f=(c[n]+t.offsetX)*t.scaleX,p=(c[n+1]+t.offsetY)*t.scaleY,v=(c[r]+t.offsetX)*t.scaleX,g=(c[r+1]+t.offsetY)*t.scaleY,m=(c[a]+t.offsetX)*t.scaleX,y=(c[a+1]+t.offsetY)*t.scaleY;if(!(p>=y))for(var _,b,k,S,w,P,x,A,C=u[i],E=u[i+1],F=u[i+2],T=u[o],M=u[o+1],R=u[o+2],I=u[s],O=u[s+1],L=u[s+2],D=Math.round(p),N=Math.round(y),G=D;G<=N;G++){if(Gy?1:g===y?0:(g-G)/(g-y)),b=T-(T-I)*z,k=M-(M-O)*z,S=R-(R-L)*z}var B=void 0;w=f-(f-m)*(B=Gy?1:(p-G)/(p-y)),P=C-(C-I)*B,x=E-(E-O)*B,A=F-(F-L)*B;for(var H=Math.round(Math.min(_,w)),U=Math.round(Math.max(_,w)),W=h*G+4*H,q=H;q<=U;q++)(B=(_-q)/(_-w))<0?B=0:B>1&&(B=1),d[W++]=b-(b-P)*B|0,d[W++]=k-(k-x)*B|0,d[W++]=S-(S-A)*B|0,d[W++]=255}}function u(e,t,n){var r,a,i=t.coords,o=t.colors;switch(t.type){case"lattice":var s=t.verticesPerRow,l=Math.floor(i.length/s)-1,u=s-1;for(r=0;r=a?i=a:r=i/t,{scale:r,size:i}}},{key:"clipBbox",value:function(e,t,n,r,i){var o=r-t,s=i-n;e.ctx.rect(t,n,o,s),e.current.updateRectMinMax((0,a.getCurrentTransform)(e.ctx),[t,n,r,i]),e.clip(),e.endPath()}},{key:"setFillAndStrokeStyleToContext",value:function(e,t,n){var a=e.ctx,i=e.current;switch(t){case f:var o=this.ctx;a.fillStyle=o.fillStyle,a.strokeStyle=o.strokeStyle,i.fillColor=o.fillStyle,i.strokeColor=o.strokeStyle;break;case p:var s=r.Util.makeHexColor(n[0],n[1],n[2]);a.fillStyle=s,a.strokeStyle=s,i.fillColor=s,i.strokeColor=s;break;default:throw new r.FormatError("Unsupported paint type: ".concat(t))}}},{key:"getPattern",value:function(e,t,n,a){var o=n;a!==i.SHADING&&(o=r.Util.transform(o,t.baseTransform),this.matrix&&(o=r.Util.transform(o,this.matrix)));var s=this.createPatternCanvas(t),l=new DOMMatrix(o);l=(l=l.translate(s.offsetX,s.offsetY)).scale(1/s.scaleX,1/s.scaleY);var c=e.createPattern(s.canvas,"repeat");return c.setTransform(l),c}}],[{key:"MAX_PATTERN_SIZE",get:function(){return(0,r.shadow)(this,"MAX_PATTERN_SIZE",3e3)}}]),e}();t.TilingPattern=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.applyMaskImageData=function(e){var t=e.src,n=e.srcPos,a=void 0===n?0:n,i=e.dest,o=e.destPos,s=void 0===o?0:o,l=e.width,c=e.height,u=e.inverseDecode,d=void 0!==u&&u,h=r.FeatureTest.isLittleEndian?4278190080:255,f=_slicedToArray(d?[0,h]:[h,0],2),p=f[0],v=f[1],g=l>>3,m=7&l,y=t.length;i=new Uint32Array(i.buffer);for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:1,s=arguments.length>2?arguments[2]:void 0;if(!this.isCancelled){var l=this.desiredSize;this.desiredSize-=o,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,r.createPromiseCapability)(),this.ready=this.sinkCapability.promise),i.postMessage({sourceName:n,targetName:a,stream:c,streamId:t,chunk:e},s)}},close:function(){this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:a,stream:l,streamId:t}),delete o.streamSinks[t])},error:function(e){(0,r.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,i.postMessage({sourceName:n,targetName:a,stream:u,streamId:t,reason:p(e)}))},sinkCapability:(0,r.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(s(e.data,d))})).then((function(){i.postMessage({sourceName:n,targetName:a,stream:f,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:n,targetName:a,stream:f,streamId:t,reason:p(e)})}))}},{key:"_processStreamMessage",value:function(e){var t=e.streamId,n=this.sourceName,a=e.sourceName,i=this.comObj,v=this.streamControllers[t],g=this.streamSinks[t];switch(e.stream){case f:e.success?v.startCall.resolve():v.startCall.reject(p(e.reason));break;case h:e.success?v.pullCall.resolve():v.pullCall.reject(p(e.reason));break;case d:if(!g){i.postMessage({sourceName:n,targetName:a,stream:h,streamId:t,success:!0});break}g.desiredSize<=0&&e.desiredSize>0&&g.sinkCapability.resolve(),g.desiredSize=e.desiredSize,new Promise((function(e){e(g.onPull&&g.onPull())})).then((function(){i.postMessage({sourceName:n,targetName:a,stream:h,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:n,targetName:a,stream:h,streamId:t,reason:p(e)})}));break;case c:if((0,r.assert)(v,"enqueue should have stream controller"),v.isClosed)break;v.controller.enqueue(e.chunk);break;case l:if((0,r.assert)(v,"close should have stream controller"),v.isClosed)break;v.isClosed=!0,v.controller.close(),this._deleteStreamController(v,t);break;case u:(0,r.assert)(v,"error should have stream controller"),v.controller.error(p(e.reason)),this._deleteStreamController(v,t);break;case s:e.success?v.cancelCall.resolve():v.cancelCall.reject(p(e.reason)),this._deleteStreamController(v,t);break;case o:if(!g)break;new Promise((function(t){t(g.onCancel&&g.onCancel(p(e.reason)))})).then((function(){i.postMessage({sourceName:n,targetName:a,stream:s,streamId:t,success:!0})}),(function(e){i.postMessage({sourceName:n,targetName:a,stream:s,streamId:t,reason:p(e)})})),g.sinkCapability.reject(p(e.reason)),g.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}},{key:"_deleteStreamController",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.allSettled([t.startCall&&t.startCall.promise,t.pullCall&&t.pullCall.promise,t.cancelCall&&t.cancelCall.promise]);case 2:delete this.streamControllers[n];case 3:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}()},{key:"destroy",value:function(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}]),e}();t.MessageHandler=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(1),a=new WeakMap,i=new WeakMap,o=function(){function e(t){var n=t.parsedData,r=t.rawData;_classCallCheck(this,e),_classPrivateFieldInitSpec(this,a,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,i,{writable:!0,value:void 0}),_classPrivateFieldSet(this,a,n),_classPrivateFieldSet(this,i,r)}return _createClass(e,[{key:"getRaw",value:function(){return _classPrivateFieldGet(this,i)}},{key:"get",value:function(e){var t;return null!==(t=_classPrivateFieldGet(this,a).get(e))&&void 0!==t?t:null}},{key:"getAll",value:function(){return(0,r.objectFromMap)(_classPrivateFieldGet(this,a))}},{key:"has",value:function(e){return _classPrivateFieldGet(this,a).has(e)}}]),e}();t.Metadata=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=n(1),a=n(8),i=Symbol("INTERNAL"),o=new WeakMap,s=function(){function e(t,n){_classCallCheck(this,e),_classPrivateFieldInitSpec(this,o,{writable:!0,value:!0}),this.name=t,this.intent=n}return _createClass(e,[{key:"visible",get:function(){return _classPrivateFieldGet(this,o)}},{key:"_setVisible",value:function(e,t){e!==i&&(0,r.unreachable)("Internal method `_setVisible` called."),_classPrivateFieldSet(this,o,t)}}]),e}(),l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakSet,f=function(){function e(t){if(_classCallCheck(this,e),_classPrivateMethodInitSpec(this,h),_classPrivateFieldInitSpec(this,l,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,c,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,u,{writable:!0,value:null}),_classPrivateFieldInitSpec(this,d,{writable:!0,value:null}),this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,_classPrivateFieldSet(this,d,t.order);var n,r=_createForOfIteratorHelper(t.groups);try{for(r.s();!(n=r.n()).done;){var a=n.value;_classPrivateFieldGet(this,c).set(a.id,new s(a.name,a.intent))}}catch(b){r.e(b)}finally{r.f()}if("OFF"===t.baseState){var o,f=_createForOfIteratorHelper(_classPrivateFieldGet(this,c).values());try{for(f.s();!(o=f.n()).done;)o.value._setVisible(i,!1)}catch(b){f.e(b)}finally{f.f()}}var p,v=_createForOfIteratorHelper(t.on);try{for(v.s();!(p=v.n()).done;){var g=p.value;_classPrivateFieldGet(this,c).get(g)._setVisible(i,!0)}}catch(b){v.e(b)}finally{v.f()}var m,y=_createForOfIteratorHelper(t.off);try{for(y.s();!(m=y.n()).done;){var _=m.value;_classPrivateFieldGet(this,c).get(_)._setVisible(i,!1)}}catch(b){y.e(b)}finally{y.f()}_classPrivateFieldSet(this,u,this.getHash())}}return _createClass(e,[{key:"isVisible",value:function(e){if(0===_classPrivateFieldGet(this,c).size)return!0;if(!e)return(0,r.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return _classPrivateFieldGet(this,c).has(e.id)?_classPrivateFieldGet(this,c).get(e.id).visible:((0,r.warn)("Optional content group not found: ".concat(e.id)),!0);if("OCMD"===e.type){if(e.expression)return _classPrivateMethodGet(this,h,p).call(this,e.expression);if(!e.policy||"AnyOn"===e.policy){var t,n=_createForOfIteratorHelper(e.ids);try{for(n.s();!(t=n.n()).done;){var a=t.value;if(!_classPrivateFieldGet(this,c).has(a))return(0,r.warn)("Optional content group not found: ".concat(a)),!0;if(_classPrivateFieldGet(this,c).get(a).visible)return!0}}catch(m){n.e(m)}finally{n.f()}return!1}if("AllOn"===e.policy){var i,o=_createForOfIteratorHelper(e.ids);try{for(o.s();!(i=o.n()).done;){var s=i.value;if(!_classPrivateFieldGet(this,c).has(s))return(0,r.warn)("Optional content group not found: ".concat(s)),!0;if(!_classPrivateFieldGet(this,c).get(s).visible)return!1}}catch(m){o.e(m)}finally{o.f()}return!0}if("AnyOff"===e.policy){var l,u=_createForOfIteratorHelper(e.ids);try{for(u.s();!(l=u.n()).done;){var d=l.value;if(!_classPrivateFieldGet(this,c).has(d))return(0,r.warn)("Optional content group not found: ".concat(d)),!0;if(!_classPrivateFieldGet(this,c).get(d).visible)return!0}}catch(m){u.e(m)}finally{u.f()}return!1}if("AllOff"===e.policy){var f,v=_createForOfIteratorHelper(e.ids);try{for(v.s();!(f=v.n()).done;){var g=f.value;if(!_classPrivateFieldGet(this,c).has(g))return(0,r.warn)("Optional content group not found: ".concat(g)),!0;if(_classPrivateFieldGet(this,c).get(g).visible)return!1}}catch(m){v.e(m)}finally{v.f()}return!0}return(0,r.warn)("Unknown optional content policy ".concat(e.policy,".")),!0}return(0,r.warn)("Unknown group type ".concat(e.type,".")),!0}},{key:"setVisibility",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];_classPrivateFieldGet(this,c).has(e)?(_classPrivateFieldGet(this,c).get(e)._setVisible(i,!!t),_classPrivateFieldSet(this,l,null)):(0,r.warn)("Optional content group not found: ".concat(e))}},{key:"hasInitialVisibility",get:function(){return this.getHash()===_classPrivateFieldGet(this,u)}},{key:"getOrder",value:function(){return _classPrivateFieldGet(this,c).size?_classPrivateFieldGet(this,d)?_classPrivateFieldGet(this,d).slice():_toConsumableArray(_classPrivateFieldGet(this,c).keys()):null}},{key:"getGroups",value:function(){return _classPrivateFieldGet(this,c).size>0?(0,r.objectFromMap)(_classPrivateFieldGet(this,c)):null}},{key:"getGroup",value:function(e){return _classPrivateFieldGet(this,c).get(e)||null}},{key:"getHash",value:function(){if(null!==_classPrivateFieldGet(this,l))return _classPrivateFieldGet(this,l);var e,t=new a.MurmurHash3_64,n=_createForOfIteratorHelper(_classPrivateFieldGet(this,c));try{for(n.s();!(e=n.n()).done;){var r=_slicedToArray(e.value,2),i=r[0],o=r[1];t.update("".concat(i,":").concat(o.visible))}}catch(s){n.e(s)}finally{n.f()}return _classPrivateFieldSet(this,l,t.hexdigest())}}]),e}();function p(e){var t=e.length;if(t<2)return!0;for(var n=e[0],a=1;a0){var v=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;this._queuedChunks.push(v)}this._pdfDataRangeTransport=n,this._isStreamingSupported=!p,this._isRangeSupported=!h,this._contentLength=i,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((function(e,t){a._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener((function(e,t){a._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((function(e){a._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((function(){a._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}return _createClass(e,[{key:"_onReceiveData",value:function(e){var t=e.begin,n=e.chunk,a=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{var i=this._rangeReaders.some((function(e){return e._begin===t&&(e._enqueue(a),!0)}));(0,r.assert)(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}},{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"_onProgress",value:function(e){var t,n,r,a;void 0===e.total?null===(t=this._rangeReaders[0])||void 0===t||null===(n=t.onProgress)||void 0===n||n.call(t,{loaded:e.loaded}):null===(r=this._fullRequestReader)||void 0===r||null===(a=r.onProgress)||void 0===a||a.call(r,{loaded:e.loaded,total:e.total})}},{key:"_onProgressiveDone",value:function(){var e;null===(e=this._fullRequestReader)||void 0===e||e.progressiveDone(),this._progressiveDone=!0}},{key:"_removeRangeReader",value:function(e){var t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}},{key:"getFullReader",value:function(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");var e=this._queuedChunks;return this._queuedChunks=null,new o(this,e,this._progressiveDone,this._contentDispositionFilename)}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var n=new s(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var n,r=_createForOfIteratorHelper(this._rangeReaders.slice(0));try{for(r.s();!(n=r.n()).done;)n.value.cancel(e)}catch(a){r.e(a)}finally{r.f()}this._pdfDataRangeTransport.abort()}}]),e}();t.PDFDataTransportStream=i;var o=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;_classCallCheck(this,e),this._stream=t,this._done=r||!1,this._filename=(0,a.isPdfFile)(i)?i:null,this._queuedChunks=n||[],this._loaded=0;var o,s=_createForOfIteratorHelper(this._queuedChunks);try{for(s.s();!(o=s.n()).done;){var l=o.value;this._loaded+=l.byteLength}}catch(c){s.e(c)}finally{s.f()}this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}return _createClass(e,[{key:"_enqueue",value:function(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}},{key:"headersReady",get:function(){return this._headersReady}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._stream._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._stream._isStreamingSupported}},{key:"contentLength",get:function(){return this._stream._contentLength}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._queuedChunks.length>0)){e.next=3;break}return t=this._queuedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 3:if(!this._done){e.next=5;break}return e.abrupt("return",{value:void 0,done:!0});case 5:return n=(0,r.createPromiseCapability)(),this._requests.push(n),e.abrupt("return",n.promise);case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0}},{key:"progressiveDone",value:function(){this._done||(this._done=!0)}}]),e}(),s=function(){function e(t,n,r){_classCallCheck(this,e),this._stream=t,this._begin=n,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}return _createClass(e,[{key:"_enqueue",value:function(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._queuedChunk){e.next=4;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 4:if(!this._done){e.next=6;break}return e.abrupt("return",{value:void 0,done:!0});case 6:return n=(0,r.createPromiseCapability)(),this._requests.push(n),e.abrupt("return",n.promise);case 9:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0,this._stream._removeRangeReader(this)}}]),e}()},function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;var n=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"textContent",value:function(t){var n=[],r={items:n,styles:Object.create(null)};return function t(r){var a;if(r){var i=null,o=r.name;if("#text"===o)i=r.value;else{if(!e.shouldBuildText(o))return;null!==r&&void 0!==r&&null!==(a=r.attributes)&&void 0!==a&&a.textContent?i=r.attributes.textContent:r.value&&(i=r.value)}if(null!==i&&n.push({str:i}),r.children){var s,l=_createForOfIteratorHelper(r.children);try{for(l.s();!(s=l.n()).done;)t(s.value)}catch(c){l.e(c)}finally{l.f()}}}}(t),r}},{key:"shouldBuildText",value:function(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}]),e}();t.XfaText=n},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=n(7),a=function(e){return new Promise((function(t,n){__webpack_require__(172).readFile(e,(function(e,r){!e&&r?t(new Uint8Array(r)):n(new Error(e))}))}))},i=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_createCanvas",value:function(e,t){return __webpack_require__(3414).createCanvas(e,t)}}]),n}(r.BaseCanvasFactory);t.NodeCanvasFactory=i;var o=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_fetchData",value:function(e,t){return a(e).then((function(e){return{cMapData:e,compressionType:t}}))}}]),n}(r.BaseCMapReaderFactory);t.NodeCMapReaderFactory=o;var s=function(e){_inherits(n,e);var t=_createSuper(n);function n(){return _classCallCheck(this,n),t.apply(this,arguments)}return _createClass(n,[{key:"_fetchData",value:function(e){return a(e)}}]),n}(r.BaseStandardFontDataFactory);t.NodeStandardFontDataFactory=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=n(1),a=n(22),i=__webpack_require__(172),o=__webpack_require__(2001),s=__webpack_require__(3779),l=__webpack_require__(6558),c=/^file:\/\/\/[a-zA-Z]:\//,u=function(){function e(t){_classCallCheck(this,e),this.source=t,this.url=function(e){var t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\]/i.test(e)?l.parse("file:///".concat(e)):(t.host||(t.protocol="file:"),t)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new g(this):new p(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var n=this.isFsUrl?new m(this,e,t):new v(this,e,t);return this._rangeRequestReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var n,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(n=r.n()).done;)n.value.cancel(e)}catch(a){r.e(a)}finally{r.f()}}}]),e}();t.PDFNodeStream=u;var d=function(){function e(t){_classCallCheck(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;var n=t.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)(),this._headersCapability=(0,r.createPromiseCapability)()}return _createClass(e,[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(n=this._readableStream.read())){e.next=10;break}return this._readCapability=(0,r.createPromiseCapability)(),e.abrupt("return",this.read());case 10:return this._loaded+=n.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),a=new Uint8Array(n).buffer,e.abrupt("return",{value:a,done:!1});case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",(function(){t._readCapability.resolve()})),e.on("end",(function(){e.destroy(),t._done=!0,t._readCapability.resolve()})),e.on("error",(function(e){t._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}]),e}(),h=function(){function e(t){_classCallCheck(this,e),this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)();var n=t.source;this._isStreamingSupported=!n.disableStream}return _createClass(e,[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:if(!this._done){e.next=4;break}return e.abrupt("return",{value:void 0,done:!0});case 4:if(!this._storedError){e.next=6;break}throw this._storedError;case 6:if(null!==(n=this._readableStream.read())){e.next=10;break}return this._readCapability=(0,r.createPromiseCapability)(),e.abrupt("return",this.read());case 10:return this._loaded+=n.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),a=new Uint8Array(n).buffer,e.abrupt("return",{value:a,done:!1});case 14:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}},{key:"_error",value:function(e){this._storedError=e,this._readCapability.resolve()}},{key:"_setReadableStream",value:function(e){var t=this;this._readableStream=e,e.on("readable",(function(){t._readCapability.resolve()})),e.on("end",(function(){e.destroy(),t._done=!0,t._readCapability.resolve()})),e.on("error",(function(e){t._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}]),e}();function f(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}var p=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var i;_classCallCheck(this,n);var l=function(t){if(404===t.statusCode){var n=new r.MissingPDFException('Missing PDF "'.concat(i._url,'".'));return i._storedError=n,void i._headersCapability.reject(n)}i._headersCapability.resolve(),i._setReadableStream(t);var o=function(e){return i._readableStream.headers[e.toLowerCase()]},s=(0,a.validateRangeRequestCapabilities)({getResponseHeader:o,isHttp:e.isHttp,rangeChunkSize:i._rangeChunkSize,disableRange:i._disableRange}),l=s.allowRangeRequests,c=s.suggestedLength;i._isRangeSupported=l,i._contentLength=c||i._contentLength,i._filename=(0,a.extractFilenameFromHeader)(o)};return(i=t.call(this,e))._request=null,"http:"===i._url.protocol?i._request=o.request(f(i._url,e.httpHeaders),l):i._request=s.request(f(i._url,e.httpHeaders),l),i._request.on("error",(function(e){i._storedError=e,i._headersCapability.reject(e)})),i._request.end(),i}return _createClass(n)}(d),v=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,a,i){var l;for(var c in _classCallCheck(this,n),(l=t.call(this,e))._httpHeaders={},e.httpHeaders){var u=e.httpHeaders[c];void 0!==u&&(l._httpHeaders[c]=u)}l._httpHeaders.Range="bytes=".concat(a,"-").concat(i-1);var d=function(e){if(404!==e.statusCode)l._setReadableStream(e);else{var t=new r.MissingPDFException('Missing PDF "'.concat(l._url,'".'));l._storedError=t}};return l._request=null,"http:"===l._url.protocol?l._request=o.request(f(l._url,l._httpHeaders),d):l._request=s.request(f(l._url,l._httpHeaders),d),l._request.on("error",(function(e){l._storedError=e})),l._request.end(),l}return _createClass(n)}(h),g=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var a;_classCallCheck(this,n),a=t.call(this,e);var o=decodeURIComponent(a._url.path);return c.test(a._url.href)&&(o=o.replace(/^\//,"")),i.lstat(o,(function(e,t){if(e)return"ENOENT"===e.code&&(e=new r.MissingPDFException('Missing PDF "'.concat(o,'".'))),a._storedError=e,void a._headersCapability.reject(e);a._contentLength=t.size,a._setReadableStream(i.createReadStream(o)),a._headersCapability.resolve()})),a}return _createClass(n)}(d),m=function(e){_inherits(n,e);var t=_createSuper(n);function n(e,r,a){var o;_classCallCheck(this,n),o=t.call(this,e);var s=decodeURIComponent(o._url.path);return c.test(o._url.href)&&(s=s.replace(/^\//,"")),o._setReadableStream(i.createReadStream(s,{start:r,end:a-1})),o}return _createClass(n)}(h)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException("Unexpected server response (".concat(e,') while retrieving PDF "').concat(t,'".'),e)},t.extractFilenameFromHeader=function(e){var t=e("Content-Disposition");if(t){var n=(0,a.getFilenameFromContentDispositionHeader)(t);if(n.includes("%"))try{n=decodeURIComponent(n)}catch(r){}if((0,i.isPdfFile)(n))return n}return null},t.validateRangeRequestCapabilities=function(e){var t=e.getResponseHeader,n=e.isHttp,r=e.rangeChunkSize,a=e.disableRange,i={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(t("Content-Length"),10);return Number.isInteger(o)?(i.suggestedLength=o,o<=2*r||a||!n||"bytes"!==t("Accept-Ranges")||"identity"!==(t("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i):i},t.validateResponseStatus=function(e){return 200===e||206===e};var r=n(1),a=n(23),i=n(6)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){var t=!0,n=o("filename\\*","i").exec(e);if(n){var a=c(n=n[1]);return l(a=d(a=u(a=unescape(a))))}if(n=function(e){for(var t,n=[],r=o("filename\\*((?!0\\d)\\d+)(\\*?)","ig");null!==(t=r.exec(e));){var a=_slicedToArray(t,4),i=a[1],s=a[2],l=a[3];if((i=parseInt(i,10))in n){if(0===i)break}else n[i]=[s,l]}for(var d=[],h=0;h1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,e),this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&n.httpHeaders||Object.create(null),this.withCredentials=n.withCredentials||!1,this.getXhr=n.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}return _createClass(e,[{key:"requestRange",value:function(e,t,n){var r={begin:e,end:t};for(var a in n)r[a]=n[a];return this.request(r)}},{key:"requestFull",value:function(e){return this.request(e)}},{key:"request",value:function(e){var t=this.getXhr(),n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};for(var a in t.open("GET",this.url),t.withCredentials=this.withCredentials,this.httpHeaders){var i=this.httpHeaders[a];void 0!==i&&t.setRequestHeader(a,i)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range","bytes=".concat(e.begin,"-").concat(e.end-1)),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}},{key:"onProgress",value:function(e,t){var n,r=this.pendingRequests[e];r&&(null===(n=r.onProgress)||void 0===n||n.call(r,t))}},{key:"onStateChange",value:function(e,t){var n=this.pendingRequests[e];if(n){var a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4===a.readyState&&e in this.pendingRequests)if(delete this.pendingRequests[e],0===a.status&&this.isHttp){var i;null===(i=n.onError)||void 0===i||i.call(n,a.status)}else{var o=a.status||200;if(200===o&&206===n.expectedStatus||o===n.expectedStatus){var s=function(e){var t=e.response;return"string"!==typeof t?t:(0,r.stringToBytes)(t).buffer}(a);if(206===o){var l=a.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);n.onDone({begin:parseInt(c[1],10),chunk:s})}else if(s)n.onDone({begin:0,chunk:s});else{var u;null===(u=n.onError)||void 0===u||u.call(n,a.status)}}else{var d;null===(d=n.onError)||void 0===d||d.call(n,a.status)}}}}},{key:"getRequestXhr",value:function(e){return this.pendingRequests[e].xhr}},{key:"isPendingRequest",value:function(e){return e in this.pendingRequests}},{key:"abortRequest",value:function(e){var t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}]),e}(),o=function(){function e(t){_classCallCheck(this,e),this._source=t,this._manager=new i(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_onRangeRequestReaderClosed",value:function(e){var t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new s(this._manager,this._source),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){var n=new l(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var n,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(n=r.n()).done;)n.value.cancel(e)}catch(a){r.e(a)}finally{r.f()}}}]),e}();t.PDFNetworkStream=o;var s=function(){function e(t,n){_classCallCheck(this,e),this._manager=t;var a={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=n.url,this._fullRequestId=t.requestFull(a),this._headersReceivedCapability=(0,r.createPromiseCapability)(),this._disableRange=n.disableRange||!1,this._contentLength=n.length,this._rangeChunkSize=n.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}return _createClass(e,[{key:"_onHeadersReceived",value:function(){var e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=function(e){return t.getResponseHeader(e)},r=(0,a.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange}),i=r.allowRangeRequests,o=r.suggestedLength;i&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}},{key:"_onDone",value:function(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0}}},{key:"_onError",value:function(e){this._storedError=(0,a.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.reject(this._storedError)}catch(r){n.e(r)}finally{n.f()}this._requests.length=0,this._cachedChunks.length=0}},{key:"_onProgress",value:function(e){var t;null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}},{key:"filename",get:function(){return this._filename}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"contentLength",get:function(){return this._contentLength}},{key:"headersReady",get:function(){return this._headersReceivedCapability.promise}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._storedError){e.next=2;break}throw this._storedError;case 2:if(!(this._cachedChunks.length>0)){e.next=5;break}return t=this._cachedChunks.shift(),e.abrupt("return",{value:t,done:!1});case 5:if(!this._done){e.next=7;break}return e.abrupt("return",{value:void 0,done:!0});case 7:return n=(0,r.createPromiseCapability)(),this._requests.push(n),e.abrupt("return",n.promise);case 10:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0,this._headersReceivedCapability.reject(e);var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}]),e}(),l=function(){function e(t,n,r){_classCallCheck(this,e),this._manager=t;var a={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(n,r,a),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}return _createClass(e,[{key:"_close",value:function(){var e;null===(e=this.onClosed)||void 0===e||e.call(this,this)}},{key:"_onDone",value:function(e){var t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;var n,r=_createForOfIteratorHelper(this._requests);try{for(r.s();!(n=r.n()).done;)n.value.resolve({value:void 0,done:!0})}catch(a){r.e(a)}finally{r.f()}this._requests.length=0,this._close()}},{key:"_onError",value:function(e){this._storedError=(0,a.createResponseStatusError)(e,this._url);var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.reject(this._storedError)}catch(r){n.e(r)}finally{n.f()}this._requests.length=0,this._queuedChunk=null}},{key:"_onProgress",value:function(e){var t;this.isStreamingSupported||null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:e.loaded})}},{key:"isStreamingSupported",get:function(){return!1}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._storedError){e.next=2;break}throw this._storedError;case 2:if(null===this._queuedChunk){e.next=6;break}return t=this._queuedChunk,this._queuedChunk=null,e.abrupt("return",{value:t,done:!1});case 6:if(!this._done){e.next=8;break}return e.abrupt("return",{value:void 0,done:!0});case 8:return n=(0,r.createPromiseCapability)(),this._requests.push(n),e.abrupt("return",n.promise);case 11:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){this._done=!0;var t,n=_createForOfIteratorHelper(this._requests);try{for(n.s();!(t=n.n()).done;)t.value.resolve({value:void 0,done:!0})}catch(r){n.e(r)}finally{n.f()}this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=n(1),a=n(22);function i(e,t,n){return{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function o(e){var t=new Headers;for(var n in e){var r=e[n];void 0!==r&&t.append(n,r)}return t}function s(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,r.warn)("getArrayBuffer - unexpected data format: ".concat(e)),new Uint8Array(e).buffer)}var l=function(){function e(t){_classCallCheck(this,e),this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}return _createClass(e,[{key:"_progressiveDataLength",get:function(){var e,t;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}},{key:"getFullReader",value:function(){return(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new c(this),this._fullRequestReader}},{key:"getRangeReader",value:function(e,t){if(t<=this._progressiveDataLength)return null;var n=new u(this,e,t);return this._rangeRequestReaders.push(n),n}},{key:"cancelAllRequests",value:function(e){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);var n,r=_createForOfIteratorHelper(this._rangeRequestReaders.slice(0));try{for(r.s();!(n=r.n()).done;)n.value.cancel(e)}catch(a){r.e(a)}finally{r.f()}}}]),e}();t.PDFFetchStream=l;var c=function(){function e(t){var n=this;_classCallCheck(this,e),this._stream=t,this._reader=null,this._loaded=0,this._filename=null;var s=t.source;this._withCredentials=s.withCredentials||!1,this._contentLength=s.length,this._headersCapability=(0,r.createPromiseCapability)(),this._disableRange=s.disableRange||!1,this._rangeChunkSize=s.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!s.disableStream,this._isRangeSupported=!s.disableRange,this._headers=o(this._stream.httpHeaders);var l=s.url;fetch(l,i(this._headers,this._withCredentials,this._abortController)).then((function(e){if(!(0,a.validateResponseStatus)(e.status))throw(0,a.createResponseStatusError)(e.status,l);n._reader=e.body.getReader(),n._headersCapability.resolve();var t=function(t){return e.headers.get(t)},i=(0,a.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:n._stream.isHttp,rangeChunkSize:n._rangeChunkSize,disableRange:n._disableRange}),o=i.allowRangeRequests,s=i.suggestedLength;n._isRangeSupported=o,n._contentLength=s||n._contentLength,n._filename=(0,a.extractFilenameFromHeader)(t),!n._isStreamingSupported&&n._isRangeSupported&&n.cancel(new r.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}return _createClass(e,[{key:"headersReady",get:function(){return this._headersCapability.promise}},{key:"filename",get:function(){return this._filename}},{key:"contentLength",get:function(){return this._contentLength}},{key:"isRangeSupported",get:function(){return this._isRangeSupported}},{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._headersCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(n=e.sent,r=n.value,!(a=n.done)){e.next=9;break}return e.abrupt("return",{value:r,done:a});case 9:return this._loaded+=r.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),e.abrupt("return",{value:s(r),done:!1});case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e),this._abortController.abort()}}]),e}(),u=function(){function e(t,n,s){var l=this;_classCallCheck(this,e),this._stream=t,this._reader=null,this._loaded=0;var c=t.source;this._withCredentials=c.withCredentials||!1,this._readCapability=(0,r.createPromiseCapability)(),this._isStreamingSupported=!c.disableStream,this._abortController=new AbortController,this._headers=o(this._stream.httpHeaders),this._headers.append("Range","bytes=".concat(n,"-").concat(s-1));var u=c.url;fetch(u,i(this._headers,this._withCredentials,this._abortController)).then((function(e){if(!(0,a.validateResponseStatus)(e.status))throw(0,a.createResponseStatusError)(e.status,u);l._readCapability.resolve(),l._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}return _createClass(e,[{key:"isStreamingSupported",get:function(){return this._isStreamingSupported}},{key:"read",value:function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(){var t,n,r,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._readCapability.promise;case 2:return e.next=4,this._reader.read();case 4:if(n=e.sent,r=n.value,!(a=n.done)){e.next=9;break}return e.abrupt("return",{value:r,done:a});case 9:return this._loaded+=r.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),e.abrupt("return",{value:s(r),done:!1});case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"cancel",value:function(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e),this._abortController.abort()}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){e.textContentSource||!e.textContent&&!e.textContentStream||((0,a.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);var t=new d(e);return t._render(),t},t.updateTextLayer=function(e){var t=e.container,n=e.viewport,r=e.textDivs,i=e.textDivProperties,o=e.isOffscreenCanvasSupported,s=e.mustRotate,c=void 0===s||s,d=e.mustRescale,h=void 0===d||d;if(c&&(0,a.setLayerDimensions)(t,{rotation:n.rotation}),h){var f,p=l(0,o),v={prevFontSize:null,prevFontFamily:null,div:null,scale:n.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:p},g=_createForOfIteratorHelper(r);try{for(g.s();!(f=g.n()).done;){var m=f.value;v.properties=i.get(m),v.div=m,u(v)}}catch(y){g.e(y)}finally{g.f()}}};var r=n(1),a=n(6),i=30,o=.8,s=new Map;function l(e,t){var n;if(t&&r.FeatureTest.isOffscreenCanvasSupported)n=new OffscreenCanvas(e,e).getContext("2d",{alpha:!1});else{var a=document.createElement("canvas");a.width=a.height=e,n=a.getContext("2d",{alpha:!1})}return n}function c(e,t,n){var a=document.createElement("span"),c={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(a);var u=r.Util.transform(e._transform,t.transform),d=Math.atan2(u[1],u[0]),h=n[t.fontName];h.vertical&&(d+=Math.PI/2);var f,p,v=Math.hypot(u[2],u[3]),g=v*function(e,t){var n=s.get(e);if(n)return n;var r=l(i,t);r.font="".concat(i,"px ").concat(e);var a=r.measureText(""),c=a.fontBoundingBoxAscent,u=Math.abs(a.fontBoundingBoxDescent);if(c){var d=c/(c+u);return s.set(e,d),r.canvas.width=r.canvas.height=0,d}r.strokeStyle="red",r.clearRect(0,0,i,i),r.strokeText("g",0,0);var h=r.getImageData(0,0,i,i).data;u=0;for(var f=h.length-1-3;f>=0;f-=4)if(h[f]>0){u=Math.ceil(f/4/i);break}r.clearRect(0,0,i,i),r.strokeText("A",0,i),c=0;for(var p=0,v=(h=r.getImageData(0,0,i,i).data).length;p0){c=i-Math.floor(p/4/i);break}if(r.canvas.width=r.canvas.height=0,c){var g=c/(c+u);return s.set(e,g),g}return s.set(e,o),o}(h.fontFamily,e._isOffscreenCanvasSupported);0===d?(f=u[4],p=u[5]-g):(f=u[4]+g*Math.sin(d),p=u[5]-g*Math.cos(d));var m="calc(var(--scale-factor)*",y=a.style;e._container===e._rootContainer?(y.left="".concat((100*f/e._pageWidth).toFixed(2),"%"),y.top="".concat((100*p/e._pageHeight).toFixed(2),"%")):(y.left="".concat(m).concat(f.toFixed(2),"px)"),y.top="".concat(m).concat(p.toFixed(2),"px)")),y.fontSize="".concat(m).concat(v.toFixed(2),"px)"),y.fontFamily=h.fontFamily,c.fontSize=v,a.setAttribute("role","presentation"),a.textContent=t.str,a.dir=t.dir,e._fontInspectorEnabled&&(a.dataset.fontName=t.fontName),0!==d&&(c.angle=d*(180/Math.PI));var _=!1;if(t.str.length>1)_=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){var b=Math.abs(t.transform[0]),k=Math.abs(t.transform[3]);b!==k&&Math.max(b,k)/Math.min(b,k)>1.5&&(_=!0)}_&&(c.canvasWidth=h.vertical?t.height:t.width),e._textDivProperties.set(a,c),e._isReadableStream&&e._layoutText(a)}function u(e){var t=e.div,n=e.scale,r=e.properties,a=e.ctx,i=e.prevFontSize,o=e.prevFontFamily,s=t.style,l="";if(0!==r.canvasWidth&&r.hasText){var c=s.fontFamily,u=r.canvasWidth,d=r.fontSize;i===d&&o===c||(a.font="".concat(d*n,"px ").concat(c),e.prevFontSize=d,e.prevFontFamily=c);var h=a.measureText(t.textContent).width;h>0&&(l="scaleX(".concat(u*n/h,")"))}0!==r.angle&&(l="rotate(".concat(r.angle,"deg) ").concat(l)),l.length>0&&(s.transform=l)}var d=function(){function e(t){var n,i=this,o=t.textContentSource,s=t.container,c=t.viewport,u=t.textDivs,d=t.textDivProperties,h=t.textContentItemsStr,f=t.isOffscreenCanvasSupported;_classCallCheck(this,e),this._textContentSource=o,this._isReadableStream=o instanceof ReadableStream,this._container=this._rootContainer=s,this._textDivs=u||[],this._textContentItemsStr=h||[],this._isOffscreenCanvasSupported=f,this._fontInspectorEnabled=!(null===(n=globalThis.FontInspector)||void 0===n||!n.enabled),this._reader=null,this._textDivProperties=d||new WeakMap,this._canceled=!1,this._capability=(0,r.createPromiseCapability)(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:c.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,f)};var p=c.rawDims,v=p.pageWidth,g=p.pageHeight,m=p.pageX,y=p.pageY;this._transform=[1,0,0,-1,-m,y+g],this._pageWidth=v,this._pageHeight=g,(0,a.setLayerDimensions)(s,c),this._capability.promise.finally((function(){i._layoutTextParams=null})).catch((function(){}))}return _createClass(e,[{key:"promise",get:function(){return this._capability.promise}},{key:"cancel",value:function(){this._canceled=!0,this._reader&&(this._reader.cancel(new r.AbortException("TextLayer task cancelled.")).catch((function(){})),this._reader=null),this._capability.reject(new r.AbortException("TextLayer task cancelled."))}},{key:"_processItems",value:function(e,t){var n,r=_createForOfIteratorHelper(e);try{for(r.s();!(n=r.n()).done;){var a=n.value;if(void 0!==a.str)this._textContentItemsStr.push(a.str),c(this,a,t);else if("beginMarkedContentProps"===a.type||"beginMarkedContent"===a.type){var i=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==a.id&&this._container.setAttribute("id","".concat(a.id)),i.append(this._container)}else"endMarkedContent"===a.type&&(this._container=this._container.parentNode)}}catch(o){r.e(o)}finally{r.f()}}},{key:"_layoutText",value:function(e){var t=this._layoutTextParams.properties=this._textDivProperties.get(e);if(this._layoutTextParams.div=e,u(this._layoutTextParams),t.hasText&&this._container.append(e),t.hasEOL){var n=document.createElement("br");n.setAttribute("role","presentation"),this._container.append(n)}}},{key:"_render",value:function(){var e=this,t=(0,r.createPromiseCapability)(),n=Object.create(null);if(this._isReadableStream)this._reader=this._textContentSource.getReader(),function r(){e._reader.read().then((function(a){var i=a.value;a.done?t.resolve():(Object.assign(n,i.styles),e._processItems(i.items,n),r())}),t.reject)}();else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');var a=this._textContentSource,i=a.items,o=a.styles;this._processItems(i,o),t.resolve()}t.promise.then((function(){n=null,function(e){if(!e._canceled){var t=e._textDivs,n=e._capability;if(t.length>1e5)n.resolve();else{if(!e._isReadableStream){var r,a=_createForOfIteratorHelper(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;e._layoutText(i)}}catch(o){a.e(o)}finally{a.f()}}n.resolve()}}}(e)}),this._capability.reject)}}]),e}();t.TextLayerRenderTask=d},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=n(1),a=n(5),i=n(28),o=n(29),s=n(6),l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakSet,m=new WeakSet,y=new WeakSet,_=new WeakSet,b=function(){function e(t){_classCallCheck(this,e),_classPrivateMethodInitSpec(this,_),_classPrivateMethodInitSpec(this,y),_classPrivateMethodInitSpec(this,m),_classPrivateMethodInitSpec(this,g),_classPrivateFieldInitSpec(this,l,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(this,c,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,u,{writable:!0,value:this.pointerup.bind(this)}),_classPrivateFieldInitSpec(this,d,{writable:!0,value:this.pointerdown.bind(this)}),_classPrivateFieldInitSpec(this,h,{writable:!0,value:new Map}),_classPrivateFieldInitSpec(this,f,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,p,{writable:!0,value:!1}),_classPrivateFieldInitSpec(this,v,{writable:!0,value:void 0}),e._initialized||(e._initialized=!0,i.FreeTextEditor.initialize(t.l10n),o.InkEditor.initialize(t.l10n)),t.uiManager.registerEditorTypes([i.FreeTextEditor,o.InkEditor]),_classPrivateFieldSet(this,v,t.uiManager),this.pageIndex=t.pageIndex,this.div=t.div,_classPrivateFieldSet(this,l,t.accessibilityManager),_classPrivateFieldGet(this,v).addLayer(this)}return _createClass(e,[{key:"isEmpty",get:function(){return 0===_classPrivateFieldGet(this,h).size}},{key:"updateToolbar",value:function(e){_classPrivateFieldGet(this,v).updateToolbar(e)}},{key:"updateMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_classPrivateFieldGet(this,v).getMode();_classPrivateMethodGet(this,_,P).call(this),e===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),_classPrivateFieldGet(this,v).unselectAll(),e!==r.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",e===r.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",e===r.AnnotationEditorType.INK),this.div.hidden=!1)}},{key:"addInkEditorIfNeeded",value:function(e){if(e||_classPrivateFieldGet(this,v).getMode()===r.AnnotationEditorType.INK){if(!e){var t,n=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(n.s();!(t=n.n()).done;){var a=t.value;if(a.isEmpty())return void a.setInBackground()}}catch(i){n.e(i)}finally{n.f()}}_classPrivateMethodGet(this,y,w).call(this,{offsetX:0,offsetY:0}).setInBackground()}}},{key:"setEditingState",value:function(e){_classPrivateFieldGet(this,v).setEditingState(e)}},{key:"addCommands",value:function(e){_classPrivateFieldGet(this,v).addCommands(e)}},{key:"enable",value:function(){this.div.style.pointerEvents="auto";var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;)e.value.enableEditing()}catch(n){t.e(n)}finally{t.f()}}},{key:"disable",value:function(){this.div.style.pointerEvents="none";var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;)e.value.disableEditing()}catch(n){t.e(n)}finally{t.f()}_classPrivateMethodGet(this,_,P).call(this),this.isEmpty&&(this.div.hidden=!0)}},{key:"setActiveEditor",value:function(e){_classPrivateFieldGet(this,v).getActive()!==e&&_classPrivateFieldGet(this,v).setActiveEditor(e)}},{key:"enableClick",value:function(){this.div.addEventListener("pointerdown",_classPrivateFieldGet(this,d)),this.div.addEventListener("pointerup",_classPrivateFieldGet(this,u))}},{key:"disableClick",value:function(){this.div.removeEventListener("pointerdown",_classPrivateFieldGet(this,d)),this.div.removeEventListener("pointerup",_classPrivateFieldGet(this,u))}},{key:"attach",value:function(e){_classPrivateFieldGet(this,h).set(e.id,e)}},{key:"detach",value:function(e){var t;_classPrivateFieldGet(this,h).delete(e.id),null===(t=_classPrivateFieldGet(this,l))||void 0===t||t.removePointerInTextLayer(e.contentDiv)}},{key:"remove",value:function(e){var t=this;_classPrivateFieldGet(this,v).removeEditor(e),this.detach(e),e.div.style.display="none",setTimeout((function(){e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&_classPrivateFieldGet(t,v).focusMainContainer()}),0),_classPrivateFieldGet(this,p)||this.addInkEditorIfNeeded(!1)}},{key:"add",value:function(e){if(_classPrivateMethodGet(this,g,k).call(this,e),_classPrivateFieldGet(this,v).addEditor(e),this.attach(e),!e.isAttachedToDOM){var t=e.render();this.div.append(t),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),_classPrivateFieldGet(this,v).addToAnnotationStorage(e)}},{key:"moveEditorInDOM",value:function(e){var t;null===(t=_classPrivateFieldGet(this,l))||void 0===t||t.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}},{key:"addOrRebuild",value:function(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}},{key:"addANewEditor",value:function(e){var t=this;this.addCommands({cmd:function(){t.addOrRebuild(e)},undo:function(){e.remove()},mustExec:!0})}},{key:"addUndoableEditor",value:function(e){var t=this;this.addCommands({cmd:function(){t.addOrRebuild(e)},undo:function(){e.remove()},mustExec:!1})}},{key:"getNextId",value:function(){return _classPrivateFieldGet(this,v).getId()}},{key:"deserialize",value:function(e){switch(e.annotationType){case r.AnnotationEditorType.FREETEXT:return i.FreeTextEditor.deserialize(e,this,_classPrivateFieldGet(this,v));case r.AnnotationEditorType.INK:return o.InkEditor.deserialize(e,this,_classPrivateFieldGet(this,v))}return null}},{key:"setSelected",value:function(e){_classPrivateFieldGet(this,v).setSelected(e)}},{key:"toggleSelected",value:function(e){_classPrivateFieldGet(this,v).toggleSelected(e)}},{key:"isSelected",value:function(e){return _classPrivateFieldGet(this,v).isSelected(e)}},{key:"unselect",value:function(e){_classPrivateFieldGet(this,v).unselect(e)}},{key:"pointerup",value:function(e){var t=r.FeatureTest.platform.isMac;0!==e.button||e.ctrlKey&&t||e.target===this.div&&_classPrivateFieldGet(this,f)&&(_classPrivateFieldSet(this,f,!1),_classPrivateFieldGet(this,c)?_classPrivateMethodGet(this,y,w).call(this,e):_classPrivateFieldSet(this,c,!0))}},{key:"pointerdown",value:function(e){var t=r.FeatureTest.platform.isMac;if(!(0!==e.button||e.ctrlKey&&t)&&e.target===this.div){_classPrivateFieldSet(this,f,!0);var n=_classPrivateFieldGet(this,v).getActive();_classPrivateFieldSet(this,c,!n||n.isEmpty())}}},{key:"drop",value:function(e){var t=e.dataTransfer.getData("text/plain"),n=_classPrivateFieldGet(this,v).getEditor(t);if(n){e.preventDefault(),e.dataTransfer.dropEffect="move",_classPrivateMethodGet(this,g,k).call(this,n);var r=this.div.getBoundingClientRect(),a=e.clientX-r.x,i=e.clientY-r.y;n.translate(a-n.startX,i-n.startY),this.moveEditorInDOM(n),n.div.focus()}}},{key:"dragover",value:function(e){e.preventDefault()}},{key:"destroy",value:function(){var e;(null===(e=_classPrivateFieldGet(this,v).getActive())||void 0===e?void 0:e.parent)===this&&_classPrivateFieldGet(this,v).setActiveEditor(null);var t,n=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(n.s();!(t=n.n()).done;){var r,a=t.value;null===(r=_classPrivateFieldGet(this,l))||void 0===r||r.removePointerInTextLayer(a.contentDiv),a.setParent(null),a.isAttachedToDOM=!1,a.div.remove()}}catch(i){n.e(i)}finally{n.f()}this.div=null,_classPrivateFieldGet(this,h).clear(),_classPrivateFieldGet(this,v).removeLayer(this)}},{key:"render",value:function(e){var t=e.viewport;this.viewport=t,(0,s.setLayerDimensions)(this.div,t),(0,a.bindEvents)(this,this.div,["dragover","drop"]);var n,r=_createForOfIteratorHelper(_classPrivateFieldGet(this,v).getEditors(this.pageIndex));try{for(r.s();!(n=r.n()).done;){var i=n.value;this.add(i)}}catch(o){r.e(o)}finally{r.f()}this.updateMode()}},{key:"update",value:function(e){var t=e.viewport;_classPrivateFieldGet(this,v).commitOrRemove(),this.viewport=t,(0,s.setLayerDimensions)(this.div,{rotation:t.rotation}),this.updateMode()}},{key:"pageDimensions",get:function(){var e=this.viewport.rawDims;return[e.pageWidth,e.pageHeight]}}]),e}();function k(e){var t;e.parent!==this&&(this.attach(e),null===(t=e.parent)||void 0===t||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}function S(e){switch(_classPrivateFieldGet(this,v).getMode()){case r.AnnotationEditorType.FREETEXT:return new i.FreeTextEditor(e);case r.AnnotationEditorType.INK:return new o.InkEditor(e)}return null}function w(e){var t=this.getNextId(),n=_classPrivateMethodGet(this,m,S).call(this,{parent:this,id:t,x:e.offsetX,y:e.offsetY,uiManager:_classPrivateFieldGet(this,v)});return n&&this.add(n),n}function P(){_classPrivateFieldSet(this,p,!0);var e,t=_createForOfIteratorHelper(_classPrivateFieldGet(this,h).values());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.isEmpty()&&n.remove()}}catch(r){t.e(r)}finally{t.f()}_classPrivateFieldSet(this,p,!1)}_defineProperty(b,"_initialized",!1),t.AnnotationEditorLayer=b},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=n(1),a=n(5),i=n(4),o=new WeakMap,s=new WeakMap,l=new WeakMap,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakSet,g=new WeakSet,m=new WeakSet,y=new WeakSet,_=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;return _classCallCheck(this,n),r=t.call(this,_objectSpread(_objectSpread({},e),{},{name:"freeTextEditor"})),_classPrivateMethodInitSpec(_assertThisInitialized(r),y),_classPrivateMethodInitSpec(_assertThisInitialized(r),m),_classPrivateMethodInitSpec(_assertThisInitialized(r),g),_classPrivateMethodInitSpec(_assertThisInitialized(r),v),_classPrivateFieldInitSpec(_assertThisInitialized(r),o,{writable:!0,value:r.editorDivBlur.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),s,{writable:!0,value:r.editorDivFocus.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),l,{writable:!0,value:r.editorDivInput.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),c,{writable:!0,value:r.editorDivKeydown.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),u,{writable:!0,value:void 0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),d,{writable:!0,value:""}),_classPrivateFieldInitSpec(_assertThisInitialized(r),h,{writable:!0,value:"".concat(r.id,"-editor")}),_classPrivateFieldInitSpec(_assertThisInitialized(r),f,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),p,{writable:!0,value:void 0}),_classPrivateFieldSet(_assertThisInitialized(r),u,e.color||n._defaultColor||i.AnnotationEditor._defaultLineColor),_classPrivateFieldSet(_assertThisInitialized(r),p,e.fontSize||n._defaultFontSize),r}return _createClass(n,[{key:"updateParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:_classPrivateMethodGet(this,v,b).call(this,t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:_classPrivateMethodGet(this,g,k).call(this,t)}}},{key:"propertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,_classPrivateFieldGet(this,p)],[r.AnnotationEditorParamsType.FREETEXT_COLOR,_classPrivateFieldGet(this,u)]]}},{key:"getInitialTranslation",value:function(){var e=this.parentScale;return[-n._internalPadding*e,-(n._internalPadding+_classPrivateFieldGet(this,p))*e]}},{key:"rebuild",value:function(){_get(_getPrototypeOf(n.prototype),"rebuild",this).call(this),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}},{key:"enableEditMode",value:function(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),_get(_getPrototypeOf(n.prototype),"enableEditMode",this).call(this),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",_classPrivateFieldGet(this,c)),this.editorDiv.addEventListener("focus",_classPrivateFieldGet(this,s)),this.editorDiv.addEventListener("blur",_classPrivateFieldGet(this,o)),this.editorDiv.addEventListener("input",_classPrivateFieldGet(this,l)))}},{key:"disableEditMode",value:function(){this.isInEditMode()&&(this.parent.setEditingState(!0),_get(_getPrototypeOf(n.prototype),"disableEditMode",this).call(this),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",_classPrivateFieldGet(this,h)),this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",_classPrivateFieldGet(this,c)),this.editorDiv.removeEventListener("focus",_classPrivateFieldGet(this,s)),this.editorDiv.removeEventListener("blur",_classPrivateFieldGet(this,o)),this.editorDiv.removeEventListener("input",_classPrivateFieldGet(this,l)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}},{key:"focusin",value:function(e){_get(_getPrototypeOf(n.prototype),"focusin",this).call(this,e),e.target!==this.editorDiv&&this.editorDiv.focus()}},{key:"onceAdded",value:function(){this.width||(this.enableEditMode(),this.editorDiv.focus())}},{key:"isEmpty",value:function(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}},{key:"remove",value:function(){this.isEditing=!1,this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing"),_get(_getPrototypeOf(n.prototype),"remove",this).call(this)}},{key:"commit",value:function(){this.isInEditMode()&&(_get(_getPrototypeOf(n.prototype),"commit",this).call(this),_classPrivateFieldGet(this,f)||(_classPrivateFieldSet(this,f,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),_classPrivateFieldSet(this,d,_classPrivateMethodGet(this,m,S).call(this).trimEnd()),_classPrivateMethodGet(this,y,w).call(this))}},{key:"shouldGetKeyboardEvents",value:function(){return this.isInEditMode()}},{key:"dblclick",value:function(e){this.enableEditMode(),this.editorDiv.focus()}},{key:"keydown",value:function(e){e.target===this.div&&"Enter"===e.key&&(this.enableEditMode(),this.editorDiv.focus())}},{key:"editorDivKeydown",value:function(e){n._keyboardManager.exec(this,e)}},{key:"editorDivFocus",value:function(e){this.isEditing=!0}},{key:"editorDivBlur",value:function(e){this.isEditing=!1}},{key:"editorDivInput",value:function(e){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}},{key:"disableEditing",value:function(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}},{key:"enableEditing",value:function(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}},{key:"render",value:function(){var e,t,r=this;if(this.div)return this.div;this.width&&(e=this.x,t=this.y),_get(_getPrototypeOf(n.prototype),"render",this).call(this),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",_classPrivateFieldGet(this,h)),this.enableEditing(),n._l10nPromise.get("editor_free_text2_aria_label").then((function(e){var t;return null===(t=r.editorDiv)||void 0===t?void 0:t.setAttribute("aria-label",e)})),n._l10nPromise.get("free_text2_default_content").then((function(e){var t;return null===(t=r.editorDiv)||void 0===t?void 0:t.setAttribute("default-content",e)})),this.editorDiv.contentEditable=!0;var i=this.editorDiv.style;if(i.fontSize="calc(".concat(_classPrivateFieldGet(this,p),"px * var(--scale-factor))"),i.color=_classPrivateFieldGet(this,u),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,a.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){var o=_slicedToArray(this.parentDimensions,2),s=o[0],l=o[1];this.setAt(e*s,t*l,this.width*s,this.height*l);var c,f=_createForOfIteratorHelper(_classPrivateFieldGet(this,d).split("\n"));try{for(f.s();!(c=f.n()).done;){var v=c.value,g=document.createElement("div");g.append(v?document.createTextNode(v):document.createElement("br")),this.editorDiv.append(g)}}catch(m){f.e(m)}finally{f.f()}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}},{key:"contentDiv",get:function(){return this.editorDiv}},{key:"serialize",value:function(){if(this.isEmpty())return null;var e=n._internalPadding*this.parentScale,t=this.getRect(e,e),a=i.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:_classPrivateFieldGet(this,u));return{annotationType:r.AnnotationEditorType.FREETEXT,color:a,fontSize:_classPrivateFieldGet(this,p),value:_classPrivateFieldGet(this,d),pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}],[{key:"initialize",value:function(e){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map((function(t){return[t,e.get(t)]})));var t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}},{key:"updateDefaultParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:n._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:n._defaultColor=t}}},{key:"defaultPropertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,n._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,n._defaultColor||i.AnnotationEditor._defaultLineColor]]}},{key:"deserialize",value:function(e,t,a){var i,o=_get(_getPrototypeOf(n),"deserialize",this).call(this,e,t,a);return _classPrivateFieldSet(o,p,e.fontSize),_classPrivateFieldSet(o,u,(i=r.Util).makeHexColor.apply(i,_toConsumableArray(e.color))),_classPrivateFieldSet(o,d,e.value),o}}]),n}(i.AnnotationEditor);function b(e){var t=this,n=function(e){t.editorDiv.style.fontSize="calc(".concat(e,"px * var(--scale-factor))"),t.translate(0,-(e-_classPrivateFieldGet(t,p))*t.parentScale),_classPrivateFieldSet(t,p,e),_classPrivateMethodGet(t,y,w).call(t)},a=_classPrivateFieldGet(this,p);this.addCommands({cmd:function(){n(e)},undo:function(){n(a)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function k(e){var t=this,n=_classPrivateFieldGet(this,u);this.addCommands({cmd:function(){_classPrivateFieldSet(t,u,t.editorDiv.style.color=e)},undo:function(){_classPrivateFieldSet(t,u,t.editorDiv.style.color=n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function S(){var e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;var t,n=[],r=_createForOfIteratorHelper(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;n.push(a.innerText.replace(/\r\n?|\n/,""))}}catch(i){r.e(i)}finally{r.f()}return n.join("\n")}function w(){var e,t=_slicedToArray(this.parentDimensions,2),n=t[0],r=t[1];if(this.isAttachedToDOM)e=this.div.getBoundingClientRect();else{var a=this.currentLayer,i=this.div,o=i.style.display;i.style.display="hidden",a.div.append(this.div),e=i.getBoundingClientRect(),i.remove(),i.style.display=o}this.width=e.width/n,this.height=e.height/r}_defineProperty(_,"_freeTextDefaultContent",""),_defineProperty(_,"_l10nPromise",void 0),_defineProperty(_,"_internalPadding",0),_defineProperty(_,"_defaultColor",null),_defineProperty(_,"_defaultFontSize",10),_defineProperty(_,"_keyboardManager",new a.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],_.prototype.commitOrRemove]])),_defineProperty(_,"_type","freetext"),t.FreeTextEditor=_},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0,Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return i.fitCurve}});var r=n(1),a=n(4),i=n(30),o=n(5),s=16,l=100,c=new WeakMap,u=new WeakMap,d=new WeakMap,h=new WeakMap,f=new WeakMap,p=new WeakMap,v=new WeakMap,g=new WeakMap,m=new WeakMap,y=new WeakMap,_=new WeakMap,b=new WeakMap,k=new WeakMap,S=new WeakMap,w=new WeakSet,P=new WeakSet,x=new WeakSet,A=new WeakSet,C=new WeakSet,E=new WeakSet,F=new WeakSet,T=new WeakSet,M=new WeakSet,R=new WeakSet,I=new WeakSet,O=new WeakSet,L=new WeakSet,D=new WeakSet,N=new WeakSet,G=new WeakSet,j=new WeakSet,z=new WeakSet,B=new WeakSet,H=new WeakSet,U=new WeakSet,W=new WeakSet,q=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;return _classCallCheck(this,n),r=t.call(this,_objectSpread(_objectSpread({},e),{},{name:"inkEditor"})),_classPrivateMethodInitSpec(_assertThisInitialized(r),W),_classPrivateMethodInitSpec(_assertThisInitialized(r),U),_classPrivateMethodInitSpec(_assertThisInitialized(r),H),_classPrivateMethodInitSpec(_assertThisInitialized(r),B),_classPrivateMethodInitSpec(_assertThisInitialized(r),z),_classPrivateMethodInitSpec(_assertThisInitialized(r),j),_classPrivateMethodInitSpec(_assertThisInitialized(r),G),_classPrivateMethodInitSpec(_assertThisInitialized(r),N),_classPrivateMethodInitSpec(_assertThisInitialized(r),D),_classPrivateMethodInitSpec(_assertThisInitialized(r),L),_classPrivateMethodInitSpec(_assertThisInitialized(r),O),_classPrivateMethodInitSpec(_assertThisInitialized(r),I),_classPrivateMethodInitSpec(_assertThisInitialized(r),R),_classPrivateMethodInitSpec(_assertThisInitialized(r),M),_classPrivateMethodInitSpec(_assertThisInitialized(r),T),_classPrivateMethodInitSpec(_assertThisInitialized(r),F),_classPrivateMethodInitSpec(_assertThisInitialized(r),E),_classPrivateMethodInitSpec(_assertThisInitialized(r),C),_classPrivateMethodInitSpec(_assertThisInitialized(r),A),_classPrivateMethodInitSpec(_assertThisInitialized(r),x),_classPrivateMethodInitSpec(_assertThisInitialized(r),P),_classPrivateMethodInitSpec(_assertThisInitialized(r),w),_classPrivateFieldInitSpec(_assertThisInitialized(r),c,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),u,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),d,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),h,{writable:!0,value:r.canvasPointermove.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),f,{writable:!0,value:r.canvasPointerleave.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),p,{writable:!0,value:r.canvasPointerup.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),v,{writable:!0,value:r.canvasPointerdown.bind(_assertThisInitialized(r))}),_classPrivateFieldInitSpec(_assertThisInitialized(r),g,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),m,{writable:!0,value:!1}),_classPrivateFieldInitSpec(_assertThisInitialized(r),y,{writable:!0,value:null}),_classPrivateFieldInitSpec(_assertThisInitialized(r),_,{writable:!0,value:null}),_classPrivateFieldInitSpec(_assertThisInitialized(r),b,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),k,{writable:!0,value:0}),_classPrivateFieldInitSpec(_assertThisInitialized(r),S,{writable:!0,value:null}),r.color=e.color||null,r.thickness=e.thickness||null,r.opacity=e.opacity||null,r.paths=[],r.bezierPath2D=[],r.currentPath=[],r.scaleFactor=1,r.translationX=r.translationY=0,r.x=0,r.y=0,r}return _createClass(n,[{key:"updateParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:_classPrivateMethodGet(this,w,V).call(this,t);break;case r.AnnotationEditorParamsType.INK_COLOR:_classPrivateMethodGet(this,P,K).call(this,t);break;case r.AnnotationEditorParamsType.INK_OPACITY:_classPrivateMethodGet(this,x,X).call(this,t)}}},{key:"propertiesToUpdate",get:function(){var e;return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||n._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||n._defaultColor||a.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(null!==(e=this.opacity)&&void 0!==e?e:n._defaultOpacity))]]}},{key:"rebuild",value:function(){_get(_getPrototypeOf(n.prototype),"rebuild",this).call(this),null!==this.div&&(this.canvas||(_classPrivateMethodGet(this,I,ne).call(this),_classPrivateMethodGet(this,O,re).call(this)),this.isAttachedToDOM||(this.parent.add(this),_classPrivateMethodGet(this,L,ae).call(this)),_classPrivateMethodGet(this,U,fe).call(this))}},{key:"remove",value:function(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,_classPrivateFieldGet(this,_).disconnect(),_classPrivateFieldSet(this,_,null),_get(_getPrototypeOf(n.prototype),"remove",this).call(this))}},{key:"setParent",value:function(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this),_get(_getPrototypeOf(n.prototype),"setParent",this).call(this,e)}},{key:"onScaleChanging",value:function(){var e=_slicedToArray(this.parentDimensions,2),t=e[0],n=e[1],r=this.width*t,a=this.height*n;this.setDimensions(r,a)}},{key:"enableEditMode",value:function(){_classPrivateFieldGet(this,g)||null===this.canvas||(_get(_getPrototypeOf(n.prototype),"enableEditMode",this).call(this),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",_classPrivateFieldGet(this,v)),this.canvas.addEventListener("pointerup",_classPrivateFieldGet(this,p)))}},{key:"disableEditMode",value:function(){this.isInEditMode()&&null!==this.canvas&&(_get(_getPrototypeOf(n.prototype),"disableEditMode",this).call(this),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",_classPrivateFieldGet(this,v)),this.canvas.removeEventListener("pointerup",_classPrivateFieldGet(this,p)))}},{key:"onceAdded",value:function(){this.div.draggable=!this.isEmpty()}},{key:"isEmpty",value:function(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}},{key:"commit",value:function(){_classPrivateFieldGet(this,g)||(_get(_getPrototypeOf(n.prototype),"commit",this).call(this),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),_classPrivateFieldSet(this,g,!0),this.div.classList.add("disabled"),_classPrivateMethodGet(this,U,fe).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus({preventScroll:!0}))}},{key:"focusin",value:function(e){_get(_getPrototypeOf(n.prototype),"focusin",this).call(this,e),this.enableEditMode()}},{key:"canvasPointerdown",value:function(e){0===e.button&&this.isInEditMode()&&!_classPrivateFieldGet(this,g)&&(this.setInForeground(),"mouse"!==e.type&&this.div.focus(),e.stopPropagation(),this.canvas.addEventListener("pointerleave",_classPrivateFieldGet(this,f)),this.canvas.addEventListener("pointermove",_classPrivateFieldGet(this,h)),_classPrivateMethodGet(this,E,Q).call(this,e.offsetX,e.offsetY))}},{key:"canvasPointermove",value:function(e){e.stopPropagation(),_classPrivateMethodGet(this,F,Z).call(this,e.offsetX,e.offsetY)}},{key:"canvasPointerup",value:function(e){0===e.button&&this.isInEditMode()&&0!==this.currentPath.length&&(e.stopPropagation(),_classPrivateMethodGet(this,R,te).call(this,e),this.setInBackground())}},{key:"canvasPointerleave",value:function(e){_classPrivateMethodGet(this,R,te).call(this,e),this.setInBackground()}},{key:"render",value:function(){var e,t,r=this;if(this.div)return this.div;this.width&&(e=this.x,t=this.y),_get(_getPrototypeOf(n.prototype),"render",this).call(this),n._l10nPromise.get("editor_ink2_aria_label").then((function(e){var t;return null===(t=r.div)||void 0===t?void 0:t.setAttribute("aria-label",e)}));var a=_classPrivateMethodGet(this,A,Y).call(this),i=_slicedToArray(a,4),o=i[0],s=i[1],l=i[2],c=i[3];if(this.setAt(o,s,0,0),this.setDims(l,c),_classPrivateMethodGet(this,I,ne).call(this),this.width){var u=_slicedToArray(this.parentDimensions,2),d=u[0],h=u[1];this.setAt(e*d,t*h,this.width*d,this.height*h),_classPrivateFieldSet(this,m,!0),_classPrivateMethodGet(this,L,ae).call(this),this.setDims(this.width*d,this.height*h),_classPrivateMethodGet(this,M,ee).call(this),_classPrivateMethodGet(this,W,pe).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return _classPrivateMethodGet(this,O,re).call(this),this.div}},{key:"setDimensions",value:function(e,t){var n=Math.round(e),r=Math.round(t);if(_classPrivateFieldGet(this,b)!==n||_classPrivateFieldGet(this,k)!==r){_classPrivateFieldSet(this,b,n),_classPrivateFieldSet(this,k,r),this.canvas.style.visibility="hidden",_classPrivateFieldGet(this,c)&&Math.abs(_classPrivateFieldGet(this,c)-e/t)>.01&&(t=Math.ceil(e/_classPrivateFieldGet(this,c)),this.setDims(e,t));var a=_slicedToArray(this.parentDimensions,2),i=a[0],o=a[1];this.width=e/i,this.height=t/o,_classPrivateFieldGet(this,g)&&_classPrivateMethodGet(this,D,ie).call(this,e,t),_classPrivateMethodGet(this,L,ae).call(this),_classPrivateMethodGet(this,M,ee).call(this),this.canvas.style.visibility="visible"}}},{key:"serialize",value:function(){if(this.isEmpty())return null;var e=this.getRect(0,0),t=this.rotation%180===0?e[3]-e[1]:e[2]-e[0],n=a.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:_classPrivateMethodGet(this,G,le).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}],[{key:"initialize",value:function(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map((function(t){return[t,e.get(t)]})))}},{key:"updateDefaultParams",value:function(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:n._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:n._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:n._defaultOpacity=t/100}}},{key:"defaultPropertiesToUpdate",get:function(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,n._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,n._defaultColor||a.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*n._defaultOpacity)]]}},{key:"deserialize",value:function(e,t,a){var i,o=_get(_getPrototypeOf(n),"deserialize",this).call(this,e,t,a);o.thickness=e.thickness,o.color=(i=r.Util).makeHexColor.apply(i,_toConsumableArray(e.color)),o.opacity=e.opacity;var l=_slicedToArray(o.pageDimensions,2),h=l[0],f=l[1],p=o.width*h,v=o.height*f,m=o.parentScale,y=e.thickness/2;_classPrivateFieldSet(o,c,p/v),_classPrivateFieldSet(o,g,!0),_classPrivateFieldSet(o,b,Math.round(p)),_classPrivateFieldSet(o,k,Math.round(v));var _,S=_createForOfIteratorHelper(e.paths);try{for(S.s();!(_=S.n()).done;){var w=_.value.bezier,P=[];o.paths.push(P);for(var x=m*(w[0]-y),A=m*(v-w[1]-y),C=2,E=w.length;C0&&void 0!==arguments[0]&&arguments[0];if(!this.isEmpty())if(_classPrivateFieldGet(this,g)){var t=_classPrivateMethodGet(this,B,de).call(this),n=_classPrivateMethodGet(this,H,he).call(this);_classPrivateFieldSet(this,d,Math.max(s,t[2]-t[0])),_classPrivateFieldSet(this,u,Math.max(s,t[3]-t[1]));var r=Math.ceil(n+_classPrivateFieldGet(this,d)*this.scaleFactor),a=Math.ceil(n+_classPrivateFieldGet(this,u)*this.scaleFactor),i=_slicedToArray(this.parentDimensions,2),o=i[0],l=i[1];this.width=r/o,this.height=a/l,_classPrivateFieldSet(this,c,r/a),_classPrivateMethodGet(this,W,pe).call(this);var h=this.translationX,f=this.translationY;this.translationX=-t[0],this.translationY=-t[1],_classPrivateMethodGet(this,L,ae).call(this),_classPrivateMethodGet(this,M,ee).call(this),_classPrivateFieldSet(this,b,r),_classPrivateFieldSet(this,k,a),this.setDims(r,a);var p=e?n/this.scaleFactor/2:0;this.translate(h-this.translationX-p,f-this.translationY-p)}else _classPrivateMethodGet(this,M,ee).call(this)}function pe(){var e=this.div.style;_classPrivateFieldGet(this,c)>=1?(e.minHeight="".concat(s,"px"),e.minWidth="".concat(Math.round(_classPrivateFieldGet(this,c)*s),"px")):(e.minWidth="".concat(s,"px"),e.minHeight="".concat(Math.round(s/_classPrivateFieldGet(this,c)),"px"))}_defineProperty(q,"_defaultColor",null),_defineProperty(q,"_defaultOpacity",1),_defineProperty(q,"_defaultThickness",1),_defineProperty(q,"_l10nPromise",void 0),_defineProperty(q,"_type","ink"),t.InkEditor=q},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.fitCurve=void 0;var r=n(31);t.fitCurve=r},function(e){function t(e,a,i,o,s){var c,u,d,h,f,p,v,g,m,y,_,b,k;if(2===e.length)return b=l.vectorLen(l.subtract(e[0],e[1]))/3,[c=[e[0],l.addArrays(e[0],l.mulItems(a,b)),l.addArrays(e[1],l.mulItems(i,b)),e[1]]];u=function(e){var t,n,r,a=[];return e.forEach((function(e,i){t=i?n+l.vectorLen(l.subtract(e,r)):0,a.push(t),n=t,r=e})),a=a.map((function(e){return e/n}))}(e);var S=n(e,u,u,a,i,s),w=_slicedToArray(S,3);if(c=w[0],h=w[1],p=w[2],0===h||h.9999&&A<1.0001)break}f=h,v=p}if(_=[],(g=l.subtract(e[p-1],e[p+1])).every((function(e){return 0===e}))){var C=[-(g=l.subtract(e[p-1],e[p]))[1],g[0]];g[0]=C[0],g[1]=C[1]}return m=l.normalize(g),y=l.mulItems(m,-1),_=(_=_.concat(t(e.slice(0,p+1),a,m,o,s))).concat(t(e.slice(p),y,i,o,s))}function n(e,t,n,r,a,s){var u,d,h;u=function(e,t,n,r){var a,i,o,s,u,d,h,f,p,v,g,m,y,_,b,k,S,w=e[0],P=e[e.length-1];for(a=[w,null,null,P],i=l.zeros_Xx2x2(t.length),y=0,_=t.length;y<_;y++)S=1-(k=t[y]),(o=i[y])[0]=l.mulItems(n,3*k*(S*S)),o[1]=l.mulItems(r,3*S*(k*k));for(s=[[0,0],[0,0]],u=[0,0],y=0,_=e.length;y<_;y++)k=t[y],o=i[y],s[0][0]+=l.dot(o[0],o[0]),s[0][1]+=l.dot(o[0],o[1]),s[1][0]+=l.dot(o[0],o[1]),s[1][1]+=l.dot(o[1],o[1]),b=l.subtract(e[y],c.q([w,w,P,P],k)),u[0]+=l.dot(o[0],b),u[1]+=l.dot(o[1],b);return d=s[0][0]*s[1][1]-s[1][0]*s[0][1],h=s[0][0]*u[1]-s[1][0]*u[0],f=u[0]*s[1][1]-u[1]*s[0][1],p=0===d?0:f/d,v=0===d?0:h/d,m=l.vectorLen(l.subtract(w,P)),p<(g=1e-6*m)||va&&(a=r,s=d);return[a,s]}(e,u,t),p=_slicedToArray(f,2);return d=p[0],h=p[1],s&&s({bez:u,points:e,params:t,maxErr:d,maxPoint:h}),[u,d,h]}function r(e,t,n){return n.map((function(n,r){return a(e,t[r],n)}))}function a(e,t,n){var r=l.subtract(c.q(e,n),t),a=c.qprime(e,n),i=l.mulMatrix(r,a),o=l.sum(l.squareItems(a))+2*l.mulMatrix(r,c.qprimeprime(e,n));return 0===o?n:n-i/o}var i=function(e,t){for(var n,r=[0],a=e[0],i=0,o=1;o<=t;o++)n=c.q(e,o/t),i+=l.vectorLen(l.subtract(n,a)),r.push(i),a=n;return r=r.map((function(e){return e/i}))};function o(e,t,n,r){if(t<0)return 0;if(t>1)return 1;for(var a,i,o,s,l=1;l<=r;l++)if(t<=n[l]){o=(l-1)/r,i=l/r,s=(t-(a=n[l-1]))/(n[l]-a)*(i-o)+o;break}return s}function s(e,t){return l.normalize(l.subtract(e,t))}var l=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"zeros_Xx2x2",value:function(e){for(var t=[];e--;)t.push([0,0]);return t}},{key:"mulItems",value:function(e,t){return e.map((function(e){return e*t}))}},{key:"mulMatrix",value:function(e,t){return e.reduce((function(e,n,r){return e+n*t[r]}),0)}},{key:"subtract",value:function(e,t){return e.map((function(e,n){return e-t[n]}))}},{key:"addArrays",value:function(e,t){return e.map((function(e,n){return e+t[n]}))}},{key:"addItems",value:function(e,t){return e.map((function(e){return e+t}))}},{key:"sum",value:function(e){return e.reduce((function(e,t){return e+t}))}},{key:"dot",value:function(t,n){return e.mulMatrix(t,n)}},{key:"vectorLen",value:function(e){return Math.hypot.apply(Math,_toConsumableArray(e))}},{key:"divItems",value:function(e,t){return e.map((function(e){return e/t}))}},{key:"squareItems",value:function(e){return e.map((function(e){return e*e}))}},{key:"normalize",value:function(e){return this.divItems(e,this.vectorLen(e))}}]),e}(),c=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"q",value:function(e,t){var n=1-t,r=l.mulItems(e[0],n*n*n),a=l.mulItems(e[1],3*n*n*t),i=l.mulItems(e[2],3*n*t*t),o=l.mulItems(e[3],t*t*t);return l.addArrays(l.addArrays(r,a),l.addArrays(i,o))}},{key:"qprime",value:function(e,t){var n=1-t,r=l.mulItems(l.subtract(e[1],e[0]),3*n*n),a=l.mulItems(l.subtract(e[2],e[1]),6*n*t),i=l.mulItems(l.subtract(e[3],e[2]),3*t*t);return l.addArrays(l.addArrays(r,a),i)}},{key:"qprimeprime",value:function(e,t){return l.addArrays(l.mulItems(l.addArrays(l.subtract(e[2],l.mulItems(e[1],2)),e[0]),6*(1-t)),l.mulItems(l.addArrays(l.subtract(e[3],l.mulItems(e[2],2)),e[1]),6*t))}}]),e}();e.exports=function(e,n,r){if(!Array.isArray(e))throw new TypeError("First argument should be an array");if(e.forEach((function(t){if(!Array.isArray(t)||t.some((function(e){return"number"!==typeof e}))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")})),(e=e.filter((function(t,n){return 0===n||!t.every((function(t,r){return t===e[n-1][r]}))}))).length<2)return[];var a=e.length,i=s(e[1],e[0]),o=s(e[a-2],e[a-1]);return t(e,i,o,n,r)},e.exports.fitCubic=t,e.exports.createTangent=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var r=n(1),a=n(6),i=n(3),o=n(33),s=n(34),l=1e3,c=new WeakSet;function u(e){return{width:e[2]-e[0],height:e[3]-e[1]}}var d=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"create",value:function(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new v(e);case r.AnnotationType.TEXT:return new y(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new b(e);case"Btn":return e.data.radioButton?new S(e):e.data.checkBox?new k(e):new w(e);case"Ch":return new P(e)}return new _(e);case r.AnnotationType.POPUP:return new x(e);case r.AnnotationType.FREETEXT:return new C(e);case r.AnnotationType.LINE:return new E(e);case r.AnnotationType.SQUARE:return new F(e);case r.AnnotationType.CIRCLE:return new T(e);case r.AnnotationType.POLYLINE:return new M(e);case r.AnnotationType.CARET:return new I(e);case r.AnnotationType.INK:return new O(e);case r.AnnotationType.POLYGON:return new R(e);case r.AnnotationType.HIGHLIGHT:return new L(e);case r.AnnotationType.UNDERLINE:return new D(e);case r.AnnotationType.SQUIGGLY:return new N(e);case r.AnnotationType.STRIKEOUT:return new G(e);case r.AnnotationType.STAMP:return new j(e);case r.AnnotationType.FILEATTACHMENT:return new z(e);default:return new h(e)}}}]),e}(),h=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.isRenderable,a=void 0!==r&&r,i=n.ignoreBorder,o=void 0!==i&&i,s=n.createQuadrilaterals,l=void 0!==s&&s;_classCallCheck(this,e),this.isRenderable=a,this.data=t.data,this.layer=t.layer,this.page=t.page,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,a&&(this.container=this._createContainer(o)),l&&(this.quadrilaterals=this._createQuadrilaterals(o))}return _createClass(e,[{key:"_createContainer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.data,n=this.page,a=this.viewport,i=document.createElement("section");i.setAttribute("data-annotation-id",t.id);var o=a.rawDims,s=o.pageWidth,l=o.pageHeight,c=o.pageX,d=o.pageY,h=u(t.rect),f=h.width,p=h.height,v=r.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(!e&&t.borderStyle.width>0){i.style.borderWidth="".concat(t.borderStyle.width,"px");var g=t.borderStyle.horizontalCornerRadius,m=t.borderStyle.verticalCornerRadius;if(g>0||m>0){var y="calc(".concat(g,"px * var(--scale-factor)) / calc(").concat(m,"px * var(--scale-factor))");i.style.borderRadius=y}else if(this instanceof S){var _="calc(".concat(f,"px * var(--scale-factor)) / calc(").concat(p,"px * var(--scale-factor))");i.style.borderRadius=_}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid"}var b=t.borderColor||null;b?i.style.borderColor=r.Util.makeHexColor(0|b[0],0|b[1],0|b[2]):i.style.borderWidth=0}i.style.left="".concat(100*(v[0]-c)/s,"%"),i.style.top="".concat(100*(v[1]-d)/l,"%");var k=t.rotation;return t.hasOwnCanvas||0===k?(i.style.width="".concat(100*f/s,"%"),i.style.height="".concat(100*p/l,"%")):this.setRotation(k,i),i}},{key:"setRotation",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container,a=this.viewport.rawDims,i=a.pageWidth,o=a.pageHeight,s=u(this.data.rect),l=s.width,c=s.height;e%180===0?(t=100*l/i,n=100*c/o):(t=100*c/i,n=100*l/o),r.style.width="".concat(t,"%"),r.style.height="".concat(n,"%"),r.setAttribute("data-main-rotation",(360-e)%360)}},{key:"_commonActions",get:function(){var e=this,t=function(e,t,n){var r=n.detail[e];n.target.style[t]=o.ColorConverters["".concat(r[0],"_HTML")](r.slice(1))};return(0,r.shadow)(this,"_commonActions",{display:function(t){var n=t.detail.display%2===1;e.container.style.visibility=n?"hidden":"visible",e.annotationStorage.setValue(e.data.id,{hidden:n,print:0===t.detail.display||3===t.detail.display})},print:function(t){e.annotationStorage.setValue(e.data.id,{print:t.detail.print})},hidden:function(t){e.container.style.visibility=t.detail.hidden?"hidden":"visible",e.annotationStorage.setValue(e.data.id,{hidden:t.detail.hidden})},focus:function(e){setTimeout((function(){return e.target.focus({preventScroll:!1})}),0)},userName:function(e){e.target.title=e.detail.userName},readonly:function(e){e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:function(t){e._setRequired(t.target,t.detail.required)},bgColor:function(e){t("bgColor","backgroundColor",e)},fillColor:function(e){t("fillColor","backgroundColor",e)},fgColor:function(e){t("fgColor","color",e)},textColor:function(e){t("textColor","color",e)},borderColor:function(e){t("borderColor","borderColor",e)},strokeColor:function(e){t("strokeColor","borderColor",e)},rotation:function(t){var n=t.detail.rotation;e.setRotation(n),e.annotationStorage.setValue(e.data.id,{rotation:n})}})}},{key:"_dispatchEventFromSandbox",value:function(e,t){for(var n=this._commonActions,r=0,a=Object.keys(t.detail);r0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;var t,n=[],r=this.data.rect,a=_createForOfIteratorHelper(this.data.quadPoints);try{for(a.s();!(t=a.n()).done;){var i=t.value;this.data.rect=[i[2].x,i[2].y,i[1].x,i[1].y],n.push(this._createContainer(e))}}catch(o){a.e(o)}finally{a.f()}return this.data.rect=r,n}},{key:"_createPopup",value:function(e,t){var n=this.container;this.quadrilaterals&&(e=e||this.quadrilaterals,n=this.quadrilaterals[0]),e||((e=document.createElement("div")).className="popupTriggerArea",n.append(e));var r=new A({container:n,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();r.style.left="100%",n.append(r)}},{key:"_renderQuadrilaterals",value:function(e){var t,n=_createForOfIteratorHelper(this.quadrilaterals);try{for(n.s();!(t=n.n()).done;)t.value.className=e}catch(r){n.e(r)}finally{n.f()}return this.quadrilaterals}},{key:"render",value:function(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}},{key:"_getElementsByName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=[];if(this._fieldObjects){var a=this._fieldObjects[e];if(a){var i,o=_createForOfIteratorHelper(a);try{for(o.s();!(i=o.n()).done;){var s=i.value,l=s.page,u=s.id,d=s.exportValues;if(-1!==l&&u!==t){var h="string"===typeof d?d:null,f=document.querySelector('[data-element-id="'.concat(u,'"]'));!f||c.has(f)?n.push({id:u,exportValue:h,domElement:f}):(0,r.warn)("_getElementsByName - element not allowed: ".concat(u))}}}catch(_){o.e(_)}finally{o.f()}}return n}var p,v=_createForOfIteratorHelper(document.getElementsByName(e));try{for(v.s();!(p=v.n()).done;){var g=p.value,m=g.exportValue,y=g.getAttribute("data-element-id");y!==t&&c.has(g)&&n.push({id:y,exportValue:m,domElement:g})}}catch(_){v.e(_)}finally{v.f()}return n}}]),e}(),f=new WeakSet,p=new WeakSet,v=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return _classCallCheck(this,n),r=t.call(this,e,{isRenderable:!0,ignoreBorder:!(null===a||void 0===a||!a.ignoreBorder),createQuadrilaterals:!0}),_classPrivateMethodInitSpec(_assertThisInitialized(r),p),_classPrivateMethodInitSpec(_assertThisInitialized(r),f),r.isTooltipOnly=e.data.isTooltipOnly,r}return _createClass(n,[{key:"render",value:function(){var e=this.data,t=this.linkService,n=document.createElement("a");n.setAttribute("data-element-id",e.id);var r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(this._bindAttachment(n,e.attachment),r=!0):e.setOCGState?(_classPrivateMethodGet(this,p,m).call(this,n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((function(e,t){var r=0===t?n:n.cloneNode();return e.append(r),e})):(this.container.className="linkAnnotation",r&&this.container.append(n),this.container)}},{key:"_bindLink",value:function(e,t){var n=this;e.href=this.linkService.getDestinationHash(t),e.onclick=function(){return t&&n.linkService.goToDestination(t),!1},(t||""===t)&&_classPrivateMethodGet(this,f,g).call(this)}},{key:"_bindNamedAction",value:function(e,t){var n=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){return n.linkService.executeNamedAction(t),!1},_classPrivateMethodGet(this,f,g).call(this)}},{key:"_bindAttachment",value:function(e,t){var n=this;e.href=this.linkService.getAnchorUrl(""),e.onclick=function(){var e;return null===(e=n.downloadManager)||void 0===e||e.openOrDownloadData(n.container,t.content,t.filename),!1},_classPrivateMethodGet(this,f,g).call(this)}},{key:"_bindJSAction",value:function(e,t){var n=this;e.href=this.linkService.getAnchorUrl("");for(var r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]),a=function(){var a=o[i],s=r.get(a);if(!s)return"continue";e[s]=function(){var e;return null===(e=n.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:n,detail:{id:t.id,name:a}}),!1}},i=0,o=Object.keys(t.actions);io&&(i=i.slice(0,o));var s={userValue:i,formattedValue:null,lastCommittedValue:null,commitKey:1};this.data.multiLine?((r=document.createElement("textarea")).textContent=i,this.data.doNotScroll&&(r.style.overflowY="hidden")):((r=document.createElement("input")).type="text",r.setAttribute("value",i),this.data.doNotScroll&&(r.style.overflowX="hidden")),c.add(r),r.setAttribute("data-element-id",n),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=l,this._setRequired(r,this.data.required),o&&(r.maxLength=o),r.addEventListener("input",(function(a){t.setValue(n,{value:a.target.value}),e.setPropertyOnSiblings(r,"value",a.target.value,"value")})),r.addEventListener("resetform",(function(t){var n,a=null!==(n=e.data.defaultFieldValue)&&void 0!==n?n:"";r.value=s.userValue=a,s.formattedValue=null}));var u=function(e){var t=s.formattedValue;null!==t&&void 0!==t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var d;r.addEventListener("focus",(function(e){var t=e.target;s.userValue&&(t.value=s.userValue),s.lastCommittedValue=t.value,s.commitKey=1})),r.addEventListener("updatefromsandbox",(function(r){var a={value:function(e){var r;s.userValue=null!==(r=e.detail.value)&&void 0!==r?r:"",t.setValue(n,{value:s.userValue.toString()}),e.target.value=s.userValue},formattedValue:function(e){var r=e.detail.formattedValue;s.formattedValue=r,null!==r&&void 0!==r&&e.target!==document.activeElement&&(e.target.value=r),t.setValue(n,{formattedValue:r})},selRange:function(e){var t;(t=e.target).setSelectionRange.apply(t,_toConsumableArray(e.detail.selRange))},charLimit:function(r){var a,i=r.detail.charLimit,o=r.target;if(0!==i){o.setAttribute("maxLength",i);var l=s.userValue;!l||l.length<=i||(l=l.slice(0,i),o.value=s.userValue=l,t.setValue(n,{value:l}),null===(a=e.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:e,detail:{id:n,name:"Keystroke",value:l,willCommit:!0,commitKey:1,selStart:o.selectionStart,selEnd:o.selectionEnd}}))}else o.removeAttribute("maxLength")}};e._dispatchEventFromSandbox(a,r)})),r.addEventListener("keydown",(function(t){var r;s.commitKey=1;var a=-1;if("Escape"===t.key?a=0:"Enter"!==t.key||e.data.multiLine?"Tab"===t.key&&(s.commitKey=3):a=2,-1!==a){var i=t.target.value;s.lastCommittedValue!==i&&(s.lastCommittedValue=i,s.userValue=i,null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:n,name:"Keystroke",value:i,willCommit:!0,commitKey:a,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}}));var h=u;u=null,r.addEventListener("blur",(function(t){if(t.relatedTarget){var r,a=t.target.value;s.userValue=a,s.lastCommittedValue!==a&&(null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:n,name:"Keystroke",value:a,willCommit:!0,commitKey:s.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),h(t)}})),null!==(d=this.data.actions)&&void 0!==d&&d.Keystroke&&r.addEventListener("beforeinput",(function(t){var r;s.lastCommittedValue=null;var a=t.data,i=t.target,o=i.value,l=i.selectionStart,c=i.selectionEnd,u=l,d=c;switch(t.inputType){case"deleteWordBackward":var h=o.substring(0,l).match(/\w*[^\w]*$/);h&&(u-=h[0].length);break;case"deleteWordForward":var f=o.substring(l).match(/^[^\w]*\w*/);f&&(d+=f[0].length);break;case"deleteContentBackward":l===c&&(u-=1);break;case"deleteContentForward":l===c&&(d+=1)}t.preventDefault(),null===(r=e.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:e,detail:{id:n,name:"Keystroke",value:o,change:a||"",willCommit:!1,selStart:u,selEnd:d}})})),this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.value}))}if(u&&r.addEventListener("blur",u),this.data.comb){var f=(this.data.rect[2]-this.data.rect[0])/o;r.classList.add("comb"),r.style.letterSpacing="calc(".concat(f,"px * var(--scale-factor) - 1ch)")}}else(r=document.createElement("div")).textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell";return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}]),n}(_),k=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(n,[{key:"render",value:function(){var e=this,t=this.annotationStorage,n=this.data,r=n.id,a=t.getValue(r,{value:n.exportValue===n.fieldValue}).value;"string"===typeof a&&(a="Off"!==a,t.setValue(r,{value:a})),this.container.className="buttonWidgetAnnotation checkBox";var i=document.createElement("input");return c.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=n.fieldName,a&&i.setAttribute("checked",!0),i.setAttribute("exportValue",n.exportValue),i.tabIndex=l,i.addEventListener("change",(function(a){var i,o=a.target,s=o.name,l=o.checked,c=_createForOfIteratorHelper(e._getElementsByName(s,r));try{for(c.s();!(i=c.n()).done;){var u=i.value,d=l&&u.exportValue===n.exportValue;u.domElement&&(u.domElement.checked=d),t.setValue(u.id,{value:d})}}catch(h){c.e(h)}finally{c.f()}t.setValue(r,{value:l})})),i.addEventListener("resetform",(function(e){var t=n.defaultFieldValue||"Off";e.target.checked=t===n.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(function(n){var a={value:function(e){e.target.checked="Off"!==e.detail.value,t.setValue(r,{value:e.target.checked})}};e._dispatchEventFromSandbox(a,n)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.checked}))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}]),n}(_),S=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(n,[{key:"render",value:function(){var e=this;this.container.className="buttonWidgetAnnotation radioButton";var t=this.annotationStorage,n=this.data,r=n.id,a=t.getValue(r,{value:n.fieldValue===n.buttonValue}).value;"string"===typeof a&&(a=a!==n.buttonValue,t.setValue(r,{value:a}));var i=document.createElement("input");if(c.add(i),i.setAttribute("data-element-id",r),i.disabled=n.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=n.fieldName,a&&i.setAttribute("checked",!0),i.tabIndex=l,i.addEventListener("change",(function(n){var a,i=n.target,o=i.name,s=i.checked,l=_createForOfIteratorHelper(e._getElementsByName(o,r));try{for(l.s();!(a=l.n()).done;){var c=a.value;t.setValue(c.id,{value:!1})}}catch(u){l.e(u)}finally{l.f()}t.setValue(r,{value:s})})),i.addEventListener("resetform",(function(e){var t=n.defaultFieldValue;e.target.checked=null!==t&&void 0!==t&&t===n.buttonValue})),this.enableScripting&&this.hasJSActions){var o=n.buttonValue;i.addEventListener("updatefromsandbox",(function(n){var a={value:function(n){var a,i=o===n.detail.value,s=_createForOfIteratorHelper(e._getElementsByName(n.target.name));try{for(s.s();!(a=s.n()).done;){var l=a.value,c=i&&l.id===r;l.domElement&&(l.domElement.checked=c),t.setValue(l.id,{value:c})}}catch(u){s.e(u)}finally{s.f()}}};e._dispatchEventFromSandbox(a,n)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(function(e){return e.target.checked}))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}]),n}(_),w=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,{ignoreBorder:e.data.hasAppearance})}return _createClass(n,[{key:"render",value:function(){var e=this,t=_get(_getPrototypeOf(n.prototype),"render",this).call(this);t.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(t.title=this.data.alternativeText);var r=t.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",(function(t){e._dispatchEventFromSandbox({},t)}))),t}}]),n}(v),P=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e,{isRenderable:e.renderForms})}return _createClass(n,[{key:"render",value:function(){var e=this;this.container.className="choiceWidgetAnnotation";var t=this.annotationStorage,n=this.data.id,r=t.getValue(n,{value:this.data.fieldValue}),a=document.createElement("select");c.add(a),a.setAttribute("data-element-id",n),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=l;var i=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",(function(t){var n,r=e.data.defaultFieldValue,i=_createForOfIteratorHelper(a.options);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.selected=o.value===r}}catch(s){i.e(s)}finally{i.f()}}));var o,s=_createForOfIteratorHelper(this.data.options);try{for(s.s();!(o=s.n()).done;){var u=o.value,d=document.createElement("option");d.textContent=u.displayValue,d.value=u.exportValue,r.value.includes(u.exportValue)&&(d.setAttribute("selected",!0),i=!1),a.append(d)}}catch(m){s.e(m)}finally{s.f()}var h=null;if(i){var f=document.createElement("option");f.value=" ",f.setAttribute("hidden",!0),f.setAttribute("selected",!0),a.prepend(f),h=function(){f.remove(),a.removeEventListener("input",h),h=null},a.addEventListener("input",h)}var p=function(e){var t=e?"value":"textContent",n=a.options;return a.multiple?Array.prototype.filter.call(n,(function(e){return e.selected})).map((function(e){return e[t]})):-1===n.selectedIndex?null:n[n.selectedIndex][t]},v=p(!1),g=function(e){var t=e.target.options;return Array.prototype.map.call(t,(function(e){return{displayValue:e.textContent,exportValue:e.value}}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",(function(r){var i={value:function(e){var r;null===(r=h)||void 0===r||r();var i,o=e.detail.value,s=new Set(Array.isArray(o)?o:[o]),l=_createForOfIteratorHelper(a.options);try{for(l.s();!(i=l.n()).done;){var c=i.value;c.selected=s.has(c.value)}}catch(m){l.e(m)}finally{l.f()}t.setValue(n,{value:p(!0)}),v=p(!1)},multipleSelection:function(e){a.multiple=!0},remove:function(e){var r=a.options,i=e.detail.remove;if(r[i].selected=!1,a.remove(i),r.length>0){var o=Array.prototype.findIndex.call(r,(function(e){return e.selected}));-1===o&&(r[0].selected=!0)}t.setValue(n,{value:p(!0),items:g(e)}),v=p(!1)},clear:function(e){for(;0!==a.length;)a.remove(0);t.setValue(n,{value:null,items:[]}),v=p(!1)},insert:function(e){var r=e.detail.insert,i=r.index,o=r.displayValue,s=r.exportValue,l=a.children[i],c=document.createElement("option");c.textContent=o,c.value=s,l?l.before(c):a.append(c),t.setValue(n,{value:p(!0),items:g(e)}),v=p(!1)},items:function(e){for(var r=e.detail.items;0!==a.length;)a.remove(0);var i,o=_createForOfIteratorHelper(r);try{for(o.s();!(i=o.n()).done;){var s=i.value,l=s.displayValue,c=s.exportValue,u=document.createElement("option");u.textContent=l,u.value=c,a.append(u)}}catch(m){o.e(m)}finally{o.f()}a.options.length>0&&(a.options[0].selected=!0),t.setValue(n,{value:p(!0),items:g(e)}),v=p(!1)},indices:function(e){var r,a=new Set(e.detail.indices),i=_createForOfIteratorHelper(e.target.options);try{for(i.s();!(r=i.n()).done;){var o=r.value;o.selected=a.has(o.index)}}catch(m){i.e(m)}finally{i.f()}t.setValue(n,{value:p(!0)}),v=p(!1)},editable:function(e){e.target.disabled=!e.detail.editable}};e._dispatchEventFromSandbox(i,r)})),a.addEventListener("input",(function(r){var a,i=p(!0);t.setValue(n,{value:i}),r.preventDefault(),null===(a=e.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:e,detail:{id:n,name:"Keystroke",value:v,changeEx:i,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(a,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(function(e){return e.target.value}))):a.addEventListener("input",(function(e){t.setValue(n,{value:p(!0)})})),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}]),n}(_),x=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=e.data,s=!n.IGNORE_TYPES.has(o.parentType)&&!!(null!==(r=o.titleObj)&&void 0!==r&&r.str||null!==(a=o.contentsObj)&&void 0!==a&&a.str||null!==(i=o.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:s})}return _createClass(n,[{key:"render",value:function(){this.container.className="popupAnnotation";var e=this.layer.querySelectorAll('[data-annotation-id="'.concat(this.data.parentId,'"]'));if(0===e.length)return this.container;var t=new A({container:this.container,trigger:Array.from(e),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),n=this.page,a=r.Util.normalizeRect([this.data.parentRect[0],n.view[3]-this.data.parentRect[1]+n.view[1],this.data.parentRect[2],n.view[3]-this.data.parentRect[3]+n.view[1]]),i=a[0]+this.data.parentRect[2]-this.data.parentRect[0],o=a[1],s=this.viewport.rawDims,l=s.pageWidth,c=s.pageHeight,u=s.pageX,d=s.pageY;return this.container.style.left="".concat(100*(i-u)/l,"%"),this.container.style.top="".concat(100*(o-d)/c,"%"),this.container.append(t.render()),this.container}}]),n}(h);_defineProperty(x,"IGNORE_TYPES",new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]));var A=function(){function e(t){_classCallCheck(this,e),this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.titleObj=t.titleObj,this.modificationDate=t.modificationDate,this.contentsObj=t.contentsObj,this.richText=t.richText,this.hideWrapper=t.hideWrapper||!1,this.pinned=!1}return _createClass(e,[{key:"render",value:function(){var e,t,n=document.createElement("div");n.className="popupWrapper",this.hideElement=this.hideWrapper?n:this.container,this.hideElement.hidden=!0;var i=document.createElement("div");i.className="popup";var o=this.color;if(o){var l=.7*(255-o[0])+o[0],c=.7*(255-o[1])+o[1],u=.7*(255-o[2])+o[2];i.style.backgroundColor=r.Util.makeHexColor(0|l,0|c,0|u)}var d=document.createElement("h1");d.dir=this.titleObj.dir,d.textContent=this.titleObj.str,i.append(d);var h=a.PDFDateString.toDateObject(this.modificationDate);if(h){var f=document.createElement("span");f.className="popupDate",f.textContent="{{date}}, {{time}}",f.dataset.l10nId="annotation_date_string",f.dataset.l10nArgs=JSON.stringify({date:h.toLocaleDateString(),time:h.toLocaleTimeString()}),i.append(f)}if(null===(e=this.richText)||void 0===e||!e.str||null!==(t=this.contentsObj)&&void 0!==t&&t.str&&this.contentsObj.str!==this.richText.str){var p=this._formatContents(this.contentsObj);i.append(p)}else s.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:i}),i.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);var v,g=_createForOfIteratorHelper(this.trigger);try{for(g.s();!(v=g.n()).done;){var m=v.value;m.addEventListener("click",this._toggle.bind(this)),m.addEventListener("mouseover",this._show.bind(this,!1)),m.addEventListener("mouseout",this._hide.bind(this,!1))}}catch(y){g.e(y)}finally{g.f()}return i.addEventListener("click",this._hide.bind(this,!0)),n.append(i),n}},{key:"_formatContents",value:function(e){var t=e.str,n=e.dir,r=document.createElement("p");r.className="popupContent",r.dir=n;for(var a=t.split(/(?:\r\n?|\n)/),i=0,o=a.length;i0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}},{key:"_hide",value:function(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}]),e}(),C=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i,o;_classCallCheck(this,n);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(o=t.call(this,e,{isRenderable:s,ignoreBorder:!0})).textContent=e.data.textContent,o}return _createClass(n,[{key:"render",value:function(){if(this.container.className="freeTextAnnotation",this.textContent){var e=document.createElement("div");e.className="annotationTextContent",e.setAttribute("role","comment");var t,n=_createForOfIteratorHelper(this.textContent);try{for(n.s();!(t=n.n()).done;){var r=t.value,a=document.createElement("span");a.textContent=r,e.append(a)}}catch(i){n.e(i)}finally{n.f()}this.container.append(e)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),n}(h),E=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0})}return _createClass(n,[{key:"render",value:function(){this.container.className="lineAnnotation";var e=this.data,t=u(e.rect),n=t.width,r=t.height,a=this.svgFactory.create(n,r,!0),i=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),a.append(i),this.container.append(a),this._createPopup(i,e),this.container}}]),n}(h),F=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0})}return _createClass(n,[{key:"render",value:function(){this.container.className="squareAnnotation";var e=this.data,t=u(e.rect),n=t.width,r=t.height,a=this.svgFactory.create(n,r,!0),i=e.borderStyle.width,o=this.svgFactory.createElement("svg:rect");return o.setAttribute("x",i/2),o.setAttribute("y",i/2),o.setAttribute("width",n-i),o.setAttribute("height",r-i),o.setAttribute("stroke-width",i||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),a.append(o),this.container.append(a),this._createPopup(o,e),this.container}}]),n}(h),T=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0})}return _createClass(n,[{key:"render",value:function(){this.container.className="circleAnnotation";var e=this.data,t=u(e.rect),n=t.width,r=t.height,a=this.svgFactory.create(n,r,!0),i=e.borderStyle.width,o=this.svgFactory.createElement("svg:ellipse");return o.setAttribute("cx",n/2),o.setAttribute("cy",r/2),o.setAttribute("rx",n/2-i/2),o.setAttribute("ry",r/2-i/2),o.setAttribute("stroke-width",i||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),a.append(o),this.container.append(a),this._createPopup(o,e),this.container}}]),n}(h),M=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i,o;_classCallCheck(this,n);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(o=t.call(this,e,{isRenderable:s,ignoreBorder:!0})).containerClassName="polylineAnnotation",o.svgElementName="svg:polyline",o}return _createClass(n,[{key:"render",value:function(){this.container.className=this.containerClassName;var e,t=this.data,n=u(t.rect),r=n.width,a=n.height,i=this.svgFactory.create(r,a,!0),o=[],s=_createForOfIteratorHelper(t.vertices);try{for(s.s();!(e=s.n()).done;){var l=e.value,c=l.x-t.rect[0],d=t.rect[3]-l.y;o.push(c+","+d)}}catch(f){s.e(f)}finally{s.f()}o=o.join(" ");var h=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",o),h.setAttribute("stroke-width",t.borderStyle.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),i.append(h),this.container.append(i),this._createPopup(h,t),this.container}}]),n}(h),R=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;return _classCallCheck(this,n),(r=t.call(this,e)).containerClassName="polygonAnnotation",r.svgElementName="svg:polygon",r}return _createClass(n)}(M),I=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0})}return _createClass(n,[{key:"render",value:function(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),n}(h),O=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i,o;_classCallCheck(this,n);var s=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return(o=t.call(this,e,{isRenderable:s,ignoreBorder:!0})).containerClassName="inkAnnotation",o.svgElementName="svg:polyline",o}return _createClass(n,[{key:"render",value:function(){this.container.className=this.containerClassName;var e,t=this.data,n=u(t.rect),r=n.width,a=n.height,i=this.svgFactory.create(r,a,!0),o=_createForOfIteratorHelper(t.inkLists);try{for(o.s();!(e=o.n()).done;){var s,l=e.value,c=[],d=_createForOfIteratorHelper(l);try{for(d.s();!(s=d.n()).done;){var h=s.value,f=h.x-t.rect[0],p=t.rect[3]-h.y;c.push("".concat(f,",").concat(p))}}catch(g){d.e(g)}finally{d.f()}c=c.join(" ");var v=this.svgFactory.createElement(this.svgElementName);v.setAttribute("points",c),v.setAttribute("stroke-width",t.borderStyle.width||1),v.setAttribute("stroke","transparent"),v.setAttribute("fill","transparent"),this._createPopup(v,t),i.append(v)}}catch(g){o.e(g)}finally{o.f()}return this.container.append(i),this.container}}]),n}(h),L=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(n,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}]),n}(h),D=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(n,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}]),n}(h),N=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(n,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}]),n}(h),G=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0,createQuadrilaterals:!0})}return _createClass(n,[{key:"render",value:function(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}]),n}(h),j=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,a,i;_classCallCheck(this,n);var o=!!(e.data.hasPopup||null!==(r=e.data.titleObj)&&void 0!==r&&r.str||null!==(a=e.data.contentsObj)&&void 0!==a&&a.str||null!==(i=e.data.richText)&&void 0!==i&&i.str);return t.call(this,e,{isRenderable:o,ignoreBorder:!0})}return _createClass(n,[{key:"render",value:function(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}]),n}(h),z=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,i;_classCallCheck(this,n);var o=(i=t.call(this,e,{isRenderable:!0})).data.file,s=o.filename,l=o.content;return i.filename=(0,a.getFilenameFromUrl)(s,!0),i.content=l,null===(r=i.linkService.eventBus)||void 0===r||r.dispatch("fileattachmentannotation",{source:_assertThisInitialized(i),filename:s,content:l}),i}return _createClass(n,[{key:"render",value:function(){var e,t,n;return this.container.className="fileAttachmentAnnotation",this.data.hasAppearance?n=document.createElement("div"):(n=document.createElement("img")).src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(this.data.name)?"paperclip":"pushpin",".svg"),n.className="popupTriggerArea",n.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(null!==(e=this.data.titleObj)&&void 0!==e&&e.str||null!==(t=this.data.contentsObj)&&void 0!==t&&t.str||this.data.richText)&&this._createPopup(n,this.data),this.container.append(n),this.container}},{key:"_download",value:function(){var e;null===(e=this.downloadManager)||void 0===e||e.openOrDownloadData(this.container,this.content,this.filename)}}]),n}(h),B=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"render",value:function(t){var n=t.annotations,o=t.div,s=t.viewport,l=t.accessibilityManager;(0,a.setLayerDimensions)(o,s);var c,h={data:null,layer:o,page:t.page,viewport:s,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new a.DOMSVGFactory,annotationStorage:t.annotationStorage||new i.AnnotationStorage,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects},f=0,p=_createForOfIteratorHelper(n);try{for(p.s();!(c=p.n()).done;){var v=c.value;if(v.annotationType!==r.AnnotationType.POPUP){var g=u(v.rect),m=g.width,y=g.height;if(m<=0||y<=0)continue}h.data=v;var _=d.create(h);if(_.isRenderable){var b=_.render();if(v.hidden&&(b.style.visibility="hidden"),Array.isArray(b)){var k,S=_createForOfIteratorHelper(b);try{for(S.s();!(k=S.n()).done;){var w=k.value;w.style.zIndex=f++,_classStaticPrivateMethodGet(e,e,H).call(e,w,v.id,o,l)}}catch(P){S.e(P)}finally{S.f()}}else b.style.zIndex=f++,_ instanceof x?o.prepend(b):_classStaticPrivateMethodGet(e,e,H).call(e,b,v.id,o,l)}}}catch(P){p.e(P)}finally{p.f()}_classStaticPrivateMethodGet(this,e,U).call(this,o,t.annotationCanvasMap)}},{key:"update",value:function(t){var n=t.annotationCanvasMap,r=t.div,i=t.viewport;(0,a.setLayerDimensions)(r,{rotation:i.rotation}),_classStaticPrivateMethodGet(this,e,U).call(this,r,n),r.hidden=!1}}]),e}();function H(e,t,n,r){var i=e.firstChild||e;i.id="".concat(a.AnnotationPrefix).concat(t),n.append(e),null===r||void 0===r||r.moveElementInDOM(n,e,i,!1)}function U(e,t){if(t){var n,r=_createForOfIteratorHelper(t);try{for(r.s();!(n=r.n()).done;){var a=_slicedToArray(n.value,2),i=a[0],o=a[1],s=e.querySelector('[data-annotation-id="'.concat(i,'"]'));if(s){var l=s.firstChild;l?"CANVAS"===l.nodeName?l.replaceWith(o):l.before(o):s.append(o)}}}catch(c){r.e(c)}finally{r.f()}t.clear()}}t.AnnotationLayer=B},function(e,t){function n(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0;var r=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"CMYK_G",value:function(e){var t=_slicedToArray(e,4),n=t[0],r=t[1],a=t[2],i=t[3];return["G",1-Math.min(1,.3*n+.59*a+.11*r+i)]}},{key:"G_CMYK",value:function(e){return["CMYK",0,0,0,1-_slicedToArray(e,1)[0]]}},{key:"G_RGB",value:function(e){var t=_slicedToArray(e,1)[0];return["RGB",t,t,t]}},{key:"G_HTML",value:function(e){var t=n(_slicedToArray(e,1)[0]);return"#".concat(t).concat(t).concat(t)}},{key:"RGB_G",value:function(e){var t=_slicedToArray(e,3);return["G",.3*t[0]+.59*t[1]+.11*t[2]]}},{key:"RGB_HTML",value:function(e){var t=_slicedToArray(e,3),r=t[0],a=t[1],i=t[2],o=n(r),s=n(a),l=n(i);return"#".concat(o).concat(s).concat(l)}},{key:"T_HTML",value:function(){return"#00000000"}},{key:"CMYK_RGB",value:function(e){var t=_slicedToArray(e,4),n=t[0],r=t[1],a=t[2],i=t[3];return["RGB",1-Math.min(1,n+i),1-Math.min(1,a+i),1-Math.min(1,r+i)]}},{key:"CMYK_HTML",value:function(e){var t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}},{key:"RGB_CMYK",value:function(e){var t=_slicedToArray(e,3),n=1-t[0],r=1-t[1],a=1-t[2];return["CMYK",n,r,a,Math.min(n,r,a)]}}]),e}();t.ColorConverters=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=n(19),a=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"setupStorage",value:function(e,t,n,r,a){var i=r.getValue(t,{value:null});switch(n.name){case"textarea":if(null!==i.value&&(e.textContent=i.value),"print"===a)break;e.addEventListener("input",(function(e){r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){if(i.value===n.attributes.xfaOn?e.setAttribute("checked",!0):i.value===n.attributes.xfaOff&&e.removeAttribute("checked"),"print"===a)break;e.addEventListener("change",(function(e){r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==i.value&&e.setAttribute("value",i.value),"print"===a)break;e.addEventListener("input",(function(e){r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==i.value){var o,s=_createForOfIteratorHelper(n.children);try{for(s.s();!(o=s.n()).done;){var l=o.value;l.attributes.value===i.value&&(l.attributes.selected=!0)}}catch(c){s.e(c)}finally{s.f()}}e.addEventListener("input",(function(e){var n=e.target.options,a=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(t,{value:a})}))}}},{key:"setAttributes",value:function(e){var t=e.html,n=e.element,r=e.storage,a=void 0===r?null:r,i=e.intent,o=e.linkService,s=n.attributes,l=t instanceof HTMLAnchorElement;"radio"===s.type&&(s.name="".concat(s.name,"-").concat(i));for(var c=0,u=Object.entries(s);c0;){var d,h=s.at(-1),f=_slicedToArray(h,3),p=f[0],v=f[1],g=f[2];if(v+1!==p.children.length){var m=p.children[++s.at(-1)[1]];if(null!==m){var y=m.name;if("#text"!==y){var _=void 0;if(_=null!==m&&void 0!==m&&null!==(d=m.attributes)&&void 0!==d&&d.xmlns?document.createElementNS(m.attributes.xmlns,y):document.createElement(y),g.append(_),m.attributes&&this.setAttributes({html:_,element:m,storage:t,intent:i,linkService:n}),m.children&&m.children.length>0)s.push([m,-1,_]);else if(m.value){var b=document.createTextNode(m.value);r.XfaText.shouldBuildText(y)&&u.push(b),_.append(b)}}else{var k=document.createTextNode(m.value);u.push(k),g.append(k)}}}else s.pop()}var S,w=_createForOfIteratorHelper(l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"));try{for(w.s();!(S=w.n()).done;)S.value.setAttribute("readOnly",!0)}catch(P){w.e(P)}finally{w.f()}return{textDivs:u}}},{key:"update",value:function(e){var t="matrix(".concat(e.viewport.transform.join(","),")");e.div.style.transform=t,e.div.hidden=!1}}]),e}();t.XfaLayer=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=n(6),a=n(1),i=n(10),o=_createClass((function e(){_classCallCheck(this,e),(0,a.unreachable)("Not implemented: SVGGraphics")}));t.SVGGraphics=o;var s=function(e){if(Number.isInteger(e))return e.toString();var t=e.toFixed(10),n=t.length-1;if("0"!==t[n])return t;do{n--}while("0"===t[n]);return t.substring(0,"."===t[n]?n:n+1)},l=function(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":"scale(".concat(s(e[0])," ").concat(s(e[3]),")");if(e[0]===e[3]&&e[1]===-e[2]){var t=180*Math.acos(e[0])/Math.PI;return"rotate(".concat(s(t),")")}}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return"translate(".concat(s(e[4])," ").concat(s(e[5]),")");return"matrix(".concat(s(e[0])," ").concat(s(e[1])," ").concat(s(e[2])," ").concat(s(e[3])," ").concat(s(e[4])," ")+"".concat(s(e[5]),")")},c={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},u=["butt","round","square"],d=["miter","round","bevel"],h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&"undefined"!==typeof Blob&&!n)return URL.createObjectURL(new Blob([e],{type:t}));for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a="data:".concat(t,";base64,"),i=0,o=e.length;i>2]+r[(3&s)<<4|l>>4]+r[i+1>6:64]+r[i+2>1&2147483647:r>>1&2147483647;t[n]=r}function s(e,n,r,a){var i=a,o=n.length;r[i]=o>>24&255,r[i+1]=o>>16&255,r[i+2]=o>>8&255,r[i+3]=255&o,r[i+=4]=255&e.charCodeAt(0),r[i+1]=255&e.charCodeAt(1),r[i+2]=255&e.charCodeAt(2),r[i+3]=255&e.charCodeAt(3),i+=4,r.set(n,i);var s=function(e,n,r){for(var a=-1,i=n;i>>8^t[o]}return-1^a}(r,a+4,i+=n.length);r[i]=s>>24&255,r[i+1]=s>>16&255,r[i+2]=s>>8&255,r[i+3]=255&s}function l(e){var t=e.length,n=65535,r=Math.ceil(t/n),a=new Uint8Array(2+t+5*r+4),i=0;a[i++]=120,a[i++]=156;for(var o=0;t>n;)a[i++]=0,a[i++]=255,a[i++]=255,a[i++]=0,a[i++]=0,a.set(e.subarray(o,o+n),i),i+=n,o+=n,t-=n;a[i++]=1,a[i++]=255&t,a[i++]=t>>8&255,a[i++]=255&~t,a[i++]=(65535&~t)>>8&255,a.set(e.subarray(o),i),i+=e.length-o;var s=function(e,t,n){for(var r=1,a=0,i=t;i>24&255,a[i++]=s>>16&255,a[i++]=s>>8&255,a[i++]=255&s,a}function c(t,n,r,o){var c,u,d,f=t.width,p=t.height,v=t.data;switch(n){case a.ImageKind.GRAYSCALE_1BPP:u=0,c=1,d=f+7>>3;break;case a.ImageKind.RGB_24BPP:u=2,c=8,d=3*f;break;case a.ImageKind.RGBA_32BPP:u=6,c=8,d=4*f;break;default:throw new Error("invalid format")}for(var g=new Uint8Array((1+d)*p),m=0,y=0,_=0;_>24&255,f>>16&255,f>>8&255,255&f,p>>24&255,p>>16&255,p>>8&255,255&p,c,u,0,0,0]),w=function(e){if(!i.isNodeJS)return l(e);try{var t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);var n=__webpack_require__(2258).deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(r){(0,a.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+r)}return l(e)}(g),P=e.length+36+S.length+w.length,x=new Uint8Array(P),A=0;return x.set(e,A),s("IHDR",S,x,A+=e.length),s("IDATA",w,x,A+=12+S.length),A+=12+w.length,s("IEND",new Uint8Array(0),x,A),h(x,"image/png",r)}return function(e,t,n){return c(e,void 0===e.kind?a.ImageKind.GRAYSCALE_1BPP:e.kind,t,n)}}(),p=function(){function e(){_classCallCheck(this,e),this.fontSizeScale=1,this.fontWeight=c.fontWeight,this.fontSize=0,this.textMatrix=a.IDENTITY_MATRIX,this.fontMatrix=a.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=a.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=c.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}return _createClass(e,[{key:"clone",value:function(){return Object.create(this)}},{key:"setCurrentPoint",value:function(e,t){this.x=e,this.y=t}}]),e}(),v=0,g=0,m=0;t.SVGGraphics=o=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];for(var o in _classCallCheck(this,e),(0,r.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new r.DOMSVGFactory,this.current=new p,this.transformMatrix=a.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=t,this.objs=n,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!i,this._operatorIdMapping=[],a.OPS)this._operatorIdMapping[a.OPS[o]]=o}return _createClass(e,[{key:"getObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"===typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}},{key:"save",value:function(){this.transformStack.push(this.transformMatrix);var e=this.current;this.extraStack.push(e),this.current=e.clone()}},{key:"restore",value:function(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}},{key:"group",value:function(e){this.save(),this.executeOpTree(e),this.restore()}},{key:"loadDependencies",value:function(e){for(var t=this,n=e.fnArray,r=e.argsArray,i=0,o=n.length;i0&&(this.current.lineWidth=e)}},{key:"setLineCap",value:function(e){this.current.lineCap=u[e]}},{key:"setLineJoin",value:function(e){this.current.lineJoin=d[e]}},{key:"setMiterLimit",value:function(e){this.current.miterLimit=e}},{key:"setStrokeAlpha",value:function(e){this.current.strokeAlpha=e}},{key:"setStrokeRGBColor",value:function(e,t,n){this.current.strokeColor=a.Util.makeHexColor(e,t,n)}},{key:"setFillAlpha",value:function(e){this.current.fillAlpha=e}},{key:"setFillRGBColor",value:function(e,t,n){this.current.fillColor=a.Util.makeHexColor(e,t,n),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}},{key:"setStrokeColorN",value:function(e){this.current.strokeColor=this._makeColorN_Pattern(e)}},{key:"setFillColorN",value:function(e){this.current.fillColor=this._makeColorN_Pattern(e)}},{key:"shadingFill",value:function(e){var t=this.viewport.width,n=this.viewport.height,r=a.Util.inverseTransform(this.transformMatrix),i=a.Util.applyTransform([0,0],r),o=a.Util.applyTransform([0,n],r),s=a.Util.applyTransform([t,0],r),l=a.Util.applyTransform([t,n],r),c=Math.min(i[0],o[0],s[0],l[0]),u=Math.min(i[1],o[1],s[1],l[1]),d=Math.max(i[0],o[0],s[0],l[0]),h=Math.max(i[1],o[1],s[1],l[1]),f=this.svgFactory.createElement("svg:rect");f.setAttributeNS(null,"x",c),f.setAttributeNS(null,"y",u),f.setAttributeNS(null,"width",d-c),f.setAttributeNS(null,"height",h-u),f.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&f.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(f)}},{key:"_makeColorN_Pattern",value:function(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}},{key:"_makeTilingPattern",value:function(e){var t=e[1],n=e[2],r=e[3]||a.IDENTITY_MATRIX,i=_slicedToArray(e[4],4),o=i[0],s=i[1],l=i[2],c=i[3],u=e[5],d=e[6],h=e[7],f="shading".concat(m++),p=a.Util.normalizeRect([].concat(_toConsumableArray(a.Util.applyTransform([o,s],r)),_toConsumableArray(a.Util.applyTransform([l,c],r)))),v=_slicedToArray(p,4),g=v[0],y=v[1],_=v[2],b=v[3],k=a.Util.singularValueDecompose2dScale(r),S=_slicedToArray(k,2),w=u*S[0],P=d*S[1],x=this.svgFactory.createElement("svg:pattern");x.setAttributeNS(null,"id",f),x.setAttributeNS(null,"patternUnits","userSpaceOnUse"),x.setAttributeNS(null,"width",w),x.setAttributeNS(null,"height",P),x.setAttributeNS(null,"x","".concat(g)),x.setAttributeNS(null,"y","".concat(y));var A=this.svg,C=this.transformMatrix,E=this.current.fillColor,F=this.current.strokeColor,T=this.svgFactory.create(_-g,b-y);if(this.svg=T,this.transformMatrix=r,2===h){var M,R=(M=a.Util).makeHexColor.apply(M,_toConsumableArray(t));this.current.fillColor=R,this.current.strokeColor=R}return this.executeOpTree(this.convertOpList(n)),this.svg=A,this.transformMatrix=C,this.current.fillColor=E,this.current.strokeColor=F,x.append(T.childNodes[0]),this.defs.append(x),"url(#".concat(f,")")}},{key:"_makeShadingPattern",value:function(e){switch("string"===typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":var t,n="shading".concat(m++),r=e[3];switch(e[1]){case"axial":var i=e[4],o=e[5];(t=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",n),t.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),t.setAttributeNS(null,"x1",i[0]),t.setAttributeNS(null,"y1",i[1]),t.setAttributeNS(null,"x2",o[0]),t.setAttributeNS(null,"y2",o[1]);break;case"radial":var s=e[4],l=e[5],c=e[6],u=e[7];(t=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",n),t.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),t.setAttributeNS(null,"cx",l[0]),t.setAttributeNS(null,"cy",l[1]),t.setAttributeNS(null,"r",u),t.setAttributeNS(null,"fx",s[0]),t.setAttributeNS(null,"fy",s[1]),t.setAttributeNS(null,"fr",c);break;default:throw new Error("Unknown RadialAxial type: ".concat(e[1]))}var d,h=_createForOfIteratorHelper(r);try{for(h.s();!(d=h.n()).done;){var f=d.value,p=this.svgFactory.createElement("svg:stop");p.setAttributeNS(null,"offset",f[0]),p.setAttributeNS(null,"stop-color",f[1]),t.append(p)}}catch(v){h.e(v)}finally{h.f()}return this.defs.append(t),"url(#".concat(n,")");case"Mesh":return(0,a.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error("Unknown IR type: ".concat(e[0]))}}},{key:"setDash",value:function(e,t){this.current.dashArray=e,this.current.dashPhase=t}},{key:"constructPath",value:function(e,t){var n,r=this.current,i=r.x,o=r.y,l=[],c=0,u=_createForOfIteratorHelper(e);try{for(u.s();!(n=u.n()).done;)switch(0|n.value){case a.OPS.rectangle:i=t[c++],o=t[c++];var d=t[c++],h=t[c++],f=i+d,p=o+h;l.push("M",s(i),s(o),"L",s(f),s(o),"L",s(f),s(p),"L",s(i),s(p),"Z");break;case a.OPS.moveTo:i=t[c++],o=t[c++],l.push("M",s(i),s(o));break;case a.OPS.lineTo:i=t[c++],o=t[c++],l.push("L",s(i),s(o));break;case a.OPS.curveTo:i=t[c+4],o=t[c+5],l.push("C",s(t[c]),s(t[c+1]),s(t[c+2]),s(t[c+3]),s(i),s(o)),c+=6;break;case a.OPS.curveTo2:l.push("C",s(i),s(o),s(t[c]),s(t[c+1]),s(t[c+2]),s(t[c+3])),i=t[c+2],o=t[c+3],c+=4;break;case a.OPS.curveTo3:i=t[c+2],o=t[c+3],l.push("C",s(t[c]),s(t[c+1]),s(i),s(o),s(i),s(o)),c+=4;break;case a.OPS.closePath:l.push("Z")}}catch(v){u.e(v)}finally{u.f()}l=l.join(" "),r.path&&e.length>0&&e[0]!==a.OPS.rectangle&&e[0]!==a.OPS.moveTo?l=r.path.getAttributeNS(null,"d")+l:(r.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(r.path)),r.path.setAttributeNS(null,"d",l),r.path.setAttributeNS(null,"fill","none"),r.element=r.path,r.setCurrentPoint(i,o)}},{key:"endPath",value:function(){var e=this.current;if(e.path=null,this.pendingClip)if(e.element){var t="clippath".concat(v++),n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"transform",l(this.transformMatrix));var r=e.element.cloneNode(!0);if("evenodd"===this.pendingClip?r.setAttributeNS(null,"clip-rule","evenodd"):r.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,n.append(r),this.defs.append(n),e.activeClipUrl){e.clipGroup=null;var a,i=_createForOfIteratorHelper(this.extraStack);try{for(i.s();!(a=i.n()).done;)a.value.clipGroup=null}catch(o){i.e(o)}finally{i.f()}n.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl="url(#".concat(t,")"),this.tgrp=null}else this.pendingClip=null}},{key:"clip",value:function(e){this.pendingClip=e}},{key:"closePath",value:function(){var e=this.current;if(e.path){var t="".concat(e.path.getAttributeNS(null,"d"),"Z");e.path.setAttributeNS(null,"d",t)}}},{key:"setLeading",value:function(e){this.current.leading=-e}},{key:"setTextRise",value:function(e){this.current.textRise=e}},{key:"setTextRenderingMode",value:function(e){this.current.textRenderingMode=e}},{key:"setHScale",value:function(e){this.current.textHScale=e/100}},{key:"setRenderingIntent",value:function(e){}},{key:"setFlatness",value:function(e){}},{key:"setGState",value:function(e){var t,n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var r=_slicedToArray(t.value,2),i=r[0],o=r[1];switch(i){case"LW":this.setLineWidth(o);break;case"LC":this.setLineCap(o);break;case"LJ":this.setLineJoin(o);break;case"ML":this.setMiterLimit(o);break;case"D":this.setDash(o[0],o[1]);break;case"RI":this.setRenderingIntent(o);break;case"FL":this.setFlatness(o);break;case"Font":this.setFont(o);break;case"CA":this.setStrokeAlpha(o);break;case"ca":this.setFillAlpha(o);break;default:(0,a.warn)("Unimplemented graphic state operator ".concat(i))}}}catch(s){n.e(s)}finally{n.f()}}},{key:"fill",value:function(){var e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}},{key:"stroke",value:function(){var e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}},{key:"_setStrokeAttributes",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.current,r=n.dashArray;1!==t&&r.length>0&&(r=r.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",n.strokeColor),e.setAttributeNS(null,"stroke-opacity",n.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",s(n.miterLimit)),e.setAttributeNS(null,"stroke-linecap",n.lineCap),e.setAttributeNS(null,"stroke-linejoin",n.lineJoin),e.setAttributeNS(null,"stroke-width",s(t*n.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",r.map(s).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",s(t*n.dashPhase)+"px")}},{key:"eoFill",value:function(){var e;null===(e=this.current.element)||void 0===e||e.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}},{key:"fillStroke",value:function(){this.stroke(),this.fill()}},{key:"eoFillStroke",value:function(){var e;null===(e=this.current.element)||void 0===e||e.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}},{key:"closeStroke",value:function(){this.closePath(),this.stroke()}},{key:"closeFillStroke",value:function(){this.closePath(),this.fillStroke()}},{key:"closeEOFillStroke",value:function(){this.closePath(),this.eoFillStroke()}},{key:"paintSolidColorImageMask",value:function(){var e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}},{key:"paintImageXObject",value:function(e){var t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,a.warn)("Dependent image with object ID ".concat(e," is not ready yet"))}},{key:"paintInlineImageXObject",value:function(e,t){var n=e.width,r=e.height,a=f(e,this.forceDataSchema,!!t),i=this.svgFactory.createElement("svg:rect");i.setAttributeNS(null,"x","0"),i.setAttributeNS(null,"y","0"),i.setAttributeNS(null,"width",s(n)),i.setAttributeNS(null,"height",s(r)),this.current.element=i,this.clip("nonzero");var o=this.svgFactory.createElement("svg:image");o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",s(-r)),o.setAttributeNS(null,"width",s(n)+"px"),o.setAttributeNS(null,"height",s(r)+"px"),o.setAttributeNS(null,"transform","scale(".concat(s(1/n)," ").concat(s(-1/r),")")),t?t.append(o):this._ensureTransformGroup().append(o)}},{key:"paintImageMaskXObject",value:function(e){var t=this.getObject(e.data,e);if(t.bitmap)(0,a.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");else{var n=this.current,r=t.width,i=t.height,o=n.fillColor;n.maskId="mask".concat(g++);var l=this.svgFactory.createElement("svg:mask");l.setAttributeNS(null,"id",n.maskId);var c=this.svgFactory.createElement("svg:rect");c.setAttributeNS(null,"x","0"),c.setAttributeNS(null,"y","0"),c.setAttributeNS(null,"width",s(r)),c.setAttributeNS(null,"height",s(i)),c.setAttributeNS(null,"fill",o),c.setAttributeNS(null,"mask","url(#".concat(n.maskId,")")),this.defs.append(l),this._ensureTransformGroup().append(c),this.paintInlineImageXObject(t,l)}}},{key:"paintFormXObjectBegin",value:function(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){var n=t[2]-t[0],r=t[3]-t[1],a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x",t[0]),a.setAttributeNS(null,"y",t[1]),a.setAttributeNS(null,"width",s(n)),a.setAttributeNS(null,"height",s(r)),this.current.element=a,this.clip("nonzero"),this.endPath()}}},{key:"paintFormXObjectEnd",value:function(){}},{key:"_initialize",value:function(e){var t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement("svg:defs");t.append(n),this.defs=n;var r=this.svgFactory.createElement("svg:g");return r.setAttributeNS(null,"transform",l(e.transform)),t.append(r),this.svg=r,t}},{key:"_ensureClipGroup",value:function(){if(!this.current.clipGroup){var e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}},{key:"_ensureTransformGroup",value:function(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",l(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}]),e}()}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__w_pdfjs_require__),n.exports}var __nested_webpack_exports__={};return function(){var e=__nested_webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return i.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return o.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return s.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return l.GlobalWorkerOptions}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}}),Object.defineProperty(e,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return t.UNSUPPORTED_FEATURES}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return u.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return t.createPromiseCapability}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return r.isDataScheme}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return a.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return r.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return a.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});var t=__w_pdfjs_require__(1),n=__w_pdfjs_require__(2),r=__w_pdfjs_require__(6),a=__w_pdfjs_require__(26),i=__w_pdfjs_require__(27),o=__w_pdfjs_require__(5),s=__w_pdfjs_require__(32),l=__w_pdfjs_require__(14),c=__w_pdfjs_require__(35),u=__w_pdfjs_require__(34)}(),__nested_webpack_exports__}()},module.exports=factory()},4463:function(e,t,n){"use strict";var r=n(2791),a=n(5296);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n