@syncfusion/ej2-react-image-editor
Version:
Essential JS 2 ImageEditor for React
10 lines • 933 kB
JavaScript
/*!
* filename: ej2-react-image-editor.min.js
* version : 33.1.44
* 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&&"object"==typeof module?module.exports=t(require("React"),require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionInputs"),require("SyncfusionNavigations"),require("SyncfusionButtons"),require("SyncfusionSplitbuttons"),require("SyncfusionReactBase")):"function"==typeof define&&define.amd?define(["React","SyncfusionBase","SyncfusionPopups","SyncfusionInputs","SyncfusionNavigations","SyncfusionButtons","SyncfusionSplitbuttons","SyncfusionReactBase"],t):"object"==typeof exports?exports.SyncfusionReactImageEditor=t(require("React"),require("SyncfusionBase"),require("SyncfusionPopups"),require("SyncfusionInputs"),require("SyncfusionNavigations"),require("SyncfusionButtons"),require("SyncfusionSplitbuttons"),require("SyncfusionReactBase")):e.SyncfusionReactImageEditor=t(e.React,e.SyncfusionBase,e.SyncfusionPopups,e.SyncfusionInputs,e.SyncfusionNavigations,e.SyncfusionButtons,e.SyncfusionSplitbuttons,e.SyncfusionReactBase)}(self,(e,t,o,i,r,a,n,s)=>(()=>{"use strict";var l={24:t=>{t.exports=e},766:e=>{e.exports=t},741:e=>{e.exports=a},323:e=>{e.exports=i},215:e=>{e.exports=r},197:e=>{e.exports=o},705:e=>{e.exports=s},295:e=>{e.exports=n}},p={};function h(e){var t=p[e];if(void 0!==t)return t.exports;var o=p[e]={exports:{}};return l[e](o,o.exports,h),o.exports}h.d=(e,t)=>{for(var o in t)h.o(t,o)&&!h.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},h.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),h.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var d={};return(()=>{h.r(d),h.d(d,{ArrowheadType:()=>p,Crop:()=>C,Direction:()=>o,Draw:()=>P,Export:()=>j,FileType:()=>t,Filter:()=>x,FinetuneSettings:()=>R,FontFamily:()=>X,FrameLineStyle:()=>u,FrameType:()=>c,FreehandDrawing:()=>w,ImageEditor:()=>Y,ImageEditorCommand:()=>n,ImageEditorComponent:()=>_,ImageFilterOption:()=>s,ImageFinetuneOption:()=>l,RedactType:()=>g,Selection:()=>O,SelectionSettings:()=>L,Shape:()=>S,ShapeType:()=>i,Theme:()=>a,ToolbarModule:()=>M,Transform:()=>T,UndoRedo:()=>k,UploadSettings:()=>z,ZoomSettings:()=>D,ZoomTrigger:()=>r});var e,t,o,i,r,a,n,s,l,p,c,u,g,v=h(24),f=h(766),C=function(){function e(e){this.croppedDegree=0,this.cropDestPoints={startX:0,startY:0,width:0,height:0},this.tempFlipPanPoint={x:0,y:0},this.isPreventScaling=!1,this.isInitCrop=!1,this.isTransformCrop=!1,this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("crop",this.cropping,this),this.parent.on("destroyed",this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off("crop",this.cropping),this.parent.off("destroyed",this.destroy)},e.prototype.cropping=function(e){switch(this.updateCropPvtVar(),e.prop){case"cropCircle":this.cropCircle(e.value.context,e.value.isSave,e.value.isFlip);break;case"setCurrSelPoints":this.setCurrSelPoints(e.value.isSetDimension);break;case"updateRotatePan":this.updateRotatePan();break;case"crop":this.crop(e.value.obj);break;case"calcRatio":this.calcRatio(e.value.obj,e.value.dimension);break;case"getCurrFlipState":this.getCurrFlipState(e.value.panObj);break;case"getPreviousCropCurrentObj":e.value.obj.prevObj=this.prevCropCurrObj;break;case"setPreviousCropCurrentObj":this.prevCropCurrObj=e.value.obj;break;case"setCropDestPoints":this.cropDestPoints=e.value.point;break;case"getTempFlipPanPoint":e.value.obj.point=this.tempFlipPanPoint;break;case"setTempFlipPanPoint":(0,f.isNullOrUndefined)(e.value.isAdd)?this.tempFlipPanPoint=e.value.point:(this.tempFlipPanPoint.x+=e.value.point.x,this.tempFlipPanPoint.y+=e.value.point.y);break;case"getPreventScaling":e.value.obj.bool=this.isPreventScaling;break;case"adjustStraightenForShapes":this.adjustStraightenForShapes(e.value.type,e.value.isInitialRotated);break;case"resizeWrapper":this.resizeWrapper();break;case"setTransformCrop":this.isTransformCrop=e.value.bool;break;case"setInitCrop":this.isInitCrop=e.value.bool;break;case"resetZoom":this.resetZoom();break;case"revertTransform":this.revertTransform(e.value.type,e.value.coll);break;case"reset":this.reset()}},e.prototype.getModuleName=function(){return"crop"},e.prototype.updateCropPvtVar=function(){var e=this.parent;e.lowerCanvas&&(this.lowerContext=e.lowerCanvas.getContext("2d")),e.upperCanvas&&(this.upperContext=e.upperCanvas.getContext("2d"))},e.prototype.reset=function(){this.prevCropCurrObj=null,this.croppedDegree=0,this.cropDestPoints={startX:0,startY:0,width:0,height:0},this.tempFlipPanPoint={x:0,y:0},this.isPreventScaling=!1,this.isInitCrop=!1,this.isTransformCrop=!1},e.prototype.cropImg=function(e){for(var t=this.parent,o=(0,f.isNullOrUndefined)(e),i=t.element.querySelector("#"+t.element.id+"_nonaspectratio"),r=t.activeObj.activePoint,a=t.img,n=!1,s=0,l=t.rotateFlipColl.length;s<l;s++){var p=t.rotateFlipColl[s];90!==p&&-90!==p||(n=!0)}if(t.notify("draw",{prop:"setImageEdited",onPropertyChange:!1}),(o||i)&&(this.croppedDegree=t.transform.degree),o&&0!==t.transform.degree||n){this.updateCropObj();var h={startX:a.destLeft,startY:a.destTop,width:a.destWidth,height:a.destHeight};t.notify("transform",{prop:"setCurrDestinationPoint",onPropertyChange:!1,value:{point:h}}),this.rotateCrop()}else if(o&&""!==t.transform.currFlipState){this.updateCropObj();h={startX:a.destLeft,startY:a.destTop,width:a.destWidth,height:a.destHeight};t.notify("transform",{prop:"setCurrDestinationPoint",onPropertyChange:!1,value:{point:h}}),this.flipCrop()}else{this.adjustStraightenForShapes("initial",!1),t.notify("draw",{prop:"setTempZoomFactor",onPropertyChange:!1,value:{tempZoomFactor:t.transform.zoomFactor}});var d=this.calcRatio();if(o||!e){this.updateCropObj(),t.notify("draw",{prop:"resetPanPoints",onPropertyChange:!1}),t.notify("shape",{prop:"updImgRatioForActObj",onPropertyChange:!1});h={startX:a.destLeft,startY:a.destTop,width:a.destWidth,height:a.destHeight};t.notify("transform",{prop:"setCurrDestinationPoint",onPropertyChange:!1,value:{point:h}}),t.currSelectionPoint=(0,f.extend)({},t.activeObj,{},!0),this.cropDestPoints={startX:a.destLeft,startY:a.destTop,width:a.destWidth,height:a.destHeight}}var c={width:0,height:0};t.notify("transform",{prop:"calcMaxDimension",onPropertyChange:!1,value:{width:r.width*d.width,height:r.height*d.height,obj:c,isImgShape:null}});var u=c;this.upperContext.clearRect(0,0,t.upperCanvas.width,t.upperCanvas.height),this.lowerContext.clearRect(0,0,t.lowerCanvas.width,t.lowerCanvas.height),t.img={srcLeft:r.startX*d.width-a.destLeft*d.width,srcTop:r.startY*d.height-a.destTop*d.height,srcWidth:r.width*d.width,srcHeight:r.height*d.height,destLeft:(t.lowerCanvas.clientWidth-u.width)/2,destTop:(t.lowerCanvas.clientHeight-u.height)/2,destWidth:u.width,destHeight:u.height};var g=this.lowerContext.filter;t.notify("draw",{prop:"drawImage",onPropertyChange:!1}),this.lowerContext.filter="none";var v=(0,f.extend)({},t.activeObj,{},!0);this.cropObjColl(),t.transform.straighten=0,t.activeObj=v,this.cropFreehandDrawColl(),t.shapeColl=[],t.notify("shape",{prop:"updateShapeColl",onPropertyChange:!1}),t.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),t.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.lowerContext}}),t.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.upperContext}}),t.currSelectionPoint&&"crop-circle"===t.currSelectionPoint.shape?this.cropCircle(this.lowerContext):t.isCircleCrop=!1,this.lowerContext.filter=g,t.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),t.currObjType.isCustomCrop=!1,t.pan(!1),t.transform.defaultZoomFactor=0}},e.prototype.adjustStraightenForShapes=function(e,t){for(var o=this.parent,i=o.img.destLeft+o.img.destWidth/2,r=o.img.destTop+o.img.destHeight/2,a=0,n=o.objColl;a<n.length;a++){var s=n[a];if(-1!==["rectangle","ellipse","text","image","redact"].indexOf(s.shape)&&(t||0!==s.rotatedAngle)){var l=s.activePoint,p=l.startX,h=l.startY,d=l.width,c=l.height,u="initial"===e?s.rotatedAngle:-s.rotatedAngle,g=p+d/2-i,v=h+c/2-r,f=Math.cos(u),C=Math.sin(u),b=f*g-C*v+i-p-d/2,m=C*g+f*v+r-h-c/2;s.activePoint.startX+=b,s.activePoint.startY+=m,s.activePoint.endX+=b,s.activePoint.endY+=m}}},e.prototype.updateCropObj=function(){this.parent.afterCropActions=[];var e={currObj:{}};this.parent.notify("filter",{prop:"getCurrentObj",onPropertyChange:!1,value:{object:e}});var t=e.currObj;t.straighten=this.parent.transform.straighten,this.parent.cropObj=(0,f.extend)({},t,{},!0)},e.prototype.rotateCrop=function(){var e=this.parent,t=this.getCurrFlipState(),o=e.activeObj.shape||"";e.notify("shape",{prop:"updImgRatioForActObj",onPropertyChange:!1}),e.currSelectionPoint=(0,f.extend)({},e.activeObj,{},!0),e.objColl.push(e.activeObj),e.activeObj=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0);var i=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),r=(0,f.extend)({},e.currSelectionPoint,{},!0),a={bool:null};e.notify("transform",{prop:"getPreventSelect",onPropertyChange:!1,value:{obj:a}}),e.notify("transform",{prop:"setPreventSelect",onPropertyChange:!1,value:{bool:!0}});var n=(0,f.extend)([],e.rotateFlipColl,[],!0);this.panToSelRangle(!0),i=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("draw",{prop:"drawObject",onPropertyChange:!1,value:{canvas:"duplicate",obj:i}}),e.objColl.pop(),e.notify("shape",{prop:"updImgRatioForActObj",onPropertyChange:!1}),e.objColl.push(e.activeObj);var s=e.transform.straighten;0!==s&&(e.transform.straighten=0,e.straightenBaseImageCanvas(),e.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),e.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),e.notify("draw",{prop:"render-image",value:{isMouseWheel:!1}})),this.resetZoom();var l=(0,f.extend)([],e.afterCropActions,[],!0);this.revertTransform("initial",n),0!==s&&(e.transform.straighten="horizontal"===t||"vertical"===t?-s:s,e.straightenBaseImageCanvas(),e.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),e.notify("draw",{prop:"render-image",value:{isMouseWheel:!1}}),e.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}})),i=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("draw",{prop:"drawObject",onPropertyChange:!1,value:{canvas:"duplicate",obj:i}}),e.objColl.pop(),e.transform.degree=0;var p={isIntersect:null};e.notify("draw",{prop:"updateImgCanvasPoints",onPropertyChange:!1}),e.notify("draw",{prop:"isLinesIntersect",onPropertyChange:!1,value:{obj:p}});for(var h=0;0!==s&&p.isIntersect&&50!==++h;)e.notify("transform",{prop:"zoomAction",onPropertyChange:!1,value:{zoomFactor:.025,zoomPoint:null},isResize:null}),e.notify("draw",{prop:"updateImgCanvasPoints",onPropertyChange:!1}),e.notify("draw",{prop:"isLinesIntersect",onPropertyChange:!1,value:{obj:p}});this.cropImg(!0),this.revertTransform("reverse",n),e.afterCropActions=l,e.currSelectionPoint=r,e.notify("transform",{prop:"setPreventSelect",onPropertyChange:!1,value:{bool:a.bool}}),e.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.lowerContext}}),e.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.upperContext}}),"crop-circle"===o&&this.cropCircle(this.lowerContext),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("draw",{prop:"resetPanPoints",onPropertyChange:!1})},e.prototype.revertTransform=function(e,t){var o=this.parent,i={isRotate:!1};if("initial"===e)for(var r=t.length-1;r>=0;r--){switch(n=t[r]){case 90:o.notify("transform",{prop:"rotate",value:{degree:-90,obj:i}});break;case-90:o.notify("transform",{prop:"rotate",value:{degree:90,obj:i}});break;default:o.notify("transform",{prop:"flipImage",value:{direction:o.toPascalCase(n.toString())}})}}else{this.updateFlipState();r=0;for(var a=t.length;r<a;r++){var n;switch(n=t[r]){case 90:o.notify("transform",{prop:"rotate",value:{degree:90,obj:i}});break;case-90:o.notify("transform",{prop:"rotate",value:{degree:-90,obj:i}});break;default:o.notify("transform",{prop:"flipImage",value:{direction:o.toPascalCase(n.toString())}})}}}},e.prototype.updateFlipState=function(){for(var e=this.parent,t=e.objColl,o=0,i=t.length;o<i;o++)t[o].shapeFlip="";var r=e.pointColl;for(o=0;o<e.freehandCounter;o++)r[o].shapeFlip=""},e.prototype.resetZoom=function(){var e=this.parent;if(e.transform.zoomFactor>0){var t=e.transform.zoomFactor,o=e.isUndoRedo;e.setProperties({zoomSettings:{zoomFactor:10*t}},!0),e.notify("transform",{prop:"setPreviousZoomValue",onPropertyChange:!1,value:{previousZoomValue:e.zoomSettings.zoomFactor}});for(var i=0;i<10*t;i++)e.isUndoRedo=!0,e.notify("transform",{prop:"zoomAction",onPropertyChange:!1,value:{zoomFactor:-.1,zoomPoint:null},isResize:null});e.isUndoRedo=o,e.notify("draw",{prop:"resetPanPoints",onPropertyChange:!1})}},e.prototype.flipCrop=function(){var e=this.parent;e.notify("transform",{prop:"setReverseFlip",onPropertyChange:!1,value:{isReverseFlip:!0}}),e.panPoint.totalPannedPoint.x+=this.tempFlipPanPoint.x,e.panPoint.totalPannedPoint.y+=this.tempFlipPanPoint.y;var t=e.transform.currFlipState,o={flipColl:null};e.notify("transform",{prop:"getFlipColl",onPropertyChange:!1,value:{obj:o}});var i=o.flipColl;if(e.notify("transform",{prop:"setFlipColl",onPropertyChange:!1,value:{flipColl:[]}}),e.notify("shape",{prop:"updImgRatioForActObj",onPropertyChange:!1}),e.objColl.push(e.activeObj),0===e.transform.degree){var r=-e.cropObj.totalPannedPoint.x,a=-e.cropObj.totalPannedPoint.y;e.img.destLeft+=r,e.img.destTop+=a,e.notify("transform",{prop:"drawPannImage",value:{point:{x:r,y:a}}}),e.activeObj=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("draw",{prop:"drawObject",onPropertyChange:!1,value:{canvas:"duplicate",obj:e.activeObj}}),e.objColl.pop(),e.notify("shape",{prop:"updImgRatioForActObj",onPropertyChange:!1}),e.objColl.push(e.activeObj)}this.resetZoom(),e.currSelectionPoint=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),this.lowerContext.clearRect(0,0,e.lowerCanvas.width,e.lowerCanvas.height),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height);var n=this.lowerContext.filter;e.notify("draw",{prop:"drawImage",onPropertyChange:!1}),this.updateFlipState(),e.notify("shape",{prop:"redrawObj",onPropertyChange:!1,value:{degree:this.getCurrFlipState()}}),e.notify("freehand-draw",{prop:"flipFHDColl",onPropertyChange:!1,value:{value:this.getCurrFlipState()}}),e.activeObj=(0,f.extend)({},e.objColl[e.objColl.length-1],{},!0),e.objColl.pop(),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("draw",{prop:"drawObject",onPropertyChange:!1,value:{canvas:"duplicate"}}),this.cropImg(!0),e.notify("transform",{prop:"setReverseRotate",onPropertyChange:!1,value:{bool:!0}}),this.lowerContext.setTransform(1,0,0,1,0,0),e.notify("draw",{prop:"setDestPoints",onPropertyChange:!1}),e.notify("draw",{prop:"currTransState",onPropertyChange:!1,value:{type:"initial",isPreventDestination:null,context:null,isPreventCircleCrop:null}}),e.notify("draw",{prop:"drawImage",onPropertyChange:!1}),this.lowerContext.filter=n,e.notify("draw",{prop:"setRotateZoom",onPropertyChange:!1,value:{isRotateZoom:!1}}),e.notify("draw",{prop:"currTransState",onPropertyChange:!1,value:{type:"reverse",isPreventDestination:null,context:null,isPreventCircleCrop:null}}),e.transform.currFlipState=t,e.notify("transform",{prop:"setFlipColl",onPropertyChange:!1,value:{flipColl:i}}),this.lowerContext.filter="none",this.updateFlipState(),e.notify("shape",{prop:"redrawObj",onPropertyChange:!1,value:{degree:this.getCurrFlipState()}}),e.notify("freehand-draw",{prop:"flipFHDColl",onPropertyChange:!1,value:{value:this.getCurrFlipState()}}),e.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),this.lowerContext.filter=n,(e.currSelectionPoint&&"crop-circle"===e.currSelectionPoint.shape||e.isCircleCrop)&&this.cropCircle(this.lowerContext),e.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),e.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.lowerContext}}),e.notify("draw",{prop:"clearOuterCanvas",onPropertyChange:!1,value:{context:this.upperContext}}),this.upperContext.clearRect(0,0,e.upperCanvas.width,e.upperCanvas.height),e.notify("transform",{prop:"setReverseFlip",onPropertyChange:!1,value:{isReverseFlip:!1}}),e.notify("draw",{prop:"resetPanPoints",onPropertyChange:!1}),this.tempFlipPanPoint={x:0,y:0}},e.prototype.cropObjColl=function(){var e,t,o,i=this.parent;if(i.objColl.length>0)for(var r=0,a=i.objColl.length;r<a;r++){e=(o=i.objColl[r]).activePoint;var n=i.activeObj.activePoint,s=n.startX,l=n.startY,p=n.width,h=n.height;t=o.shape,o.imageRatio={startX:(e.startX-s)/p,startY:(e.startY-l)/h,endX:(e.endX-s)/p,endY:(e.endY-l)/h,width:p/e.width,height:h/e.height};var d=void 0,c=void 0;switch(t){case"text":c=0===(d=0===o.shapeDegree?i.transform.degree:i.transform.degree-o.shapeDegree)||180===Math.abs(d)?e.width:e.height,o.textSettings.fontRatio=c/o.textSettings.fontSize;break;case"line":case"arrow":this.cropPointCollection(r),"arrow"===t&&i.notify("shape",{prop:"updateArrowRatio",onPropertyChange:!1,value:{obj:o}});break;case"path":this.cropPointCollection(r)}}},e.prototype.cropPointCollection=function(e){var t,o,i,r,a=this.parent,n=a.objColl[e].shape,s=a.activeObj.activePoint,l=a.img,p=l.destLeft,h=l.destTop,d=l.destWidth,c=l.destHeight;"path"===n?(t=s.startX,o=s.startY,i=s.width,r=s.height):(t=p,o=h,i=d,r=c);for(var u=a.objColl[e].pointColl,g=0,v=u.length;g<v;g++)u[g].ratioX=(u[g].x-t)/i,u[g].ratioY=(u[g].y-o)/r},e.prototype.cropFreehandDrawColl=function(){for(var e=this.parent,t=e.activeObj.activePoint,o=t.startX,i=t.startY,r=t.width,a=t.height,n=0;n<e.freehandCounter;n++){e.points=(0,f.extend)([],e.pointColl[n].points,[]),e.notify("freehand-draw",{prop:"setPointCounter",onPropertyChange:!1,value:{value:0}});for(var s=e.points.length,l=0;l<s;l++)e.points[l].ratioX=(e.points[l].x-o)/r,e.points[l].ratioY=(e.points[l].y-i)/a}e.notify("freehand-draw",{prop:"updateCropPtsForSel",onPropertyChange:!1})},e.prototype.resetAnnotations=function(){var e=this.parent;e.objColl=[],e.pointColl=[],e.freehandCounter=0,e.notify("freehand-draw",{prop:"resetStraightenPoint"})},e.prototype.setCurrSelPoints=function(e){var t=this.parent;t.allowDownScale=!1;var o=this.cropDestPoints,i=this.lowerContext.filter,r=t.isCropTab;t.img={srcLeft:0,srcTop:0,srcWidth:t.baseImgCanvas.width,srcHeight:t.baseImgCanvas.height,destLeft:o.startX,destTop:o.startY,destWidth:o.width,destHeight:o.height};var a=t.img,n=t.currSelectionPoint;this.lowerContext.clearRect(0,0,t.lowerCanvas.width,t.lowerCanvas.height),e&&t.notify("draw",{prop:"setDestPoints",onPropertyChange:!1}),t.notify("draw",{prop:"currTransState",onPropertyChange:!1,value:{type:"initial",isPreventDestination:null,context:null,isPreventCircleCrop:null}}),0===this.croppedDegree&&0===t.transform.degree&&n&&"crop-circle"!==n.shape&&"crop-square"!==n.shape&&(a.destLeft=o.startX,a.destTop=o.startY,a.destWidth=o.width,a.destHeight=o.height),0===t.transform.degree&&(a.destLeft+=t.panPoint.totalPannedInternalPoint.x,a.destTop+=t.panPoint.totalPannedInternalPoint.y),t.notify("draw",{prop:"drawImage",onPropertyChange:!1}),this.lowerContext.filter=i,t.notify("draw",{prop:"currTransState",onPropertyChange:!1,value:{type:"reverse",isPreventDestination:null,context:null,isPreventCircleCrop:!0}});var s=(0,f.extend)([],t.objColl,null,!0),l=(0,f.extend)([],t.pointColl,null,!0),p={straightenPoint:null};if(t.notify("freehand-draw",{prop:"getStraightenPoint",onPropertyChange:!1,value:{obj:p}}),this.resetAnnotations(),(0,f.isNullOrUndefined)(t.activeObj.shape)&&t.cropObj.activeObj.shape&&(t.activeObj=(0,f.extend)({},t.cropObj.activeObj,null,!0)),this.panToSelRangle(),t.isCropTab=r,t.objColl=s,t.pointColl=l,t.freehandCounter=t.pointColl.length,p.straightenPoint.x&&p.straightenPoint.y&&t.notify("freehand-draw",{prop:"setStraightenPoint",onPropertyChange:!1,value:{x:p.straightenPoint.x,y:p.straightenPoint.y,ratioX:p.straightenPoint.ratioX,ratioY:p.straightenPoint.ratioY}}),t.cropObj.activeObj.shape){var h={startX:a.destLeft,startY:a.destTop,width:a.destWidth,height:a.destHeight};if(n&&n.activePoint){var d=n.activePoint,c=d.startX,u=d.startY,g=d.width,v=d.height;a.destLeft=c,a.destTop=u,a.destWidth=g,a.destHeight=v}t.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),a.destLeft=h.startX,a.destTop=h.startY,a.destWidth=h.width,a.destHeight=h.height,t.notify("freehand-draw",{prop:"updateFHDColl",onPropertyChange:!1}),s=(0,f.extend)([],t.objColl,null,!0),l=(0,f.extend)([],t.pointColl,null,!0),t.notify("freehand-draw",{prop:"getStraightenPoint",onPropertyChange:!1,value:{obj:p}}),this.resetAnnotations();var C={selPointColl:null};t.notify("freehand-draw",{prop:"getSelPointColl",onPropertyChange:!1,value:{obj:C}});var b=C.selPointColl;t.notify("freehand-draw",{prop:"setSelPointColl",onPropertyChange:!1,value:{obj:{selPointColl:[]}}}),t.cropObj.filter=this.lowerContext.filter;var m=(0,f.extend)({},t.currSelectionPoint,null,!0);t.notify("draw",{prop:"setCurrentObj",onPropertyChange:!1,value:{obj:null}}),t.activeObj=(0,f.extend)({},m,null,!0);var y=(0,f.extend)({},t.activeObj,null,!0);if(t.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),t.currSelectionPoint=null,t.isCircleCrop=!1,0!==t.transform.degree&&((0,f.isNullOrUndefined)(t.activeObj.shape)&&t.cropObj.activeObj.shape&&(t.activeObj=(0,f.extend)({},t.cropObj.activeObj,null,!0)),t.notify("transform",{prop:"drawPannedImage",value:{xDiff:0,yDiff:0}}),t.panPoint.currentPannedPoint={x:0,y:0}),t.objColl=s,t.pointColl=l,t.freehandCounter=t.pointColl.length,p.straightenPoint.x&&p.straightenPoint.y&&t.notify("freehand-draw",{prop:"setStraightenPoint",onPropertyChange:!1,value:{x:p.straightenPoint.x,y:p.straightenPoint.y,ratioX:p.straightenPoint.ratioX,ratioY:p.straightenPoint.ratioY}}),t.notify("freehand-draw",{prop:"setSelPointColl",onPropertyChange:!1,value:{obj:{selPointColl:b}}}),t.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"iterate",pen:"iterate",isPreventApply:null}}),this.adjustStraightenForShapes("reverse",!1),t.notify("freehand-draw",{prop:"updateFHDColl",onPropertyChange:!1,value:{isPreventApply:!0}}),t.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"zoom",pen:"zoom",isPreventApply:null}}),0===t.transform.degree?t.notify("transform",{prop:"drawPannImage",onPropertyChange:!1,value:{point:{x:0,y:0}}}):((0,f.isNullOrUndefined)(t.activeObj.shape)&&t.cropObj.activeObj.shape&&(t.activeObj=(0,f.extend)({},t.cropObj.activeObj,null,!0)),t.notify("transform",{prop:"drawPannedImage",value:{xDiff:0,yDiff:0}}),t.panPoint.currentPannedPoint={x:0,y:0}),t.activeObj=y,t.notify("draw",{prop:"drawObject",onPropertyChange:!1,value:{canvas:"duplicate"}}),t.notify("transform",{prop:"setTempPanMove",onPropertyChange:!1,value:{point:null}}),this.isInitCrop||0!==t.transform.degree||""===t.cropObj.currFlipState||0===t.cropObj.cropZoom)this.isInitCrop=!1;else{this.isInitCrop=!0;var P={activeObj:null};t.notify("draw",{prop:"getStraightenActObj",onPropertyChange:!1,value:{obj:P}}),t.notify("draw",{prop:"performCancel",value:{isContextualToolbar:null}}),t.notify("draw",{prop:"setStraightenActObj",onPropertyChange:!1,value:{activeObj:P.activeObj}}),t.notify("toolbar",{prop:"refresh-toolbar",onPropertyChange:!1,value:{type:"croptransform",isApplyBtn:!1,isCropping:null,isZooming:null,cType:null}})}}else{this.adjustStraightenForShapes("reverse",!0),t.notify("freehand-draw",{prop:"updateFHDColl",onPropertyChange:!1,value:{isPreventApply:!0}});var j=this.lowerContext.filter;this.lowerContext.filter="none",t.notify("shape",{prop:"drawAnnotations",onPropertyChange:!1,value:{ctx:this.lowerContext,shape:"iterate",pen:"iterate",isPreventApply:null}}),this.lowerContext.filter=j,t.currSelectionPoint=null}document.querySelector(".e-ie-straighten-value-span")&&(document.querySelector(".e-ie-straighten-value-span").innerHTML=t.transform.straighten.toString()+"°")},e.prototype.panToSelRangle=function(e){var t=this.parent,o=t.cropObj.totalPannedClientPoint,i=0!==t.transform.degree?e?-o.x:o.x:0,r=0!==t.transform.degree?e?-o.y:o.y:0;0!==t.transform.degree&&(t.panPoint.currentPannedPoint={x:i,y:r},t.notify("transform",{prop:"drawPannedImage",value:{xDiff:i,yDiff:r}}),t.panPoint.currentPannedPoint={x:0,y:0})},e.prototype.cropCircle=function(e,t,o){var i=this.parent,r=i.img,a=r.destLeft,n=r.destTop,s=r.destWidth,l=r.destHeight;o&&""!==i.transform.currFlipState&&i.notify("draw",{prop:"setTransform",onPropertyChange:!1,value:{context:e,value:i.transform.currFlipState,isReverse:null}});var p=e.filter;e.filter="none",e.globalCompositeOperation="destination-in",e.beginPath();var h=(0,f.isNullOrUndefined)(t)?a+s/2:e.canvas.width/2,d=(0,f.isNullOrUndefined)(t)?n+l/2:e.canvas.height/2,c=t?e.canvas.width/2:s/2;e.arc(h,d,c,0,2*Math.PI),e.closePath(),e.fill(),e.restore(),e.globalCompositeOperation="source-over",i.currObjType.isActiveObj=i.isCircleCrop=!0,e.filter=p,o&&""!==i.transform.currFlipState&&i.notify("draw",{prop:"setTransform",onPropertyChange:!1,value:{context:e,value:i.transform.currFlipState,isReverse:null}})},e.prototype.getCurrCropState=function(){var e=this.parent,t="",o={flipColl:null};return e.notify("transform",{prop:"getFlipColl",onPropertyChange:!1,value:{obj:o}}),t=this.getCurrFlipState(),-90!==e.transform.degree&&-270!==e.transform.degree||("horizontal"===t?t="vertical":"vertical"===t&&(t="horizontal")),""===t&&(t=o.flipColl.length>1?this.getCurrFlipState():e.transform.currFlipState),t},e.prototype.updateRotatePan=function(){var e=this.parent;if(!(0,f.isNullOrUndefined)(e.panPoint.currentPannedPoint)){var t="",o=e.transform.degree,i=e.panPoint.currentPannedPoint,r=i.x,a=i.y;t=e.rotateFlipColl.length>0&&"number"==typeof e.rotateFlipColl[0]&&o<0?this.getCurrCropState():this.getCurrFlipState(),o%90==0&&o%180!=0?90===o||-90===o&&("horizontal"===t||"vertical"===t)||-270===o&&(""===t||"verticalHorizontal"===t||"horizontalVertical"===t)?("horizontal"===t||""===t?e.img.destLeft+=a:e.img.destLeft-=a,""===t||"vertical"===t?e.img.destTop-=r:e.img.destTop+=r):270!==o&&(-270!==o||"horizontal"!==t&&"vertical"!==t)&&(-90!==o||""!==t&&"verticalHorizontal"!==t&&"horizontalVertical"!==t)||(""===t||"horizontal"===t?e.img.destLeft-=a:e.img.destLeft+=a,""===t||"vertical"===t?e.img.destTop+=r:e.img.destTop-=r):180!==o&&-180!==o||(""===t||"vertical"===t?e.img.destLeft-=r:e.img.destLeft+=r,""===t||"horizontal"===t?e.img.destTop-=a:e.img.destTop+=a)}},e.prototype.crop=function(e){var t=this.parent,o=t.activeObj.activePoint,i=o.startX,r=o.startY,a=o.endX,n=o.endY;if(!t.disabled&&t.isImageLoaded){var s={isCropToolbar:t.isCropToolbar};t.currObjType.isUndoAction&&!s.isCropToolbar&&t.notify("undo-redo",{prop:"refreshUrc",value:{bool:null}});var l={cancel:!1,startPoint:{x:i,y:r},endPoint:{x:a,y:n},preventScaling:!1};s.isCropToolbar||(t.trigger("cropping",l),t.editCompleteArgs=l),this.cropEvent(l,e,s)}},e.prototype.cropEvent=function(e,t,o){var i,r=this.parent;if(!e.cancel&&(i=r.activeObj.shape?r.activeObj.shape.split("-"):[],!r.disabled&&r.activeObj.horTopLine&&(r.currObjType.isCustomCrop||i.length>0&&"crop"===i[0]))){t.isCrop=!0;var a=(0,f.extend)({},r.cropObj,{},!0),n=(0,f.extend)({},this.prevCropCurrObj,{},!0);e.preventScaling?this.isPreventScaling=!0:this.isPreventScaling=!1,this.cropImg(),this.isPreventScaling&&(r.aspectWidth=r.img.destWidth,r.aspectHeight=r.img.destHeight),r.notify("freehand-draw",{prop:"resetStraightenPoint"}),r.isCropTab=!1,r.transform.zoomFactor=0,r.setProperties({zoomSettings:{zoomFactor:1}},!0),r.notify("transform",{prop:"setPreviousZoomValue",onPropertyChange:!1,value:{previousZoomValue:r.zoomSettings.zoomFactor}}),f.Browser.isDevice||this.updateUndoRedoColl(n,a,o),r.notify("transform",{prop:"setCropDimension",onPropertyChange:!1,value:{width:r.cropObj.destPoints.width,height:r.cropObj.destPoints.height}});var s=r.element.querySelector("#"+r.element.id+"_aspectratio"),l=r.element.querySelector("#"+r.element.id+"_nonaspectratio");r.notify("draw",{prop:"render-image",value:{isMouseWheel:!1}}),!o.isCropToolbar&&(0,f.isNullOrUndefined)(s)&&(0,f.isNullOrUndefined)(l)&&r.notify("toolbar",{prop:"refresh-toolbar",onPropertyChange:!1,value:{type:"main",isApplyBtn:!1,isCropping:!1,isZooming:null,cType:null}}),this.resizeWrapper(),f.Browser.isDevice&&this.updateUndoRedoColl(n,a,o)}},e.prototype.updateUndoRedoColl=function(e,t,o){var i=this.parent,r={prevCurrSelectionPoint:i.prevCurrSelectionPoint};e.currSelectionPoint=(0,f.extend)({},r.prevCurrSelectionPoint,{},!0),i.notify("undo-redo",{prop:"updateUndoRedoColl",onPropertyChange:!1,value:{operation:"crop",previousObj:e,previousObjColl:e.objColl,previousPointColl:e.pointColl,previousSelPointColl:e.selPointColl,previousCropObj:t,previousText:null,currentText:null,previousFilter:null,isCircleCrop:i.isCircleCrop}}),o.isCropToolbar||i.notify("undo-redo",{prop:"updateCurrUrc",value:{type:"ok"}})},e.prototype.resizeWrapper=function(){var e=this.parent;if(f.Browser.isDevice){var t=e.element,o=t.querySelector("#"+t.id+"_contextualToolbarArea");o&&""===o.style.position&&!this.isTransformCrop&&(o.style.position="absolute",e.isStraightening=!1,e.update(),e.notify("filter",{prop:"setAdjustmentValue",value:{adjustmentValue:e.canvasFilter}}))}},e.prototype.calcRatio=function(e,t){var o=this.parent,i=o.transform.degree,r=o.img,a=r.destWidth,n=r.destHeight,s=t||o.baseImgCanvas,l=s.width,p=s.height,h=0===i||i%180==0?l/a:p/a,d=0===i||i%180==0?p/n:l/n;return e&&(e.width=h,e.height=d),{width:h,height:d}},e.prototype.getCurrFlipState=function(e){var t=this.parent,o={panRegion:""},i={collection:t.rotateFlipColl};t.notify("shape",{prop:"alignRotateFlipColl",onPropertyChange:!1,value:{collection:t.rotateFlipColl,isRotateFlipCollection:!0,obj:i}}),t.rotateFlipColl=i.collection;for(var r=0,a=t.rotateFlipColl.length;r<a;r++)t.notify("transform",{prop:"setCurrPanRegion",onPropertyChange:!1,value:{region:o.panRegion,type:t.rotateFlipColl[r],obj:o}});return e&&(e.panRegion=o.panRegion),o.panRegion},e}(),b=h(197),m=function(e,t,o,i){return new(o||(o=Promise))(function(r,a){function n(e){try{l(i.next(e))}catch(e){a(e)}}function s(e){try{l(i.throw(e))}catch(e){a(e)}}function l(e){e.done?r(e.value):new o(function(t){t(e.value)}).then(n,s)}l((i=i.apply(e,t||[])).next())})},y=function(e,t){var o,i,r,a,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(o)throw new TypeError("Generator is already executing.");for(;n;)try{if(o=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(!(r=n.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){n=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(6===a[0]&&n.label<r[1]){n.label=r[1],r=a;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(a);break}r[2]&&n.ops.pop(),n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e],i=0}finally{o=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},P=function(){function e(e){this.isInitialLoading=!1,this.fileName="",this.isErrorImage=!1,this.isShapeTextInserted=!1,this.isRotateZoom=!1,this.tempStrokeSettings={strokeColor:"#fff",fillColor:"",strokeWidth:null,outlineColor:"",radius:null,outlineWidth:null},this.tempTextSettings={text:"Enter Text",fontFamily:"",fontSize:null,fontRatio:null,bold:!1,italic:!1,underline:!1,strikethrough:!1},this.tempAdjValue="",this.tempFilter="",this.tempUndoRedoStep=0,this.tempFreehandCounter=0,this.tempCurrFhdIndex=0,this.tempZoomFactor=null,this.isCancelAction=!1,this.rotatedFlipCropSel=!1,this.zoomCrop={width:0,height:0},this.isImageEdited=!1,this.isFileChanged=!1,this.isNewPath=!1,this.isResizeSelect=!1,this.arrowDimension={bar:{width:10,height:32,ratioX:null,ratioY:null},arrow:{width:24,height:24,ratioX:null,ratioY:null},arrowSolid:{width:32,height:32,ratioX:null,ratioY:null},circle:{width:10,height:10,ratioX:null,ratioY:null},square:{width:20,height:20,ratioX:null,ratioY:null}},this.origDim={width:0,height:0},this.isImageApply=!1,this.imgCanvasPoints=[],this.isCropSelect=!1,this.isDownScale=!1,this.preventStraightening=!1,this.tempObjColl=[],this.tempPointColl={},this.imageBackgroundColor="",this.allowRedactStraighten=!0,this.isNullExtension=!0,this.isRedactStraighten=!1,this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.parent.isDestroyed||this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("draw",this.draw,this),this.parent.on("destroyed",this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off("draw",this.draw),this.parent.off("destroyed",this.destroy)},e.prototype.draw=function(e){switch(this.updatePrivateVariables(),e.prop){case"drawObject":this.drawObject(e.value.canvas,e.value.obj,e.value.isCropRatio,e.value.points,e.value.isPreventDrag,e.value.saveContext,e.value.isPreventSelection);break;case"updateActiveObject":this.updateActiveObject(e.value.actPoint,e.value.obj,e.value.isMouseMove,e.value.x,e.value.y);break;case"clearOuterCanvas":this.clearOuterCanvas(e.value.context);break;case"setDestPoints":this.setDestPoints();break;case"updateCurrTransState":this.updateCurrTransState(e.value.type,e.value.isPreventDestination,e.value.isRotatePan);break;case"currTransState":this.currTransState(e.value.type,e.value.isPreventDestination,e.value.context,e.value.isPreventCircleCrop);break;case"setTransform":this.setTransform(e.value.context,e.value.value,e.value.isReverse);break;case"render-image":this.renderImage(e.value.isMouseWheel,e.value.isPreventClearRect,e.value.isFrame,e.value.isStraighten);break;case"draw-image-to-canvas":this.drawImgToCanvas(e.value.dimension);break;case"update-canvas":this.updateCanvas();break;case"performCancel":this.performCancel(e.value.isContextualToolbar,e.value.isUndoRedo,e.value.isFinalCancel);break;case"updateFlipPan":this.updateFlipPan(e.value.tempSelectionObj);break;case"select":this.select(e.value.type,e.value.startX,e.value.startY,e.value.width,e.value.height);break;case"callUpdateCurrTransState":this.callUpdateCurrTransState();break;case"resetPanPoints":this.resetPanPoints();break;case"setClientTransDim":this.setClientTransDim(e.value.isPreventDimension);break;case"redrawImgWithObj":this.redrawImgWithObj();break;case"setCurrentObj":this.setCurrentObj(e.value.obj,e.value.isUndoRedo,e.value.isCircleCrop);break;case"performPointZoom":this.performPointZoom(e.value.x,e.value.y,e.value.type,e.value.isResize);break;case"open":this.open(e.value.data);break;case"isInitialLoading":this.isInitialLoading=e.value.isInitialLoading;break;case"isInitialLoaded":this.getInitialLoaded(e.value.object);break;case"fileSelect":this.fileSelect(e.value.inputElement,e.value.args);break;case"getFileName":e.value.obj.fileName=this.fileName,e.value.obj.fileType=this.fileType;break;case"getErrorImage":e.value.obj.isErrorImage=this.isErrorImage;break;case"getInitialZoomValue":e.value.obj.initialZoomValue=this.initZoomValue;break;case"setShapeTextInsert":this.isShapeTextInserted=e.value.bool;break;case"resetCurrentSelectionPoint":this.currSelPoint=null;break;case"setRotateZoom":this.isRotateZoom=e.value.isRotateZoom;break;case"setTempStrokeSettings":this.tempStrokeSettings=e.value.tempStrokeSettings;break;case"setTempTextSettings":this.tempTextSettings=e.value.tempTextSettings;break;case"setTempAdjustmentValue":this.tempAdjValue=e.value.tempAdjustmentValue;break;case"getTempAdjustmentValue":e.value.obj.value=this.tempAdjValue;break;case"setTempFilter":this.tempFilter=e.value.tempFilter;break;case"setTempUndoRedoStep":this.tempUndoRedoStep=e.value.tempUndoRedoStep;break;case"setTempFreehandCounter":this.tempFreehandCounter=e.value.tempFreehandCounter;break;case"setTempCurrentFreehandDrawIndex":this.tempCurrFhdIndex=e.value.tempCurrentFreehandDrawIndex;break;case"setTempZoomFactor":this.tempZoomFactor=e.value.tempZoomFactor;break;case"setCancelAction":this.isCancelAction=e.value.bool;break;case"getRotatedFlipCropSelection":e.value.bool.isSelected=this.rotatedFlipCropSel;break;case"getPrevActObj":e.value.obj.prevActObj=this.prevActObj;break;case"setPrevActObj":this.prevActObj=e.value.prevActObj;break;case"setZoomCropWidth":this.zoomCrop.width=e.value.width,this.zoomCrop.height=e.value.height;break;case"setImageEdited":this.isImageEdited=!0;break;case"reset":this.reset();break;case"setNewPath":this.isNewPath=e.value.bool;break;case"getNewPath":e.value.obj.isNewPath=this.isNewPath;break;case"getArrowDimension":e.value.obj.arrowDimension=(0,f.extend)({},this.arrowDimension,{},!0);break;case"setArrowDimension":this.arrowDimension=e.value.arrowDimension;break;case"moveToSelectionRange":this.moveToSelectionRange(e.value.type,e.value.activeObj);break;case"setResizeSelect":this.isResizeSelect=e.value.bool;break;case"applyFrame":this.applyFrame(e.value.ctx,e.value.frame,e.value.preventImg);break;case"drawImage":this.drawImage();break;case"downScaleImgCanvas":this.downScaleImgCanvas(e.value.ctx,e.value.isImgAnnotation,e.value.isHFlip,e.value.isVFlip);break;case"downScale":this.downScale(e.value.canvas,e.value.width,e.value.height);break;case"resetFrameZoom":this.resetFrameZoom(e.value.isOk);break;case"triggerFrameChange":e.value.obj.frameChangeEventArgs=this.triggerFrameChange(e.value.prevFrameSettings);break;case"setImageApply":this.isImageApply=e.value.bool;break;case"zoomToSel":this.zoomToSel(e.value.activeObj,e.value.isToolbar);break;case"getStraightenActObj":e.value.obj.activeObj=this.straightenActObj;break;case"setStraightenActObj":this.straightenActObj=e.value.activeObj;break;case"updateImgCanvasPoints":this.updateImgCanvasPoints();break;case"isLinesIntersect":e.value.obj.isIntersect=this.isLinesIntersect(e.value.obj);break;case"getImageCanvasPoints":e.value.obj.points=this.imgCanvasPoints;break;case"setDestForStraighten":this.setDestForStraighten();break;case"setTempDestForStraighten":this.tempStraightenDestPoints=(0,f.extend)({},this.straightenDestPoints,{},!0);break;case"getStraightenInitZoom":e.value.obj.zoomFactor=this.straightenInitZoom;break;case"setStraightenInitZoom":this.straightenInitZoom=e.value.zoomFactor;break;case"isPointsInsideImg":e.value.obj.bool="inside"!==this.checkPointPosition(e.value.x,e.value.y,this.imgCanvasPoints[0].x,this.imgCanvasPoints[0].y,this.imgCanvasPoints[1].x,this.imgCanvasPoints[1].y,this.imgCanvasPoints[2].x,this.imgCanvasPoints[2].y,this.imgCanvasPoints[3].x,this.imgCanvasPoints[3].y);break;case"setIsCropSelect":this.isCropSelect=e.value.bool;break;case"updateCropSelection":this.updateCropSelection();break;case"updateCropSelObj":this.updateCropSelObj();break;case"redrawDownScale":this.redrawDownScale();break;case"updateFinetune":this.updateFinetune();break;case"isSelOutsideImg":e.value.obj.bool=this.isSelOutsideImg();break;case"resetStraightenDestPoints":this.straightenDestPoints=null;break;case"checkPointPosition":e.value.obj.position=this.checkPointPosition(e.value.obj.x,e.value.obj.y,e.value.obj.x1,e.value.obj.y1,e.value.obj.x2,e.value.obj.y2,e.value.obj.x3,e.value.obj.y3,e.value.obj.x4,e.value.obj.y4);break;case"updateTempObjColl":this.tempObjColl=(0,f.extend)([],this.parent.objColl,[],!0);break;case"resetTempObjColl":this.tempObjColl=null;break;case"updateTempPointColl":this.tempPointColl=(0,f.extend)({},this.parent.pointColl,{},!0);break;case"resetTempPointColl":this.tempPointColl={};break;case"showDialogPopup":this.showDialogPopup();break;case"imageBackgroundColor":this.imageBackgroundColor=e.value.color;break;case"getImageBackgroundColor":e.value.obj.color=this.imageBackgroundColor;break;case"setTempStrokeWidth":this.tempStrokeWidth=e.value.strokeWidth;break;case"setNullExtension":this.isNullExtension=e.value.extension;break;case"setRedactStraighten":this.isRedactStraighten=e.value.bool}},e.prototype.getModuleName=function(){return"draw"},e.prototype.updatePrivateVariables=function(){var e=this.parent;e.lowerCanvas&&(this.lowerContext=e.lowerCanvas.getContext("2d")),e.upperCanvas&&(this.upperContext=e.upperCanvas.getContext("2d")),(0,f.isNullOrUndefined)(this.tempZoomFactor)&&(this.tempZoomFactor=e.transform.zoomFactor),""===this.tempTextSettings.fontFamily&&(this.tempTextSettings.fontFamily=e.fontFamily.default)},e.prototype.reset=function(){this.isInitialLoading=this.isErrorImage=this.isNewPath=this.isResizeSelect=!1,this.isShapeTextInserted=!1,this.isImageApply=!1,this.isNullExtension=!0,this.initZoomValue=null,this.tempFilter="",this.origDim={width:0,height:0},this.currSelPoint=null,this.isRotateZoom=!1,this.tempAdjValue="",this.tempStrokeSettings={strokeColor:"#fff",fillColor:"",strokeWidth:null,radius:null,outlineColor:"",outlineWidth:null},this.tempTextSettings={text:"Enter Text",fontFamily:this.parent.fontFamily.default,fontSize:null,fontRatio:null,bold:!1,italic:!1,underline:!1,strikethrough:!1},this.tempUndoRedoStep=this.tempFreehandCounter=this.tempCurrFhdIndex=0,this.tempZoomFactor=null,this.isCancelAction=!1,this.rotatedFlipCropSel=!1,this.prevActObj=null,this.tempStraightenDestPoints=null,this.arrowDimension={bar:{width:10,height:32,ratioX:null,ratioY:null},arrow:{width:24,height:24,ratioX:null,ratioY:null},arrowSolid:{width:32,height:32,ratioX:null,ratioY:null},circle:{width:10,height:10,ratioX:null,ratioY:null},square:{width:20,height:20,ratioX:null,ratioY:null}},this.straightenActObj=null,this.imgCanvasPoints=[],this.straightenInitZoom=null,this.allowRedactStraighten=!0,this.tempObjColl=[],this.tempPointColl={},this.imageBackgroundColor="",this.tempStrokeWidth=null,this.straightenDestPoints=null,this.isCropSelect=this.isDownScale=this.preventStraightening=!1,this.isRedactStraighten=!1},e.prototype.redrawDownScale=function(){var e=this.parent;if(e.transform.zoomFactor&&e.transform.zoomFactor<0){var t=(0,f.extend)({},e.activeObj,{},!0);e.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),this.isDownScale=!0,this.renderImage(),this.isDownScale=!1,t.shape&&this.drawObject("duplicate",t)}},e.prototype.updateFinetune=function(){var e=this.parent;if(e.transform.zoomFactor&&e.transform.zoomFactor<0){var t=this.lowerContext.filter;this.lowerContext.filter="none",e.notify("draw",{prop:"redrawDownScale"});var o=e.inMemoryCanvas.getContext("2d"),i=this.lowerContext,r=i.getImageData(0,0,i.canvas.width,i.canvas.height);e.inMemoryCanvas.width=r.width,e.inMemoryCanvas.height=r.height,o.putImageData(r,0,0),this.lowerContext.filter=t,e.notify("draw",{prop:"redrawDownScale"})}},e.prototype.drawImage=function(){this.applyFrame(this.lowerContext,this.parent.frameObj.type)},e.prototype.drawObject=function(e,t,o,i,r,a,n){var s,l=this.parent,p=l.activeObj,h=l.activeObj.activePoint;(this.upperContext.clearRect(0,0,l.upperCanvas.width,l.upperCanvas.height),"original"===(e=e.toLowerCase())?s=this.lowerContext:"duplicate"===e?s=this.upperContext:a&&(s=a),!r&&p.shape&&this.setDragLimit(),l.currObjType.shape)&&("crop"===l.currObjType.shape.split("-")[0].toLowerCase()&&o&&this.drawCropRatio());if(p=l.activeObj,h=l.activeObj.activePoint,(0,f.isNullOrUndefined)(p.strokeSettings)){var d={strokeSettings:{}};l.notify("shape",{prop:"getStrokeSettings",onPropertyChange:!1,value:{obj:d}}),p.strokeSettings=d.strokeSettings}if((0,f.isNullOrUndefined)(p.strokeSettings.strokeWidth)&&(p.strokeSettings.strokeWidth=2),t&&(l.activeObj=(0,f.extend)({},t,{},!0)),i&&i.startX&&i.startY&&i.endX&&i.endY&&i.width&&i.height&&(h.startX=i.startX,h.startY=i.startY,h.endX=i.endX,h.endY=i.endY,h.width=i.width,h.height=i.height),this.updateActiveObject(),p=l.activeObj,h=l.activeObj.activePoint,!(0,f.isNullOrUndefined)(h.startX)||!(0,f.isNullOrUndefined)(h.startY)){if(l.currObjType.isText){var c={keyHistory:""};l.notify("shape",{prop:"getKeyHistory",onPropertyChange:!1,value:{obj:c}}),p.keyHistory=c.keyHistory}var u=!1;if("original"!==e){p.shape&&"crop"===p.shape.split("-")[0]&&(u=!0),u&&(i&&i.startX&&i.startY&&i.endX&&i.endY&&i.width&&i.height?(h.startX=i.startX,h.startY=i.startY,h.endX=i.endX,h.endY=i.endY,h.width=i.width,h.height=i.height):h=p.activePoint,this.upperContext.fillStyle="rgb(0, 0, 0, 0.25)",this.upperContext.fillRect(0,0,l.lowerCanvas.width,l.lowerCanvas.height),this.upperContext.clearRect(h.startX,h.startY,h.width,h.height)),!(0,f.isNullOrUndefined)(n)||s!==this.lowerContext&&s!==this.upperContext||(this.rotateContext("initial",s),this.drawOuterSelection(s),this.rotateContext("reverse",s))}l.currObjType.isActiveObj=!0;var g={keyHistory:""};l.notify("shape",{prop:"getKeyHistory",onPropertyChange:!1,value:{obj:g}}),t?this.drawShapeObj(e,t.shape,a,n):""!==g.keyHistory&&l.currObjType.isText?this.drawShapeObj(e,"text",a,n):p.shape?this.drawShapeObj(e,p.shape,a,n):this.drawShapeObj(e,void 0,a,n),"duplicate"===e&&u&&"crop-circle"!==p.shape&&"none"!==l.frameObj.type&&(this.applyFrame(this.upperContext,l.frameObj.type),this.drawCornerCircles(this.upperContext))}},e.prototype.rotateContext=function(e,t){var o=this.parent,i=o.activeObj,r=i.shape,a=i.rotatedAngle,n=o.img,s=n.destLeft,l=n.destTop,p=n.destWidth,h=n.destHeight,d=o.activeObj.activePoint,c=d.startX,u=d.startY,g=d.width,v=d.height;if("line"!==r&&"arrow"!==r){var f,C,b="initial"===e?a:-a;0!==o.transform.straighten||o.isCropTab?(f=s+p/2,C=l+h/2):(f=c+g/2,C=u+v/2),t.translate(f,C),t.rotate(b),t.translate(-f,-C)}},e.prototype.setDragLimit=function(){var e=this.parent,t=e.activeObj.activePoint,o=e.activeObj,i=o.shape,r=o.rotatedAngle;if(t&&"image"!==i&&"line"!==i&&0===r&&e.activeObj.preventShapeDragOut){var a=e.img,n=a.destLeft,s=a.destTop,l=a.destWidth,p=a.destHeight;t.startX<n?(t.startX=n,t.endX=Math.min(t.startX+t.width,n+l)):t.endX>n+l&&(t.endX=n+l,t.startX=Math.max(t.endX-t.width,n)),t.startY<s?t.startY=s:t.endY>s+p&&(t.endY=s+p,t.startY=Math.max(t.endY-t.height,s)),e.activeObj=this.updateWidthHeight(e.activeObj)}},e.prototype.drawCropRatio=function(){var e,t,o,i,r=this.parent,a=r.activeObj.activePoint,n=r.img,s=n.destLeft,l=n.destTop,p=n.destWidth,h=n.destHeight;if(r.transform.zoomFactor>0&&this.currSelPoint){var d=(0,f.extend)({},r.activeObj,{},!0);this.drawCustomSelection("crop-custom",null,null,null,null),0!==r.transform.straighten&&(a=r.activeObj.activePoint),r.transform.degree%90==0&&r.transform.degree%180!=0?i=o=a.width<a.height?a.width:a.height:(o=a.width,i=a.height),r.notify("shape",{prop:"refreshActiveObj",onPropertyChange:!1}),r.activeObj=d,r.currObjType.shape=d.shape,this.upperContext.clearRect(0,0,r.upperCanvas.width,r.upperCanvas.height),r.currObjType.isCustomCrop=!1}else o=p,i=h,s<0&&(o+=s),l<0&&(i+=l),s+p>r.lowerCanvas.width&&(o-=s+p-r.lowerCanvas.width),l+h>r.lowerCanvas.height&&(i-=l+h-r.lowerCanvas.height);switch(r.currObjType.shape.toLowerCase()){case"crop-square":case"crop-circle":r.notify("selection",{prop:"setDragDirection",onPropertyChange:!1,value:{width:o,height:i}}),a=r.activeObj.activePoint,r.lowerCanvas.width<a.endX-a.startX&&(a.startX=7.5,a.endX=r.lowerCanvas.width-7.5),r.lowerCanvas.height<a.endY-a.startY&&(a.startY=7.5,a.endY=r.lowerCanvas.height-7.5),o===p&&i===h&&(a.startX+=s,a.startY+=l,a.endX+=s,a.endY+=l),r.lowerCanvas.width>r.lowerCanvas.height?(a.height=a.endY-a.startY,a.width=a.height,a.endX=a.startX+a.width):(a.width=a.endX-a.startX,a.height=a.width,a.endY=a.startY+a.height);break;case"crop-3:2":e=3,t=2;break;case"crop-4:3":e=4,t=3;break;case"crop-5:4":e=5,t=4;break;case"crop-7:5":e=7,t=5;break;case"crop-16:9":e=16,t=9;break;case"crop-2:3":e=2,t=3;break;case"crop-3:4":e=3,t=4;break;case"crop-4:5":e=4,t=5;break;case"crop-5:7":e=5,t=7;break;case"crop-9:16":e=9,t=16;break;default:e=parseInt(r.currObjType.shape.toLowerCase().split("crop-")[1].split(":")[0]),t=parseInt(r.currObjType.shape.toLowerCase().split("crop-")[1].split(":")[1])}if(void 0!==e&&void 0!==t&&(r.notify("selection",{prop:"calcShapeRatio",onPropertyChange:!1,value:{x:e,y:t,imgWidth:o,imgHeight:i}}),o===p&&i===h&&this.updatePoints(),a=r.activeObj.activePoint),a.startX<s){var c=s-a.startX+7.5;a.startX+=c,a.endX+=c}if(a.startY<l){c=l-a.startY+7.5;a.startY+=c,a.endY+=c}r.activeObj=this.updateWidthHeight(r.activeObj),this.adjToCenter(),this.enlargeToImg(),0!==r.transform.straighten&&(this.adjToStraighten(),this.updateActiveObject(r.activeObj.activePoint,r.activeObj));var u={isIntersect:null,arr:null},g=0;if(a=r.activeObj.activePoint,0!==r.transform.straighten)for(;this.isLinesIntersect(u)&&g<100;){g++;c=1*a.width/100;a.startX+=c,a.endX-=c,c=1*a.height/100,a.startY+=c,a.endY-=c,a.width=a.endX-a.startX,a.height=a.endY-a.startY,this.updateActiveObject(a,r.activeObj)}this.straightenInitZoom=r.tran