@syncfusion/ej2-pdfviewer
Version:
Essential JS 2 PDF viewer Component
10 lines • 3.25 MB
JavaScript
/*!
* filename: ej2-pdfviewer.min.js
* version : 29.1.38
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
this.ej=this.ej||{},this.ej.pdfviewer=function(e,t,i,n,o,r,a,s,l,d,A,h,p,c){"use strict";function g(e){return"Line"===e.shapeAnnotationType||"LineWidthArrowHead"===e.shapeAnnotationType||"Distance"===e.shapeAnnotationType||"Polygon"===e.shapeAnnotationType}function u(e,t){if(e&&t)if(e.formFieldAnnotationType)-1!==e.id.indexOf("diagram_helper")?(t.style.fill="transparent",t.style.strokeWidth=1,t.style.strokeDashArray=e.borderDashArray):(t.style.fill="transparent",t.style.strokeWidth=0);else{var i="#ffffff00"===e.fillColor?"transparent":e.fillColor;t.style.fill=i||"white",t.style.strokeColor=e.strokeColor?e.strokeColor:e.borderColor,t.style.color=e.strokeColor?e.strokeColor:e.borderColor,t.style.strokeWidth=e.thickness,"Image"!==e.shapeAnnotationType&&"SignatureText"!==e.shapeAnnotationType&&"SignatureImage"!==e.shapeAnnotationType||(t.style.strokeWidth=0),t.style.strokeDashArray=e.borderDashArray,t.style.opacity=e.opacity}}function f(e){for(var t=0,n=0;n<e.length-1;n++)t+=i.Point.findLength(e[parseInt(n.toString(),10)],e[n+1]);return t}function m(e){return i.Point.getLengthFromListOfPoints(e)}function w(e,t){var i={width:e.actualSize.width,height:e.actualSize.height,x:e.offsetX-e.actualSize.width*e.pivot.x+.5,y:e.offsetY-e.actualSize.height*e.pivot.y+.5,angle:e.rotateAngle+e.parentTransform,fill:e.style.fill,stroke:e.style.strokeColor,pivotX:e.pivot.x,pivotY:e.pivot.y,strokeWidth:1,opacity:e.style.opacity,dashArray:e.style.strokeDashArray||"",visible:e.visible,id:e.id};return t&&(i.x+=t.tx,i.y+=t.ty),i}function C(e){return void 0!==e&&"string"==typeof e&&(e=t.getValue(e,window)),e}function B(e,t,i){var n={};if(e){i=e.propName;var o=e.properties||e,r=[],a=[];if((r=r.concat(Object.keys(o))).push("version"),i){var s=C(t);a=s?s(i):[],r=r.concat(a)}for(var l=y(i),d=0,A=r=r.concat(l);d<A.length;d++){var h=A[d];"historyManager"!==h&&("wrapper"!==h?!(!e[""+h]||!Object.prototype.hasOwnProperty.call(e,"observers"))||(e[""+h]instanceof Array?n[""+h]=S(-1===l.indexOf(h)&&e[""+i]?e[""+i][""+h]:e[""+h],t,h):e[""+h]instanceof Array==!1&&e[""+h]instanceof HTMLElement?n[""+h]=e[""+h].cloneNode(!0).innerHtml:e[""+h]instanceof Array==!1&&e[""+h]instanceof Object&&"template"!==h?n[""+h]=B(-1===l.indexOf(h)&&e[""+i]?e[""+i][""+h]:e[""+h]):n[""+h]=e[""+h]):e[""+h]&&(n[""+h]={actualSize:{width:e[""+h].actualSize.width,height:e[""+h].actualSize.height},offsetX:e[""+h].offsetX,offsetY:e[""+h].offsetY}))}}return n}function S(e,t,i){var n;if(e){n=[];for(var o=0;o<e.length;o++)e[parseInt(o.toString(),10)]instanceof Array?n.push(e[parseInt(o.toString(),10)]):e[parseInt(o.toString(),10)]instanceof Object?n.push(B(e[parseInt(o.toString(),10)],t,i)):n.push(e[parseInt(o.toString(),10)])}return n}function y(e){switch(e){case"nodes":case"children":return["inEdges","outEdges","parentId","processId","nodeId","umlIndex","isPhase","isLane"];case"connectors":return["parentId"];case"annotation":case"annotations":return["nodeId"];case"shape":return["hasHeader"]}return[]}function I(e,t){var n;if("Distance"===e.shapeAnnotationType)for(var o=0,r=void 0,a=0;a<e.wrapper.children.length;a++){var s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(e.wrapper.children[parseInt(a.toString(),10)].id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;0===o?(r={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=e.sourcePoint):(r={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},l=e.targetPoint);var d=i.identityMatrix();if(i.rotateMatrix(d,s,l.x,l.y),n=i.transformPointByMatrix(d,{x:r.x,y:r.y}),t==="Leader"+o)return{leader:"leader"+o,point:n};o++}}return{leader:"",point:n}}function E(e,t){var i=(t=e.vertexPoints).slice(0);return i&&i.length>0&&(e.sourcePoint=i[0],e.targetPoint=i[i.length-1]),i}function v(e,t){for(var i,n="",o=[],r=0;r<t.length;)o.push({x:t[parseInt(r.toString(),10)].x,y:t[parseInt(r.toString(),10)].y}),r++;o=x(e,o);for(var a=0;a<o.length;a++)i=o[parseInt(a.toString(),10)],0===a&&(n="M"+i.x+" "+i.y),a>0&&(n+=" L"+i.x+" "+i.y);return n}function V(e,t,n){var o=new i.Rect,r=v(e,t);if(o=i.Rect.toBounds(t),n.width=o.width,n.height=o.height,n.offsetX=o.x+n.width/2,n.offsetY=o.y+n.height/2,n.data=r,e.wrapper){e.wrapper.offsetX=n.offsetX,e.wrapper.offsetY=n.offsetY;var a=o.width;a=o.width<o.height?o.height:o.width,e.wrapper.width=e.enableShapeLabel?a/2:a,e.wrapper.height=o.height}return n}function Q(e,t){var i=[];return i=E(e),t.staticSize=!0,t=V(e,i,t),u(e,t),t}function D(e,t,n,o,r){t.offsetX=n.x,t.offsetY=n.y;var a,s=i.Point.findAngle(n,o),l=J(r?e.sourceDecoraterShapes:e.taregetDecoraterShapes),d=0;"LineWidthArrowHead"===e.shapeAnnotationType||"Line"===e.shapeAnnotationType?(d=e.thickness,a=new i.Size(12*d,12*d)):(d=e.thickness<=5?5:e.thickness,a=new i.Size(2*d,2*d)),t.transform=i.RotateTransform.Self,u(e,t),t.style.fill="tranparent"!==e.fillColor?e.fillColor:"white",t.rotateAngle=s,t.data=l,t.canMeasurePath=!0,t.width=a.width,t.height=a.height,"Butt"===e.sourceDecoraterShapes&&(t.width=a.width-10,t.height=a.height+10)}function b(e,t,n,o){var r=new i.PathElement;return D(e,r,t,n,o),r}function x(e,t){return t[0]=M(e,t,!0),t[t.length-1]=M(e,t,!1),t}function M(e,t,n){var o={x:0,y:0},r={x:0,y:0},a={x:0,y:0},s=t.length;r=n?t[0]:t[s-1],a=n?t[1]:t[s-2];var l=i.Point.distancePoints(r,a);l=0===l?1:l;var d=e.thickness;o.x=Math.round(r.x+d*(a.x-r.x)/l),o.y=Math.round(r.y+d*(a.y-r.y)/l);return o=i.Point.adjustPoint(o,a,!0,.5)}function F(e,t,n,o){var r=[],a=i.Point.findAngle(t[0],t[1]),s=O(e,a);return!o.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?s.content=e.notes:s.content=n.setConversion(f([t[0],t[1]])*n.pixelToPointFactor,e),s.rotateValue={y:-10,angle:a},!0===e.enableShapeLabel&&(s.style.strokeColor=e.labelBorderColor,s.style.fill=e.labelFillColor,s.style.fontSize=e.fontSize,s.style.color=e.fontColor,s.style.fontFamily=e.fontFamily),r.push(s),r}function T(e,i,n){for(var o,r=0;r<e.wrapper.children.length;r++){var a=e.wrapper.children[parseInt(r.toString(),10)];a&&!t.isNullOrUndefined(a.content)&&(o=n.setConversion(f([i[0],i[1]])*n.pixelToPointFactor,e),a.content=o,a.childNodes[0].text=a.content,a.refreshTextElement())}return o}function k(e,i){for(var n,o=0;o<e.wrapper.children.length;o++){var r=e.wrapper.children[parseInt(o.toString(),10)];r&&!t.isNullOrUndefined(r.content)&&(n=i.setConversion(e.bounds.width/2*i.pixelToPointFactor,e),r.content=n,2===r.childNodes.length?(r.childNodes[0].text=n,r.childNodes.splice(r.childNodes.length-1,1)):r.childNodes[0].text=n,r.refreshTextElement())}return n}function P(e,t,n,o){var r=[],a=i.Point.findAngle(t[0],t[1]),s=O(e,a);return!o.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?s.content=e.notes:s.content=n.calculatePerimeter(e),!0===e.enableShapeLabel&&(s.style.strokeColor=e.labelBorderColor,s.style.fill=e.labelFillColor,s.style.fontSize=e.fontSize,s.style.color=e.fontColor,s.style.fontFamily=e.fontFamily),s.rotateValue={y:-10,angle:a},r.push(s),r}function N(e,i,n){for(var o,r=0;r<e.wrapper.children.length;r++){var a=e.wrapper.children[parseInt(r.toString(),10)];a&&!t.isNullOrUndefined(a.content)&&(o=n.calculatePerimeter(e),a.content=o,a.childNodes[0].text=a.content,a.refreshTextElement())}return o}function R(e){for(var i=0;i<e.wrapper.children.length;i++){var n=e.wrapper.children[parseInt(i.toString(),10)];n&&!t.isNullOrUndefined(n.content)&&e.wrapper.children.splice(i,1)}}function L(e){if(e.wrapper&&e.wrapper.children)for(var i=0;i<e.wrapper.children.length;i++){var n=e.wrapper.children[parseInt(i.toString(),10)];n&&!t.isNullOrUndefined(n.content)&&(n.content=e.notes,n.childNodes[0].text=n.content,n.refreshTextElement())}}function U(e){var t,i="";i="M"+e[0].x+" "+e[0].y;var n;for(n=1;n<e.length;n++)i+="L"+(t=e[parseInt(n.toString(),10)]).x+" "+t.y;return i+="Z"}function O(e,t){var n=new i.TextElement;return u(e,n),n.style.fill="transparent",n.id=i.randomId(),n.horizontalAlignment="Center",n.rotateValue={y:10,angle:t},n.verticalAlignment="Top",n.relativeMode="Object",n.setOffsetWithRespectToBounds(.5,.5,"Absolute"),n.style.textWrapping="NoWrap",n}function z(e,t){var i=[],n=H(e,t[0],t[1]);return i.push(n),n=H(e,t[1],t[0],!0),i.push(n),i}function H(e,t,n,o){var r=new i.PathElement;r.offsetX=t.x,r.offsetY=t.y;var a=i.Point.findAngle(t,n),s={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=i.identityMatrix();i.rotateMatrix(l,0-a,s.x,s.y);var d=i.transformPointByMatrix(l,t),A={x:d.x,y:d.y-e.leaderHeight};l=i.identityMatrix(),i.rotateMatrix(l,a,r.offsetX,r.offsetY),d=i.transformPointByMatrix(l,A);var h={x:t.x,y:t.y};r.offsetX=h.x,r.offsetY=h.y,r.transform=i.RotateTransform.Self;var p="M"+t.x+","+t.y+",L"+d.x+","+d.y+"Z",c=new i.Size(0,e.leaderHeight);return r.pivot.x=.5,o?(r.id="leader2_"+i.randomId(),r.pivot.y=0):(r.id="leader1_"+i.randomId(),r.pivot.y=1),u(e,r),r.rotateAngle=a,r.data=p,r.canMeasurePath=!0,r.width=c.width,r.height=c.height,r}function Y(e,n){var o=e.vertexPoints;if(!t.isNullOrUndefined(o))for(var r=0;r<o.length-1;r++){var a=o[parseInt(r.toString(),10)],s=o[r+1],l=i.Rect.toBounds([a,s]);if(l.Inflate(10),l.containsPoint(n)){var d=G(n,a,s),A={x1:a.x,x2:s.x,y1:a.y,y2:s.y},h={x1:n.x,x2:d.x,y1:n.y,y2:d.y},p=i.intersect3(A,h);if(p.enabled){var c=i.Point.findLength(n,p.intersectPt);if(Math.abs(c)<10)return!0}else{var g=i.Rect.toBounds([n,n]);if(g.Inflate(3),g.containsPoint(a)||g.containsPoint(s))return!0}if(i.Point.equals(n,d))return!0}}return!1}function G(e,t,n){var o;o=i.Point.findLength(t,e)>i.Point.findLength(n,e)?n:t;var r=i.Point.findAngle(t,n),a=i.Point.findAngle(o,e),s=i.Point.findLength(o,e),l=a+2*(r-a);return{x:o.x+s*Math.cos(l*Math.PI/180),y:o.y+s*Math.sin(l*Math.PI/180)}}function J(e){return st[""+e]}function j(e,t,i,n){if(i&&t.activeElements.activePageID>-1){var o=K(t,i,e),r=W(o,e,t,i);return n?o:r}}function K(e,t,i){var n=e.currentPosition||{x:i.offsetX,y:i.offsetY};return $(n={x:n.x/e.getZoomFactor(),y:n.y/e.getZoomFactor()},t.getPageTable(e.activeElements.activePageID).objects,t.touchPadding)}function W(e,t,n,o){var r,a,s,l=null;if(t&&t.type&&-1!==t.type.indexOf("touch")){if(r=t,o.annotation){var d=n.getElement("_pageDiv_"+o.annotation.getEventPageNumber(t));if(d){var A=d.getBoundingClientRect();a=r.changedTouches[0].clientX-A.left,s=r.changedTouches[0].clientY-A.top}}}else if(t&&t.target&&t.path&&t.target.parentElement&&t.target.parentElement.classList.contains("foreign-object")){h=t.path[4].getBoundingClientRect();a=t.clientX-h.left,s=t.clientY-h.top}else if(t.target&&t.target.parentElement&&t.target.parentElement.classList.contains("foreign-object")){h=t.target.offsetParent.offsetParent.offsetParent.getBoundingClientRect();a=t.clientX-h.left,s=t.clientY-h.top}else if(t.target&&t.target.parentElement&&t.target.parentElement.parentElement&&t.target.parentElement.parentElement.classList.contains("foreign-object")){var h=void 0;t.target.offsetParent&&t.target.offsetParent.offsetParent&&t.target.offsetParent.offsetParent.offsetParent&&t.target.offsetParent.offsetParent.offsetParent.offsetParent?(h=t.target.offsetParent.offsetParent.offsetParent.offsetParent.getBoundingClientRect(),a=t.clientX-h.left,s=t.clientY-h.top):t.target.parentElement.offsetParent&&t.target.parentElement.offsetParent.offsetParent&&(h=t.target.parentElement.offsetParent.offsetParent.getBoundingClientRect(),a=t.clientX-h.left,s=t.clientY-h.top)}else a=isNaN(t.offsetX)?t.position?t.position.x:0:t.offsetX,s=isNaN(t.offsetY)?t.position?t.position.y:0:t.offsetY;for(var p=o.touchPadding/2,c=0,g=0;g<e.length;g++)if("Distance"===e[parseInt(g.toString(),10)].shapeAnnotationType||"Line"===e[parseInt(g.toString(),10)].shapeAnnotationType||"LineWidthArrowHead"===e[parseInt(g.toString(),10)].shapeAnnotationType||n.tool instanceof St){var u={x:a/n.getZoomFactor(),y:s/n.getZoomFactor()},f=X(e[parseInt(g.toString(),10)],u,p),m=Y(e[parseInt(g.toString(),10)],u);if(f&&!m){var w=Z(e[parseInt(g.toString(),10)],f);if(w){var C=i.Rect.toBounds([w,w]);C.Inflate(10),C.containsPoint(u)&&(m=!0)}}f&&m&&(l=e[parseInt(g.toString(),10)])}else{var B=e[parseInt(g.toString(),10)].wrapper.bounds,S=0;if("Stamp"!==e[parseInt(g.toString(),10)].shapeAnnotationType&&"Image"!==e[parseInt(g.toString(),10)].shapeAnnotationType||(S=25),(B.x-p)*n.getZoomFactor()<a&&(B.x+B.width+p)*n.getZoomFactor()>a&&(B.y-p-S)*n.getZoomFactor()<s&&(B.y+B.height+p)*n.getZoomFactor()>s)if(n.tool instanceof Ct||n.tool instanceof ut)l=e[parseInt(g.toString(),10)];else if(c){var y=a-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-a)+(s-(B.y-p-S)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s);c>y?(l=e[parseInt(g.toString(),10)],c=y):c===y?(l=e[parseInt(g.toString(),10)],c=y):"Image"!==e[parseInt(g.toString(),10)].shapeAnnotationType&&"Stamp"!==e[parseInt(g.toString(),10)].shapeAnnotationType||(l=e[parseInt(g.toString(),10)])}else l=e[parseInt(g.toString(),10)],c=a-(B.x-p)*n.getZoomFactor()+((B.x+B.width+p)*n.getZoomFactor()-a)+(s-(B.y-p-S)*n.getZoomFactor())+((B.y+B.height+p)*n.getZoomFactor()-s)}return l}function Z(e,t){var n=e.sourcePoint,o=e.targetPoint;if("Distance"===e.shapeAnnotationType){var r=t,a=void 0,s=i.Point.findAngle(e.sourcePoint,e.targetPoint);if(r.id.indexOf("leader")>-1){var l=e.wrapper.children[0].bounds.center;r.id.indexOf("leader1")>-1?(a={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},l=n):(a={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},l=o);var d=i.identityMatrix();return i.rotateMatrix(d,s,l.x,l.y),i.transformPointByMatrix(d,{x:a.x,y:a.y})}}}function X(e,t,i){return q(e.wrapper,t,i)}function _(e,t,i){if(0===i.length)i.push(e);else if(1===i.length)i[0][""+t]>e[""+t]?i.splice(0,0,e):i.push(e);else if(i.length>1){for(var n=0,o=i.length-1,r=Math.floor((n+o)/2);r!==n;)i[parseInt(r.toString(),10)][""+t]<e[""+t]?(n=r,r=Math.floor((n+o)/2)):i[parseInt(r.toString(),10)][""+t]>e[""+t]&&(o=r,r=Math.floor((n+o)/2));i[parseInt(o.toString(),10)][""+t]<e[""+t]?i.push(e):i[parseInt(n.toString(),10)][""+t]>e[""+t]?i.splice(n,0,e):i[parseInt(n.toString(),10)][""+t]<e[""+t]&&i[parseInt(o.toString(),10)][""+t]>e[""+t]&&i.splice(o,0,e)}}function q(e,n,o){if(e&&e.children)for(var r=e.children.length-1;r>=0;r--){var a=e.children[parseInt(r.toString(),10)],s=o;if(!t.isNullOrUndefined(a.children)&&a.children.length>0)for(var l=a.children.length-1;l>=0;l--){var d=a.children[parseInt(l.toString(),10)];if(d&&d.bounds.containsPoint(n,s)){if(d instanceof i.Container&&(A=this.findTargetElement(d,n)))return A;if(d.bounds.containsPoint(n,s))return d}}else if(a&&a.bounds.containsPoint(n,s)){if(a instanceof i.Container){var A=this.findTargetElement(a,n);if(A)return A}if(a.bounds.containsPoint(n,s))return a}}if(e&&e.bounds.containsPoint(n,o)&&"none"!==e.style.fill){var h=e,p=i.identityMatrix();i.rotateMatrix(p,h.parentTransform,h.offsetX,h.offsetY);var c=h.offsetX-h.pivot.x*h.actualSize.width,g=h.offsetY-h.pivot.y*h.actualSize.height,u={x:c+(.5===h.pivot.x?2*h.pivot.x:h.pivot.x)*h.actualSize.width/2,y:g-30};if(u=i.transformPointByMatrix(p,u),i.contains(n,u,10))return e}return null}function $(e,t,i){for(var n=[],o=0,r=t;o<r.length;o++){var a=r[o];(X(a,e,i)||"Stamp"===a.shapeAnnotationType&&X(a,e,40))&&_(a,"zIndex",n)}return n}function ee(e){var t=void 0;if(e.target&&e.target.wrapper)return e.target.pageIndex;if(e.target){var i=e.target.id.split("_");i.length>0&&(t=parseInt(i[i.length-1],10))}return t}function te(e,t,n,o,r){var a=i.createHtmlElement("div",{id:r.element.id+o+"_diagramAdornerLayer",style:"width:"+e.width+"px;height:"+e.height+"px;"+t});if(!i.getDiagramElement(a.id)){var s=r.viewerBase.getElement("_pageDiv_"+o),l=s.getBoundingClientRect(),d=ie(r.element.id+o+"_diagramAdorner_svg",l.width,l.height);d.setAttribute("class","e-adorner-layer"+o),d.style.pointerEvents="none",r.adornerSvgLayer=i.createSvgElement("g",{id:r.element.id+o+"_diagramAdorner"}),r.adornerSvgLayer.style.pointerEvents="all",d.appendChild(r.adornerSvgLayer),a.appendChild(d),a.style.width=l.width+"px",a.style.height=l.height+"px",s?s.insertBefore(a,s.childNodes[0]):n.parentElement.appendChild(a);var A=i.createSvgElement("g",{id:r.element.id+o+"_SelectorElement"});r.adornerSvgLayer.appendChild(A),i.setAttributeSvg(d,{style:"pointer-events:none;"})}r.viewerBase.applyElementStyles(a,o)}function ie(e,t,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttributeSvg(o,{id:e,width:t,height:n}),o}function ne(e,t,i,n){switch(e){case"Create":oe({type:n,target:document.querySelector(t.target),cssClass:t.cssClass,label:t.label,width:t.width});break;case"Show":Ye(document.querySelector(i));break;case"Hide":Je(document.querySelector(i));break;case"Set":je({cssClass:t.cssClass,type:n})}}function oe(e,i){if(e.target){var n,o=t.isNullOrUndefined(i)?t.createElement:i,r=xe(e.target,o);if(t.isNullOrUndefined(e.cssClass)||r.wrap.classList.add(e.cssClass),t.isNullOrUndefined(e.template)&&t.isNullOrUndefined(Wt)){var a=t.isNullOrUndefined(e.type)?me(r.wrap):e.type;n=ve(t.isNullOrUndefined(e.width)?void 0:e.width,a),we(a,r.wrap,n,o),t.isNullOrUndefined(e.label)||re(r.innerWrap,e.label,o)}else{var s=t.isNullOrUndefined(e.template)?Wt:e.template;r.wrap.classList.add(Si),Ee(r.wrap,s,Zt)}r.wrap.classList.add(oi),r=null}}function re(e,t,i){var n=i("div",{});return n.classList.add(Bi),n.textContent=t,e.appendChild(n),n}function ae(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Material",radius:t},be(e,n,i,ri),Te(t,e,"Material",ri)}function se(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Fluent2",radius:t},De(e,n,ci),Ue(t,e,ci)}function le(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Material3",radius:t},be(e,n,i,ai),Te(t,e,"Material3",ai)}function de(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Tailwind3",radius:t},be(e,n,i,gi),Te(t,e,"Tailwind3",gi)}function Ae(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Bootstrap4",radius:t},be(e,n,i,di),Te(t,e,"Bootstrap4",di)}function he(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Bootstrap5",radius:t},be(e,n,i,Ai),Te(t,e,"Bootstrap5",Ai)}function pe(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Tailwind",radius:t},De(e,n,hi),Ue(t,e,hi)}function ce(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Fluent",radius:t},De(e,n,pi),Ue(t,e,pi)}function ge(e,t,i){var n={};Kt[""+t].timeOut=0,n[""+t]=Ve(t,i,0,0),Me({uniqueID:t,container:e,globalInfo:n,timeOutVar:0})}function ue(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Fabric",radius:t},De(e,n,si),Ue(t,e,si)}function fe(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"HighContrast",radius:t},De(e,n,ui),Ue(t,e,ui)}function me(e){return window.getComputedStyle(e,":after").getPropertyValue("content").replace(/['"]+/g,"")}function we(e,i,n,o){var r=i.querySelector("."+mi),a=r.querySelector("svg");switch(t.isNullOrUndefined(a)||r.removeChild(a),e){case"Material":ae(r,n,o);break;case"Material3":le(r,n,o);break;case"Fabric":ue(r,n);break;case"Bootstrap":Ce(r,n);break;case"HighContrast":fe(r,n);break;case"Bootstrap4":Ae(r,n,o);break;case"Bootstrap5":he(r,n,o);break;case"Tailwind":pe(r,n);break;case"Fluent":ce(r,n);break;case"Fluent2":se(r,n);break;case"Tailwind3":de(r,n,o)}}function Ce(e,t,i){var n=Qe();Kt[""+n]={timeOut:0,type:"Bootstrap",radius:t},Be(e,n),Se(e,t)}function Be(e,t,i){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("id",t),n.setAttribute("class",li),n.setAttribute("viewBox","0 0 64 64"),e.insertBefore(n,e.firstChild);for(var o=0;o<=7;o++){var r=document.createElementNS("http://www.w3.org/2000/svg","circle");r.setAttribute("class",wi+"_"+o),r.setAttribute("r","2"),r.setAttribute("transform","translate(32,32)"),n.appendChild(r)}}function Se(e,t){var i=e.querySelector("svg.e-spin-bootstrap");i.style.width=i.style.height=t+"px";for(var n=90,o=0;o<=7;o++){var r=Oe(0,0,24,n),a=i.querySelector("."+wi+"_"+o);a.setAttribute("cx",r.x+""),a.setAttribute("cy",r.y+""),n=n>=360?0:n,n+=45}}function ye(e,t){function i(e){n.push(e),e===r&&1!==s||(e<=o&&e>1&&!a?e=parseFloat((e-.2).toFixed(2)):1===e?(e=7,e=parseFloat((e+.2).toFixed(2)),a=!0):e<8&&a?8===(e=parseFloat((e+.2).toFixed(2)))&&(a=!1):e<=8&&!a&&(e=parseFloat((e-.2).toFixed(2))),++s,i(e))}var n=[],o=e,r=t,a=!1,s=1;return i(o),n}function Ie(e){for(var t=e.querySelector("svg.e-spin-bootstrap").getAttribute("id"),i=1;i<=8;i++)!function(e,t,i,n,o){function r(t){Kt[""+o].isAnimate&&(++a,e.setAttribute("r",t+""),a>=n.length&&(a=0),Kt[""+o].timeOut=setTimeout(r.bind(null,n[parseInt(a.toString(),10)]),18))}var a=0;r(t)}(e.getElementsByClassName("e-path-circle_"+(8===i?0:i))[0],i,0,ye(i,i),t)}function Ee(e,i,n){t.isNullOrUndefined(n)||e.classList.add(n),e.querySelector(".e-spinner-inner").innerHTML=i}function ve(e,t){var i;switch(t){case"Material":i=Xt;break;case"Material3":i=_t;break;case"Fabric":i=qt;break;case"Fluent2":i=ti;break;case"Tailwind3":i=ii;break;case"Bootstrap4":i=ei;break;default:i=$t}return e=e?parseFloat(e+""):i,"Bootstrap"===t?e:e/2}function Ve(e,t,i,n){return{radius:t,count:i,previousId:n}}function Qe(){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<5;i++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}function De(e,t,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("id",t),o.setAttribute("class",i);var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class",wi);var a=document.createElementNS("http://www.w3.org/2000/svg","path");a.setAttribute("class",Ci),e.insertBefore(o,e.firstChild),o.appendChild(r),o.appendChild(a)}function be(e,t,i,n){var o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("class",n),o.setAttribute("id",t);var r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("class",wi),e.insertBefore(o,e.firstChild),o.appendChild(r)}function xe(e,t){var i=t("div",{});i.classList.add(fi);var n=t("div",{});return n.classList.add(mi),e.appendChild(i),i.appendChild(n),{wrap:i,innerWrap:n}}function Me(e){Fe(1,149,Le,1333,e.globalInfo[e.uniqueID].count,75,e),e.globalInfo[e.uniqueID].count=++e.globalInfo[e.uniqueID].count%4}function Fe(e,i,n,o,r,a,s){function l(i){var r=Math.max(0,Math.min((new Date).getTime()-h,o));t.isNullOrUndefined(Kt[i.uniqueID])||t.isNullOrUndefined(Kt[i.uniqueID].timeOut)||(d(n(r,e,p,o),i.container),A===i.globalInfo[i.uniqueID].previousId&&r<o?Kt[i.uniqueID].timeOut=requestAnimationFrame(function(){return l(i)}):(clearTimeout(Kt[i.uniqueID].timeOut),Kt[i.uniqueID].timeOut=null,Me(i)))}function d(e,i){if(!t.isNullOrUndefined(i.querySelector("svg.e-spin-material"))||!t.isNullOrUndefined(i.querySelector("svg.e-spin-material3"))){var n=void 0;if(t.isNullOrUndefined(i.querySelector("svg.e-spin-material"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-material").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-fluent2"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-fluent2").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-material3"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-material3").querySelector("path.e-path-circle"))?t.isNullOrUndefined(i.querySelector("svg.e-spin-tailwind3"))||t.isNullOrUndefined(i.querySelector("svg.e-spin-tailwind3").querySelector("path.e-path-circle"))||(n=i.querySelector("svg.e-spin-tailwind3")):n=i.querySelector("svg.e-spin-material3"):n=i.querySelector("svg.e-spin-fluent2"):n=i.querySelector("svg.e-spin-material"),!t.isNullOrUndefined(n)){var o=n.querySelector("path.e-path-circle");o.setAttribute("stroke-dashoffset",Re(c,g,e,a)+""),o.setAttribute("transform","rotate("+u+" "+c/2+" "+c/2+")")}}}var A=++s.globalInfo[s.uniqueID].previousId,h=(new Date).getTime(),p=i-e,c=ke(2*s.globalInfo[s.uniqueID].radius+""),g=Ne(c),u=-90*(s.globalInfo[s.uniqueID].count||0);!t.isNullOrUndefined(Kt[s.uniqueID])&&Kt[s.uniqueID].timeOut&&(clearTimeout(Kt[s.uniqueID].timeOut),Kt[s.uniqueID].timeOut=null),l(s)}function Te(e,t,i,n){var o=2*e,r=t.querySelector("svg."+n),a=r.querySelector("path.e-path-circle"),s=Ne(o),l=o/2+"px";r.setAttribute("viewBox","0 0 "+o+" "+o),r.style.width=r.style.height=o+"px",r.style.transformOrigin=l+" "+l+" "+l,a.setAttribute("d",Pe(o,s)),"Material"!==i&&"Material3"!==i||(a.setAttribute("stroke-width",s+""),a.setAttribute("stroke-dasharray",(o-s)*Math.PI*.75+""),a.setAttribute("stroke-dashoffset",Re(o,s,1,75)+"")),"Tailwind3"===i&&a.setAttribute("stroke-width",s+"")}function ke(e){return parseFloat(e)}function Pe(e,t){var i=e/2,n=t/2;return"M"+i+","+n+"A"+(i-n)+","+(i-n)+" 0 1 1 "+n+","+i}function Ne(e){return.1*e}function Re(e,t,i,n){return(e-t)*Math.PI*(3*n/100-i/100)}function Le(e,t,i,n){var o=(e/=n)*e,r=o*e;return t+i*(6*r*o+-15*o*o+10*r)}function Ue(e,t,i){var n=e,o=e,r=2*e,a=t.querySelector("."+i),s=a.querySelector(".e-path-circle"),l=a.querySelector(".e-path-arc"),d=r/2+"px";s.setAttribute("d",He(n,o,e)),l.setAttribute("d",ze(n,o,e,315,45)),a.setAttribute("viewBox","0 0 "+r+" "+r),a.style.transformOrigin=d+" "+d+" "+d,a.style.width=a.style.height=r+"px"}function Oe(e,t,i,n){var o=(n-90)*Math.PI/180;return{x:e+i*Math.cos(o),y:t+i*Math.sin(o)}}function ze(e,t,i,n,o){var r=Oe(e,t,i,o),a=Oe(e,t,i,n);return["M",r.x,r.y,"A",i,i,0,0,0,a.x,a.y].join(" ")}function He(e,t,i){return["M",e,t,"m",-i,0,"a",i,i,0,1,0,2*i,0,"a",i,i,0,1,0,2*-i,0].join(" ")}function Ye(e){Ge(e,!1),e=null}function Ge(e,i){var n;if(e&&(n=e.classList.contains(fi)?e:e.querySelector("."+fi)),e&&n){var o=n.querySelector("."+mi);if(i?!n.classList.contains(Si)&&!n.classList.contains(oi):!n.classList.contains(Si)&&!n.classList.contains(ni)){var r=n.querySelector("svg");if(t.isNullOrUndefined(r))return;var a=r.getAttribute("id");switch(Kt[""+a].isAnimate=!i,Kt[""+a].type){case"Material":case"Material3":case"Fluent2":case"Tailwind3":i?clearTimeout(Kt[""+a].timeOut):ge(o,a,Kt[""+a].radius);break;case"Bootstrap":i?clearTimeout(Kt[""+a].timeOut):Ie(o)}}i?t.classList(n,[oi],[ni]):t.classList(n,[ni],[oi]),e=null}}function Je(e){Ge(e,!0),e=null}function je(e,i){var n=t.isNullOrUndefined(i)?t.createElement:i;void 0!==e.template&&(Wt=e.template,void 0!==e.template&&(Zt=e.cssClass));for(var o=document.querySelectorAll("."+fi),r=0;r<o.length;r++)Ke(e.template,o[parseInt(r.toString(),10)],e.type,e.cssClass,n)}function Ke(e,i,n,o,r){t.isNullOrUndefined(e)&&!i.classList.contains(Si)?(We(i,n,o,r),i.classList.contains(ni)?(i.classList.remove(ni),Ye(i)):(i.classList.remove(oi),Je(i))):(Wt=e,t.isNullOrUndefined(o)||(Zt=o))}function We(e,i,n,o){t.isNullOrUndefined(n)||e.classList.add(n);var r=e.querySelector("svg"),a="Bootstrap"===i?parseFloat(r.style.height):parseFloat(r.style.height)/2;if(r.getAttribute("class").split(/\s/).indexOf("e-spin-material")>=0){var s=r.getAttribute("id");clearTimeout(Kt[""+s].timeOut)}we(i,e,a,o)}function Ze(){function e(){a.Init=l.cwrap("FPDF_InitLibrary"),a.RenderPageBitmap=l.cwrap("FPDF_RenderPageBitmap","",["number","number","number","number","number","number","number","number"]),a.Bitmap_FillRect=l.cwrap("FPDFBitmap_FillRect","",["number","number","number","number","number","number"]),a.Bitmap_CreateEx=l.cwrap("FPDFBitmap_CreateEx","number",["number","number","number","number","number"]),a.Bitmap_Destroy=l.cwrap("FPDFBitmap_Destroy","",["number"]),a.LoadPage=l.cwrap("FPDF_LoadPage","number",["number","number"]),a.ClosePage=l.cwrap("FPDF_ClosePage","",["number"]),a.LoadMemDocument=l.cwrap("FPDF_LoadMemDocument","number",["number","number","string"]),a.GetPageSizeByIndex=l.cwrap("FPDF_GetPageSizeByIndex","number",["number","number","number","number"]),a.GetLastError=l.cwrap("FPDF_GetLastError","number"),a.GetPageCount=l.cwrap("FPDF_GetPageCount","number",["number"]),a.CloseDocument=l.cwrap("FPDF_CloseDocument","",["number"]),a.DestroyLibrary=l.cwrap("FPDF_DestroyLibrary"),a.LoadTextPage=l.cwrap("FPDFText_LoadPage","number",["number"]),a.CloseTextPage=l.cwrap("FPDFText_ClosePage","",["number"]),a.TextCountChars=l.cwrap("FPDFText_CountChars","number",["number"]),a.GetUnicodeChar=l.cwrap("FPDFText_GetUnicode","number",["number"]),a.GetCharBox=l.cwrap("FPDFText_GetCharBox","number",["number","number","number","number","number"]),a.GetPageRotation=l.cwrap("FPDFPage_GetRotation","number",["number"]),a.GetCharAngle=l.cwrap("FPDFText_GetCharAngle","number",["number"]),a.TextFindStart=l.cwrap("FPDFText_FindStart","",["number","number","number","number"]),a.TextFindClose=l.cwrap("FPDFText_FindClose","",["number"]),a.TextFindNext=l.cwrap("FPDFText_FindNext","",["number"]),a.TextFindResultIndex=l.cwrap("FPDFText_GetSchResultIndex","",["number"]),a.TextFindCount=l.cwrap("FPDFText_GetSchCount","",["number"]),a.GetPageHeight=l.cwrap("FPDF_GetPageHeight","number",["number"]),a.GetPageHeight=l.cwrap("FPDF_GetPageHeight","number",["number"]),a.GetPageWidth=l.cwrap("FPDF_GetPageWidth","number",["number"]),s.heap=function(e,t){var i;switch(e){case Int8Array:i=l.HEAP8;break;case Int16Array:i=l.HEAP16;break;case Int32Array:i=l.HEAP32;break;case Uint8Array:i=l.HEAPU8;break;case Uint16Array:i=l.HEAPU16;break;case Uint32Array:i=l.HEAPU32;break;case Float32Array:i=l.HEAPF32;break;case Float64Array:i=l.HEAPF64}var n=e.BYTES_PER_ELEMENT,o=l.asm.malloc(t*n),r=Array(1+t);r[0]={s:t,J:e,Z:n,E:i,m:o,free:function(){return l.asm.free(o)}};for(var a=0;a<t;a++)!function(e){r[e+1]={p:o+e*n,get v(){return i[o/n+e]}}}(a);return r}}function t(){((o=!0)||r)&&i()}function i(){e(),s.loaded&&s.loaded()}var n,o=!1,r=!1,a={},s=s||{},l=void 0!==s.Module?s.Module:{},d=Float64Array,A=function(e,t,i){return function(n){var o=s.heap(e,t),r=o[0],a=o.slice(1);if(!n.apply(void 0,a.map(function(e){return e.p})))return r.free(),i;var l=a.map(function(e){return e.v});return r.free(),l}};Object.assign(a,{LCD_TEXT:2,NO_NATIVETEXT:4,GRAYSCALE:8,DEBUG_INFO:128,NO_CATCH:256,RENDER_LIMITEDIMAGECACHE:512,RENDER_FORCEHALFTONE:1024,PRINTING:2048,REVERSE_BYTE_ORDER:16,Bitmap_Gray:1,Bitmap_BGR:2,Bitmap_BGRx:3,Bitmap_BGRA:4,LAST_ERROR:{SUCCESS:0,UNKNOWN:1,FILE:2,FORMAT:3,PASSWORD:4,SECURITY:5,PAGE:6}}),l.onRuntimeInitialized=function(){r=!0,t()},s.onload=function(){o=!0,t()},s.loaded=function(){h.postMessage({message:"loaded"})};var h=self;h.onmessage=function(e){if("initialLoading"===e.data.message)importScripts(e.data.url+"/pdfium.js"),l.url=e.data.url,l.onRuntimeInitialized=function(){if(r=!0,t(),e.data.fonts&&Object.keys(e.data.fonts).length>0){l.FS.createPath("/","/usr/share/fonts/",!0,!0);for(var i in e.data.fonts)e.data.fonts[""+i]&&-1===i.indexOf("fallbackfonts")&&l.FS.createDataFile("/usr/share/fonts/"+i,null,e.data.fonts[""+i],!0,!0,!0)}},this.PDFiumModule(l);else if("LoadPageCollection"===e.data.message){s.fileByteArray=e.data.uploadedFile;i=s.fileByteArray.length;a.Init();o=l.asm.malloc(i);l.HEAPU8.set(s.fileByteArray,o),s.fileByteArray=null,n=new u({wasm:a.LoadMemDocument(o,i,e.data.password),wasmBuffer:o});g=a.GetPageCount(n.processor.wasmData.wasm);n.setPages(g),n.createAllPages(),h.postMessage({message:"PageLoaded",pageIndex:e.data.pageIndex,isZoomMode:e.data.isZoomMode})}else if("LoadPageStampCollection"===e.data.message){var i=e.data.uploadedFile.length;a.Init();var o=l.asm.malloc(i);l.HEAPU8.set(e.data.uploadedFile,o);var p=new u({wasm:a.LoadMemDocument(o,i,e.data.password),wasmBuffer:o}),g=a.GetPageCount(p.processor.wasmData.wasm);p.setPages(g),p.createAllPages();var f=p.getPage(e.data.pageIndex),m=e.data;(C=f.render(null,m.zoomFactor,!1,null,null,null,!0)).message="LoadedStamp",C.annotName=e.data.AnnotName,C.rubberStampAnnotationPageNumber=e.data.rubberStampAnnotationPageNumber,C.annotationOrder=e.data.annotationOrder,C.collectionOrder=e.data.collectionOrder,C.isFormField=e.data.isFormField,C.isFormField&&(C.message="LoadedStampForFormFields",C.formFieldName=e.data.formFieldName,C.formFieldList=e.data.formFieldList,C.formFields=e.data.rubberStampAnnotation,C.PageIndex=e.data.PageIndex),h.postMessage(C)}if(n)if("renderPage"===e.data.message){var f=n.getPage(e.data.pageIndex),w=e.data,C=f.render(null,w.zoomFactor,w.isTextNeed,null,null,w.textDetailsId,null,e.data.cropBoxRect,e.data.mediaBoxRect);h.postMessage(C)}else if("renderPageSearch"===e.data.message){var f=n.getPage(e.data.pageIndex),B=e.data;(C=f.render(null,B.zoomFactor,B.isTextNeed,null,null,B.textDetailsId,null,e.data.cropBoxRect)).message="imageRenderedSearch",h.postMessage(C)}else if(-1!==e.data.message.indexOf("extractText")){var f=n.getPage(e.data.pageIndex),S=e.data,y=e.data.isSkipCharacterBounds;(C=f.render("extractText",S.zoomFactor,S.isTextNeed,null,null,S.textDetailsId,null,null,null,null,y)).message=e.data.message,C.isLayout=e.data.isLayout,C.isRenderText=e.data.isRenderText,C.jsonObject=e.data.jsonObject,C.requestType=e.data.requestType,C.annotationObject=e.data.annotationObject,C.pageIndex=e.data.pageIndex,C.options=e.data.options,C.isAPI=e.data.isAPI,C.isNeedToRender=e.data.isNeedToRender,h.postMessage(C)}else if("searchText"===e.data.message){for(var I=a.GetPageCount(n.processor.wasmData.wasm),E=e.data.searchWord,v=new Uint16Array(E.length+1),V=0;V<E.length;V++)v[parseInt(V.toString(),10)]=E.charCodeAt(V);v[E.length]=0;var Q=l.asm.malloc(v.length*v.BYTES_PER_ELEMENT);l.HEAPU16.set(v,Q/Uint16Array.BYTES_PER_ELEMENT);for(var D=0,b=!0===e.data.matchCase?1:0,x=e.data.startIndex,M=e.data.endIndex,F={},T=x;T<M;T++)!function(e){for(var t=-1,i=a.LoadPage(n.processor.wasmData.wasm,e),o=a.LoadTextPage(i),r=a.TextFindStart(o,Q,b,0),s=a.GetPageHeight(i);a.TextFindNext(r);)!function(){D++,t++;var i=a.TextFindCount(r),n=a.TextFindResultIndex(r);F[parseInt(e.toString(),10)]||(F[parseInt(e.toString(),10)]={Indices:[],Bounds:{},pageOccurrence:0}),F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)]||(F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)]=[]),F[parseInt(e.toString(),10)].Indices.push(n);for(var l=Number.POSITIVE_INFINITY,h=0,p=Number.POSITIVE_INFINITY,g=0,u=0;u<i;u++)!function(i){var r=a.GetUnicodeChar(o,n+i),u=String.fromCharCode(r);if("\r"!==u&&"\n"!==u){var f=A(d,4,[-1,-1,-1,-1])(function(e,t,r,s){return a.GetCharBox(o,n+i,e,t,r,s)});l=Math.min(l,f[0]),h=Math.max(h,f[1]),p=Math.min(p,f[2]),g=Math.max(g,f[3])}if("\r"===u){var m=new c(l*(96/72),96/72*(s-(g-p)-p),96/72*(h-l),96/72*(g-p),"",null);F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].push(m),F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),l=Number.POSITIVE_INFINITY,h=0,p=Number.POSITIVE_INFINITY,g=0}}(u);var f=new c(l*(96/72),96/72*(s-(g-p)-p),96/72*(h-l),96/72*(g-p),"",null);F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].push(f),F[parseInt(e.toString(),10)].Bounds[parseInt(t.toString(),10)].sort(function(e,t){return e.Top===t.Top?e.Left-t.Left:e.Top-t.Top}),F[parseInt(e.toString(),10)].pageOccurrence=t+1}();a.TextFindClose(r),a.ClosePage(i)}(T);var k={totalSearchCount:D,resultPages:F,message:"textSearched",searchWord:E,matchCase:e.data.matchCase,isRequestsend:e.data.isRequestsend,isCompletedSearch:M===I,endIndex:M};h.postMessage(k),F={},l.asm.free(Q)}else if("renderThumbnail"===e.data.message)new Promise(function(t,i){try{var o=n.getPage(e.data.pageIndex);if(null!==o.processor&&void 0!==o.processor){var r=o.render("thumbnail",null,e.data.isTextNeed,null,null,null,null,null,null,null,e.data.isSkipCharacterBounds);r.isRenderText=e.data.isRenderText,r.jsonObject=e.data.jsonObject,r.requestType=e.data.requestType,t(r)}}catch(e){i(e)}}).then(function(e){h.postMessage(e)});else if("renderPreviewTileImage"===e.data.message)(C=(f=n.getPage(e.data.pageIndex)).render("thumbnail",null,e.data.isTextNeed,null,null,null,null,null,null,null,e.data.isSkipCharacterBounds)).message="renderPreviewTileImage",C.isRenderText=e.data.isRenderText,C.jsonObject=e.data.jsonObject,C.requestType=e.data.requestType,C.startIndex=e.data.startIndex,C.endIndex=e.data.endIndex,h.postMessage(C);else if("printImage"===e.data.message){C=(f=n.getPage(e.data.pageIndex)).render("print",null,!1,e.data.printScaleFactor,e.data.printDevicePixelRatio);h.postMessage(C)}else if("extractImage"===e.data.message||"extractImages"===e.data.message){var f=n.getPage(e.data.pageIndex),P=e.data,C=f.render(null,P.zoomFactor,P.isTextNeed,null,null,P.textDetailsId,null,null,null,e.data.size);"extractImage"===e.data.message&&(C.message="imageExtracted"),"extractImages"===e.data.message&&(C.message="imagesExtracted"),h.postMessage(C)}else if("renderImageAsTile"===e.data.message){var N=e.data,C=(f=n.getPage(e.data.pageIndex)).renderTileImage(N.tileX,N.tileY,N.tileXCount,N.tileYCount,N.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect);h.postMessage(C)}else if("renderImageAsTileSearch"===e.data.message){N=e.data;(C=(f=n.getPage(e.data.pageIndex)).renderTileImage(N.tileX,N.tileY,N.tileXCount,N.tileYCount,N.zoomFactor,e.data.isTextNeed,e.data.textDetailsId,e.data.cropBoxRect,e.data.mediaBoxRect)).message="renderTileImageSearch",h.postMessage(C)}else"unloadFPDF"===e.data.message&&n&&(l.asm.free(n.processor.wasmData.wasmBuffer),a.CloseDocument(n.processor.wasmData.wasm),a.DestroyLibrary(),n=null);"unloadFPDF"===e.data.message&&h.postMessage({message:""})};var p=function(){function e(e,t){this.index=e,this.src=null,this.processor=t}return e.prototype.render=function(e,t,i,n,o,r,a,s,l,d,A){return this.processor.render(this.index,e,t,i,n,o,r,a,s,l,d,A)},e.prototype.renderTileImage=function(e,t,i,n,o,r,a,s,l){return this.processor.renderTileImage(this.index,e,t,i,n,o,r,a,s,l)},e}(),c=function(){function e(e,t,i,n,o,r){this.X=e,this.Y=t,this.Width=i,this.Height=n,this.Bottom=this.Y+this.Height,this.Right=this.X+this.Width,this.Top=this.Y,this.Left=this.X,this.Rotation=r,this.Text=o}return e}(),g=function(){function e(e){this.TextBounds=[],this.TextContent=[],this.CharacterBounds=[],this.PageText="",this.wasmData=e}return e.prototype.getPageSize=function(e){var t=this;return void 0===e&&(e=0),A(d,2,[-1,-1])(function(i,n){return a.GetPageSizeByIndex(t.wasmData.wasm,e,i,n)}).map(function(e){return parseInt((e*(96/72)).toString(),10)})},e.prototype.getCharBounds=function(e,t){return void 0===t&&(t=0),A(d,4,[-1,-1,-1,-1])(function(i,n,o,r){return a.GetCharBox(e,t,i,n,o,r)})},e.prototype.getRender=function(e,t,i,n,o,r,s,d){void 0===e&&(e=0);var A=a.REVERSE_BYTE_ORDER,h=l.asm.malloc(t*i*4);l.HEAPU8.fill(0,h,h+t*i*4);var p=a.Bitmap_CreateEx(t,i,a.Bitmap_BGRA,h,4*t),c=a.LoadPage(this.wasmData.wasm,e);return a.Bitmap_FillRect(p,0,0,t,i,o?16777215:4294967295),a.RenderPageBitmap(p,c,0,0,t,i,0,A),a.Bitmap_Destroy(p),this.textExtraction(c,e,n,r,s,d),a.ClosePage(c),h},e.prototype.textExtraction=function(e,t,i,n,o,r){var s;if(i){var l=this.getPageSize(t),d=l[0],A=l[1];A+=this.pointerToPixelConverter(o&&o.y?o.y:0);var h=a.LoadTextPage(e,t),p=a.GetPageRotation(e),g=a.TextCountChars(h);this.TextBounds=[],this.TextContent=[],this.CharacterBounds=[];for(var u="",f=0,m=0,w=0,C=0,B=[],S=[],y=[],I=[],E=[],v="",V=0,Q=0,D=0,b=0,x=0,M=!0,F=!1,T=!1,k=!1,P=0;P<=g;P++)if(r){var N=a.GetUnicodeChar(h,P),R=String.fromCharCode(N);P<g&&(u+=R)}else{var N=a.GetUnicodeChar(h,P),L=a.GetCharAngle(h,P),R=String.fromCharCode(N),U=this.getCharBounds(h,P),O=U[0],z=U[1],H=U[2],Y=U[3],G=this.pointerToPixelConverter(O)-this.pointerToPixelConverter(n&&n.x?n.x:0),J=A+this.pointerToPixelConverter(n&&n.y?n.y:0)-this.pointerToPixelConverter(Y),j=this.pointerToPixelConverter(z-O),K=this.pointerToPixelConverter(Y-H),W=parseInt((180*L/Math.PI).toString(),10);if(P<g){u+=R;Z=new c(G,J,j,K,R,W);this.CharacterBounds.push(Z)}switch(1!==p&&3!==p||(J=d-this.pointerToPixelConverter(Y)),R){case"\0":f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);_=new c(V,D,Q-V,b-D,v,x);E.push(_),this.textBoundsCalculation(E,f,m,C,w,p,d,A,g),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0;break;case"\r":if(P<g){X=new c(G,J,j,K,"\r\n",W);B.push(X.Top),S.push(X.Bottom),y.push(X.Left),I.push(X.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);_=void 0;!1===M&&(_=new c(V,D,Q-V,b-D,v,x),E.push(_)),E.push(X),this.textBoundsCalculation(E,f,m,C,w,p,d,A,g),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0,u+="\n",L=a.GetCharAngle(h,P),O=(s=this.getCharBounds(h,P))[0],z=s[1],H=s[2],Y=s[3],G=this.pointerToPixelConverter(O),J=A-this.pointerToPixelConverter(Y),j=this.pointerToPixelConverter(z-O),K=this.pointerToPixelConverter(Y-H),W=parseInt((180*L/Math.PI).toString(),10);var Z=new c(G,J,j,K,R,W);this.CharacterBounds.push(Z),P++}break;case"":case"":X=new c(G,J,j,K,R,W);B.push(X.Top),S.push(X.Bottom),y.push(X.Left),I.push(X.Right),f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);_=void 0;!1===M&&(_=new c(V,D,Q-V,b-D,v,x),E.push(_)),""===R&&E.push(X),this.textBoundsCalculation(E,f,m,C,w,p,d,A,g),E=[],M=!0,T=!1,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0;break;default:if(0===j||0===K){F=!0,f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);_=new c(V,D,Q-V,b-D,v,x);E.push(_),D=(X=new c(G,J,j,K,R,W)).Top,b=X.Bottom,V=X.Left,Q=X.Right,v=R,x=E[E.length-1].Rotation,_=new c(V,D,Q-V,b-D,v,x),E.push(_),D=0,b=0,V=0,Q=0,v="",x=0,M=!0,T=!0}else{!0===M&&(D=J,b=J+K,V=G,Q=G+j);var X=new c(G,J,j,K,R,W);if(" "!==R){if(T&&E.length>0&&W===E[0].Rotation&&((180===W||0===W)&&Math.abs(X.Y-E[0].Y)>11&&(k=!0),(270===W||90===W)&&Math.abs(X.X-E[0].X)>11&&(k=!0)),F&&E.length>=1&&E[E.length-1].Rotation!==X.Rotation||k){F=!1,k=!1,f=Math.min.apply(Math,B),m=Math.max.apply(Math,S),w=Math.min.apply(Math,y),C=Math.max.apply(Math,I);_=void 0;!1===M&&(_=new c(V,D,Q-V,b-D,v,x),E.push(_)),this.textBoundsCalculation(E,f,m,C,w,p,d,A,g),E=[],M=!0,v="",B=[],y=[],S=[],I=[],f=0,m=0,w=0,C=0}B.push(X.Top),S.push(X.Bottom),y.push(X.Left),I.push(X.Right),D=Math.min(D,X.Top),b=Math.max(b,X.Bottom),V=Math.min(V,X.Left),Q=Math.max(Q,X.Right),v+=R,x=X.Rotation,M=!1,T=!1}else{var _=new c(V,D,Q-V,b-D,v,x);E.push(_),D=X.Top,b=X.Bottom,V=X.Left,Q=X.Right,v=R,x=X.Rotation,_=new c(V,D,Q-V,b-D,v,x),E.push(_),D=0,b=0,V=0,Q=0,v="",x=0,M=!0,T=!0}}}}a.CloseTextPage(h),this.Rotation=p,this.PageText=u}},e.prototype.pointerToPixelConverter=function(e){return e*(96/72)},e.prototype.textBoundsCalculation=function(e,t,i,n,o,r,a,s,l){var d,A=!1,h="",p=e.reduce(function(e,t){return e+t.Text},""),g=this.checkIsRtlText(p);if(l>=5e3){for(var u=[],f=0,m=function(e,t){t.minX=Math.min(t.minX,e.X),t.minY=Math.min(t.minY,e.Y),t.maxX=Math.max(t.maxX,e.X+e.Width),t.maxY=Math.max(t.maxY,e.Y+e.Height)},w=0;w<e.length;w++)!function(t){var i=0;if(t<e.length-1&&(i=e[parseInt((t+1).toString(),10)].Left-e[parseInt(t.toString(),10)].Right),i>=5&&"\r\n"!==e[parseInt(t.toString(),10)].Text){for(var n={minX:e[parseInt(f.toString(),10)].X,minY:e[parseInt(f.toString(),10)].Y,maxX:e[parseInt(f.toString(),10)].X,maxY:e[parseInt(f.toString(),10)].Y},o="",r=[],a=f;a<=t;a++){w=e[parseInt(a.toString(),10)];m(w,n),r.push(w.Height),o+=w.Text}var s=n.maxX-n.minX,l=n.maxY-n.minY,d=new c(n.minX,n.minY,s,l,o,e[0].Rotation);u.push(d),f=t+1}else if(0===u.length&&t===e.length-1){var A={minX:e[0].X,minY:e[0].Y,maxX:e[0].X,maxY:e[0].Y};e.forEach(function(e){m(e,A)});var s=A.maxX-A.minX,l=A.maxY-A.minY,h=e.map(function(e){return e.Text}).join(""),p=new c(A.minX,A.minY,s,l,h,e[0].Rotation);e=[p]}else if(t===e.length-1){for(var n={minX:e[parseInt(f.toString(),10)].X,minY:e[parseInt(f.toString(),10)].Y,maxX:e[parseInt(f.toString(),10)].X,maxY:e[parseInt(f.toString(),10)].Y},g="",r=[],a=f;a<=t;a++){var w=e[parseInt(a.toString(),10)];m(w,n),r.push(w.Height),g+=w.Text}var s=n.maxX-n.minX,l=n.maxY-n.minY,C=new c(n.minX,n.minY,s,l,g,e[0].Rotation);u.push(C)}}(w);u.length>0&&(e=u)}for(var C=0;C<e.length;C++){var B=e[parseInt(C.toString(),10)].Rotation;if(0===B||180===B?(A&&(this.TextBounds.push(d),this.TextContent.push(h),h=""),A=!1,0===r?d=new c(e[parseInt(C.toString(),10)].Left,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[parseInt(C.toString(),10)].Left,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-e[parseInt(C.toString(),10)].Left,s-t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-e[parseInt(C.toString(),10)].Left,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B))):90===B||270===B?(A&&(this.TextBounds.push(d),this.TextContent.push(h),h=""),A=!1,0===r?d=new c(o,e[parseInt(C.toString(),10)].Top,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-e[parseInt(C.toString(),10)].Top,o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-o,s-e[parseInt(C.toString(),10)].Top,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(e[parseInt(C.toString(),10)].Top,s-o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B))):A?h+=e[parseInt(C.toString(),10)].Text:(A=!0,h+=e[parseInt(C.toString(),10)].Text,0===r?d=new c(e[parseInt(C.toString(),10)].Left,t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[parseInt(C.toString(),10)].Left,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-e[parseInt(C.toString(),10)].Left,s-t,n-o,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-e[parseInt(C.toString(),10)].Left,n-o,i-t,e[parseInt(C.toString(),10)].Text,B))),!A&&" "===e[parseInt(C.toString(),10)].Text&&0!==C&&C+1<=e.length)if(g)g&&C+1!==e.length?((30<(S=e[C-1].Left-(e[C+1].Left+e[C+1].Width))||S<0)&&(S=0),d=new c(e[C+1].Left+e[C+1].Width,t,S,i-t,e[parseInt(C.toString(),10)].Text,e[parseInt(C.toString(),10)].Rotation)):g&&(d=new c(e[C-1].Left-e[parseInt(C.toString(),10)].Width,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,e[parseInt(C.toString(),10)].Rotation));else if(C+1!==e.length){var S=0;switch(B){case 0:(30<(S=e[C+1].Left-(e[C-1].Left+e[C-1].Width))||S<0)&&(S=0),0===r?d=new c(e[C-1].Left+e[C-1].Width,t,S,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[C-1].Left+e[C-1].Width,S,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-(e[C-1].Left+e[C-1].Width),s-t,S,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-(e[C-1].Left+e[C-1].Width),S,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 90:(30<(S=e[C+1].Top-(e[C-1].Top+e[C-1].Height))||S<0)&&(S=0),0===r?d=new c(o,e[C-1].Top+e[C-1].Height,n-o,S,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-(e[C-1].Top+e[C-1].Height),o,n-o,S,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-o,s-(e[C-1].Top+e[C-1].Height),n-o,S,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(e[C-1].Top+e[C-1].Height,s-o,n-o,S,e[parseInt(C.toString(),10)].Text,B));break;case 180:(30<(S=e[C-1].Left-(e[C+1].Left+e[C+1].Width))||S<0)&&(S=0),0===r?d=new c(e[C+1].Left+e[C+1].Width,t,S,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[C+1].Left+e[C+1].Width,S,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-(e[C+1].Left+e[C+1].Width),s-t,S,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-(e[C+1].Left+e[C+1].Width),S,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 270:(30<(S=e[C-1].Top-(e[C+1].Top+e[C+1].Height))||S<0)&&(S=0),0===r?d=new c(o,e[C+1].Top+e[C+1].Height,n-o,S,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-(e[C+1].Top+e[C+1].Height),o,n-o,S,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-o,s-(e[C+1].Top+e[C+1].Height),n-o,S,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(e[C+1].Top+e[C+1].Height,s-o,n-o,S,e[parseInt(C.toString(),10)].Text,B))}}else switch(B){case 90:0===r?d=new c(o,e[C-1].Top+e[C-1].Height,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-(e[C-1].Top+e[C-1].Height),o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-o,s-(e[C-1].Top+e[C-1].Height),n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(e[C-1].Top+e[C-1].Height,s-o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B));break;case 270:0===r?d=new c(o,e[C-1].Top-e[parseInt(C.toString(),10)].Height,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-(e[C-1].Top-e[parseInt(C.toString(),10)].Height),o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-o,s-e[C-1].Top-e[parseInt(C.toString(),10)].Height,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(e[C-1].Top-e[parseInt(C.toString(),10)].Height,s-o,n-o,e[parseInt(C.toString(),10)].Height,e[parseInt(C.toString(),10)].Text,B));break;case 180:0===r?d=new c(e[C-1].Left-e[parseInt(C.toString(),10)].Width,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[C-1].Left-e[parseInt(C.toString(),10)].Width,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-(e[C-1].Left-e[parseInt(C.toString(),10)].Width),s-t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-(e[C-1].Left-e[parseInt(C.toString(),10)].Width),e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B));break;case 0:0===r?d=new c(e[C-1].Left+e[C-1].Width,t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):1===r?d=new c(a-t,e[C-1].Left+e[C-1].Width,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):2===r?d=new c(a-(e[C-1].Left+e[C-1].Width),s-t,e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B):3===r&&(d=new c(t,s-(e[C-1].Left+e[C-1].Width),e[parseInt(C.toString(),10)].Width,i-t,e[parseInt(C.toString(),10)].Text,B))}A||(this.TextBounds.push(d),this.TextContent.push(e[parseInt(C.toString(),1