@syncfusion/ej2-pdfviewer
Version:
Essential JS 2 PDF viewer Component
10 lines • 3.6 MB
JavaScript
/*!
* filename: ej2-pdfviewer.umd.min.js
* version : 32.1.21
* Copyright Syncfusion Inc. 2001 - 2025. 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.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-drawings"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-splitbuttons"),require("@syncfusion/ej2-inplace-editor"),require("@syncfusion/ej2-navigations"),require("@syncfusion/ej2-notifications"),require("@syncfusion/ej2-pdf"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-lists"),require("@syncfusion/ej2-pdf-data-extract")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-drawings","@syncfusion/ej2-inputs","@syncfusion/ej2-popups","@syncfusion/ej2-splitbuttons","@syncfusion/ej2-inplace-editor","@syncfusion/ej2-navigations","@syncfusion/ej2-notifications","@syncfusion/ej2-pdf","@syncfusion/ej2-buttons","@syncfusion/ej2-dropdowns","@syncfusion/ej2-data","@syncfusion/ej2-lists","@syncfusion/ej2-pdf-data-extract"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Drawings,e.ej2Inputs,e.ej2Popups,e.ej2Splitbuttons,e.ej2InplaceEditor,e.ej2Navigations,e.ej2Notifications,e.ej2Pdf,e.ej2Buttons,e.ej2Dropdowns,e.ej2Data,e.ej2Lists,e.ej2PdfDataExtract)}(this,function(N,G,j,w,Q,T,F,C,k,J,P,L,O,U,z){"use strict";H=function(e,t){return(H=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var H,Y,K=function(e,t){function i(){this.constructor=e}H(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,n){var o,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(r=(a<3?o(r):3<a?o(t,i,r):o(t,i))||r);return 3<a&&r&&Object.defineProperty(t,i,r),r},W=(Y=G.ChildProperty,K(_,Y),e([G.Property(0)],_.prototype,"x",void 0),e([G.Property(0)],_.prototype,"y",void 0),e([G.Property(0)],_.prototype,"width",void 0),e([G.Property(0)],_.prototype,"height",void 0),e([G.Property(0)],_.prototype,"left",void 0),e([G.Property(0)],_.prototype,"top",void 0),e([G.Property(0)],_.prototype,"right",void 0),e([G.Property(0)],_.prototype,"bottom",void 0),e([G.Complex({x:0,y:0},j.Point)],_.prototype,"location",void 0),e([G.Complex(new j.Size(0,0),j.Size)],_.prototype,"size",void 0),_);function _(){return null!==Y&&Y.apply(this,arguments)||this}Z=G.ChildProperty,K(q,Z),e([G.Property(!1)],q.prototype,"isBold",void 0),e([G.Property(!1)],q.prototype,"isItalic",void 0),e([G.Property(!1)],q.prototype,"isUnderline",void 0),e([G.Property(!1)],q.prototype,"isStrikeout",void 0);var Z,X=q;function q(){return null!==Z&&Z.apply(this,arguments)||this}$=G.ChildProperty,K(t,$),e([G.Property("")],t.prototype,"id",void 0),e([G.Property("Rectangle")],t.prototype,"shapeAnnotationType",void 0),e([G.Property(null)],t.prototype,"formFieldAnnotationType",void 0),e([G.Property("")],t.prototype,"measureType",void 0),e([G.Property("")],t.prototype,"author",void 0),e([G.Property("")],t.prototype,"overlayText",void 0),e([G.Property("")],t.prototype,"modifiedDate",void 0),e([G.Property("")],t.prototype,"subject",void 0),e([G.Property("")],t.prototype,"notes",void 0),e([G.Property(!1)],t.prototype,"isCommentLock",void 0),e([G.Property("black")],t.prototype,"strokeColor",void 0),e([G.Property("#ffffff00")],t.prototype,"fillColor",void 0),e([G.Property(!1)],t.prototype,"isRepeat",void 0),e([G.Property(!1)],t.prototype,"useOverlayText",void 0),e([G.Property(1)],t.prototype,"markerOpacity",void 0),e([G.Property("rgba(255, 0, 0, 1)")],t.prototype,"markerBorderColor",void 0),e([G.Property("rgba(0, 0, 0, 1)")],t.prototype,"originalFillColor",void 0),e([G.Property("rgba(255, 255, 255, 1)")],t.prototype,"markerFillColor",void 0),e([G.Property("#ffffff00")],t.prototype,"stampFillColor",void 0),e([G.Property("black")],t.prototype,"stampStrokeColor",void 0),e([G.Property("")],t.prototype,"data",void 0),e([G.Property(1)],t.prototype,"opacity",void 0),e([G.Property(1)],t.prototype,"thickness",void 0),e([G.Property("")],t.prototype,"borderStyle",void 0),e([G.Property("")],t.prototype,"borderDashArray",void 0),e([G.Property(0)],t.prototype,"rotateAngle",void 0),e([G.Property(!1)],t.prototype,"isCloudShape",void 0),e([G.Property(0)],t.prototype,"cloudIntensity",void 0),e([G.Property(40)],t.prototype,"leaderHeight",void 0),e([G.Property(null)],t.prototype,"lineHeadStart",void 0),e([G.Property(null)],t.prototype,"lineHeadEnd",void 0),e([G.Property([])],t.prototype,"vertexPoints",void 0),e([G.Property(null)],t.prototype,"sourcePoint",void 0),e([G.Property("None")],t.prototype,"sourceDecoraterShapes",void 0),e([G.Property("None")],t.prototype,"taregetDecoraterShapes",void 0),e([G.Property(null)],t.prototype,"targetPoint",void 0),e([G.Property([])],t.prototype,"segments",void 0),e([G.Complex({x:0,y:0},W)],t.prototype,"bounds",void 0),e([G.Property(0)],t.prototype,"pageIndex",void 0),e([G.Property(-1)],t.prototype,"zIndex",void 0),e([G.Property(null)],t.prototype,"wrapper",void 0),e([G.Property(!1)],t.prototype,"isDynamicStamp",void 0),e([G.Property("")],t.prototype,"dynamicText",void 0),e([G.Property("")],t.prototype,"annotName",void 0),e([G.Property({})],t.prototype,"review",void 0),e([G.Property([])],t.prototype,"comments",void 0),e([G.Property("#000")],t.prototype,"fontColor",void 0),e([G.Property(16)],t.prototype,"fontSize",void 0),e([G.Property("Helvetica")],t.prototype,"fontFamily",void 0),e([G.Property("None")],t.prototype,"fontStyle",void 0),e([G.Property(!1)],t.prototype,"enableShapeLabel",void 0),e([G.Property("label")],t.prototype,"labelContent",void 0),e([G.Property("#ffffff00")],t.prototype,"labelFillColor",void 0),e([G.Property(15)],t.prototype,"labelMaxLength",void 0),e([G.Property("")],t.prototype,"template",void 0),e([G.Property("")],t.prototype,"templateSize",void 0),e([G.Property(1)],t.prototype,"labelOpacity",void 0),e([G.Property("")],t.prototype,"annotationSelectorSettings",void 0),e([G.Property("#ffffff00")],t.prototype,"labelBorderColor",void 0),e([G.Property("left")],t.prototype,"textAlign",void 0),e([G.Property("")],t.prototype,"signatureName",void 0),e([G.Property(0)],t.prototype,"minHeight",void 0),e([G.Property(0)],t.prototype,"minWidth",void 0),e([G.Property(0)],t.prototype,"maxHeight",void 0),e([G.Property(0)],t.prototype,"maxWidth",void 0),e([G.Property(!1)],t.prototype,"isLock",void 0),e([G.Property("UI Drawn Annotation")],t.prototype,"annotationAddMode",void 0),e([G.Property("")],t.prototype,"annotationSettings",void 0),e([G.Property(16)],t.prototype,"previousFontSize",void 0),e([G.Complex({isBold:!1,isItalic:!1,isStrikeout:!1,isUnderline:!1},X)],t.prototype,"font",void 0),e([G.Complex({x:0,y:0},W)],t.prototype,"labelBounds",void 0),e([G.Property(null)],t.prototype,"customData",void 0),e([G.Property(["None"])],t.prototype,"allowedInteractions",void 0),e([G.Property(!0)],t.prototype,"isPrint",void 0),e([G.Property(!1)],t.prototype,"isReadonly",void 0),e([G.Property(0)],t.prototype,"pageRotation",void 0),e([G.Property("")],t.prototype,"icon",void 0),e([G.Property(!1)],t.prototype,"isAddAnnotationProgrammatically",void 0),e([G.Property(!1)],t.prototype,"isTransparentSet",void 0);var $,ee=t;function t(e,t,i,n){return $.call(this,e,t,i,n)||this}te=G.ChildProperty,K(i,te),e([G.Property("")],i.prototype,"id",void 0),e([G.Property("")],i.prototype,"signatureType",void 0),e([G.Property("")],i.prototype,"name",void 0),e([G.Property("")],i.prototype,"value",void 0),e([G.Property(null)],i.prototype,"formFieldAnnotationType",void 0),e([G.Property("#daeaf7ff")],i.prototype,"backgroundColor",void 0),e([G.Property("black")],i.prototype,"color",void 0),e([G.Property("#303030")],i.prototype,"borderColor",void 0),e([G.Property("")],i.prototype,"tooltip",void 0),e([G.Property(1)],i.prototype,"opacity",void 0),e([G.Property(1)],i.prototype,"thickness",void 0),e([G.Property(0)],i.prototype,"rotateAngle",void 0),e([G.Complex({x:0,y:0},W)],i.prototype,"bounds",void 0),e([G.Property(0)],i.prototype,"pageIndex",void 0),e([G.Property(1)],i.prototype,"pageNumber",void 0),e([G.Property(-1)],i.prototype,"zIndex",void 0),e([G.Property(null)],i.prototype,"wrapper",void 0),e([G.Property(16)],i.prototype,"fontSize",void 0),e([G.Property("Helvetica")],i.prototype,"fontFamily",void 0),e([G.Property("None")],i.prototype,"fontStyle",void 0),e([G.Property("left")],i.prototype,"alignment",void 0),e([G.Property(0)],i.prototype,"minHeight",void 0),e([G.Property(0)],i.prototype,"minWidth",void 0),e([G.Property(0)],i.prototype,"maxHeight",void 0),e([G.Property(0)],i.prototype,"maxWidth",void 0),e([G.Property(0)],i.prototype,"maxLength",void 0),e([G.Property("visible")],i.prototype,"visibility",void 0),e([G.Property(!0)],i.prototype,"isPrint",void 0),e([G.Property(!1)],i.prototype,"isReadonly",void 0),e([G.Property(!1)],i.prototype,"isChecked",void 0),e([G.Property(!1)],i.prototype,"isSelected",void 0),e([G.Property(!1)],i.prototype,"isRequired",void 0),e([G.Property(!1)],i.prototype,"isMultiline",void 0),e([G.Property(!1)],i.prototype,"isTransparent",void 0),e([G.Property(!1)],i.prototype,"insertSpaces",void 0),e([G.Property("")],i.prototype,"options",void 0),e([G.Property()],i.prototype,"signatureIndicatorSettings",void 0),e([G.Complex({isBold:!1,isItalic:!1,isStrikeout:!1,isUnderline:!1},X)],i.prototype,"font",void 0),e([G.Property()],i.prototype,"selectedIndex",void 0),e([G.Property(null)],i.prototype,"customData",void 0);var te,ie=i;function i(e,t,i,n){return te.call(this,e,t,i,n)||this}Object.defineProperty(oe.prototype,"pageId",{get:function(){return this.pageIdTemp},set:function(e){this.pageIdTemp=e},enumerable:!0,configurable:!0}),Object.defineProperty(oe.prototype,"zIndex",{get:function(){return this.zIndexTemp},set:function(e){this.zIndexTemp=e},enumerable:!0,configurable:!0}),Object.defineProperty(oe.prototype,"objects",{get:function(){return this.childNodesTemp},set:function(e){this.childNodesTemp=e},enumerable:!0,configurable:!0});var ne=oe;function oe(){this.pageIdTemp=0,this.zIndexTemp=-1,this.childNodesTemp=[],this.objects=[],this.zIndexTemp=-1,this.pageIdTemp=0}ae=function(e,t){return(ae=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ae,re,K=function(e,t){function i(){this.constructor=e}ae(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},e=function(e,t,i,n){var o,a=arguments.length,r=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;0<=s;s--)(o=e[s])&&(r=(a<3?o(r):3<a?o(t,i,r):o(t,i))||r);return 3<a&&r&&Object.defineProperty(t,i,r),r},se=(re=G.ChildProperty,K(le,re),le.prototype.init=function(e){var t=new j.Container;if(t.measureChildren=!1,t.children=[],this.formFields&&0<this.formFields.length)for(var i=0;i<this.formFields.length;i++){var n=e.pdfViewer.nameTable[this.formFields[parseInt(i.toString(),10)].id].wrapper;t.children.push(n)}else if(this.annotations)for(i=0;i<this.annotations.length;i++)G.isNullOrUndefined(this.annotations[parseInt(i.toString(),10)])||(n=e.pdfViewer.nameTable[this.annotations[parseInt(i.toString(),10)].id].wrapper,t.children.push(n));return this.wrapper=t},e([G.Property(null)],le.prototype,"wrapper",void 0),e([G.Collection([],ee)],le.prototype,"annotations",void 0),e([G.Collection([],ie)],le.prototype,"formFields",void 0),e([G.Property()],le.prototype,"width",void 0),e([G.Property()],le.prototype,"height",void 0),e([G.Property(0)],le.prototype,"rotateAngle",void 0),e([G.Property(0)],le.prototype,"offsetX",void 0),e([G.Property(0)],le.prototype,"offsetY",void 0),e([G.Complex({x:.5,y:.5},j.Point)],le.prototype,"pivot",void 0),le);function le(){return null!==re&&re.apply(this,arguments)||this}function de(e){return"Line"===e.shapeAnnotationType||"LineWidthArrowHead"===e.shapeAnnotationType||"Distance"===e.shapeAnnotationType||"Polygon"===e.shapeAnnotationType}function Ae(e,t){var i;e&&t&&(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):(i="#ffffff00"===e.fillColor?"transparent":e.fillColor,t.style.fill=i||"white","Redaction"===e.shapeAnnotationType&&(i=he(e.markerFillColor,e.markerOpacity),t.style.fill=i),t.style.strokeColor=e.strokeColor||e.borderColor,t.style.color=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 he(e,o){return e.replace(/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*[\d.]+\s*\)/,function(e,t,i,n){return"rgba("+t+","+i+","+n+","+o+")"})}function pe(e){for(var t=0,i=0;i<e.length-1;i++)t+=j.Point.findLength(e[parseInt(i.toString(),10)],e[i+1]);return t}function ce(e,t){e={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&&(e.x+=t.tx,e.y+=t.ty),e}function ge(e){return e=void 0!==e&&"string"==typeof e?G.getValue(e,window):e}function R(e,t,i){var n={};if(e){i=e.propName;for(var o=e.properties||e,a=[],r=[],s=((a=a.concat(Object.keys(o))).push("version"),i&&(r=(o=ge(t))?o(i):[],a=a.concat(r)),fe(i)),l=0,d=a=a.concat(s);l<d.length;l++){var A=d[l];"historyManager"!==A&&("wrapper"!==A?e[""+A]&&Object.prototype.hasOwnProperty.call(e,"observers")||(e[""+A]instanceof Array?n[""+A]=ue((-1===s.indexOf(A)&&e[""+i]?e[""+i]:e)[""+A],t):e[""+A]instanceof Array==!1&&e[""+A]instanceof HTMLElement?n[""+A]=e[""+A].cloneNode(!0).innerHtml:e[""+A]instanceof Array==!1&&e[""+A]instanceof Object&&"template"!==A?n[""+A]=R((-1===s.indexOf(A)&&e[""+i]?e[""+i]:e)[""+A]):n[""+A]=e[""+A]):e[""+A]&&(n[""+A]={actualSize:{width:e[""+A].actualSize.width,height:e[""+A].actualSize.height},offsetX:e[""+A].offsetX,offsetY:e[""+A].offsetY}))}}return n}function ue(e,t,i){if(e)for(var n=[],o=0;o<e.length;o++)!(e[parseInt(o.toString(),10)]instanceof Array)&&e[parseInt(o.toString(),10)]instanceof Object?n.push(R(e[parseInt(o.toString(),10)],t)):n.push(e[parseInt(o.toString(),10)]);return n}function fe(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 me(e,t){var i;if("Distance"===e.shapeAnnotationType)for(var n=0,o=void 0,a=0;a<e.wrapper.children.length;a++){var r=j.Point.findAngle(e.sourcePoint,e.targetPoint);if(-1<e.wrapper.children[parseInt(a.toString(),10)].id.indexOf("leader")){var s=e.wrapper.children[0].bounds.center,s=0===n?(o={x:e.sourcePoint.x,y:e.sourcePoint.y-e.leaderHeight},e.sourcePoint):(o={x:e.targetPoint.x,y:e.targetPoint.y-e.leaderHeight},e.targetPoint),l=j.identityMatrix();if(j.rotateMatrix(l,r,s.x,s.y),i=j.transformPointByMatrix(l,{x:o.x,y:o.y}),t==="Leader"+n)return{leader:"leader"+n,point:i};n++}}return{leader:"",point:i}}function we(e,t){var i=e.vertexPoints.slice(0);return i&&0<i.length&&(e.sourcePoint=i[0],e.targetPoint=i[i.length-1]),i}function Ce(e,t){for(var i,n="",o=[],a=0;a<t.length;)o.push({x:t[parseInt(a.toString(),10)].x,y:t[parseInt(a.toString(),10)].y}),a++;for(var o=Ee(e,o),r=0;r<o.length;r++)i=o[parseInt(r.toString(),10)],0===r&&(n="M"+i.x+" "+i.y),0<r&&(n+=" L"+i.x+" "+i.y);return n}function Be(e,t,i){new j.Rect;var n=Ce(e,t),t=j.Rect.toBounds(t);return i.width=t.width,i.height=t.height,i.offsetX=t.x+i.width/2,i.offsetY=t.y+i.height/2,i.data=n,e.wrapper&&(e.wrapper.offsetX=i.offsetX,e.wrapper.offsetY=i.offsetY,n=t.width,n=t.width<t.height?t.height:t.width,e.wrapper.width=e.enableShapeLabel?n/2:n,e.wrapper.height=t.height),i}function ye(e,t){var i=we(e);return t.staticSize=!0,Ae(e,t=Be(e,i,t)),t}function Se(e,t,i,n,o){t.offsetX=i.x,t.offsetY=i.y;i=j.Point.findAngle(i,n),n=Le(o?e.sourceDecoraterShapes:e.taregetDecoraterShapes),o=0,o="LineWidthArrowHead"===e.shapeAnnotationType||"Line"===e.shapeAnnotationType?(o=e.thickness,new j.Size(12*o,12*o)):(o=e.thickness<=5?5:e.thickness,new j.Size(2*o,2*o));t.transform=j.RotateTransform.Self,Ae(e,t),t.style.fill="tranparent"!==e.fillColor?e.fillColor:"white",t.rotateAngle=i,t.data=n,t.canMeasurePath=!0,t.width=o.width,t.height=o.height,"Butt"!==e.sourceDecoraterShapes&&"Butt"!==e.taregetDecoraterShapes||(t.width=o.width-10,t.height=o.height+10)}function Ie(e,t,i,n){var o=new j.PathElement;return Se(e,o,t,i,n),o}function Ee(e,t){return t[0]=be(e,t,!0),t[t.length-1]=be(e,t,!1),t}function be(e,t,i){var n={x:0,y:0},o=t.length,a=i?t[0]:t[o-1],t=i?t[1]:t[o-2];return"Butt"===(i?e.sourceDecoraterShapes:e.taregetDecoraterShapes)?a:(o=0===(o=j.Point.distancePoints(a,t))?1:o,i=e.thickness,n.x=Math.round(a.x+i*(t.x-a.x)/o),n.y=Math.round(a.y+i*(t.y-a.y)/o),j.Point.adjustPoint(n,t,!0,.5))}function xe(e,t,i,n){var o=[],a=j.Point.findAngle(t[0],t[1]),r=Fe(e,a);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?r.content=e.notes:r.content=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),r.rotateValue={y:-10,angle:a},!0===e.enableShapeLabel&&(r.style.strokeColor=e.labelBorderColor,r.style.fill=e.labelFillColor,r.style.fontSize=e.fontSize,r.style.color=e.fontColor,r.style.fontFamily=e.fontFamily),o.push(r),o}function Ve(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var a=e.wrapper.children[parseInt(o.toString(),10)];a&&!G.isNullOrUndefined(a.content)&&(n=i.setConversion(pe([t[0],t[1]])*i.pixelToPointFactor,e),a.content=n,a.childNodes[0].text=a.content,a.refreshTextElement())}return n}function Me(e,t){for(var i,n=0;n<e.wrapper.children.length;n++){var o=e.wrapper.children[parseInt(n.toString(),10)];o&&!G.isNullOrUndefined(o.content)&&(i=t.setConversion(e.bounds.width/2*t.pixelToPointFactor,e),o.content=i,2===o.childNodes.length?(o.childNodes[0].text=i,o.childNodes.splice(o.childNodes.length-1,1)):o.childNodes[0].text=i,o.refreshTextElement())}return i}function ve(e,t,i,n){var o=[],t=j.Point.findAngle(t[0],t[1]),a=Fe(e,t);return!n.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?a.content=e.notes:a.content=i.calculatePerimeter(e),!0===e.enableShapeLabel&&(a.style.strokeColor=e.labelBorderColor,a.style.fill=e.labelFillColor,a.style.fontSize=e.fontSize,a.style.color=e.fontColor,a.style.fontFamily=e.fontFamily),a.rotateValue={y:-10,angle:t},o.push(a),o}function De(e,t,i){for(var n,o=0;o<e.wrapper.children.length;o++){var a=e.wrapper.children[parseInt(o.toString(),10)];a&&!G.isNullOrUndefined(a.content)&&(n=i.calculatePerimeter(e),a.content=n,a.childNodes[0].text=a.content,a.refreshTextElement())}return n}function Qe(e){if(e.wrapper&&e.wrapper.children)for(var t=0;t<e.wrapper.children.length;t++){var i=e.wrapper.children[parseInt(t.toString(),10)];i&&!G.isNullOrUndefined(i.content)&&(i.content=e.notes,i.childNodes[0].text=i.content,i.refreshTextElement())}}function Te(e){for(var t,i="",i="M"+e[0].x+" "+e[0].y,n=1;n<e.length;n++)i+="L"+(t=e[parseInt(n.toString(),10)]).x+" "+t.y;return i+="Z"}function Fe(e,t){var i=new j.TextElement;return Ae(e,i),i.style.fill="transparent",i.id=j.randomId(),i.horizontalAlignment="Center",i.rotateValue={y:10,angle:t},i.verticalAlignment="Top",i.relativeMode="Object",i.setOffsetWithRespectToBounds(.5,.5,"Absolute"),i.style.textWrapping="NoWrap",i}function ke(e,t){var i=[],n=Pe(e,t[0],t[1]);return i.push(n),n=Pe(e,t[1],t[0],!0),i.push(n),i}function Pe(e,t,i,n){var o=new j.PathElement,a=(o.offsetX=t.x,o.offsetY=t.y,j.Point.findAngle(t,i)),i={x:(t.x+i.x)/2,y:(t.y+i.y)/2},r=j.identityMatrix();j.rotateMatrix(r,0-a,i.x,i.y);var s={x:(i=j.transformPointByMatrix(r,t)).x,y:i.y-e.leaderHeight},r=j.identityMatrix(),i=(j.rotateMatrix(r,a,o.offsetX,o.offsetY),j.transformPointByMatrix(r,s)),r={x:t.x,y:t.y},s=(o.offsetX=r.x,o.offsetY=r.y,o.transform=j.RotateTransform.Self,"M"+t.x+","+t.y+",L"+i.x+","+i.y+"Z"),r=new j.Size(0,e.leaderHeight);return o.pivot.x=.5,n?(o.id="leader2_"+j.randomId(),o.pivot.y=0):(o.id="leader1_"+j.randomId(),o.pivot.y=1),Ae(e,o),o.rotateAngle=a,o.data=s,o.canMeasurePath=!0,o.width=r.width,o.height=r.height,o}function Ne(e,t){var i=e.vertexPoints;if(!G.isNullOrUndefined(i))for(var n=0;n<i.length-1;n++){var o=i[parseInt(n.toString(),10)],a=i[n+1],r=j.Rect.toBounds([o,a]);if(r.Inflate(10),r.containsPoint(t)){var r=Re(t,o,a),s={x1:o.x,x2:a.x,y1:o.y,y2:a.y},l={x1:t.x,x2:r.x,y1:t.y,y2:r.y},s=j.intersect3(s,l);if(s.enabled){l=j.Point.findLength(t,s.intersectPt);if(Math.abs(l)<10)return!0}else{s=j.Rect.toBounds([t,t]);if(s.Inflate(3),s.containsPoint(o)||s.containsPoint(a))return!0}if(j.Point.equals(t,r))return!0}}return!1}function Re(e,t,i){var n=j.Point.findLength(t,e),n=j.Point.findLength(i,e)<n?i:t,t=j.Point.findAngle(t,i),i=j.Point.findAngle(n,e),e=j.Point.findLength(n,e),t=i+2*(t-i);return{x:n.x+e*Math.cos(t*Math.PI/180),y:n.y+e*Math.sin(t*Math.PI/180)}}function Le(e){return ze[""+e]}var Oe,Ue,ze={OpenArrow:"M15.9,23 L5,16 L15.9,9 L17,10.7 L8.7,16 L17,21.3Z",Square:"M0,0 L10,0 L10,10 L0,10 z",Fletch:"M14.8,10c0,0-3.5,6,0.2,12c0,0-2.5-6-10.9-6C4.1,16,11.3,16,14.8,10z",OpenFetch:"M6,17c-0.6,0-1-0.4-1-1s0.4-1,1-1c10.9,0,11-5,11-5c0-0.6,0.4-1,1-1s1,0.4,1,1C19,10.3,18.9,17,6,17C6,17,6,17,6,17z M18,23c-0.5,0-1-0.4-1-1c0-0.2-0.3-5-11-5c-0.6,0-1-0.5-1-1s0.4-1,1-1c0,0,0,0,0,0c12.9,0,13,6.7,13,7 C19,22.6,18.6,23,18,23z",IndentedArrow:"M17,10c0,0-4.5,5.5,0,12L5,16L17,10z",OutdentedArrow:"M14.6,10c0,0,5.4,6,0,12L5,16L14.6,10z",DoubleArrow:"M19,10 L19,22 L13,16Z M12,10 L12,22 L6,16Z",Arrow:"M15,10 L15,22 L5,16Z",Diamond:"M12,23l-7-7l7-7l6.9,7L12,23z",Circle:"M0,50 A50,50,0 1 1 100,50 A50,50,0 1 1 0,50 Z",Butt:"M0,0 L0,90"},K=(Oe=function(e,t){return(Oe=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)},function(e,t){function i(){this.constructor=e}Oe(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),He=(Ue=j.DrawingElement,K(Ye,Ue),Ye.prototype.templateCompiler=function(t){if(t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?G.compile(document.querySelector(t).innerHTML.trim()):G.compile(t)}catch(e){return G.compile(t)}},Ye.prototype.getNodeTemplate=function(){return this.templateFn},Ye);function Ye(e){var t=Ue.call(this)||this;return t.templateFn=t.templateCompiler(e),t}n.prototype.renderLabels=function(e){var t=e.annotations;if(t)for(var i=0;i<t.length;i++){var n=t[parseInt(i.toString(),10)];this.initObject(n)}},n.prototype.createNewZindexTable=function(e){var t=new ne;return this.pdfViewer.zIndex++,t.pageId=this.pdfViewer.zIndex,this.pdfViewer.zIndexTable.push(t),t},n.prototype.getPageTable=function(e){var t;if(void 0!==this.pdfViewer.zIndexTable.length){for(var i=!0,n=0;n<this.pdfViewer.zIndexTable.length;n++)if(this.pdfViewer.zIndexTable[parseInt(n.toString(),10)].pageId===e){i=!1,t=this.pdfViewer.zIndexTable[parseInt(n.toString(),10)];break}i&&((t=this.createNewZindexTable(e)).pageId=e)}else t=this.createNewZindexTable(e);return t},n.prototype.setZIndex=function(e,t){if(void 0!==t.pageIndex){var i,n=this.getPageTable(t.pageIndex),o=!1;if("Polygon"!==t.shapeAnnotationType)for(var a=0;a<n.objects.length;a++)if(t.id===n.objects[parseInt(a.toString(),10)].id){n.objects.splice(parseInt(a.toString(),10),1),n.objects.splice(parseInt(a.toString(),10),0,t),o=!0;break}o||(-1===t.zIndex?(n.zIndex++,t.zIndex=n.zIndex):(i=n.objects.length,t.zIndex=i++),n.objects.push(t))}},n.prototype.initObject=function(e){return this.setZIndex(this.pdfViewer.zIndex,e),j.createMeasureElements(),de(e)?(this.initLine(e),e.wrapper.children[1]instanceof j.TextElement&&(e.wrapper.children[1].isEJ2=!0,"FreeText"===e.shapeAnnotationType)&&(e.wrapper.children[1].isFreeText=!0),e.wrapper.measure(new j.Size(void 0,void 0)),e.wrapper.arrange(e.wrapper.desiredSize)):this.initNode(e),e.wrapper,this.pdfViewer.nameTable[e.id]=e},n.prototype.initNode=function(e){this.pdfViewer.annotationModule.isUndoRedoAction&&"Stamp"===e.shapeAnnotationType&&(t=e.id,t=this.pdfViewer.nameTable[""+t].wrapper.children,this.stampPreviousSize=JSON.parse(JSON.stringify(t)),this.stampPreviousWidth=e.wrapper.actualSize.width,this.stampPerviousHeight=e.wrapper.actualSize.height),this.isPasted&&"Stamp"===e.shapeAnnotationType&&(this.stampOriginalWidth=e.wrapper.actualSize.width,this.stampOriginalHeight=e.wrapper.actualSize.height);var t=this.initContainer(e);t.children||(t.children=[]),this.init(e,t),t.rotateAngle=e.rotateAngle,e.wrapper.children[1]instanceof j.TextElement&&(e.wrapper.children[1].isEJ2=!0,"FreeText"===e.shapeAnnotationType)&&(e.wrapper.children[1].isFreeText=!0),t.measure(new j.Size(e.wrapper.width,e.wrapper.height)),t.arrange(t.desiredSize),this.isDynamicStamps&&(this.pdfViewer.annotation.stampAnnotationModule.updateSessionStorage(e,null,"dynamicStamp"),this.isDynamicStamps=!1)},n.prototype.init=function(e,t){var i=new j.DrawingElement,n=this.pdfViewer.annotationModule?this.pdfViewer.annotationModule.findAnnotationSettings(e):{},o=0,a=0,r=0,s=0,n=((n.minWidth||n.maxWidth||n.minHeight||n.maxHeight)&&(o=n.maxHeight||2e3,a=n.maxWidth||2e3,r=n.minHeight||0,s=n.minWidth||0),!1);return(r||s||o||a)&&(n=!0),(i=e.formFieldAnnotationType?this.initFormFields(e,i,t):this.initAnnotationObject(e,void 0,i,t,!1,void 0,n,o,a,s,r)).id=e.id+"_content",i.relativeMode="Object","Stamp"!==e.shapeAnnotationType&&(void 0!==e.bounds.width&&(i.width=e.bounds.width,n)&&(i.width<s||i.width>a)&&(i.width<s&&(i.width=s),i.width>a)&&(i.width=a),i.horizontalAlignment="Stretch",void 0!==e.bounds.height&&(i.height=e.bounds.height,n)&&(i.height<r||i.width>o)&&(i.height<r&&(i.height=r),i.height>o)&&(i.height=o),Ae(e,i),this.pdfViewer.viewerBase.drawSignatureWithTool)&&"SignatureText"===e.shapeAnnotationType&&(i.style.strokeWidth=0),i.isRectElement=!0,i.verticalAlignment="Stretch",i},n.prototype.initFormFields=function(e,t,i){switch(e.formFieldAnnotationType){case"Textbox":case"PasswordField":case"Checkbox":case"RadioButton":case"DropdownList":case"ListBox":case"SignatureField":case"InitialField":(t=new He).id=e.id+"_content",i.children.push(t)}return t},n.prototype.initAnnotationObject=function(e,t,i,n,o,a,r,s,l,d,A){switch(e.shapeAnnotationType){case"Ellipse":(t=new j.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",i=t,n.children.push(i),e.enableShapeLabel&&((c=this.textElement(e)).content=e.labelContent,c.style.color=e.fontColor,c.style.strokeColor=e.labelBorderColor,c.style.fill=e.labelFillColor,c.style.fontSize=e.fontSize,c.style.fontFamily=e.fontFamily,c.style.opacity=e.labelOpacity,n.children.push(c));break;case"Path":(t=new j.PathElement).data=e.data,i=t,n.children.push(i);break;case"HandWrittenSignature":case"Ink":(t=new j.PathElement).data=e.data,t.style.strokeColor=e.strokeColor,t.style.strokeWidth=e.thickness,t.style.opacity=e.opacity,i=t,n.children.push(i);break;case"Polygon":(t=new j.PathElement).data=Te(e.vertexPoints),i=t,n.children.push(i);break;case"Stamp":this.isDynamicStamps=o=!0;var h=void 0;this.isPasted&&(f=this.pdfViewer.clipboardData.clipObject[0].id,h=this.pdfViewer.nameTable[""+f]),e.isDynamicStamp?(n.horizontalAlignment="Left",(i=a=new j.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),(g=new j.TextElement).style.fontFamily="Helvetica",g.style.fontSize=14,g.style.italic=!0,g.style.bold=!0,g.style.color=e.fillColor,g.rotateValue=void 0,g.content=e.dynamicText,g.style.textAlign="Left",g.relativeMode="Point",g.margin.left=5,g.margin.bottom=3,g.setOffsetWithRespectToBounds(0,.75,null),"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(m=e.bounds.width+20,u=e.bounds.height+20,w=.02*m,p=Math.max(0,m-2*w),g.style.fontSize=this.fontSizeCalculation(e,g,p,g.content),f=(.25*u-(B=this.measureTextMetrics(e,g.content,g.style.fontSize,g.style.fontFamily)).height)/8,g.margin.bottom=Math.max(0,f),g.margin.bottom<1&&(g.margin.bottom=5),g.margin.left=(m-B.width)/2),this.isPasted&&(g.style.fontSize=h.wrapper.children[1].style.fontSize,g.margin.left=h.wrapper.children[1].margin.left),this.pdfViewer.annotationModule.isUndoRedoAction&&(g.style.fontSize=this.stampPreviousSize[1].style.fontSize),n.children.push(g),r&&e.bounds.width>l&&(e.bounds.width=l),r&&e.bounds.height>s&&(e.bounds.height=s/2),(C=new j.TextElement).style.fontFamily="Helvetica",C.style.fontSize=e.fontSize,C.style.italic=!0,C.style.bold=!0,C.style.color=e.fillColor,C.rotateValue=void 0,C.content=e.icon.toUpperCase(),C.style.textAlign="Left",C.relativeMode="Point",C.margin.left=5,C.margin.top=4,C.setOffsetWithRespectToBounds(0,.1,null),"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(m=e.bounds.width+20,u=e.bounds.height+20,f=m,"REVISED"===C.content||"REVIEWED"===C.content||"RECEIVED"===C.content||"APPROVED"===C.content?f/=2:"CONFIDENTIAL"!==C.content&&"NOT APPROVED"!==C.content||(f*=.75),w=.02*f,p=Math.max(0,f-2*w),C.style.fontSize=this.fontSizeCalculation(e,C,p,C.content),f=(.75*u-(B=this.measureTextMetrics(e,C.content,C.style.fontSize,C.style.fontFamily)).height)/10,C.margin.top=Math.max(0,f),"CONFIDENTIAL"===C.content||"NOT APPROVED"===C.content?C.margin.left=(m-B.width*(4/3))/2:C.margin.left=(m-2*B.width)/2),this.isPasted?(C.style.fontSize=h.wrapper.children[2].style.fontSize,C.margin.left=h.wrapper.children[2].margin.left,C.margin.top=h.wrapper.children[2].margin.top-.5*h.wrapper.children[2].margin.top,i.width=this.stampOriginalWidth,i.height=this.stampOriginalHeight):this.pdfViewer.annotationModule.isUndoRedoAction?(C.style.fontSize=this.stampPreviousSize[2].style.fontSize,i.width=this.stampPreviousWidth,i.height=this.stampPerviousHeight):(i.width=e.bounds.width+20,i.height=e.bounds.height+20),i.style.opacity=e.opacity,C.id=j.randomId()+"_stamp",n.children.push(C)):(n.horizontalAlignment="Left",(i=a=new j.DrawingElement).cornerRadius=10,i.style.fill=e.stampFillColor,i.style.strokeColor=e.stampStrokeColor,n.children.push(i),"Accepted"===e.icon||"Rejected"===e.icon?(e&&e.annotationAddMode&&("Existing Annotation"===e.annotationAddMode||"Imported Annotation"===e.annotationAddMode)&&(e.bounds.width=e.bounds.width-20,e.bounds.height=e.bounds.height-20),(w=new j.PathElement).id=j.randomId()+"_stamp",w.data=e.data,w.width=e.bounds.width,r&&e.bounds.width>l&&(w.width=l,e.bounds.width=l),w.height=e.bounds.height,r&&e.bounds.height>s&&(w.height=s,e.bounds.height=s),w.minWidth=w.width/2,w.minHeight=w.height/2,(p=w).style.fill=e.fillColor,w.style.strokeColor=e.strokeColor,w.style.opacity=e.opacity,i.width=e.bounds.width+20,i.height=e.bounds.height+20,i.minWidth=w.width/2,i.minHeight=w.height/2,i.style.opacity=e.opacity,n.children.push(p),n.minHeight=i.minHeight+20,n.minWidth=i.minWidth+20):(r&&e.bounds.width>l&&(e.bounds.width=l),r&&e.bounds.height>s&&(e.bounds.height=s/2),(C=new j.TextElement).style.fontFamily="Helvetica",C.style.fontSize=e.fontSize,C.style.italic=!0,C.style.bold=!0,C.style.color=e.fillColor,C.rotateValue=void 0,C.style.textAlign="Left",C.content=e.icon.toUpperCase(),C.relativeMode="Point",C.setOffsetWithRespectToBounds(0,.1,null),B=this.measureTextMetrics(e,C.content,C.style.fontSize,C.style.fontFamily),C.margin.top=5,C.margin.left=(e.bounds.width+20-B.width)/2,"Existing Annotation"!==e.annotationAddMode&&"Imported Annotation"!==e.annotationAddMode||(m=e.bounds.width+20,u=e.bounds.height+20,f=Math.max(0,m-2*(.05*m)),C.style.fontSize=this.fontSizeCalculation(e,C,f,C.content),w=(m-this.measureTextMetrics(e,C.content,C.style.fontSize,C.style.fontFamily).width)/2,C.margin.left=Math.max(0,w)),this.isPasted?(C.style.fontSize=h.wrapper.children[1].style.fontSize,C.margin.left=h.wrapper.children[1].margin.left,C.margin.top=h.wrapper.children[1].margin.top-.5*h.wrapper.children[1].margin.top,i.width=this.stampOriginalWidth,i.height=this.stampOriginalHeight):this.pdfViewer.annotationModule.isUndoRedoAction?(C.style.fontSize=this.stampPreviousSize[1].style.fontSize,C.margin.left=(this.stampPreviousWidth-B.width)/2,i.width=this.stampPreviousWidth,i.height=this.stampPerviousHeight):(i.width=e.bounds.width+20,i.height=e.bounds.height+20),i.style.opacity=e.opacity,C.id=j.randomId()+"_stamp",n.children.push(C)));break;case"Image":case"SignatureImage":var p=new j.ImageElement;p.source=e.data,(i=p).style.strokeWidth=0,n.children.push(i);break;case"Rectangle":case"Redaction":var c;i=a=new j.DrawingElement,n.children.push(i),e.enableShapeLabel&&((c=this.textElement(e)).content=e.labelContent,c.style.color=e.fontColor,c.style.strokeColor=e.labelBorderColor,c.style.fill=e.labelFillColor,c.style.fontSize=e.fontSize,c.style.fontFamily=e.fontFamily,c.style.opacity=e.labelOpacity,n.children.push(c));break;case"Perimeter":(t=new j.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Ae(e,i=t),n.children.push(i),(a=new j.DrawingElement).id="perimeter_"+j.randomId(),a.height=.2,a.width=.2,a.transform=j.RotateTransform.Self,a.horizontalAlignment="Stretch",this.setNodePosition(a,e),a.rotateAngle=e.rotateAngle,Ae(e,a),n.children.push(a);var g=this.textElement(e);(g=new j.TextElement).content=g.content=pe([{x:e.bounds.x,y:e.bounds.y},{x:e.bounds.x+e.bounds.width,y:e.bounds.y+e.bounds.height}]).toString(),g.rotateValue={y:-10,angle:e.rotateAngle},n.children.push(g);break;case"Radius":(t=new j.PathElement).data="M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z",Ae(e,i=t),n.children.push(i),(a=new j.DrawingElement).id="radius_"+j.randomId(),a.height=.2,a.width=e.bounds.width/2,a.transform=j.RotateTransform.Self,this.setNodePosition(a,e),a.rotateAngle=e.rotateAngle,Ae(e,a),n.children.push(a);var u=this.textElement(e);e.enableShapeLabel&&(u.style.color=e.fontColor,u.style.strokeColor=e.labelBorderColor,u.style.fill=e.labelFillColor,u.style.fontSize=e.fontSize,u.style.fontFamily=e.fontFamily,u.style.opacity=e.labelOpacity),pe([{x:e.bounds.x,y:e.bounds.y},{x:e.bounds.x+e.bounds.width,y:e.bounds.y+e.bounds.height}]);!this.pdfViewer.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?u.content=e.notes:u.content=this.pdfViewer.annotation.measureAnnotationModule.setConversion(e.bounds.width/2*this.pdfViewer.annotation.measureAnnotationModule.pixelToPointFactor,e),u.rotateValue={y:-10,x:e.bounds.width/4,angle:e.rotateAngle},n.children.push(u);break;case"StickyNotes":var f=new j.ImageElement;f.source=e.data,f.width=e.bounds.width,f.height=e.bounds.height,f.style.strokeColor=e.strokeColor,f.style.strokeWidth=0,n.children.push(i=f);break;case"SignatureText":var m=new j.DrawingElement,w=(m.style.strokeWidth=0,(i=m).style.strokeWidth=0,n.style.strokeWidth=0,n.children.push(i),this.textElement(e));w.style.fontFamily=e.fontFamily,w.style.fontSize=e.fontSize,w.style.textAlign="Left",w.rotateValue=void 0,w.content=e.data,w.style.strokeWidth=0,n.children.push(w);break;case"FreeText":var C,h=new j.DrawingElement,B=(n.children.push(i=h),this.textElement(e));(B=new j.TextElement).style.fontFamily=e.fontFamily,B.style.fontSize=e.fontSize,B.style.textAlign="Left","center"===e.textAlign.toLowerCase()?B.style.textAlign="Center":"right"===e.textAlign.toLowerCase()?B.style.textAlign="Right":"justify"===e.textAlign.toLowerCase()&&(B.style.textAlign="Justify"),B.style.color=e.fontColor,B.style.bold=e.font.isBold,B.style.italic=e.font.isItalic,!0===e.font.isUnderline?B.style.textDecoration="Underline":!0===e.font.isStrikeout&&(B.style.textDecoration="LineThrough"),B.rotateValue=void 0,B.content=e.dynamicText,B.style.opacity=e.opacity,B.style.strokeWidth=e.thickness,B.margin.left=4,B.margin.right=5,B.margin.top=e.fontSize/16*5,this.isPasted&&(C=(e.thickness||0)/2,B.margin.left=C,B.margin.right=C),this.isPasted=!1,this.pdfViewer.freeTextSettings.enableAutoFit?B.style.textWrapping="Wrap":B.style.textWrapping="WrapWithOverflow",B.relativeMode="Point",B.setOffsetWithRespectToBounds(0,0,null),B.relativeMode="Point",n.children.push(B)}return i.id=e.id+"_content",i.relativeMode="Object",o||(void 0!==e.bounds.width&&(i.width=e.bounds.width,r)&&(i.width<d||i.width>l)&&(i.width<d&&(i.width=d),i.width>l)&&(i.width=l),i.horizontalAlignment="Stretch",void 0!==e.bounds.height&&(i.height=e.bounds.height,r)&&(i.height<A||i.width>s)&&(i.height<A&&(i.height=A),i.height>s)&&(i.height=s),Ae(e,i)),i.isRectElement=!0,i.verticalAlignment="Stretch",i},n.prototype.textElement=function(e){var t=new j.TextElement;return Ae(e,t),t.horizontalAlignment="Center",t.verticalAlignment="SignatureText"===e.shapeAnnotationType?"Center":"Top",t.relativeMode="Object",t.setOffsetWithRespectToBounds(.5,.5,"Absolute"),t},n.prototype.setNodePosition=function(e,t){var i,n,o;"Perimeter"===t.shapeAnnotationType?(e.offsetX=t.bounds.x+t.bounds.width/2,e.offsetY=t.bounds.y+t.bounds.height/2):"Radius"===t.shapeAnnotationType&&(i={x:t.bounds.x+t.bounds.width/2+t.bounds.width/4,y:t.bounds.y+t.bounds.height/2},n={x:t.bounds.x+t.bounds.width/2,y:t.bounds.y+t.bounds.height/2},o=j.identityMatrix(),j.rotateMatrix(o,t.rotateAngle,n.x,n.y),o={x:(n=j.transformPointByMatrix(o,i)).x,y:n.y},e.offsetX=o.x,e.offsetY=o.y,e.width=t.bounds.width/2)},n.prototype.initContainer=function(e){e.id||(e.id=j.randomId());var t=new j.Canvas;return t.id=e.id,t.offsetX=e.bounds.x+.5*e.bounds.width,t.offsetY=e.bounds.y+.5*e.bounds.height,t.style.fill="transparent",t.style.strokeColor="transparent",t.rotateAngle=e.rotateAngle,e.wrapper=t},n.prototype.initLine=function(e){e.id||(e.id=j.randomId());var t=new j.Canvas,i=((a=new j.PathElement).id=e.id+"_path",new j.PathElement),n=new j.PathElement;if(e.vertexPoints.length){e.sourcePoint=e.vertexPoints[0],e.targetPoint=e.vertexPoints[e.vertexPoints.length-1];for(var o=0;o<e.vertexPoints.length;o++)0!==o&&o!==e.vertexPoints.length-1&&e.segments.push(e.vertexPoints[parseInt(o.toString(),10)])}var a=ye(e,a),r=we(e),s=[],l=[],d=("Distance"===e.shapeAnnotationType&&(s=ke(e,r),l=xe(e,r,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),"Line"!==e.shapeAnnotationType&&"LineWidthArrowHead"!==e.shapeAnnotationType||"Perimeter"!==e.measureType||(l=ve(e,r,this.pdfViewer.annotation.measureAnnotationModule,this.pdfViewer)),!0===e.enableShapeLabel&&"Distance"!==e.shapeAnnotationType&&"Perimeter"!==e.measureType&&(d=j.Point.findAngle(r[0],r[1]),(A=this.textElement(e)).id=j.randomId(),!this.pdfViewer.enableImportAnnotationMeasurement&&e.notes&&""!==e.notes?A.content=e.notes:A.content=e.labelContent,A.style.strokeColor=e.labelBorderColor,A.style.fill=e.labelFillColor,A.style.fontSize=e.fontSize,A.style.color=e.fontColor,A.style.fontFamily=e.fontFamily,A.style.opacity=e.labelOpacity,A.rotateValue={y:-10,angle:d},l.push(A)),r=Ee(e,r),j.Rect.toBounds(r)),A=(t.width=d.width,t.height=d.height,t.offsetX=d.x+t.pivot.x*d.width,t.offsetY=d.y+t.pivot.y*d.height,e.vertexPoints);if("Line"!==e.shapeAnnotationType&&"LineWidthArrowHead"!==e.shapeAnnotationType&&"Distance"!==e.shapeAnnotationType||(i=Ie(e,r[0],A[1],!0),n=Ie(e,r[r.length-1],A[A.length-2],!1)),i.id=e.id+"_srcDec",n.id=e.id+"_tarDec",a.style.fill="transparent",t.style.strokeColor="transparent",t.style.fill="transparent",t.style.strokeWidth=0,t.children=[],Ae(e,a),t.children.push(a),0<s.length)for(o=0;o<s.length;o++)t.children.push(s[parseInt(o.toString(),10)]);if(0<l.length)for(o=0;o<l.length;o++)t.children.push(l[parseInt(o.toString(),10)]);if(t.children.push(i),t.children.push(n),"LineWidthArrowHead"===e.shapeAnnotationType)for(o=0;o<t.children.length;o++){var h=t.children[parseInt(o.toString(),10)];(h.id.includes("srcDec")||h.id.includes("tarDec"))&&("Butt"!==e.sourceDecoraterShapes&&"Butt"!==e.taregetDecoraterShapes&&(h.width=12*e.thickness),h.height=12*e.thickness)}return t.id=e.id,t.offsetX=a.offsetX,t.offsetY=a.offsetY,t.width=a.width,t.height=a.height,we(e),e.wrapper=t},n.prototype.add=function(e){var t=this.pdfViewer.allowServerDataBinding;return this.pdfViewer.enableServerDataBinding(!1),(e.formFieldAnnotationType&&this.pdfViewer.formDesignerModule?(e=new ie(this.pdfViewer,"formFields",e,!0),e=this.initObject(e),this.pdfViewer.formFields):(e=new ee(this.pdfViewer,"annotations",e,!0),e=this.initObject(e),this.pdfViewer.annotations)).push(e),this.pdfViewer.enableServerDataBinding(t,!0),e},n.prototype.remove=function(e){for(var t=this.pdfViewer.allowServerDataBinding,i=(this.pdfViewer.enableServerDataBinding(!1),e.pageIndex),n=0;n<this.pdfViewer.annotations.length;n++){var o=this.pdfViewer.annotations[parseInt(n.toString(),10)];if(o.id&&(o.id===e.id||o.id.split("_")[0]===e.id)||o.wrapper&&o.wrapper.id===e.id){this.pdfViewer.annotations.splice(n,1);for(var a=this.getPageObjects(e.pageIndex),r=0;r<a.length;r++)a[parseInt(r.toString(),10)].id===e.id&&(a.splice(r,1),"Path"===e.shapeAnnotationType||"SignatureImage"===e.shapeAnnotationType||"SignatureText"===e.shapeAnnotationType?this.refreshCanvasDiagramLayer(void 0,i,e.id):this.pdfViewer.renderDrawing(void 0,i))}}for(n=0;n<this.pdfViewer.formFields.length;n++)if((l=this.pdfViewer.formFields[parseInt(n.toString(),10)]).id===e.id||l.wrapper.id===e.id){this.pdfViewer.formFields.splice(n,1),this.pdfViewer.formDesignerModule&&e.formFieldAnnotationType&&this.pdfViewer.formFieldCollection.splice(n,1);for(a=this.getPageObjects(e.pageIndex),r=0;r<a.length;r++){if(a[parseInt(r.toString(),10)].id===e.id){a.splice(r,1);break}a[parseInt(r.toString(),10)]&&a[parseInt(r.toString(),10)].id&&-1!==a[parseInt(r.toString(),10)].id.indexOf(e.id)&&a.splice(r,1)}}if("Textbox"===e.formFieldAnnotationType||"Checkbox"===e.formFieldAnnotationType||"RadioButton"===e.formFieldAnnotationType||"PasswordField"===e.formFieldAnnotationType||"DropdownList"===e.formFieldAnnotationType||"ListBox"===e.formFieldAnnotationType||"SignatureField"===e.formFieldAnnotationType||"InitialField"===e.formFieldAnnotationType){var s=document.getElementById("form_field_"+e.id+"_content_html_element");s&&(s.remove(),this.pdfViewer.renderDrawing(void 0,i));for(var l,n=0;n<this.pdfViewer.formFieldCollections.length;n++)(l=this.pdfViewer.formFieldCollections[parseInt(n.toString(),10)]).id===e.id&&this.pdfViewer.formFieldCollections.splice(n,1);for(n=0;n<this.pdfViewer.viewerBase.formFieldCollection.length;n++)e.id==this.pdfViewer.viewerBase.formFieldCollection[parseInt(n.toString(),10)]&&this.pdfViewer.viewerBase.formFieldCollection.splice(n,1);s={name:e.name,id:e.id,value:e.value,fontFamily:e.fontFamily,fontSize:e.fontSize,fontStyle:e.fontStyle,color:e.color,backgroundColor:e.backgroundColor,alignment:e.alignment,isReadonly:e.isReadonly,visibility:e.visibility,maxLength:e.maxLength,isRequired:e.isRequired,isPrint:e.isPrint,rotation:e.rotateAngle,tooltip:e.tooltip,options:e.options,isChecked:e.isChecked,isSelected:e.isSelected,customData:e.customData,lineBound:e.bounds,pageNumber:e.pageIndex,insertSpaces:e.insertSpaces,formFieldAnnotationType:e.formFieldAnnotationType,borderColor:e.borderColor,thickness:e.thickness,isTransparent:e.isTransparent};G.isNullOrUndefined(s)||"diagram_helper"===s.id||(this.pdfViewer.fireFormFieldRemoveEvent("formFieldRemove",s,e.pageIndex),this.pdfViewer.formDesignerModule.removeFieldsFromAnnotationCollections(e.id,s.name))}this.pdfViewer.enableServerDataBinding(t,!0)},n.prototype.getPageObjects=function(e){return this.getPageTable(e).objects},n.prototype.refreshCanvasDiagramLayer=function(e,t,i){var n=this;if(e=e||this.pdfViewer.viewerBase.getAnnotationCanvas("_annotationCanvas_",t)){var o=void 0,o=e.id===this.pdfViewer.element.id+"_print_annotation_layer_"+t?1:this.pdfViewer.viewerBase.getZoomFactor(),a=e.width/o,r=e.height/o,s=e.getContext("2d");s.lineCap="round",s.lineJoin="round",o<1&&(s.lineWidth=s.lineWidth/o);var l=o*this.pdfViewer.viewerBase.getWindowDevicePixelRatio();!G.Browser.isDevice||G.Browser.isDevice&&o<=.7?s.setTransform(l,0,0,l,0,0):s.setTransform(o,0,0,o,0,0),s.clearRect(0,0,a,r);for(var d=this.getPageObjects(t).filter(function(t,e,i){return"free"===t.id.split("_")[0]||(G.isNullOrUndefined(n.pdfViewer.formDesignerModule)?e===i.findIndex(function(e){return e.id===t.id}):e===i.findIndex(function(e){return e.id.split("_")[0]===t.id.split("_")[0]}))}),A=0;A<d.length;A++){var h,p,c=void 0;e.id===this.pdfViewer.element.id+"_print_annotation_layer_"+t?d[parseInt(A.toString(),10)].isPrint&&(c=this.pdfViewer.nameTable[d[parseInt(A.toString(),10)].id].wrapper,G.isNullOrUndefined(c)||j.refreshDiagramElements(e,[c],this.renderer)):(c=this.pdfViewer.nameTable[d[parseInt(A.toString(),10)].id].wrapper,h=d[parseInt(A.toString(),10)].id,h=this.pdfViewer.nameTable[""+h],(c&&this.shouldRefreshElement(h)||G.isNullOrUndefined(this.pdfViewer.formDesignerModule))&&(!G.isNullOrUndefined(h.properties.data)&&h.properties.data.includes("base64")?((p=new Image).src=h.properties.data,null==window.customStampCollection&&void 0===window.customStampCollection&&(window.customStampCollection=new Map),window.customStampCollection&&!window.customStampCollection.get(c.id)&&window.customStampCollection.set(c.id,p)):!G.isNullOrUndefined(h.properties.value)&&h.properties.value.includes("base64")&&((p=new Image).src=h.properties.value,null==window.signatureCollection&&void 0===window.signatureCollection&&(window.signatureCollection=new Map),window.signatureCollection)&&!window.signatureCollection.get(c.id)&&window.signatureCollection.set(c.id,p),c.children[1]instanceof j.TextElement&&(c.children[1].isEJ2=!0),j.refreshDiagramElements(e,[c],this.renderer)))}}},n.prototype.shouldRefreshElement=function(e){var t=this.pdfViewer.nameTable[e.id.split("_")[0]];return!G.isNullOrUndefined(t)&&"visible"===e.visibility||!G.isNullOrUndefined(e.subject)&&"SignatureField"!==e.annotName&&G.isNullOrUndefined(e.visibility)||"annotations"===e.propName&&"Path"!==e.shapeAnnotationType&&"SignatureText"!==e.shapeAnnotationType&&"SignatureImage"!==e.shapeAnnotationType||"SignatureImage"===e.shapeAnnotationType&&"formFields"!==e.propName||"SignatureText"===e.shapeAnnotationType&&"formFields"!==e.propName||G.isNullOrUndefined(t)&&"diagram_helper"===e.id},n.prototype.clearHighlighter=function(e){var e=this.getAdornerLayerSvg(this.pdfViewer.element.id+e+"_diagramAdornerLayer",e);e&&(e=e.getElementById(e.id+"_highlighter"))&&e.parentNode.removeChild(e)},n.prototype.getSelectorElement=function(e,t){var i=null,n=this.getAdornerLayerSvg(e,t);return i=n?n.getElementById(e+t+"_SelectorElement"):i},n.prototype.getAdornerLayerSvg=function(e,t){var i=null,n=j.getDiagramElement(e+t+"_diagramAdornerLayer");return G.isNullOrUndefined(n)&&(this.pdfViewer.viewerBase.getAnnotationCanvas("_annotationCanvas_",t),n=j.getDiagramElement(e+t+"_diagramAdornerLayer")),i=n?n.getElementsByClassName("e-adorner-layer"+t)[0]:i},n.prototype.clearSelectorLayer=function(e){var t=this.getAdornerLayerSvg(this.pdfViewer.element.id,e);if(t)for(var t=t.getElementById(this.pdfViewer.adornerSvgLayer.id+"_selected_region"),i=(t&&t.parentNode.removeChild(t),this.clearHighlighter(e),this.getSelectorElement(this.pdfViewer.element.id,e).childNodes),n=void 0,o=i.length;0<o;o--)(n=i[o-1]).parentNode.removeChild(n)},n.prototype.renderSelector=function(e,t,i,n){if(!i||n){var n=new j.Size,o=this.pdfViewer.selectedItems;if(this.clearSelectorLayer(e),this.pdfViewer.toolbarModule&&this.pdfViewer.toolbarModule.annotationToolbarModule&&(this.pdfViewer.toolbarModule.annotationToolbarModule.isRedactAnnotSelected=!1),o.wrapper){o.wrapper.children[1]instanceof j.TextElement&&(o.wrapper.children[1].isEJ2=!0,"FreeText"===o.annotations[0].shapeAnnotationType)&&(o.wrapper.children[1].isFreeText=!0),o.wrapper.measure(n);var a=this.pdfViewer.viewerBase.getZoomFactor(),r=(o.wrapper.arrange(o.wrapper.desiredSize),o.width=o.wrapper.actualSize.width,o.height=o.wrapper.actualSize.height,o.offsetX=o.wrapper.offsetX,o.offsetY=o.wrapper.offsetY,1===o.annotations.length&&(o.rotateAngle=o.annotations[0].rotateAngle,o.wrapper.rotateAngle=o.annotations[0].rotateAngle),void 0);if(o.formFields.length)for(var s=0;s<o.formFields.length;s++){var l=o.formFields[parseInt(s.toString(),10)];(r=this.getSelectorElement(this.pdfViewer.element.id,e))&&l.pageIndex===e&&this.pdfViewer.designerMode&&this.renderResizeHandle(l.wrapper.children[0],r,o.thumbsConstraints,a,void 0,void 0,void 0,!1,!0,null,null,t),this.pdfViewer.formDesignerModule&&l.formFieldAnnotationType&&(this.pdfViewer.viewerBase.isFormFieldSelect||this.pdfViewer.viewerBase.isFormFieldMouseDown||this.pdfViewer.viewerBase.isFormFieldMouseMove||(this.pdfViewer.viewerBase.isFormFieldSelect=!0,h={name:l.name,id:l.id,value:l.value,fontFamily:l.fontFamily,fontSize:l.fontSize,fontStyle:l.fontStyle,color:l.color,backgroundColor:l.backgroundColor,alignment:l.alignment,isReadonly:l.isReadonly,visibility:l.visibility,maxLength:l.maxLength,isRequired:l.isRequired,isPrint:l.isPrint,rotation:l.rotateAngle,tooltip:l.tooltip,options:l.optio