PageSourceSearch

https://www.randa.org/_next/static/chunks/30.cc5b954ac8ff258d.js

js randa.org collected 2026-10-01 09:12:05 UTC 85,438 bytes, 59 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[30],{40270:function(){},39359:function(){},42717:function(t,e){var n;(n=function(t){"use strict";class e{constructor(t,e){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0},this.createdDensity=e,this.nowDrawingDensity=this.createdDensity,this.render=t}setDensity(t){this.createdDensity=t,this.nowDrawingDensity=t}setDrawingDensity(t){this.nowDrawingDensity=t}setPosition(t){this.state.position=t}setAngle(t){this.state.angle=t}setArea(t){this.state.area=t}setHardDrawingAngle(t){this.state.hardDrawingAngle=t}setHardAngle(t){this.state.hardAngle=t,this.state.hardDrawingAngle=t}setOrientation(t){this.orientation=t}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class n extends e{constructor(t,e,n){super(t,n),this.image=null,this.isLoad=!1,this.loadingAngle=0,this.image=new Image,this.image.src=e}draw(t){let e=this.render.getContext(),n=this.render.convertToGlobal(this.state.position),i=this.render.getRect().pageWidth,r=this.render.getRect().height;for(let o of(e.save(),e.translate(n.x,n.y),e.beginPath(),this.state.area))null!==o&&(o=this.render.convertToGlobal(o),e.lineTo(o.x-n.x,o.y-n.y));e.rotate(this.state.angle),e.clip(),this.isLoad?e.drawImage(this.image,0,0,i,r):this.drawLoader(e,{x:0,y:0},i,r),e.restore()}simpleDraw(t){let e=this.render.getRect(),n=this.render.getContext(),i=e.pageWidth,r=e.height,o=1===t?e.left+e.pageWidth:e.left,s=e.top;this.isLoad?n.drawImage(this.image,o,s,i,r):this.drawLoader(n,{x:o,y:s},i,r)}drawLoader(t,e,n,i){t.beginPath(),t.strokeStyle="rgb(200, 200, 200)",t.fillStyle="rgb(255, 255, 255)",t.lineWidth=1,t.rect(e.x+1,e.y+1,n-1,i-1),t.stroke(),t.fill();let r={x:e.x+n/2,y:e.y+i/2};t.beginPath(),t.lineWidth=10,t.arc(r.x,r.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle),t.stroke(),t.closePath(),this.loadingAngle+=.07,this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class i{constructor(t,e){this.pages=[],this.currentPageIndex=0,this.currentSpreadIndex=0,this.landscapeSpread=[],this.portraitSpread=[],this.render=e,this.app=t,this.currentPageIndex=0,this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[],this.portraitSpread=[];for(let t=0;t<this.pages.length;t++)this.portraitSpread.push([t]);let e=0;this.isShowCover&&(this.pages[0].setDensity("hard"),this.landscapeSpread.push([e]),e++);for(let n=e;n<this.pages.length;n+=2)n<this.pages.length-1?this.landscapeSpread.push([n,n+1]):(this.landscapeSpread.push([n]),this.pages[n].setDensity("hard"))}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(t){let e=this.getSpread();for(let n=0;n<e.length;n++)if(t===e[n][0]||t===e[n][1])return n;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(t){if(t>=0&&t<this.pages.length)return this.pages[t];throw Error("Invalid page number")}nextBy(t){let e=this.pages.indexOf(t);return e<this.pages.length-1?this.pages[e+1]:null}prevBy(t){let e=this.pages.indexOf(t);return e>0?this.pages[e-1]:null}getFlippingPage(t){let e=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===t?this.pages[e].newTemporaryCopy():this.pages[e-1];{let n=0===t?this.getSpread()[e+1]:this.getSpread()[e-1];return 1===n.length||0===t?this.pages[n[0]]:this.pages[n[1]]}}getBottomPage(t){let e=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===t?this.pages[e+1]:this.pages[e-1];{let n=0===t?this.getSpread()[e+1]:this.getSpread()[e-1];return 1===n.length?this.pages[n[0]]:0===t?this.pages[n[1]]:this.pages[n[0]]}}showNext(){this.currentSpreadIndex<this.getSpread().length&&(this.currentSpreadIndex++,this.showSpread())}showPrev(){this.currentSpreadIndex>0&&(this.currentSpreadIndex--,this.showSpread())}getCurrentPageIndex(){return this.currentPageIndex}show(t=null){if(null===t&&(t=this.currentPageIndex),t<0||t>=this.pages.length)return;let e=this.getSpreadIndexByPage(t);null!==e&&(this.currentSpreadIndex=e,this.showSpread())}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(t){if(!(t>=0&&t<this.getSpread().length))throw Error("Invalid page");this.currentSpreadIndex=t}showSpread(){let t=this.getSpread()[this.currentSpreadIndex];2===t.length?(this.render.setLeftPage(this.pages[t[0]]),this.render.setRightPage(this.pages[t[1]])):"landscape"===this.render.getOrientation()&&t[0]===this.pages.length-1?(this.render.setLeftPage(this.pages[t[0]]),this.render.setRightPage(null)):(this.render.setLeftPage(null),this.render.setRightPage(this.pages[t[0]])),this.currentPageIndex=t[0],this.app.updatePageIndex(this.currentPageIndex)}}class r extends i{constructor(t,e,n){super(t,e),this.imagesHref=n}load(){for(let t of this.imagesHref){let e=new n(this.render,t,"soft");e.load(),this.pages.push(e)}this.createSpread()}}class o{static GetDistanceBetweenTwoPoint(t,e){return null===t||null===e?1/0:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}static GetSegmentLength(t){return o.GetDistanceBetweenTwoPoint(t[0],t[1])}
1static GetAngleBetweenTwoLine(t,e){let n=t[0].y-t[1].y,i=e[0].y-e[1].y,r=t[1].x-t[0].x,o=e[1].x-e[0].x;return Math.acos((n*i+r*o)/(Math.sqrt(n*n+r*r)*Math.sqrt(i*i+o*o)))}static PointInRect(t,e){return null===e?null:e.x>=t.left&&e.x<=t.width+t.left&&e.y>=t.top&&e.y<=t.top+t.height?e:null}static GetRotatedPoint(t,e,n){return{x:t.x*Math.cos(n)+t.y*Math.sin(n)+e.x,y:t.y*Math.cos(n)-t.x*Math.sin(n)+e.y}}static LimitPointToCircle(t,e,n){if(o.GetDistanceBetweenTwoPoint(t,n)<=e)return n;let i=t.x,r=t.y,s=n.x,a=n.y,h=Math.sqrt(Math.pow(e,2)*Math.pow(i-s,2)/(Math.pow(i-s,2)+Math.pow(r-a,2)))+i;n.x<0&&(h*=-1);let c=(h-i)*(r-a)/(i-s)+r;return i-s+r===0&&(c=e),{x:h,y:c}}static GetIntersectBetweenTwoSegment(t,e,n){return o.PointInRect(t,o.GetIntersectBeetwenTwoLine(e,n))}static GetIntersectBeetwenTwoLine(t,e){let n=t[0].y-t[1].y,i=e[0].y-e[1].y,r=t[1].x-t[0].x,o=e[1].x-e[0].x,s=t[0].x*t[1].y-t[1].x*t[0].y,a=e[0].x*e[1].y-e[1].x*e[0].y,h=-(s*o-a*r)/(n*o-i*r),c=-(n*a-i*s)/(n*o-i*r);if(isFinite(h)&&isFinite(c))return{x:h,y:c};if(.1>Math.abs(n*a-i*s-(r*a-o*s)))throw Error("Segment included");return null}static GetCordsFromTwoPoint(t,e){let n=Math.abs(t.x-e.x),i=Math.abs(t.y-e.y),r=Math.max(n,i),o=[t];function s(t,e,n,i,r){return e>t?t+r*(n/i):e<t?t-r*(n/i):t}for(let a=1;a<=r;a+=1)o.push({x:s(t.x,e.x,n,r,a),y:s(t.y,e.y,i,r,a)});return o}}class s extends e{constructor(t,e,n){super(t,n),this.copiedElement=null,this.temporaryCopy=null,this.isLoad=!1,this.element=e,this.element.classList.add("stf__item"),this.element.classList.add("--"+n)}newTemporaryCopy(){return"hard"===this.nowDrawingDensity?this:(null===this.temporaryCopy&&(this.copiedElement=this.element.cloneNode(!0),this.element.parentElement.appendChild(this.copiedElement),this.temporaryCopy=new s(this.render,this.copiedElement,this.nowDrawingDensity)),this.getTemporaryCopy())}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){null!==this.temporaryCopy&&(this.copiedElement.remove(),this.copiedElement=null,this.temporaryCopy=null)}draw(t){let e=t||this.nowDrawingDensity,n=this.render.convertToGlobal(this.state.position),i=this.render.getRect().pageWidth,r=this.render.getRect().height;this.element.classList.remove("--simple");let o=`
2            display: block;
3            z-index: ${this.element.style.zIndex};
4            left: 0;
5            top: 0;
6            width: ${i}px;
7            height: ${r}px;
8        `;"hard"===e?this.drawHard(o):this.drawSoft(n,o)}drawHard(t=""){let e=this.render.getRect().left+this.render.getRect().width/2,n=this.state.hardDrawingAngle,i=t+"\n                backface-visibility: hidden;\n                -webkit-backface-visibility: hidden;\n                clip-path: none;\n                -webkit-clip-path: none;\n            "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0; 
9                   transform: translate3d(0, 0, 0) rotateY(${n}deg);`:`transform-origin: 0 0; 
10                   transform: translate3d(${e}px, 0, 0) rotateY(${n}deg);`);this.element.style.cssText=i}drawSoft(t,e=""){let n="polygon( ";for(let i of this.state.area)if(null!==i){let r=1===this.render.getDirection()?{x:-i.x+this.state.position.x,y:i.y-this.state.position.y}:{x:i.x-this.state.position.x,y:i.y-this.state.position.y};n+=(r=o.GetRotatedPoint(r,{x:0,y:0},this.state.angle)).x+"px "+r.y+"px, "}n=n.slice(0,-2),n+=")";let s=e+`transform-origin: 0 0; clip-path: ${n}; -webkit-clip-path: ${n};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${t.x}px, ${t.y}px);`:`transform: translate3d(${t.x}px, ${t.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=s}simpleDraw(t){let e=this.render.getRect(),n=e.pageWidth,i=e.height,r=1===t?e.left+e.pageWidth:e.left,o=e.top;this.element.classList.add("--simple"),this.element.style.cssText=`
11            position: absolute; 
12            display: block; 
13            height: ${i}px; 
14            left: ${r}px; 
15            top: ${o}px; 
16            width: ${n}px; 
17            z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(t){super.setOrientation(t),this.element.classList.remove("--left","--right"),this.element.classList.add(1===t?"--right":"--left")}setDrawingDensity(t){this.element.classList.remove("--soft","--hard"),this.element.classList.add("--"+t),super.setDrawingDensity(t)}}class a extends i{constructor(t,e,n,i){super(t,e),this.element=n,this.pagesElement=i}load(){for(let t of this.pagesElement){let e=new s(this.render,t,"hard"===t.dataset.density?"hard":"soft");e.load(),this.pages.push(e)}this.createSpread()}}class h{constructor(t,e,n,i){this.direction=t,this.corner=e,this.topIntersectPoint=null,this.sideIntersectPoint=null,this.bottomIntersectPoint=null,this.pageWidth=parseInt(n,10),this.pageHeight=parseInt(i,10)}calc(t){try{return this.position=this.calcAngleAndPosition(t),this.calculateIntersectPoint(this.position),!0}catch(e){return!1}}getFlippingClipArea(){let t=[],e=!1;return t.push(this.rect.topLeft),t.push(this.topIntersectPoint),null===this.sideIntersectPoint?e=!0:(t.push(this.sideIntersectPoint),null===this.bottomIntersectPoint&&(e=!1)),t.push(this.bottomIntersectPoint),(e||"bottom"===this.corner)&&t.push(this.rect.bottomLeft),t}getBottomClipArea(){let t=[];return t.push(this.topIntersectPoint),"top"===this.corner?t.push({x:this.pageWidth,y:0}):(null!==this.topIntersectPoint&&t.push({x:this.pageWidth,y:0}),t.push({x:this.pageWidth,y:this.pageHeight})),null!==this.sideIntersectPoint?o.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&t.push(this.sideIntersectPoint):"top"===this.corner&&t.push({x:this.pageWidth,y:this.pageHeight}),t.push(this.bottomIntersectPoint),t.push(this.topIntersectPoint),t}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}
17getShadowAngle(){let t=o.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?t:Math.PI-t}calcAngleAndPosition(t){let e=t;if(this.updateAngleAndGeometry(e),1>Math.abs((e="top"===this.corner?this.checkPositionAtCenterLine(e,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(e,{x:0,y:this.pageHeight},{x:0,y:0})).x-this.pageWidth)&&1>Math.abs(e.y))throw Error("Point is too small");return e}updateAngleAndGeometry(t){this.angle=this.calculateAngle(t),this.rect=this.getPageRect(t)}calculateAngle(t){let e=this.pageWidth-t.x+1,n="bottom"===this.corner?this.pageHeight-t.y:t.y,i=2*Math.acos(e/Math.sqrt(n*n+e*e));n<0&&(i=-i);let r=Math.PI-i;if(!isFinite(i)||r>=0&&r<.003)throw Error("The G point is too small");return"bottom"===this.corner&&(i=-i),i}getPageRect(t){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],t):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],t)}getRectFromBasePoint(t,e){return{topLeft:this.getRotatedPoint(t[0],e),topRight:this.getRotatedPoint(t[1],e),bottomLeft:this.getRotatedPoint(t[2],e),bottomRight:this.getRotatedPoint(t[3],e)}}getRotatedPoint(t,e){return{x:t.x*Math.cos(this.angle)+t.y*Math.sin(this.angle)+e.x,y:t.y*Math.cos(this.angle)-t.x*Math.sin(this.angle)+e.y}}calculateIntersectPoint(t){let e={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};"top"===this.corner?(this.topIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[t,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]),this.sideIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[t,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]),this.bottomIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])):(this.topIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]),this.sideIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[t,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]),this.bottomIntersectPoint=o.GetIntersectBetweenTwoSegment(e,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}]))}checkPositionAtCenterLine(t,e,n){let i=t,r=o.LimitPointToCircle(e,this.pageWidth,i);i!==r&&(i=r,this.updateAngleAndGeometry(i));let s=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2)),a=this.rect.bottomRight,h=this.rect.topLeft;if("bottom"===this.corner&&(a=this.rect.topRight,h=this.rect.bottomLeft),a.x<=0){let c=o.LimitPointToCircle(n,s,h);c!==i&&(i=c,this.updateAngleAndGeometry(i))}return i}getSegmentToShadowLine(){let t=this.getShadowStartPoint();return[t,t!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class c{constructor(t,e){this.flippingPage=null,this.bottomPage=null,this.calc=null,this.state="read",this.render=t,this.app=e}fold(t){this.setState("user_fold"),null===this.calc&&this.start(t),this.do(this.render.convertToPage(t))}flip(t){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(t)||(null!==this.calc&&this.render.finishAnimation(),!this.start(t)))return;let e=this.getBoundsRect();this.setState("flipping");let n=e.height/10,i="bottom"===this.calc.getCorner()?e.height-n:n,r="bottom"===this.calc.getCorner()?e.height:0;this.calc.calc({x:e.pageWidth-n,y:i}),this.animateFlippingTo({x:e.pageWidth-n,y:i},{x:-e.pageWidth,y:r},!0)}start(t){this.reset();let e=this.render.convertToBook(t),n=this.getBoundsRect(),i=this.getDirectionByPoint(e),r=e.y>=n.height/2?"bottom":"top";if(!this.checkDirection(i))return!1;try{if(this.flippingPage=this.app.getPageCollection().getFlippingPage(i),this.bottomPage=this.app.getPageCollection().getBottomPage(i),"landscape"===this.render.getOrientation()){if(1===i){let o=this.app.getPageCollection().nextBy(this.flippingPage);null!==o&&this.flippingPage.getDensity()!==o.getDensity()&&(this.flippingPage.setDrawingDensity("hard"),o.setDrawingDensity("hard"))}else{let s=this.app.getPageCollection().prevBy(this.flippingPage);null!==s&&this.flippingPage.getDensity()!==s.getDensity()&&(this.flippingPage.setDrawingDensity("hard"),s.setDrawingDensity("hard"))}}return this.render.setDirection(i),this.calc=new h(i,r,n.pageWidth.toString(10),n.height.toString(10)),!0}catch(a){return!1}}do(t){if(null!==this.calc&&this.calc.calc(t)){let e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea()),this.bottomPage.setPosition(this.calc.getBottomPagePosition()),this.bottomPage.setAngle(0),this.bottomPage.setHardA
17ngle(0),this.flippingPage.setArea(this.calc.getFlippingClipArea()),this.flippingPage.setPosition(this.calc.getActiveCorner()),this.flippingPage.setAngle(this.calc.getAngle()),0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100),this.render.setPageRect(this.calc.getRect()),this.render.setBottomPage(this.bottomPage),this.render.setFlippingPage(this.flippingPage),this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(t,e){let n=this.app.getPageCollection().getCurrentSpreadIndex(),i=this.app.getPageCollection().getSpreadIndexByPage(t);try{i>n&&(this.app.getPageCollection().setCurrentSpreadIndex(i-1),this.flipNext(e)),i<n&&(this.app.getPageCollection().setCurrentSpreadIndex(i+1),this.flipPrev(e))}catch(r){}}flipNext(t){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===t?1:this.render.getRect().height-2})}flipPrev(t){this.flip({x:10,y:"top"===t?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;let t=this.calc.getPosition(),e=this.getBoundsRect(),n="bottom"===this.calc.getCorner()?e.height:0;t.x<=0?this.animateFlippingTo(t,{x:-e.pageWidth,y:n},!0):this.animateFlippingTo(t,{x:e.pageWidth,y:n},!1)}showCorner(t){if(!this.checkState("read","fold_corner"))return;let e=this.getBoundsRect(),n=e.pageWidth;if(this.isPointOnCorners(t)){if(null===this.calc){if(!this.start(t))return;this.setState("fold_corner"),this.calc.calc({x:n-1,y:1});let i="bottom"===this.calc.getCorner()?e.height-1:1,r="bottom"===this.calc.getCorner()?e.height-50:50;this.animateFlippingTo({x:n-1,y:i},{x:n-50,y:r},!1,!1)}else this.do(this.render.convertToPage(t))}else this.setState("read"),this.render.finishAnimation(),this.stopMove()}animateFlippingTo(t,e,n,i=!0){let r=o.GetCordsFromTwoPoint(t,e),s=[];for(let a of r)s.push(()=>this.do(a));let h=this.getAnimationDuration(r.length);this.render.startAnimation(s,h,()=>{this.calc&&(n&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage()),i&&(this.render.setBottomPage(null),this.render.setFlippingPage(null),this.render.clearShadow(),this.setState("read"),this.reset()))})}getCalculation(){return this.calc}getState(){return this.state}setState(t){this.state!==t&&(this.app.updateState(t),this.state=t)}getDirectionByPoint(t){let e=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(t.x-e.pageWidth<=e.width/5)return 1}else if(t.x<e.width/2)return 1;return 0}getAnimationDuration(t){let e=this.app.getSettings().flippingTime;return t>=1e3?e:t/1e3*e}checkDirection(t){return 0===t?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null,this.flippingPage=null,this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(...t){for(let e of t)if(this.state===e)return!0;return!1}isPointOnCorners(t){let e=this.getBoundsRect(),n=e.pageWidth,i=Math.sqrt(Math.pow(n,2)+Math.pow(e.height,2))/5,r=this.render.convertToBook(t);return r.x>0&&r.y>0&&r.x<e.width&&r.y<e.height&&(r.x<i||r.x>e.width-i)&&(r.y<i||r.y>e.height-i)}}class l{constructor(t,e){this.leftPage=null,this.rightPage=null,this.flippingPage=null,this.bottomPage=null,this.direction=null,this.orientation=null,this.shadow=null,this.animation=null,this.pageRect=null,this.boundsRect=null,this.timer=0,this.safari=!1,this.setting=e,this.app=t;let n=RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==n.exec(window.navigator.userAgent)}render(t){if(null!==this.animation){let e=Math.round((t-this.animation.startedAt)/this.animation.durationFrame);e<this.animation.frames.length?this.animation.frames[e]():(this.animation.onAnimateEnd(),this.animation=null)}this.timer=t,this.drawFrame()}start(){this.update();let t=e=>{this.render(e),requestAnimationFrame(t)};requestAnimationFrame(t)}startAnimation(t,e,n){this.finishAnimation(),this.animation={frames:t,duration:e,durationFrame:e/t.length,onAnimateEnd:n,startedAt:this.timer}}finishAnimation(){null!==this.animation&&(this.animation.frames[this.animation.frames.length-1](),null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()),this.animation=null}update(){this.boundsRect=null;let t=this.calculateBoundsRect();this.orientation!==t&&(this.orientation=t,this.app.updateOrientation(t))}calculateBoundsRect(){let t="landscape",e=this.getBlockWidth(),n=e/2,i=this.getBlockHeight()/2,r=this.setting.width/this.setting.height,o=this.setting.width,s=this.setting.height,a=n-o;return"stretch"===this.setting.size?(e<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(t="portrait"),(o="portrait"===t?this.getBlockWidth():this.getBlockWidth()/2)>this.setting.maxWidth&&(o=this.setting.maxWidth),(s=o/r)>this.getBlockHeight()&&(o=(s=this.getBlockHeight())*r),a="portrait"===t?n-o/2-o:n-o):e<2*o&&this.app.getSettings().usePortrait&&(t="portrait",a=n-o/2-o),this.boundsRect={left:a,top:i-s/2,width:2*o,height:s,pageWidth:o},t}setShadowData(t,e,n,i){if(!this.app.getSettings().drawShadow)return;let r=100*this.getSettings().maxShadowOpacity;this.shadow={pos:t,angle:e,width:3*this.getRect().pageWidth/4*n/100,opacity:(100-n)*r/100/100,direction:i,progress:2*n}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){return null===this.boundsRect&&this.calculateBoundsRect(),this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(t){this.pageRect=t}setDirection(t){this.direction=t}setRightPage(t){null!==t&&t.setOrientation(1),this.rightPage=t}setLeftPage(t){null!==t&&t.setOrientation(0),this.leftPage=t}setBottomPage(t){null!==t&&t.setOrientation(1===this.direction?0:1),this.bottomPage=t}
17setFlippingPage(t){null!==t&&t.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1),this.flippingPage=t}convertToBook(t){let e=this.getRect();return{x:t.x-e.left,y:t.y-e.top}}isSafari(){return this.safari}convertToPage(t,e){e||(e=this.direction);let n=this.getRect();return{x:0===e?t.x-n.left-n.width/2:n.width/2-t.x+n.left,y:t.y-n.top}}convertToGlobal(t,e){if(e||(e=this.direction),null==t)return null;let n=this.getRect();return{x:0===e?t.x+n.left+n.width/2:n.width/2-t.x+n.left,y:t.y+n.top}}convertRectToGlobal(t,e){return e||(e=this.direction),{topLeft:this.convertToGlobal(t.topLeft,e),topRight:this.convertToGlobal(t.topRight,e),bottomLeft:this.convertToGlobal(t.bottomLeft,e),bottomRight:this.convertToGlobal(t.bottomRight,e)}}}class u extends l{constructor(t,e,n){super(t,e),this.canvas=n,this.ctx=n.getContext("2d")}getContext(){return this.ctx}reload(){}drawFrame(){this.clear(),"portrait"!==this.orientation&&null!=this.leftPage&&this.leftPage.simpleDraw(0),null!=this.rightPage&&this.rightPage.simpleDraw(1),null!=this.bottomPage&&this.bottomPage.draw(),this.drawBookShadow(),null!=this.flippingPage&&this.flippingPage.draw(),null!=this.shadow&&(this.drawOuterShadow(),this.drawInnerShadow());let t=this.getRect();"portrait"===this.orientation&&(this.ctx.beginPath(),this.ctx.rect(t.left+t.pageWidth,t.top,t.width,t.height),this.ctx.clip())}drawBookShadow(){let t=this.getRect();this.ctx.save(),this.ctx.beginPath();let e=t.width/20;this.ctx.rect(t.left,t.top,t.width,t.height);let n={x:t.left+t.width/2-e/2,y:0};this.ctx.translate(n.x,n.y);let i=this.ctx.createLinearGradient(0,0,e,0);i.addColorStop(0,"rgba(0, 0, 0, 0)"),i.addColorStop(.4,"rgba(0, 0, 0, 0.2)"),i.addColorStop(.49,"rgba(0, 0, 0, 0.1)"),i.addColorStop(.5,"rgba(0, 0, 0, 0.5)"),i.addColorStop(.51,"rgba(0, 0, 0, 0.4)"),i.addColorStop(1,"rgba(0, 0, 0, 0)"),this.ctx.clip(),this.ctx.fillStyle=i,this.ctx.fillRect(0,0,e,2*t.height),this.ctx.restore()}drawOuterShadow(){let t=this.getRect();this.ctx.save(),this.ctx.beginPath(),this.ctx.rect(t.left,t.top,t.width,t.height);let e=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y});this.ctx.translate(e.x,e.y),this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);let n=this.ctx.createLinearGradient(0,0,this.shadow.width,0);0===this.shadow.direction?(this.ctx.translate(0,-100),n.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")"),n.addColorStop(1,"rgba(0, 0, 0, 0)")):(this.ctx.translate(-this.shadow.width,-100),n.addColorStop(0,"rgba(0, 0, 0, 0)"),n.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")")),this.ctx.clip(),this.ctx.fillStyle=n,this.ctx.fillRect(0,0,this.shadow.width,2*t.height),this.ctx.restore()}drawInnerShadow(){let t=this.getRect();this.ctx.save(),this.ctx.beginPath();let e=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),n=this.convertRectToGlobal(this.pageRect);
17this.ctx.moveTo(n.topLeft.x,n.topLeft.y),this.ctx.lineTo(n.topRight.x,n.topRight.y),this.ctx.lineTo(n.bottomRight.x,n.bottomRight.y),this.ctx.lineTo(n.bottomLeft.x,n.bottomLeft.y),this.ctx.translate(e.x,e.y),this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);let i=3*this.shadow.width/4,r=this.ctx.createLinearGradient(0,0,i,0);0===this.shadow.direction?(this.ctx.translate(-i,-100),r.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")"),r.addColorStop(.9,"rgba(0, 0, 0, 0.05)"),r.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")"),r.addColorStop(0,"rgba(0, 0, 0, 0)")):(this.ctx.translate(0,-100),r.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")"),r.addColorStop(.1,"rgba(0, 0, 0, 0.05)"),r.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")"),r.addColorStop(1,"rgba(0, 0, 0, 0)")),this.ctx.clip(),this.ctx.fillStyle=r,this.ctx.fillRect(0,0,i,2*t.height),this.ctx.restore()}clear(){this.ctx.fillStyle="white",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}}class p{constructor(t,e,n){this.touchPoint=null,this.swipeTimeout=250,this.onResize=()=>{this.update()},this.onMouseDown=t=>{if(this.checkTarget(t.target)){let e=this.getMousePos(t.clientX,t.clientY);this.app.startUserTouch(e),t.preventDefault()}},this.onTouchStart=t=>{if(this.checkTarget(t.target)&&t.changedTouches.length>0){let e=t.changedTouches[0],n=this.getMousePos(e.clientX,e.clientY);this.touchPoint={point:n,time:Date.now()},setTimeout(()=>{null!==this.touchPoint&&this.app.startUserTouch(n)},this.swipeTimeout),this.app.getSettings().mobileScrollSupport||t.preventDefault()}},this.onMouseUp=t=>{let e=this.getMousePos(t.clientX,t.clientY);this.app.userStop(e)},this.onMouseMove=t=>{let e=this.getMousePos(t.clientX,t.clientY);this.app.userMove(e,!1)},this.onTouchMove=t=>{if(t.changedTouches.length>0){let e=t.changedTouches[0],n=this.getMousePos(e.clientX,e.clientY);this.app.getSettings().mobileScrollSupport?(null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-n.x)>10||"read"!==this.app.getState())&&t.cancelable&&this.app.userMove(n,!0),"read"!==this.app.getState()&&t.preventDefault()):this.app.userMove(n,!0)}},this.onTouchEnd=t=>{if(t.changedTouches.length>0){let e=t.changedTouches[0],n=this.getMousePos(e.clientX,e.clientY),i=!1;if(null!==this.touchPoint){let r=n.x-this.touchPoint.point.x,o=Math.abs(n.y-this.touchPoint.point.y);Math.abs(r)>this.swipeDistance&&o<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout&&(r>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"),i=!0),this.touchPoint=null}this.app.userStop(n,i)}},this.parentElement=t,t.classList.add("stf__parent"),t.insertAdjacentHTML("afterbegin",'<div class="stf__wrapper"></div>'),this.wrapper=t.querySelector(".stf__wrapper"),this.app=e;let i=this.app.getSettings().usePortrait?1:2;t.style.minWidth=n.minWidth*i+"px",t.style.minHeight=n.minHeight+"px","fixed"===n.size&&(t.style.minWidth=n.width*i+"px",t.style.minHeight=n.height+"px"),n.autoSize&&(t.style.width="100%",t.style.maxWidth=2*n.maxWidth+"px"),t.style.display="block",window.addEventListener("resize",this.onResize,!1),this.swipeDistance=n.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers(),this.distElement.remove(),this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(t){this.wrapper.classList.remove("--portrait","--landscape"),"portrait"===t?(this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%"),this.wrapper.classList.add("--portrait")):(this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%"),this.wrapper.classList.add("--landscape")),this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize),this.distElement.removeEventListener("mousedown",this.onMouseDown),this.distElement.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1),this.app.getSettings().useMouseEvents&&(this.distElement.addEventListener("mousedown",this.onMouseDown),this.distElement.addEventListener("touchstart",this.onTouchStart),window.addEventListener("mousemove",this.onMouseMove),window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport}),window.addEventListener("mouseup",this.onMouseUp),window.addEventListener("touchend",this.onTouchEnd))}getMousePos(t,e){let n=this.distElement.getBoundingClientRect();return{x:t-n.left,y:e-n.top}}checkTarget(t){return!this.app.getSettings().clickEventForward||!["a","button"].includes(t.tagName.toLowerCase())}}class d extends p{constructor(t,e,n,i){for(let r of(super(t,e,n),this.wrapper.insertAdjacentHTML("afterbegin",'<div class="stf__block"></div>'),this.distElement=t.querySelector(".stf__block"),this.items=i,i))this.distElement.appendChild(r);this.setHandlers()}clear(){for(let t of this.items)this.parentElement.appendChild(t)}updateItems(t){for(let e of(this.removeHandlers(),this.distElement.innerHTML="",t))this.distElement.appendChild(e);this.items=t,this.setHandlers()}update(){this.app.getRender().update()}}class g extends p{constructor(t,e,n){super(t,e,n),this.wrapper.innerHTML='<canvas class="stf__canvas"></canvas>',this.canvas=t.querySelectorAll("canvas")[0],this.distElement=this.canvas,this.resizeCanvas(),this.setHandlers()}resizeCanvas(){let t=getComputedStyle(this.canvas),e=parseInt(t.getPropertyValue("width"),10),n=parseInt(t.getPropertyValue("height"),10);this.canvas.width=e,this.canvas.height=n}getCanvas(){return this.canvas}update(){this.resizeCanvas(),this.app.getRender().update()}}class f extends l{constructor(t,e,n){super(t,e),this.outerShadow=null,this.innerShadow=null,this.hardShadow=null,this.hardInnerShadow=null,this.element=n,this.createShadows()}createShadows(){this.element.insertAdjacentHTML("beforeend",'<div class="stf__outerShadow"></div>\n             <div class="stf__innerShadow"></div>\n             <div class="stf__hardShadow"></div>\n             <div class="stf__hardInnerShadow"></div>'),this.outerShadow=this.element.querySelector(".stf__outerShadow"),this.innerShadow=this.element.querySelector(".stf__innerShadow"),this.hardShadow=this.element.querySelector(".stf__hardShadow"),this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow(),this.outerShadow.style.cssText="display: none",this.innerShadow.style.cssText="display: none",this.hardShadow.style.cssText="display: none",this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){let t=this.getRect(),e=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress,n=(100-e)*(2.5*t.pageWidth)/100+20;n>t.pageWidth&&(n=t.pageWidth);let i=`
18            display: block;
19            z-index: ${(this.getSettings().startZIndex+5).toString(10)};
20            width: ${n}px;
21            height: ${t.height}px;
22            background: linear-gradient(to right,
23                rgba(0, 0, 0, ${this.shadow.opacity*e/100}) 5%,
24                rgba(0, 0, 0, 0) 100%);
25            left: ${t.left+t.width/2}px;
26            transform-origin: 0 0;
27        `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);",this.hardInnerShadow.style.cssText=i}
27drawHardOuterShadow(){let t=this.getRect(),e=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*t.pageWidth)/100+20;e>t.pageWidth&&(e=t.pageWidth);let n=`
28            display: block;
29            z-index: ${(this.getSettings().startZIndex+4).toString(10)};
30            width: ${e}px;
31            height: ${t.height}px;
32            background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);
33            left: ${t.left+t.width/2}px;
34            transform-origin: 0 0;
35        `;n+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);",this.hardShadow.style.cssText=n}drawInnerShadow(){let t=this.getRect(),e=3*this.shadow.width/4,n=0===this.getDirection()?e:0,i=0===this.getDirection()?"to left":"to right",r=this.convertToGlobal(this.shadow.pos),s=this.shadow.angle+3*Math.PI/2,a=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft],h="polygon( ";for(let c of a){let l=1===this.getDirection()?{x:-c.x+this.shadow.pos.x,y:c.y-this.shadow.pos.y}:{x:c.x-this.shadow.pos.x,y:c.y-this.shadow.pos.y};l=o.GetRotatedPoint(l,{x:n,y:100},s),h+=l.x+"px "+l.y+"px, "}h=h.slice(0,-2),h+=")";let u=`
36            display: block;
37            z-index: ${(this.getSettings().startZIndex+10).toString(10)};
38            width: ${e}px;
39            height: ${2*t.height}px;
40            background: linear-gradient(${i},
41                rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
42                rgba(0, 0, 0, 0.05) 15%,
43                rgba(0, 0, 0, ${this.shadow.opacity}) 35%,
44                rgba(0, 0, 0, 0) 100%);
45            transform-origin: ${n}px 100px;
46            transform: translate3d(${r.x-n}px, ${r.y-100}px, 0) rotate(${s}rad);
47            clip-path: ${h};
48            -webkit-clip-path: ${h};
49        `;this.innerShadow.style.cssText=u}drawOuterShadow(){let t=this.getRect(),e=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),n=this.shadow.angle+3*Math.PI/2,i=1===this.getDirection()?this.shadow.width:0,r=0===this.getDirection()?"to right":"to left",s=[{x:0,y:0},{x:t.pageWidth,y:0},{x:t.pageWidth,y:t.height},{x:0,y:t.height}],a="polygon( ";for(let h of s)if(null!==h){let c=1===this.getDirection()?{x:-h.x+this.shadow.pos.x,y:h.y-this.shadow.pos.y}:{x:h.x-this.shadow.pos.x,y:h.y-this.shadow.pos.y};c=o.GetRotatedPoint(c,{x:i,y:100},n),a+=c.x+"px "+c.y+"px, "}a=a.slice(0,-2),a+=")";let l=`
50            display: block;
51            z-index: ${(this.getSettings().startZIndex+10).toString(10)};
52            width: ${this.shadow.width}px;
53            height: ${2*t.height}px;
54            background: linear-gradient(${r}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));
55            transform-origin: ${i}px 100px;
56            transform: translate3d(${e.x-i}px, ${e.y-100}px, 0) rotate(${n}rad);
57            clip-path: ${a};
58            -webkit-clip-path: ${a};
59        `;this.outerShadow.style.cssText=l}drawLeftPage(){"portrait"!==this.orientation&&null!==this.leftPage&&(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()?(this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10),this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle()),this.leftPage.draw(this.flippingPage.getDrawingDensity())):this.leftPage.simpleDraw(0))}drawRightPage(){null!==this.rightPage&&(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()?(this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10),this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle()),this.rightPage.draw(this.flippingPage.getDrawingDensity())):this.rightPage.simpleDraw(1))}drawBottomPage(){if(null===this.bottomPage)return;let t=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;"portrait"===this.orientation&&1===this.direction||(this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10),this.bottomPage.draw(t))}drawFrame(){this.clear(),this.drawLeftPage(),this.drawRightPage(),this.drawBottomPage(),null!=this.flippingPage&&(this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10),this.flippingPage.draw()),null!=this.shadow&&null!==this.flippingPage&&("soft"===this.flippingPage.getDrawingDensity()?(this.drawOuterShadow(),this.drawInnerShadow()):(this.drawHardOuterShadow(),this.drawHardInnerShadow()))}clear(){for(let t of this.app.getPageCollection().getPages())t!==this.leftPage&&t!==this.rightPage&&t!==this.flippingPage&&t!==this.bottomPage&&(t.getElement().style.cssText="display: none"),t.getTemporaryCopy()!==this.flippingPage&&t.hideTemporaryCopy()}
59update(){super.update(),null!==this.rightPage&&this.rightPage.setOrientation(1),null!==this.leftPage&&this.leftPage.setOrientation(0)}}class m{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(t){let e=this._default;if(Object.assign(e,t),"stretch"!==e.size&&"fixed"!==e.size)throw Error('Invalid size type. Available only "fixed" and "stretch" value');if(e.width<=0||e.height<=0)throw Error("Invalid width or height");if(e.flippingTime<=0)throw Error("Invalid flipping time");return"stretch"===e.size?(e.minWidth<=0&&(e.minWidth=100),e.maxWidth<e.minWidth&&(e.maxWidth=2e3),e.minHeight<=0&&(e.minHeight=100),e.maxHeight<e.minHeight&&(e.maxHeight=2e3)):(e.minWidth=e.width,e.maxWidth=e.width,e.minHeight=e.height,e.maxHeight=e.height),e}}(function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}})(".stf__parent {\n  position: relative;\n  display: block;\n  box-sizing: border-box;\n  transform: translateZ(0);\n\n  -ms-touch-action: pan-y;\n  touch-action: pan-y;\n}\n\n.sft__wrapper {\n  position: relative;\n  width: 100%;\n  box-sizing: border-box;\n}\n\n.stf__parent canvas {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  left: 0;\n  top: 0;\n}\n\n.stf__block {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  box-sizing: border-box;\n  perspective: 2000px;\n}\n\n.stf__item {\n  display: none;\n  position: absolute;\n  transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__innerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__hardShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}\n\n.stf__hardInnerShadow {\n  position: absolute;\n  left: 0;\n  top: 0;\n}"),t.PageFlip=class extends class{constructor(){this.events=new Map}on(t,e){return this.events.has(t)?this.events.get(t).push(e):this.events.set(t,[e]),this}off(t){this.events.delete(t)}trigger(t,e,n=null){if(this.events.has(t))for(let i of this.events.get(t))i({data:n,object:e})}}{constructor(t,e){super(),this.isUserTouch=!1,this.isUserMove=!1,this.setting=null,this.pages=null,this.setting=(new m).getSettings(e),this.block=t}destroy(){this.ui.destroy(),this.block.remove()}update(){this.render.update(),this.pages.show()}loadFromImages(t){this.ui=new g(this.block,this,this.setting);let e=this.ui.getCanvas();this.render=new u(this,this.setting,e),this.flipController=new c(this.render,this),this.pages=new r(this,this.render,t),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}loadFromHTML(t){this.ui=new d(this.block,this,this.setting,t),this.render=new f(this,this.setting,this.ui.getDistElement()),this.flipController=new c(this.render,this),this.pages=new a(this,this.render,this.ui.getDistElement(),t),this.pages.load(),this.render.start(),this.pages.show(this.setting.startPage),setTimeout(()=>{this.ui.update(),this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})},1)}updateFromImages(t){let e=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new r(this,this.render,t),this.pages.load(),this.pages.show(e),this.trigger("update",this,{page:e,mode:this.render.getOrientation()})}updateFromHtml(t){let e=this.pages.getCurrentPageIndex();this.pages.destroy(),this.pages=new a(this,this.render,this.ui.getDistElement(),t),this.pages.load(),this.ui.updateItems(t),this.render.reload(),this.pages.show(e),this.trigger("update",this,{page:e,mode:this.render.getOrientation()})}clear(){this.pages.destroy(),this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(t){this.pages.show(t)}flipNext(t="top"){this.flipController.flipNext(t)}flipPrev(t="top"){this.flipController.flipPrev(t)}flip(t,e="top"){this.flipController.flipToPage(t,e)}updateState(t){this.trigger("changeState",this,t)}updatePageIndex(t){this.trigger("flip",this,t)}updateOrientation(t){this.ui.setOrientationStyle(t),this.update(),this.trigger("changeOrientation",this,t)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(t){return this.pages.getPage(t)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(t){this.mousePosition=t,this.isUserTouch=!0,this.isUserMove=!1}userMove(t,e){this.isUserTouch||e||!this.setting.showPageCorners?this.isUserTouch&&o.GetDistanceBetweenTwoPoint(this.mousePosition,t)>5&&(this.isUserMove=!0,this.flipController.fold(t)):this.flipController.showCorner(t)}userStop(t,e=!1){this.isUserTouch&&(this.isUserTouch=!1,e||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(t)))}}
59,Object.defineProperty(t,"__esModule",{value:!0})})(e)},71744:function(t,e,n){"use strict";var i=n(67294),r=n(42717);let o=i.forwardRef((t,e)=>{let n=(0,i.useRef)(null),o=(0,i.useRef)([]),s=(0,i.useRef)(),[a,h]=(0,i.useState)([]);(0,i.useImperativeHandle)(e,()=>({pageFlip:()=>s.current}));let c=(0,i.useCallback)(()=>{s.current&&s.current.clear()},[]),l=(0,i.useCallback)(()=>{let t=s.current;t&&(t.off("flip"),t.off("changeOrientation"),t.off("changeState"),t.off("init"),t.off("update"))},[]);return(0,i.useEffect)(()=>{if(o.current=[],t.children){let e=i.Children.map(t.children,t=>i.cloneElement(t,{ref(t){t&&o.current.push(t)}}));t.renderOnlyPageLengthChange&&a.length===e.length||(e.length<a.length&&c(),h(e))}},[t.children]),(0,i.useEffect)(()=>{a.length>0&&o.current.length>0&&(l(),n.current&&!s.current&&(s.current=new r.PageFlip(n.current,t)),s.current.getFlipController()?s.current.updateFromHtml(o.current):s.current.loadFromHTML(o.current),(()=>{let e=s.current;e&&(t.onFlip&&e.on("flip",e=>t.onFlip(e)),t.onChangeOrientation&&e.on("changeOrientation",e=>t.onChangeOrientation(e)),t.onChangeState&&e.on("changeState",e=>t.onChangeState(e)),t.onInit&&e.on("init",e=>t.onInit(e)),t.onUpdate&&e.on("update",e=>t.onUpdate(e)))})())},[a]),i.createElement("div",{ref:n,className:t.className,style:t.style},a)}),s=i.memo(o);e.Z=s},8554:function(t,e,n){"use strict";n.d(e,{BB:function(){return th},T3:function(){return tO},v0:function(){return i}});var i=n(99299),r=n(87462),o=n(45987),s=n(71002),a=n(15671),h=n(43144),c=n(97326),l=n(60136),u=n(82963),p=n(61120),d=n(4942),g=n(67294),f=n(45697),m=n.n(f),y=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,o=e.length;r<o;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))},v=["onKeyDown","onKeyPress","onKeyUp"],w=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp",],x=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],P=y(y(y(y(y(y(y(y(y(y(y(y(y(y(y(y(y(y([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate",],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),v,!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting",],!0),w,!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop",],!0),["onSelect"],!0),x,!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut",],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration",],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function S(t,e){var n={};return P.forEach(function(i){var r=t[i];r&&(e?n[i]=function(t){return r(t,e(i))}:n[i]=r)}),n}function b(t){var e=!1;return{promise:new Promise(function(n,i){t.then(function(t){return!e&&n(t)}).catch(function(t){return!e&&i(t)})}),cancel:function(){e=!0}}}function R(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t){if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=R(t[e]))&&(i&&(i+=" "),i+=n);else for(e in t)t[e]&&(i&&(i+=" "),i+=e)}return i}var E=function(){for(var t,e,n=0,i="";n<arguments.length;)(t=arguments[n++])&&(e=R(t))&&(i&&(i+=" "),i+=e);return i};function T(t,e){if(!t)throw Error("Invariant failed")}var k=function(t,e){},C=(0,g.createContext)(null);function D(t){var e=t.children,n=t.type;return g.createElement("div",{className:"react-pdf__message react-pdf__message--".concat(n)},e)}D.propTypes={children:m().node,type:m().oneOf(["error","loading","no-data"]).isRequired};var L=function(){function t(){(0,a.Z)(this,t),this.externalLinkTarget=null,this.externalLinkRel=null}return(0,h.Z)(t,[{key:"setDocument",value:function(t){this.pdfDocument=t}}
59,{key:"setViewer",value:function(t){this.pdfViewer=t}},{key:"setExternalLinkRel",value:function(t){this.externalLinkRel=t}},{key:"setExternalLinkTarget",value:function(t){this.externalLinkTarget=t}},{key:"setHistory",value:function(){}},{key:"pagesCount",get:function(){return this.pdfDocument?this.pdfDocument.numPages:0}},{key:"page",get:function(){return this.pdfViewer.currentPageNumber},set:function(t){this.pdfViewer.currentPageNumber=t}},{key:"rotation",get:function(){return 0},set:function(t){}},{key:"goToDestination",value:function(t){var e=this;new Promise(function(n){"string"==typeof t?e.pdfDocument.getDestination(t).then(n):Array.isArray(t)?n(t):t.then(n)}).then(function(n){T(Array.isArray(n),'"'.concat(n,'" is not a valid destination array.'));var i=n[0];new Promise(function(t){i instanceof Object?e.pdfDocument.getPageIndex(i).then(function(e){t(e)}).catch(function(){T(!1,'"'.concat(i,'" is not a valid page reference.'))}):"number"==typeof i?t(i):T(!1,'"'.concat(i,'" is not a valid destination reference.'))}).then(function(n){var i=n+1;T(i>=1&&i<=e.pagesCount,'"'.concat(i,'" is not a valid page number.')),e.pdfViewer.scrollPageIntoView({dest:t,pageIndex:n,pageNumber:i})})})}},{key:"navigateTo",value:function(t){this.goToDestination(t)}},{key:"goToPage",value:function(){}},{key:"addLinkAttributes",value:function(t,e,n){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=n?"_blank":this.externalLinkTarget||""}},{key:"getDestinationHash",value:function(){return"#"}},{key:"getAnchorUrl",value:function(){return"#"}},{key:"setHash",value:function(){}},{key:"executeNamedAction",value:function(){}},{key:"cachePageRef",value:function(){}},{key:"isPageVisible",value:function(){return!0}},{key:"isPageCached",value:function(){return!0}}]),t}(),I={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Z=n(97685),O="undefined"!=typeof document,A=O&&"file:"===window.location.protocol;function M(t){return void 0!==t}function B(t){return M(t)&&null!==t}function _(t){var e;return"string"==typeof t&&/^data:/.test(t)}function W(t){T(_(t),"Invalid data URI.");var e=t.split(","),n=(0,Z.Z)(e,2),i=n[0],r=n[1];return -1!==i.split(";").indexOf("base64")?atob(r):unescape(r)}var H="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function F(){k(!A,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(H))}function N(t){t&&t.cancel&&t.cancel()}function j(t,e){return Object.defineProperty(t,"width",{get:function(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get:function(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get:function(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get:function(){return this.view[3]},configurable:!0}),t}
59function G(t){return"RenderingCancelledException"===t.name}var $,U=n(74902),q=($={},[].concat((0,U.Z)(w),(0,U.Z)(x),(0,U.Z)(v)).forEach(function(t){$[t]=m().func}),$),z=[m().string,m().instanceOf(ArrayBuffer),m().shape({data:m().oneOfType([m().object,m().string]),httpHeaders:m().object,range:m().object,url:m().string,withCredentials:m().bool})];"undefined"!=typeof File&&z.push(m().instanceOf(File)),"undefined"!=typeof Blob&&z.push(m().instanceOf(Blob));var V=m().oneOfType([m().string,m().arrayOf(m().string)]),Y=m().oneOfType(z),K=m().instanceOf(L);m().oneOf(["_self","_blank","_parent","_top"]);var X=m().shape({commonObjs:m().shape({}).isRequired,getAnnotations:m().func.isRequired,getTextContent:m().func.isRequired,getViewport:m().func.isRequired,render:m().func.isRequired}),J=function(t,e,n){var i=t[e],r=t.pageNumber,o=t.pdf;if(!M(o))return null;if(M(i)){if("number"!=typeof i)return Error("`".concat(e,"` of type `").concat((0,s.Z)(i),"` supplied to `").concat(n,"`, expected `number`."));if(i<0)return Error("Expected `".concat(e,"` to be greater or equal to 0."));var a=o.numPages;if(i+1>a)return Error("Expected `".concat(e,"` to be less or equal to ").concat(a-1,"."))}else if(!M(r))return Error("`".concat(e,"` not supplied. Either pageIndex or pageNumber must be supplied to `").concat(n,"`."));return null},Q=function(t,e,n){var i=t[e],r=t.pageIndex,o=t.pdf;if(!M(o))return null;if(M(i)){if("number"!=typeof i)return Error("`".concat(e,"` of type `").concat((0,s.Z)(i),"` supplied to `").concat(n,"`, expected `number`."));if(i<1)return Error("Expected `".concat(e,"` to be greater or equal to 1."));var a=o.numPages;if(i>a)return Error("Expected `".concat(e,"` to be less or equal to ").concat(a,"."))}else if(!M(r))return Error("`".concat(e,"` not supplied. Either pageIndex or pageNumber must be supplied to `").concat(n,"`."));return null},tt=m().oneOfType([m().shape({getDestination:m().func.isRequired,getOutline:m().func.isRequired,getPage:m().func.isRequired,numPages:m().number.isRequired}),m().bool]),te=m().oneOfType([m().func,m().shape({current:m().any})]),tn=m().oneOf(["canvas","none","svg"]),ti=m().oneOf([0,90,180,270]),tr=["url"];function to(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function ts(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?to(Object(n),!0).forEach(function(e){(0,d.Z)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):to(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var ta=i.PDFDataRangeTransport,th=function(t){(0,l.Z)(m,t);var e,n,f=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(m);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function m(){var t;(0,a.Z)(this,m);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t=f.call.apply(f,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{pdf:null}),(0,d.Z)((0,c.Z)(t),"viewer",{scrollPageIntoView:function(e){var n=e.dest,i=e.pageIndex,r=e.pageNumber,o=t.props.onItemClick;if(o){o({dest:n,pageIndex:i,pageNumber:r});return}var s=t.pages[i];if(s){s.scrollIntoView();return}k(!1,"An internal link leading to page ".concat(r," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}}),(0,d.Z)((0,c.Z)(t),"linkService",new L),(0,d.Z)((0,c.Z)(t),"loadDocument",function(){N(t.runningTask),t.loadingTask&&t.loadingTask.destroy();var e=b(t.findDocumentSource());t.runningTask=e,e.promise.then(function(e){if(t.onSourceSuccess(),e){t.setState(function(t){return t.pdf?{pdf:null}:null});var n=t.props,r=n.options,o=n.onLoadProgress,s=n.onPassword,a=i.getDocument(ts(ts({},e),r));a.onPassword=s,o&&(a.onProgress=o),t.loadingTask=a,a.promise.then(function(e){t.setState(function(t){return t.pdf&&t.pdf.fingerprint===e.fingerprint?null:{pdf:e}},t.onLoadSuccess)}).catch(function(e){t.onLoadError(e)})}}).catch(function(e){t.onSourceError(e)})}),(0,d.Z)((0,c.Z)(t),"setupLinkService",function(){var e=t.props,n=e.externalLinkRel,i=e.externalLinkTarget;t.linkService.setViewer(t.viewer),t.linkService.setExternalLinkRel(n),t.linkService.setExternalLinkTarget(i)}),(0,d.Z)((0,c.Z)(t),"onSourceSuccess",function(){var e=t.props.onSourceSuccess;e&&e()}),(0,d.Z)((0,c.Z)(t),"onSourceError",function(e){k(e);var n=t.props.onSourceError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"onLoadSuccess",function(){var e=t.props.onLoadSuccess,n=t.state.pdf;e&&e(n),t.pages=Array(n.numPages),t.linkService.setDocument(n)}),(0,d.Z)((0,c.Z)(t),"onLoadError",function(e){t.setState({pdf:!1}),k(e);var n=t.props.onLoadError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"findDocumentSource",function(){return new Promise(function(e){var n,i,r,a,h=t.props.file;if(h||e(null),"string"==typeof h){if(_(h)){var c=W(h);e({data:c})}F(),e({url:h})}if(h instanceof ta&&e({range:h}),h instanceof ArrayBuffer&&e({data:h}),O&&(i=h,T(O,"isBlob can only be used in a browser environment"),i instanceof Blob||(r=h,T(O,"isFile can only be used in a browser environment"),r instanceof File))){(a=h,new Promise(function(t,e){var n=new FileReader;return n.onload=function(){return t(new Uint8Array(n.result))},n.onerror=function(t){switch(t.target.error.code){case t.target.error.NOT_FOUND_ERR:return e(Error("Error while reading a file: File not found."));case t.target.error.NOT_READABLE_ERR:return e(Error("Error while reading a file: File not readable."));case t.target.error.SECURITY_ERR:return e(Error("Error while reading a file: Security error."));case t.target.error.ABORT_ERR:return e(Error("Error while reading a file: Aborted."));default:return e(Error("Error while reading a file."))}},n.readAsArrayBuffer(a),null})).then(function(t){e({data:t})});return}if(T("object"===(0,s.Z)(h),"Invalid parameter in file, need either Uint8Array, string or a parameter object"),T(h.url||h.data||h.range,"Invalid parameter object: need either .data, .range or .url"),"string"==typeof h.url){if(_(h.url)){var l=h.url,u=(0,o.Z)(h,tr),p=W(l);e(ts({data:p},u))}F()}e(h)})}),(0,d.Z)((0,c.Z)(t),"registerPage",function(e,n){t.pages[e]=n}),(0,d.Z)((0,c.Z)(t),"unregisterPage",function(e){delete t.pages[e]}),t}
59return(0,h.Z)(m,[{key:"componentDidMount",value:function(){this.loadDocument(),this.setupLinkService()}},{key:"componentDidUpdate",value:function(t){this.props.file!==t.file&&this.loadDocument()}},{key:"componentWillUnmount",value:function(){N(this.runningTask),this.loadingTask&&this.loadingTask.destroy()}},{key:"childContext",get:function(){var t=this.linkService,e=this.registerPage,n=this.unregisterPage,i=this.props,r=i.imageResourcesPath,o=i.renderMode,s=i.rotate;return{imageResourcesPath:r,linkService:t,pdf:this.state.pdf,registerPage:e,renderMode:o,rotate:s,unregisterPage:n}}},{key:"eventProps",get:function(){var t=this;return S(this.props,function(){return t.state.pdf})}},{key:"renderChildren",value:function(){var t=this.props.children;return g.createElement(C.Provider,{value:this.childContext},t)}},{key:"renderContent",value:function(){var t=this.props.file,e=this.state.pdf;if(!t){var n=this.props.noData;return g.createElement(D,{type:"no-data"},"function"==typeof n?n():n)}if(null===e){var i=this.props.loading;return g.createElement(D,{type:"loading"},"function"==typeof i?i():i)}if(!1===e){var r=this.props.error;return g.createElement(D,{type:"error"},"function"==typeof r?r():r)}return this.renderChildren()}},{key:"render",value:function(){var t=this.props,e=t.className,n=t.inputRef;return g.createElement("div",(0,r.Z)({className:E("react-pdf__Document",e),ref:n},this.eventProps),this.renderContent())}}]),m}(g.PureComponent);th.defaultProps={error:"Failed to load PDF file.",loading:"Loading PDF…",noData:"No PDF file specified.",onPassword:function(t,e){switch(e){case I.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case I.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."))}}};var tc=m().oneOfType([m().func,m().node]);th.propTypes=ts(ts({},q),{},{children:m().node,className:V,error:tc,externalLinkRel:m().string,externalLinkTarget:m().string,file:Y,imageResourcesPath:m().string,inputRef:te,loading:tc,noData:tc,onItemClick:m().func,onLoadError:m().func,onLoadProgress:m().func,onLoadSuccess:m().func,onPassword:m().func,onSourceError:m().func,onSourceSuccess:m().func,rotate:m().number});var tl=(0,g.createContext)(null),tu=function(){function t(e){var n=e.num,i=e.gen;(0,a.Z)(this,t),this.num=n,this.gen=i}return(0,h.Z)(t,[{key:"toString",value:function(){var t="".concat(this.num,"R");return 0!==this.gen&&(t+=this.gen),t}}]),t}(),tp=["item"],td=function(t){(0,l.Z)(s,t);var e,n,i=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(s);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function s(){var t;(0,a.Z)(this,s);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t=i.call.apply(i,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"getDestination",function(){return new Promise(function(e,n){if(M(t.destination)){e(t.destination);return}var i=t.props,r=i.item,o=i.pdf;"string"==typeof r.dest?o.getDestination(r.dest).then(e).catch(n):e(r.dest)}).then(function(e){return t.destination=e,e})}),(0,d.Z)((0,c.Z)(t),"getPageIndex",function(){return new Promise(function(e,n){var i=t.props.pdf;if(M(t.pageIndex)){e(t.pageIndex);return}t.getDestination().then(function(t){if(t){var r=(0,Z.Z)(t,1)[0];i.getPageIndex(new tu(r)).then(e).catch(n)}})}).then(function(e){return t.pageIndex=e,t.pageIndex})}),(0,d.Z)((0,c.Z)(t),"getPageNumber",function(){return new Promise(function(e,n){if(M(t.pageNumber)){e(t.pageNumber);return}t.getPageIndex().then(function(t){e(t+1)}).catch(n)}).then(function(e){return t.pageNumber=e,e})}),(0,d.Z)((0,c.Z)(t),"onClick",function(e){var n=t.props.onClick;return e.preventDefault(),!!n&&Promise.all([t.getDestination(),t.getPageIndex(),t.getPageNumber()]).then(function(t){var e,i=(0,Z.Z)(t,3),r=i[0];n({dest:r,pageIndex:i[1],pageNumber:i[2]})})}),t}return(0,h.Z)(s,[{key:"renderSubitems",value:function(){var t=this.props,e=t.item,n=(0,o.Z)(t,tp);if(!e.items||!e.items.length)return null;var i=e.items;return g.createElement("ul",null,i.map(function(t,e){return g.createElement(s,(0,r.Z)({key:"string"==typeof t.destination?t.destination:e,item:t},n))}))}},{key:"render",value:function(){var t=this.props.item;return g.createElement("li",null,g.createElement("a",{href:"#",onClick:this.onClick},t.title),this.renderSubitems())}}]),s}
59(g.PureComponent),tg=m().oneOfType([m().string,m().arrayOf(m().any)]);td.propTypes={item:m().shape({dest:tg,items:m().arrayOf(m().shape({dest:tg,title:m().string})),title:m().string}).isRequired,onClick:m().func,pdf:tt.isRequired};var tf=function(t){return g.createElement(C.Consumer,null,function(e){return g.createElement(tl.Consumer,null,function(n){return g.createElement(td,(0,r.Z)({},e,n,t))})})};function tm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function ty(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Boolean);return n.length<=1?n[0]||null:function(t){n.forEach(function(e){"function"==typeof e?e(t):e&&(e.current=t)})}}(function(t){(0,l.Z)(o,t);var e,n,i=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(o);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function o(){var t;(0,a.Z)(this,o);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t=i.call.apply(i,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{outline:null}),(0,d.Z)((0,c.Z)(t),"loadOutline",function(){var e=t.props.pdf;t.setState(function(t){return t.outline?{outline:null}:null});var n=b(e.getOutline());t.runningTask=n,n.promise.then(function(e){t.setState({outline:e},t.onLoadSuccess)}).catch(function(e){t.onLoadError(e)})}),(0,d.Z)((0,c.Z)(t),"onLoadSuccess",function(){var e=t.props.onLoadSuccess,n=t.state.outline;e&&e(n)}),(0,d.Z)((0,c.Z)(t),"onLoadError",function(e){t.setState({outline:!1}),k(e);var n=t.props.onLoadError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"onItemClick",function(e){var n=e.dest,i=e.pageIndex,r=e.pageNumber,o=t.props.onItemClick;o&&o({dest:n,pageIndex:i,pageNumber:r})}),t}return(0,h.Z)(o,[{key:"componentDidMount",value:function(){T(this.props.pdf,"Attempted to load an outline, but no document was specified."),this.loadOutline()}},{key:"componentDidUpdate",value:function(t){var e=this.props.pdf;t.pdf&&e!==t.pdf&&this.loadOutline()}},{key:"componentWillUnmount",value:function(){N(this.runningTask)}},{key:"childContext",get:function(){return{onClick:this.onItemClick}}},{key:"eventProps",get:function(){var t=this;return S(this.props,function(){return t.state.outline})}},{key:"renderOutline",value:function(){var t=this.state.outline;return g.createElement("ul",null,t.map(function(t,e){return g.createElement(tf,{key:"string"==typeof t.destination?t.destination:e,item:t})}))}},{key:"render",value:function(){var t=this.props.pdf,e=this.state.outline;if(!t||!e)return null;var n=this.props,i=n.className,o=n.inputRef;return g.createElement("div",(0,r.Z)({className:E("react-pdf__Outline",i),ref:o},this.eventProps),g.createElement(tl.Provider,{value:this.childContext},this.renderOutline()))}}]),o})(g.PureComponent).propTypes=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tm(Object(n),!0).forEach(function(e){(0,d.Z)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tm(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({className:V,inputRef:te,onItemClick:m().func,onLoadError:m().func,onLoadSuccess:m().func,pdf:tt},q);var tv=(0,g.createContext)(null),tw=i.AnnotationMode,tx=function(t){(0,l.Z)(r,t);var e,n,i=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(r);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function r(){var t;(0,a.Z)(this,r);for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];return t=i.call.apply(i,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"canvasElement",(0,g.createRef)()),(0,d.Z)((0,c.Z)(t),"onRenderSuccess",function(){t.renderer=null;var e=t.props,n=e.onRenderSuccess,i=e.page,r=e.scale;n&&n(j(i,r))}),(0,d.Z)((0,c.Z)(t),"onRenderError",function(e){if(!G(e)){k(e);var n=t.props.onRenderError;n&&n(e)}}),(0,d.Z)((0,c.Z)(t),"drawPageOnCanvas",function(){var e=t.canvasElement.current;if(!e)return null;var n=(0,c.Z)(t),i=n.renderViewport,r=n.viewport,o=t.props,s=o.canvasBackgroun
59d,a=o.page,h=o.renderForms;e.width=i.width,e.height=i.height,e.style.width="".concat(Math.floor(r.width),"px"),e.style.height="".concat(Math.floor(r.height),"px");var l={annotationMode:h?tw.ENABLE_FORMS:tw.ENABLE,get canvasContext(){return e.getContext("2d",{alpha:!1})},viewport:i};s&&(l.background=s),t.cancelRenderingTask();var u=a.render(l);return t.renderer=u,u.promise.then(t.onRenderSuccess).catch(t.onRenderError)}),t}return(0,h.Z)(r,[{key:"componentDidMount",value:function(){this.drawPageOnCanvas()}},{key:"componentDidUpdate",value:function(t){var e=this.props,n=e.canvasBackground,i=e.devicePixelRatio,r=e.page,o=e.renderForms;(n!==t.canvasBackground||i!==t.devicePixelRatio||o!==t.renderForms)&&(r.cleanup(),this.drawPageOnCanvas())}},{key:"componentWillUnmount",value:function(){this.cancelRenderingTask();var t=this.canvasElement.current;t&&(t.width=0,t.height=0)}},{key:"cancelRenderingTask",value:function(){this.renderer&&(this.renderer.cancel(),this.renderer=null)}},{key:"devicePixelRatio",get:function(){return this.props.devicePixelRatio||O&&window.devicePixelRatio||1}},{key:"renderViewport",get:function(){var t=this.devicePixelRatio,e=this.props,n=e.page,i=e.rotate,r=e.scale;return n.getViewport({scale:r*t,rotation:i})}},{key:"viewport",get:function(){var t=this.props,e=t.page,n=t.rotate,i=t.scale;return e.getViewport({scale:i,rotation:n})}},{key:"render",value:function(){var t=this.props.canvasRef;return g.createElement("canvas",{className:"react-pdf__Page__canvas",dir:"ltr",ref:ty(t,this.canvasElement),style:{display:"block",userSelect:"none"}})}}]),r}(g.PureComponent);function tP(t){return g.createElement(tv.Consumer,null,function(e){return g.createElement(tx,(0,r.Z)({},e,t))})}tx.propTypes={canvasBackground:m().string,canvasRef:te,devicePixelRatio:m().number,onRenderError:m().func,onRenderSuccess:m().func,page:X.isRequired,renderForms:m().bool,rotate:ti,scale:m().number.isRequired};var tS=function(t){(0,l.Z)(o,t);var e,n,r=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(o);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function o(){var t;(0,a.Z)(this,o);for(var e=arguments.length,n=Array(e),s=0;s<e;s++)n[s]=arguments[s];return t=r.call.apply(r,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{svg:null}),(0,d.Z)((0,c.Z)(t),"onRenderSuccess",function(){t.renderer=null;var e=t.props,n=e.onRenderSuccess,i=e.page,r=e.scale;n&&n(j(i,r))}),(0,d.Z)((0,c.Z)(t),"onRenderError",function(e){if(!G(e)){k(e);var n=t.props.onRenderError;n&&n(e)}}),(0,d.Z)((0,c.Z)(t),"renderSVG",function(){var e=t.props.page;return t.renderer=e.getOperatorList(),t.renderer.then(function(n){var r=new i.SVGGraphics(e.commonObjs,e.objs);t.renderer=r.getSVG(n,t.viewport).then(function(e){t.setState({svg:e},t.onRenderSuccess)}).catch(t.onRenderError)}).catch(t.onRenderError)}),(0,d.Z)((0,c.Z)(t),"drawPageOnContainer",function(e){var n=t.state.svg;if(e&&n){e.firstElementChild||e.appendChild(n);var i=t.viewport,r=i.width,o=i.height;n.setAttribute("width",r),n.setAttribute("height",o)}}),t}return(0,h.Z)(o,[{key:"componentDidMount",value:function(){this.renderSVG()}},{key:"viewport",get:function(){var t=this.props,e=t.page,n=t.rotate,i=t.scale;return e.getViewport({scale:i,rotation:n})}},{key:"render",value:function(){var t=this,e=this.viewport,n=e.width,i=e.height;return g.createElement("div",{className:"react-pdf__Page__svg",ref:function(e){return t.drawPageOnContainer(e)},style:{display:"block",backgroundColor:"white",overflow:"hidden",width:n,height:i,userSelect:"none"}})}}]),o}(g.PureComponent);function tb(t){return g.createElement(tv.Consumer,null,function(e){return g.createElement(tS,(0,r.Z)({},e,t))})}function tR(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}tS.propTypes={onRenderError:m().func,onRenderSuccess:m().func,page:X.isRequired,rotate:ti,scale:m().number.isRequired};var tE=function(t){(0,l.Z)(o,t);var e,n,r=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(o);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function o(){var t;(0,a.Z)(this,o);for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t=r.call.apply(r,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{textContent:null}),(0,d.Z)((0,c.Z)(t),"layerElement",(0,g.createRef)()),(0,d.Z)((0,c.Z)(t),"endElement",(0,g.createRef)()),(0,d.Z)((0,c.Z)(t),"loadTextContent",function(){var e=b(t.props.page.getTextContent());t.runningTask=e,e.promise.then(function(e){t.setState({textContent:e},t.onLoadSuccess)}).catch(function(e){t.onLoadError(e)})}),(0,d.Z)((0,c.Z)(t),"onLoadSuccess",function(){var e=t.props.onGetTextSuccess,n=t.state.textContent;e&&e(n)}),(0,d.Z)((0,c.Z)(t),"onLoadError",function(e){t.setState({textItems:!1}),k(e);var n=t.props.onGetTextError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"onRenderSuccess",function(){var e=t.props.onRenderTextLayerSuccess;e&&e()}),(0,d.Z)((0,c.Z)(t),"onRenderError",function(e){k(e);var n=t.props.onRenderTextLayerError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"onMouseDown",function(){var e=t.endElement.current;e&&e.classList.add("active")}),(0,d.Z)((0,c.Z)(t),"onMouseUp",function(){var e=t.endElement.current;e&&e.classList.remove("active")}),t}
59return(0,h.Z)(o,[{key:"componentDidMount",value:function(){T(this.props.page,"Attempted to load page text content, but no page was specified."),k(1===parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),this.loadTextContent()}},{key:"componentDidUpdate",value:function(t){var e=this.props.page;t.page&&e!==t.page&&this.loadTextContent()}},{key:"componentWillUnmount",value:function(){N(this.runningTask)}},{key:"viewport",get:function(){var t=this.props,e=t.page,n=t.rotate,i=t.scale;return e.getViewport({scale:i,rotation:n})}},{key:"unrotatedViewport",get:function(){var t=this.props,e=t.page,n=t.scale;return e.getViewport({scale:n})}},{key:"rotate",get:function(){var t=this.props,e=t.page;return t.rotate-e.rotate}},{key:"renderTextLayer",value:function(){var t=this,e=this.state.textContent;if(!e)return null;var n=this.layerElement.current,r=this.viewport,o=this.props,s=o.customTextRenderer,a=o.pageIndex,h=o.pageNumber;N(this.runningTask),n.innerHTML="";var c=i.renderTextLayer({container:n,textContent:e,viewport:r});this.runningTask=c,c.promise.then(function(){var i=document.createElement("div");if(i.className="endOfContent",n.append(i),t.endElement.current=i,s){var r=0;e.items.forEach(function(e,n){var i=t.layerElement.current.children[r],o=s(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tR(Object(n),!0).forEach(function(e){(0,d.Z)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tR(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({pageIndex:a,pageNumber:h,itemIndex:n},e));i.innerHTML=o,r+=e.str&&e.hasEOL?2:1})}t.onRenderSuccess()}).catch(function(e){t.onRenderError(e)})}},{key:"render",value:function(){return g.createElement("div",{className:"react-pdf__Page__textContent textLayer",onMouseUp:this.onMouseUp,onMouseDown:this.onMouseDown,ref:this.layerElement},this.renderTextLayer())}}]),o}(g.PureComponent);function tT(t){return g.createElement(tv.Consumer,null,function(e){return g.createElement(tE,(0,r.Z)({},e,t))})}tE.propTypes={customTextRenderer:m().func,onGetTextError:m().func,onGetTextSuccess:m().func,onRenderTextLayerError:m().func,onRenderTextLayerSuccess:m().func,page:X.isRequired,pageIndex:m().number.isRequired,pageNumber:m().number.isRequired,rotate:ti,scale:m().number};var tk=function(t){(0,l.Z)(o,t);var e,n,r=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(o);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function o(){var t;(0,a.Z)(this,o);for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t=r.call.apply(r,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{annotations:null}),(0,d.Z)((0,c.Z)(t),"layerElement",(0,g.createRef)()),(0,d.Z)((0,c.Z)(t),"loadAnnotations",function(){var e=b(t.props.page.getAnnotations());t.runningTask=e,e.promise.then(function(e){t.setState({annotations:e},t.onLoadSuccess)}).catch(function(e){t.onLoadError(e)})}),(0,d.Z)((0,c.Z)(t),"onLoadSuccess",function(){var e=t.props.onGetAnnotationsSuccess,n=t.state.annotations;e&&e(n)}),(0,d.Z)((0,c.Z)(t),"onLoadError",function(e){t.setState({annotations:!1}),k(e);var n=t.props.onGetAnnotationsError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"onRenderSuccess",function(){var e=t.props.onRenderAnnotationLayerSuccess;e&&e()}),(0,d.Z)((0,c.Z)(t),"onRenderError",function(e){k(e);var n=t.props.onRenderAnnotationLayerError;n&&n(e)}),t}return(0,h.Z)(o,[{key:"componentDidMount",value:function(){T(this.props.page,"Attempted to load page annotations, but no page was specified."),k(1===parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),this.loadAnnotations()}},{key:"componentDidUpdate",value:function(t){var e=this.props,n=e.page,i=e.renderForms;(t.page&&n!==t.page||i!==t.renderForms)&&this.loadAnnotations()}},{key:"componentWillUnmount",value:function(){N(this.runningTask)}},{key:"viewport",get:function(){var t=this.props,e=t.page,n=t.rotate,i=t.scale;return e.getViewport({scale:i,rotation:n})}},{key:"renderAnnotationLayer",value:function(){var t=this.state.annotations;if(t){var e=this.props,n=e.imageResourcesPath,r=e.linkService,o=e.page,s=e.renderForms,a=this.viewport.clone({dontFlip:!0}),h={annotations:t,div:this.layerElement.current,imageResourcesPath:n,linkService:r,page:o,renderForms:s,viewport:
59a};this.layerElement.current.innerHTML="";try{i.AnnotationLayer.render(h),this.onRenderSuccess()}catch(c){this.onRenderError(c)}}}},{key:"render",value:function(){return g.createElement("div",{className:"react-pdf__Page__annotations annotationLayer",ref:this.layerElement},this.renderAnnotationLayer())}}]),o}(g.PureComponent);tk.propTypes={imageResourcesPath:m().string,linkService:K.isRequired,onGetAnnotationsError:m().func,onGetAnnotationsSuccess:m().func,onRenderAnnotationLayerError:m().func,onRenderAnnotationLayerSuccess:m().func,page:X,renderForms:m().bool,rotate:ti,scale:m().number};var tC=function(t){return g.createElement(C.Consumer,null,function(e){return g.createElement(tv.Consumer,null,function(n){return g.createElement(tk,(0,r.Z)({},e,n,t))})})};function tD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function tL(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tD(Object(n),!0).forEach(function(e){(0,d.Z)(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tD(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var tI=function(t){(0,l.Z)(o,t);var e,n,i=(n=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}(),function(){var t,e=(0,p.Z)(o);if(n){var i=(0,p.Z)(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return(0,u.Z)(this,t)});function o(){var t;(0,a.Z)(this,o);for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return t=i.call.apply(i,[this].concat(n)),(0,d.Z)((0,c.Z)(t),"state",{page:null}),(0,d.Z)((0,c.Z)(t),"pageElement",(0,g.createRef)()),(0,d.Z)((0,c.Z)(t),"onLoadSuccess",function(){var e=t.props,n=e.onLoadSuccess,i=e.registerPage,r=t.state.page;n&&n(j(r,t.scale)),i&&i(t.pageIndex,t.pageElement.current)}),(0,d.Z)((0,c.Z)(t),"onLoadError",function(e){t.setState({page:!1}),k(e);var n=t.props.onLoadError;n&&n(e)}),(0,d.Z)((0,c.Z)(t),"loadPage",function(){var e=t.props.pdf,n=t.getPageNumber();if(n){t.setState(function(t){return t.page?{page:null}:null});var i=b(e.getPage(n));t.runningTask=i,i.promise.then(function(e){t.setState({page:e},t.onLoadSuccess)}).catch(function(e){t.onLoadError(e)})}}),t}return(0,h.Z)(o,[{key:"componentDidMount",value:function(){T(this.props.pdf,"Attempted to load a page, but no document was specified."),this.loadPage()}},{key:"componentDidUpdate",value:function(t){var e=this.props.pdf;if(t.pdf&&e!==t.pdf||this.getPageNumber()!==this.getPageNumber(t)){var n=this.props.unregisterPage;n&&n(this.getPageIndex(t)),this.loadPage()}}},{key:"componentWillUnmount",value:function(){var t=this.props.unregisterPage;t&&t(this.pageIndex),N(this.runningTask)}},{key:"childContext",get:function(){var t=this.pageIndex,e=this.pageNumber,n=this.state.page;if(!n)return{};var i=this.props,r=i.canvasBackground,o=i.customTextRenderer,s=i.devicePixelRatio,a=i.onGetAnnotationsError,h=i.onGetAnnotationsSuccess,c=i.onGetTextError,l=i.onGetTextSuccess,u=i.onRenderAnnotationLayerError,p=i.onRenderAnnotationLayerSuccess,d=i.onRenderError,g=i.onRenderSuccess,f=i.onRenderTextLayerError,m=i.onRenderTextLayerSuccess,y=i.renderForms,v=i.renderInteractiveForms;return{canvasBackground:r,customTextRenderer:o,devicePixelRatio:s,onGetAnnotationsError:a,onGetAnnotationsSuccess:h,onGetTextError:c,onGetTextSuccess:l,onRenderAnnotationLayerError:u,onRenderAnnotationLayerSuccess:p,onRenderError:d,onRenderSuccess:g,onRenderTextLayerError:f,onRenderTextLayerSuccess:m,page:n,pageIndex:t,pageNumber:e,renderForms:null!=y?y:v,rotate:this.rotate,scale:this.scale}}},{key:"getPageIndex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return B(t.pageNumber)?t.pageNumber-1:B(t.pageIndex)?t.pageIndex:null}},{key:"getPageNumber",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;return B(t.pageNumber)?t.pageNumber:B(t.pageIndex)?t.pageIndex+1:null}},{key:"pageIndex",get:function(){return this.getPageIndex()}},{key:"pageNumber",get:function(){return this.getPageNumber()}},{key:"rotate",get:function(){var t=this.props.rotate;if(B(t))return t;var e=this.state.page;return e?e.rotate:null}},{key:"scale",get:function(){var t=this.state.page;if(!t)return null;var e=this.props,n=e.scale,i=e.width,r=e.height,o=this.rotate,s=1;if(i||r){var a=t.getViewport({scale:1,rotation:o});s=i?i/a.width:r/a.height}return(null===n?1:n)*s}
59},{key:"eventProps",get:function(){var t=this;return S(this.props,function(){var e=t.state.page;return e?j(e,t.scale):e})}},{key:"pageKey",get:function(){return"".concat(this.pageIndex,"@").concat(this.scale,"/").concat(this.rotate)}},{key:"pageKeyNoScale",get:function(){return"".concat(this.pageIndex,"/").concat(this.rotate)}},{key:"renderMainLayer",value:function(){var t=this.props,e=t.canvasRef,n=t.renderMode;switch(n){case"none":return null;case"svg":return g.createElement(tb,{key:"".concat(this.pageKeyNoScale,"_svg")});default:return g.createElement(tP,{key:"".concat(this.pageKey,"_canvas"),canvasRef:e})}}},{key:"renderTextLayer",value:function(){return this.props.renderTextLayer?g.createElement(tT,{key:"".concat(this.pageKey,"_text")}):null}},{key:"renderAnnotationLayer",value:function(){return this.props.renderAnnotationLayer?g.createElement(tC,{key:"".concat(this.pageKey,"_annotations")}):null}},{key:"renderChildren",value:function(){var t=this.props.children;return g.createElement(tv.Provider,{value:this.childContext},this.renderMainLayer(),this.renderTextLayer(),this.renderAnnotationLayer(),t)}},{key:"renderContent",value:function(){var t=this.pageNumber,e=this.props.pdf,n=this.state.page;if(!t){var i=this.props.noData;return g.createElement(D,{type:"no-data"},"function"==typeof i?i():i)}if(null===e||null===n){var r=this.props.loading;return g.createElement(D,{type:"loading"},"function"==typeof r?r():r)}if(!1===e||!1===n){var o=this.props.error;return g.createElement(D,{type:"error"},"function"==typeof o?o():o)}return this.renderChildren()}},{key:"render",value:function(){var t=this.pageNumber,e=this.props,n=e.className,i=e.inputRef;return g.createElement("div",(0,r.Z)({className:E("react-pdf__Page",n),"data-page-number":t,ref:ty(i,this.pageElement),style:{position:"relative",minWidth:"min-content",minHeight:"min-content"}},this.eventProps),this.renderContent())}}]),o}(g.PureComponent);tI.defaultProps={error:"Failed to load the page.",loading:"Loading page…",noData:"No page specified.",renderAnnotationLayer:!0,renderMode:"canvas",renderTextLayer:!0,scale:1};var tZ=m().oneOfType([m().func,m().node]);tI.propTypes=tL(tL({},q),{},{canvasBackground:m().string,children:m().node,className:V,customTextRenderer:m().func,devicePixelRatio:m().number,error:tZ,height:m().number,imageResourcesPath:m().string,inputRef:te,loading:tZ,noData:tZ,onGetTextError:m().func,onGetTextSuccess:m().func,onLoadError:m().func,onLoadSuccess:m().func,onRenderError:m().func,onRenderSuccess:m().func,onRenderTextLayerError:m().func,onRenderTextLayerSuccess:m().func,pageIndex:J,pageNumber:Q,pdf:tt,registerPage:m().func,renderAnnotationLayer:m().bool,renderForms:m().bool,renderInteractiveForms:m().bool,renderMode:tn,renderTextLayer:m().bool,rotate:ti,scale:m().number,unregisterPage:m().func,width:m().number});var tO=g.forwardRef(function(t,e){return g.createElement(C.Consumer,null,function(n){return g.createElement(tI,(0,r.Z)({ref:e},n,t))})});k(!A,"Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ".concat(H)),i.GlobalWorkerOptions.workerSrc="pdf.worker.js"}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.