1(self.webpackChunklightx=self.webpackChunklightx||[]).push([[7222],{67502:(_e,ie,g)=>{"use strict";g.d(ie,{y:()=>d});var n=g(93552),G=g(63065),P=g(84412),h=g(71971),a=g(23170);class d{constructor(l){this._tansformation=new P.t("y"),this.tansformation=this._tansformation.asObservable(),this.andorObjList=[],this.fabricObjList=[],this.mouseDown=!1,this.drag=!1,this.activegroup=l,this.canvas=l.canvas,l.set({borderColor:"#626ADF",borderDashArray:[7,7],cornerStyle:"circle",cornerColor:"#fff",cornerStrokeColor:"#626ADF",cornerSize:14,borderScaleFactor:1.5,transparentCorners:!1}),l.setControlsVisibility({mt:!1,mb:!1,ml:!1,mr:!1});const _=l.getObjects();this.fabricObjList=_;for(const C of _)C.ingroup="yes",C.set({borderColor:"#A400F1",borderDashArray:null,borderScaleFactor:.75}),C.andorObj&&this.andorObjList.push(C.andorObj),C.andorObj instanceof G.$&&(C.selectedText=null);l.on("rotating",C=>this.transformation(C)),l.on("moving",C=>this.transformation(C)),l.on("scaling",C=>this.transformation(C)),l.on("mousedown",C=>{this.mouseDown=!0,this.drag=!1}),l.on("mousemove",C=>{this.mouseDown&&(this.drag=!0)}),l.on("modified",C=>{for(const S of this.andorObjList)S.updateFromGroup(C),S instanceof G.$?("scale"===C.action||"rotate"===C.action||"drag"===C.action)&&S.configurePivot():S instanceof a.y&&S.updateGroupObjectState(!1);this.onChange()}),l.on("mouseup",C=>{!C.e.shiftKey&&!this.drag&&this.mouseDown&&setTimeout(()=>{const S=this.checkSelect(C);S&&this.canvas.setActiveObject(S)},100),this.drag=!1,this.mouseDown=!1})}checkSelect(l){let _=null;const S=new n.fabric.Point(l.pointer.x,l.pointer.y);S.x=S.x/this.canvas.viewportTransform[0],S.y=S.y/this.canvas.viewportTransform[3];const x=this.activegroup.getCenterPoint(),R=new n.fabric.Point(S.x-x.x,S.y-x.y),I=this.fabricObjList;for(let D=0;D<I.length;D++)I[D].containsPoint(R)&&(_=I[D]);return _}getScale(){let l;return l=this.canvas.clipPath?this.canvas.clipPath.width:this.canvas.width/this.canvas.viewportTransform[0],this.activegroup.width*this.activegroup.scaleX/l}setScale(l,_){const C=this.activegroup;let S;S=this.canvas.clipPath?this.canvas.clipPath.width:this.canvas.width/this.canvas.viewportTransform[0];const x=l*S/this.activegroup.width,R=x*C.width/(C.width*C.scaleX/(C.height*C.scaleY))/C.height;C._setOriginToCenter(),C.set({scaleX:x,scaleY:R}),C._resetOrigin(),C.setCoords(),this.transformation(null),this.canvas.requestRenderAll(),_&&this.onChange()}getAngle(){return this.activegroup.angle}setAngle(l,_){this.activegroup.rotate(l),this.transformation({}),this.canvas.requestRenderAll(),_&&this.onChange()}align(l,_=!1){const C=this.activegroup.angle;this.activegroup.rotate(0);const S=this.activegroup.getObjects();for(const x of S){const E=x.calcACoords(!0);let I,D,M=0,R=0;switch(l){case h.W3.RIGHT:const p=this.getMaxX(E,x);I=this.activegroup.width*this.activegroup.scaleX/2-p,M=E.tl.x+I,x.set({left:M});break;case h.W3.LEFT:const u=this.getMinX(E,x);I=this.activegroup.width*this.activegroup.scaleX/2+u,M=E.tl.x-I,x.set({left:M});break;case h.W3.TOP:const m=this.getMinY(E,x);D=this.activegroup.height*this.activegroup.scaleY/2+m,R=E.tl.y-D,x.set({top:R});break;case h.W3.BOTTOM:const b=this.getMaxY(E,x);D=this.activegroup.height*this.activegroup.scaleY/2-b,R=E.tl.y+D,x.set({top:R});break;case h.W3.CENTER:const k=x.angle;x.rotate(0),M=-x.width*x.scaleX/2,x.set({left:M}),x.rotate(k);break;case h.W3.MIDDLE:const A=x.angle;x.rotate(0),R=-x.height*x.scaleY/2,x.set({top:R}),x.rotate(A)}}this.activegroup.rotate(C),this.transformation({}),this.activegroup._restoreObjectsState(),n.fabric.util.resetObjectTransform(this.activegroup),this.activegroup._calcBounds(),this.activegroup._updateObjectsCoords(),this.activegroup.dirty=!0,_||(this.onChange(),this.canvas.renderAll())}getMaxX(l,_){let C=null;return C=_.angle>90&&_.angle<270?Math.max(l.bl.x,l.tl.x):Math.max(l.br.x,l.tr.x),C}getMinX(l,_){let C=null;return C=_.angle>90&&_.angle<270?Math.min(l.br.x,l.tr.x):Math.min(l.bl.x,l.tl.x),C}getMinY(l,_){let C=null;return C=_.angle>90&&_.angle<270?Math.min(l.bl.y,l.br.y):Math.min(l.tl.y,l.tr.y),C}getMaxY(l,_){let C=null;return C=_.angle>90&&_.angle<270?Math.max(l.tr.y,l.tl.y):Math.max(l.br.y,l.bl.y),C}xFlip(){throw new Error("Method not implemented.")}yFlip(){throw new Error("Method not implemented.")}isFlipable(){return!1}transformation(l){for(const _ of this.andorObjList)_.updateFromGroup(l);this._tansformation.next("y")}delete(l){for(const _ of this.andorObjList)l.delete(_);this.activegroup.canvas.discardActiveObject().renderAll(),l.onAddRemove(),l.setDirty()}
1duplicate(l,_){if(!_.groupDuplicateInprogress){l.inProgress=!0,_.groupDuplicateInprogress=!0;const C=[];for(const S of this.andorObjList)C.push(_.duplicateEle(S,this.canvas,l.selectedScene));Promise.all(C).then(S=>{const x=[];S.forEach(M=>{M.addToCanvas(this.canvas),x.push(M.getboundingBox())});const E=new n.fabric.ActiveSelection(x,{canvas:this.canvas});this.canvas.setActiveObject(E),l.selectedScene.setDirty()}).finally(()=>{l.inProgress=!1,_.groupDuplicateInprogress=!1})}}moveUpwards(l){const _=new Set,C=[];for(const E of this.andorObjList)C.push(E);C.sort((E,M)=>E.getDesignItem().designZOrder-M.getDesignItem().designZOrder);let S=C.pop(),x=null;for(;S;){let E=!0;for(;E;){const M=this.getUpper(l,S);M?x?x==M?(E=!1,x=S):(_.add(M),_.add(S),this.exchangeZindex(M,S)):(_.add(M),_.add(S),this.exchangeZindex(M,S),x=S,E=!1):(x=S,E=!1)}S=C.pop()}for(const E of _)E.setDesignItemZindex(20*E.getDesignItem().designZOrder),E.removeFromCanvas(this.canvas),E.addToCanvas(this.canvas);this.canvas.renderAll(),this.onChange()}moveDownwards(l){const _=new Set,C=[];for(const E of this.andorObjList)C.push(E);C.sort((E,M)=>E.getDesignItem().designZOrder-M.getDesignItem().designZOrder);let S=C.shift(),x=null;for(;S;){let E=!0;for(;E;){const M=this.getLower(l,S);M?x?x==M?(E=!1,x=S):(_.add(M),_.add(S),this.exchangeZindex(M,S)):(_.add(M),_.add(S),this.exchangeZindex(M,S),x=S,E=!1):(x=S,E=!1)}S=C.shift()}for(const E of _)E.setDesignItemZindex(20*E.getDesignItem().designZOrder),E.removeFromCanvas(this.canvas),E.addToCanvas(this.canvas);this.canvas.renderAll(),this.onChange()}exchangeZindex(l,_){const C=l.getDesignItem().designZOrder;l.getDesignItem().designZOrder=_.getDesignItem().designZOrder,_.getDesignItem().designZOrder=C}getUpper(l,_){const C=l.designItemList;let S=null;for(const x of C)x.isOverlay()&&x.getDesignItem().designZOrder>_.getDesignItem().designZOrder&&(S?S.getDesignItem().designZOrder>x.getDesignItem().designZOrder&&(S=x):S=x);return S}getLower(l,_){const C=l.designItemList;let S=null;for(const x of C)x.isOverlay()&&x.getDesignItem().designZOrder<_.getDesignItem().designZOrder&&(S?S.getDesignItem().designZOrder<x.getDesignItem().designZOrder&&(S=x):S=x);return S}}},99404:(_e,ie,g)=>{"use strict";g.d(ie,{b:()=>h});var n=g(93552),G=g(84412);class P{}class h{constructor(d,e,l,_){this.bgImageObj=d,this.canvasWidth=e,this.canvasHeight=l,this.scaleInput=_,this.scale=1,this.isThereAnyVideoLoop=!1,this.isThereAnyShorterVideo=!1,this._tansformation=new G.t("y"),this.tansformation=this._tansformation.asObservable(),this.scale=_}getVideo(){return this.video}getBgImageObj(){return this.bgImageObj}getImgName(){return this.bgImageObj.imgName}getMediaType(){return this.bgImageObj.imageType}updateOImg(d){this.oImg=d,this.bgImageObj=null,this.bgImageObj=new P,this.bgImageObj.imageType=0,this.bgImageObj.imgName=d.src,this.common(this.oImg)}getScale(){return this.bgImageObj.aspectWH<=this.canvasWidth/this.canvasHeight?this.oImg.width*this.oImg.scaleX/(this.oImg.canvas.width/this.oImg.canvas.viewportTransform[0]):this.oImg.height*this.oImg.scaleY/(this.oImg.canvas.height/this.oImg.canvas.viewportTransform[0])}setScale(d,e){const l=this.oImg.canvas.width/this.oImg.canvas.viewportTransform[0],_=this.oImg.canvas.height/this.oImg.canvas.viewportTransform[0];let S;S=this.bgImageObj.aspectWH<=this.canvasWidth/this.canvasHeight?d*l/this.oImg.width:d*_/this.oImg.height,this.oImg._setOriginToCenter(),this.oImg.scale(S),this.oImg._resetOrigin();const m=0+_-this.oImg.height*this.oImg.scaleY;this.oImg.set({left:this.clamp(this.oImg.left,0+l-this.oImg.width*this.oImg.scaleX,0),top:this.clamp(this.oImg.top,m,0)}),this.oImg.canvas.requestRenderAll(),e&&(this.bgImageObj.width=this.oImg.width*this.oImg.scaleX/l,this.bgImageObj.xPos=this.oImg.left/l,this.bgImageObj.yPos=this.oImg.top/l,this.onChange()),this._tansformation.next("y")}clamp(d,e,l){return Math.min(Math.max(d,e),l)}addToCanvas(d){d.setBackgroundImage(this.oImg,()=>d.renderAll(),{originX:"left",originY:"top",crossOrigin:"anonymous"})}removeFromCanvas(d){d.backgroundImage=null}addBgImage(d,e){return this.bgImageObj=null,new Promise((l,_)=>{n.fabric.Image.fromURL(d,C=>{this.bgImageObj=new P,this.bgImageObj.imageType=0,this.bgImageObj.imgN
1ame=d,this.common(C),l()},{crossOrigin:"anonymous"})})}addBgImageFromHTMLImage(d){return this.bgImageObj=null,new Promise((e,l)=>{var _=new n.fabric.Image(d,{crossOrigin:"anonymous"});_.scale(this.scale),this.oImg=_,e(_)})}loadImage(d){return this.bgImageObj=null,new Promise((e,l)=>{n.fabric.Image.fromURL(d,_=>{this.bgImageObj=new P,this.bgImageObj.imageType=0,this.bgImageObj.imgName=d,e(_)},{crossOrigin:"anonymous"})})}formatAssets(d,e){this.canvasWidth=d,this.canvasHeight=e,this.common(this.oImg)}common(d){if(this.bgImageObj.aspectWH=d.width/d.height,this.bgImageObj.aspectWH<=this.canvasWidth/this.canvasHeight){d.scale(this.canvasWidth/d.width),this.bgImageObj.width=1;const _=0,C=(this.canvasHeight-d.getScaledHeight())/2;this.bgImageObj.xPos=_/this.canvasWidth,this.bgImageObj.yPos=C/this.canvasHeight,d.set({left:_,top:C})}else{d.scale(this.canvasHeight/d.height),this.bgImageObj.width=d.getScaledWidth()/this.canvasWidth;const _=(this.canvasWidth-d.getScaledWidth())/2,C=0;this.bgImageObj.xPos=_/this.canvasWidth,this.bgImageObj.yPos=C/this.canvasHeight,d.set({left:_,top:C})}this.oImg=d,this.oImg.setCoords()}mouseDown(d){this._isMouseDown=!0,this._initialDragPoint=d.pointer,this._initialImagePoint={left:this.oImg.left,top:this.oImg.top}}mouseMove(d){if(this._isMouseDown){this._isDragOn=!0;const e=(d.pointer.x-this._initialDragPoint.x)/this.oImg.canvas.getZoom(),l=(d.pointer.y-this._initialDragPoint.y)/this.oImg.canvas.getZoom();this.oImg.set({left:this._initialImagePoint.left+e,top:this._initialImagePoint.top+l});const E=0-this.oImg.height*this.oImg.scaleY+this.oImg.canvas.height/this.oImg.canvas.viewportTransform[0];this.oImg.set({left:this.clamp(this.oImg.left,0+this.oImg.canvas.width/this.oImg.canvas.viewportTransform[0]-this.oImg.width*this.oImg.scaleX,0),top:this.clamp(this.oImg.top,E,0)}),this.oImg.canvas.requestRenderAll()}}mouseUp(d){if(this._isMouseDown=!1,this._isDragOn){this._isDragOn=!1;const e=this.oImg.canvas.width/this.oImg.canvas.viewportTransform[0],l=this.oImg.canvas.height/this.oImg.canvas.viewportTransform[0];this.bgImageObj.width=this.oImg.width*this.oImg.scaleX/e,this.bgImageObj.xPos=this.oImg.left/e,this.bgImageObj.yPos=this.oImg.top/l}}}},32294:(_e,ie,g)=>{"use strict";g.d(ie,{Z:()=>b});var n=g(10467),o=g(93552),P=g(63065),h=g(92771),a=g(67294),d=g(50585),e=g(16471),l=g(2850),_=g(24886),C=g(26381),S=g(67502),x=g(54438),E=g(84301),M=g(68887),R=g(29431),I=g(3408),D=g(92838),p=g(45975),u=g(32764),m=g(45944);let b=(()=>{var k;class A{addHistory(y,O=!0){this.exportedVideos.clear(),O&&this.historyPointer++,y.templateType&&y.templateType==_.If.DESIGN?this.historyJsonArray.length>20&&(this.historyJsonArray.splice(0,1),this.historyRemoveBgArray.splice(0,1),this.historyPointer=this.historyPointer-1):this.historyJsonArray.length>10&&(this.historyJsonArray.splice(0,1),this.historyRemoveBgArray.splice(0,1),this.historyPointer=this.historyPointer-1),this.historyJsonArray.length>this.historyPointer&&this.historyJsonArray.splice(this.historyPointer),y.sceenIndex=this.selectedSceneIndex,this.historyJsonArray[this.historyPointer]=JSON.stringify(y),this.addRemoveBgHistory()}updateHistory(y){this.historyJsonArray.length>=this.historyPointer&&(this.historyJsonArray[this.historyPointer]=JSON.stringify(y))}getState(){return this.state}addRemoveBgHistory(){const y=new Map;let O=0;for(const w of this.scenes){for(const j of w.designItemList)if(j.getDesignItem().itemType===d.SP.MEDIA_CONTAINER&&j.getRemoveBgEdit()){const L=j.getRemoveBgEdit(),U=new d.MO(L);y.set(O+"_"+j.getDesignItem().designEntityId,U)}O++}this.historyRemoveBgArray.length>this.historyPointer&&this.historyRemoveBgArray.splice(this.historyPointer),this.historyRemoveBgArray[this.historyPointer]=y}getAudioObject(){return this.audioObjs}get audioObj(){return this.audioObjs&&this.audioObjs.length>0?this.audioObjs[0]:null}constructor(y,O,w,j,L,U,z,Z){this.sceneParser=y,this.projectSyncService=O,this.sceneThumbGenerator=w,this.mixedGroupBuilder=j,this.canvasService=L,this.uploadService=U,this.templateService=z,this.videoRepository=Z,this.tabselection=!1,this.selectedSceneIndex=0,this.scenes=[],this.updateInterval=500,this.isPlaying=!1,this.currentPlayTime=0,this.inProgress=!1,this.inProgressCount=-1,this.editorVolume=!0,this.onChange=null,this.dirty=!1,this.deselectAllFlag=!1,this.historyJsonArray=[],this.historyRemoveBgArray=new Array,this.historyPointer=-1,this.exportedVideos=new Map,this.projectType=null,this.expectedBlobUploadMap=new Map,this.isUserQuotaFull=!1,this.editingInProcess=!1,this.isSaving=!1}getOnDirtyFn(y=!0){return O=>{this.editingInProcess=!1,this.updateDesignJson(),O&&(this.state.editorType===e._Y.VideoEditor||this.mixedGroupBuilder.groupDupl
1icateInprogress)||this.addHistory(this.design,y)}}init(y,O,w,j,L,U,z,Z,$=null,Y){this.state=z,this.zoom=Z,this.exportedVideos=new Map,this._activeEditToolPanel=new h.m(1),this.activeEditToolPanel=this._activeEditToolPanel.asObservable(),this.isSubscribed=L,this.onMediaAdjust=j,this.onBackgroundAdjust=Y,this.editorService=w,this.historyJsonArray=[],this.historyPointer=-1;const Q=y.metadata.data;return this.design=y,this.design.properties.originalSocialPlatformId=y.properties.socialPlatformId,this.design.properties.originalFormat=this.design.properties.format,this.design.properties.originalWidth=this.design.properties.width,this.design.properties.originalHeight=this.design.properties.height,this.orignalwRatio=this.design.metadata.data.wRatio,this.orignalhRatio=this.design.metadata.data.hRatio,this.projectType=this.design.properties.projectType,this.design.thumbAssetId=y.metadata.thumbAssetId,O&&(this.canvas=O),this.inProgress=!0,new Promise((K,W)=>{this.sceneParser.parseMusic(Q).then(X=>{X&&(this.audioObjs=X),this.sceneParser.parseProject(Q,this.canvas,this.state.editorType===e._Y.VideoTemplate,this.onMediaAdjust,!1,this.projectType).then(V=>{this.scenes=V,this.markWaterMakedRequired(),this.selectScene(0),this.markSaved(),this.inProgress=!1,this.updateDesignJson(),this.addHistory(this.design),K(),V.forEach(le=>{"default_project"===U&&(le.dirty=!0),le.onDirty=this.getOnDirtyFn(),le.onAddRemove=(fe,Ce)=>{this.checkAndUpdateWatermark(),fe&&Ce&&this.eventCall(fe,Ce)},le.setSceneThumbGenerator(this.sceneThumbGenerator),le.generateThumb()})}).catch(()=>{W()})})})}getHistory(){return this.historyJsonArray}getProjectType(){return this.projectType}getHistoryPointer(){return this.historyPointer}undo(){var y=this;return(0,n.A)(function*(){let O=[];const w=y.state.mainCanvas.getActiveObject();w instanceof o.fabric.ActiveSelection&&(O=y.groupActiveSelection([],w));const j=y.selectedScene.selectedDesignItem;if(y.editingInProcess&&(y.updateDesignJson(),y.setDirty(),y.editingInProcess=!1),y.historyPointer>0&&!y.inProgress){y.inProgress=!0,y.scenes.forEach(Q=>{Q.onDeselect=null});const L=JSON.parse(y.historyJsonArray[y.historyPointer-1]);y.state.editorType==e._Y.VideoTemplate&&(y.selectedSceneIndex=L.sceenIndex);const U=y.historyRemoveBgArray[y.historyPointer-1];y.design.properties.socialPlatformId!=L.properties.socialPlatformId&&(y.canvas.clear(),26==L.properties.socialPlatformId?yield y.zoom.setLayout(L.properties.socialPlatformId,L.properties.width,L.properties.height):yield y.zoom.setLayout(L.properties.socialPlatformId));const z=y.state.editorType===e._Y.VideoTemplate,Z=yield y.sceneParser.parseProject(L.metadata.data,y.canvas,z,y.onMediaAdjust);if(y.historyPointer--,Z[y.selectedSceneIndex].dirty=(z?Z[y.selectedSceneIndex]:y.scenes[y.selectedSceneIndex]).dirty,y.scenes=Z,Z.forEach((Q,K)=>{if(U&&U.size>0)for(const W of Q.designItemList){const X=U.get(K+"_"+W.getDesignItem().designEntityId);X&&W.setRemoveBgEdit(X)}Q.setSceneThumbGenerator(y.sceneThumbGenerator),y.state.editorType!==e._Y.VideoEditor&&y.state.editorType!==e._Y.DesignTemplate&&Q.generateThumb(),Q.onDirty=y.getOnDirtyFn(),Q.onAddRemove=(W,X)=>{y.checkAndUpdateWatermark(),W&&X&&y.eventCall(W,X)}}),y.audioObjs=null,y.sceneParser.parseMusic(L.metadata.data).then(Q=>{Q?(y.audioObjs=Q,y.state.editorType==e._Y.VideoTemplate&&y.audioObjs&&y.audioObjs.length>0&&(y.editorService.setActiveToolPanel(a.sv.MUSIC),y.selectScene(y.selectedSceneIndex))):y.state.editorType==e._Y.VideoTemplate&&y.editorService.setActiveToolPanel(a.sv.MEDIA)}),y.design=L,y.markWaterMakedRequired(),y.selectScene(y.selectedSceneIndex),w instanceof o.fabric.ActiveSelection&&O.length){if(y.groupActiveSelection(O),j&&y.selectedScene&&1==O.length)y.selectScene(y.selectedSceneIndex);else if(!j&&y.selectedScene&&2==O.length&&1==y.selectedScene.getDesignItemList().length){y.selectScene(y.selectedSceneIndex);const Q=y.selectedScene.getDesignItemList()[0];Q&&y.selectedScene.setActive(Q)}}else if(y.selectedScene&&j){const Q=y.selectedScene.getDesignItemList().find(K=>K.getDesignItem().designEntityId==j.getDesignItem().designEntityId);Q&&y.selectedScene.setActive(Q)}else y.editorService.setActiveToolPanel(y.state.editorType==e._Y.VideoEditor?a.sv.PROJECT:y.state.editorType==e._Y.VideoTemplate?a.sv.MEDIA:a.sv.TEMPLATE);y.inProgress=!1}})()}redo(){var y=this;return(0,n.A)(function*(){let O=[];const w=y.state.mainCanvas.getActiveObject();w instanceof o.fabric.ActiveSelection&&(O=y.groupActiveSelection([],w));const j=y.selectedScene.selectedDesignItem;if(y.editingInProcess&&(y.updateDesignJson(),y.setDirty(),y.editingInProcess=!1),y.historyPointer<y.historyJsonArray.length-1&&!y.inProgress){y.inProgress=!0,y.scenes.forEac
1h(Q=>{Q.onDeselect=null});const L=JSON.parse(y.historyJsonArray[y.historyPointer+1]);y.state.editorType==e._Y.VideoTemplate&&(y.selectedSceneIndex=L.sceenIndex);const U=y.historyRemoveBgArray[y.historyPointer+1];y.design.properties.socialPlatformId!=L.properties.socialPlatformId&&(y.canvas.clear(),26==L.properties.socialPlatformId?yield y.zoom.setLayout(L.properties.socialPlatformId,L.properties.width,L.properties.height):yield y.zoom.setLayout(L.properties.socialPlatformId));const z=y.state.editorType===e._Y.VideoTemplate,Z=yield y.sceneParser.parseProject(L.metadata.data,y.canvas,z,y.onMediaAdjust);if(y.historyPointer++,Z[y.selectedSceneIndex].dirty=(z?Z[y.selectedSceneIndex]:y.scenes[y.selectedSceneIndex]).dirty,y.scenes=Z,Z.forEach((Q,K)=>{if(U&&U.size>0)for(const W of Q.designItemList){const X=U.get(K+"_"+W.getDesignItem().designEntityId);X&&W.setRemoveBgEdit(X)}Q.setSceneThumbGenerator(y.sceneThumbGenerator),y.state.editorType!==e._Y.VideoEditor&&Q.generateThumb(),Q.onDirty=y.getOnDirtyFn(),Q.onAddRemove=(W,X)=>{y.checkAndUpdateWatermark(),W&&X&&y.eventCall(W,X)}}),y.audioObjs=null,y.sceneParser.parseMusic(L.metadata.data).then(Q=>{Q?(y.audioObjs=Q,y.state.editorType==e._Y.VideoTemplate&&y.audioObjs&&y.audioObjs.length>0&&y.editorService.setActiveToolPanel(a.sv.MUSIC)):y.state.editorType==e._Y.VideoTemplate&&y.editorService.setActiveToolPanel(a.sv.MEDIA)}),y.design=L,y.markWaterMakedRequired(),y.selectScene(y.selectedSceneIndex),w instanceof o.fabric.ActiveSelection&&O.length)y.groupActiveSelection(O);else if(y.selectedScene&&j){const Q=y.selectedScene.getDesignItemList().find(K=>K.getDesignItem().designEntityId==j.getDesignItem().designEntityId);Q&&y.selectedScene.setActive(Q)}else y.editorService.setActiveToolPanel(y.state.editorType==e._Y.VideoEditor?a.sv.PROJECT:y.state.editorType==e._Y.VideoTemplate?a.sv.MEDIA:a.sv.TEMPLATE);y.inProgress=!1}})()}selectScene(y){this.selectedScene&&(this.selectedScene.selectedDesignItem=null,this.selectedScene.clear());const O=this.scenes[y];this.selectedSceneIndex=y,this.selectedScene=O,this.canvas.clear(),this.selectedScene.addToCanvas(this.canvas),this.isWarkWaterMakedRequired&&this.addWatermarkOverlay(this.canvas),O.onSelect=w=>{this._activeEditToolPanel.next(w),this.checkAndUpdateWatermark()},O.onDeselect=()=>{!this.canvas.getActiveObject()&&!this.selectedAudioObject&&this.editorService.setActiveToolPanel(this.editorService.getActiveToolPanel())},O.onBackgroundAdjust=this.onBackgroundAdjust,this.editorService.replace=!1,this.editorService.sceneIndexChanged(y)}selectAudio(y){this.deselectAll(),this.selectedAudioObject=y,this._activeEditToolPanel.next(y)}markWaterMakedRequired(){return this.checkPremiumItems(),this.isWarkWaterMakedRequired=!this.isSubscribed&&0!==(this.design.properties.pro||this.design.properties.hasProElements),this.isWarkWaterMakedRequired}checkPremiumBgImage(){let y=!1,w=this.getUpdatedProjectJson().sceneItems;for(let j=0;j<w.length;j++){let L=w[j];L.bgImageObj&&L.bgImageObj.ispro&&(y=!0)}this.design.properties.hasProElements=y?1:0}checkPremiumItems(){const y=this.design.metadata.data.sceneItems.reduce((L,U)=>L||U.pro>0,!1);this.design.properties.pro=y?1:0;let O=!1,j=this.getUpdatedProjectJson().sceneItems;for(let L=0;L<j.length;L++){let U=j[L];for(let z=0;z<U.designItems.length&&!O;z++)U.designItems[z].isPro&&(O=!0)}this.design.properties.hasProElements=O?1:0,O||this.checkPremiumBgImage()}addWatermarkOverlay(y){let O=this.state.original.height,w=this.state.original.width,j=0;j=O>w?O/4e3:w/4e3,y.setOverlayImage("https://static.lightxeditor.com/assets/images/Watermark.png",y.renderAll.bind(y),{scaleX:j,scaleY:j})}removeWatermarkOverlay(y){y.overlayImage=null,this.canvas.renderAll()}checkAndUpdateWatermark(){this.markWaterMakedRequired(),this.isWarkWaterMakedRequired?this.addWatermarkOverlay(this.canvas):this.removeWatermarkOverlay(this.canvas)}checkAndUpdateBgImageWatermark(){this.checkAndUpdateWatermark()}setUserSubscribed(){this.isSubscribed=!0,this.checkAndUpdateWatermark()}getDesign(){return this.design}getSelectedScene(){return this.selectedScene}getCanvas(){return this.canvas}isSaved(){let y=!1;for(const O of this.scenes)y=y||O.dirty;if(this.audioObjs&&this.audioObjs.length>0)for(const O of this.audioObjs)y=y||O.dirty;return!(y||this.dirty)}markSaved(){for(const y of this.scenes)y.dirty=!1;if(this.audioObjs&&this.audioObjs.length>0)for(const y of this.audioObjs)y.dirty=!1;this.dirty=!1}tempMarkSaved(){for(const y of this.scenes)y.dirty=!1}save(y,O=null,w=null){let j=!1;this.isSaved()?(j=!1,this.isSaving=!1,O()):(this.isSaving=!0,this.checkAnyUploadIsAlreadyInProgress().then(()=>{this.checkNonUploadedMedia().then(()=>{let L=this.getAudioJson();if(L&&L.length>0?(this.design.metadata.data.veMusic=L,this.design.metadata.data.music=L[0]):(delete this.design.metadata.data.music,delete this.design.metadata.data.veMusic),j=!0,this.design.folderIds&&0==this.design.folderIds.length&&y&&(this.design.folderIds=[y]),this.design.assetId){let U=JSON.parse(JSON.stringify(this.design));U.metadata.data=this.getUpdatedProjectJson(),this.projectSyncService.update(U,this.scenes[0].toJson(),j,y).then(()=>{this.markSaved(),O&&(this.design.properties.originalSocialPlatformId=this.design.properties.socialPlatformId,this.design.properties.originalFormat=this.design.properties.format,this.design.properties.originalWidth=this.design.properties.width,this.design.properties.originalHeight=this.design.properties.height,this.isSaving=!1,O())})}else{let U=this.design.metadata.data.sceneItems[0],z=JSON.parse(JSON.stringify(this.design));z.metadata.data=this.getUpdatedProjectJson(),this.projectSyncService.createProject(z,U).then(
1Z=>{this.markSaved(),this.isSaving=!1,this.design.assetId=Z.assetId,this.design.thumbUrl=Z.thumbUrl,this.design.thumbAssetId=Z.thumbAssetId,this.design.metadata.thumbAssetId=Z.metadata.thumbAssetId,O()}).catch(Z=>{this.isSaving=!1})}}).catch(()=>{this.isSaving=!1,w()})}))}_getExtension(y){var O=/^.+\.([^.]+)$/.exec(y);return null==O?"":O[1]}checkNonUploadedMedia(){return new Promise((y,O)=>{this.expectedBlobUploadMap.clear();const w=new Array;for(const j of this.scenes){for(const U of j.getDesignItemList()){const z=U.getDesignItem();if(U.getDesignItem().itemType===d.SP.MEDIA_CONTAINER){const Z=U,$=Z.getMediaObjects();if($&&$.length>0){let Y=0;for(const Q of $){if("image"!==Q.type||Q.getElement()instanceof HTMLVideoElement){if(Q.getElement()instanceof HTMLVideoElement){const W=z.box.imgArray[Y].imgName;W.includes("blob:http")&&(this.expectedBlobUploadMap.has(W)?this.expectedBlobUploadMap.get(W).push(Z):this.expectedBlobUploadMap.set(W,[Z]))}}else{let K=Q.getElement();if("IMG"!==K.tagName&&(K=Q._originalElement),"IMG"==K.tagName&&K.src&&(K.src.includes("blob:http")||K.src.includes("pixabay"))){let W=K.src.includes("blob:http")?null:this._getExtension(K.src);W=W?"image/"+W:"image/png",w[w.length]=new Promise((X,F)=>{fetch(K.src).then(V=>{V.blob().then(le=>{this.uploadService.addImageBlob(le,K,fe=>{this.isUserQuotaFull=!1,!1===fe.status&&(this.isUserQuotaFull=!0,F())},fe=>{const Ce=fe.contentUrl,Ne=fe.assetId;Z.selectedMediaItemIndex=0,Z.changeSrc(Ce,Ne),this.updateDesignJson(),this.replaceRemoveBgURL(K.src,Ce),this.uploadService.removeLocalFile("temp-"+K.src),X()},W)})})})}}Y++}}}}w.push(...this.uploadVideoFileToServer());const L=j.getBackgroundMedia();if(L&&1===L.getMediaType()&&L.getImgName().includes("blob:http")&&this.templateService.needtoUploadVideoFile&&(w[w.length]=new Promise((z,Z)=>{this.uploadService.addVideoFile(this.templateService.needtoUploadVideoFile,$=>{this.isUserQuotaFull=!1,!1===$.status&&(this.isUserQuotaFull=!0,Z())},$=>{const Y=L.toJson();Y.imgName=$.contentUrl,L.bgImageObj=Y,L.parseBG(!1).then(()=>{this.canvas.clear(),this.selectedScene.addToCanvas(this.canvas),z()}).catch(()=>{Z()})})})),L&&0===L.getMediaType()){const U=L.getImgName();if(U.includes("blob:http")||U.includes("pixabay")){let z=U.includes("blob:http")?null:this._getExtension(U);z=z?"image/"+z:"image/png";let Z=L.oImg.getElement();w[w.length]=new Promise(($,Y)=>{fetch(U).then(Q=>{Q.blob().then(K=>{this.uploadService.addImageBlob(K,Z,W=>{this.isUserQuotaFull=!1,!1===W.status&&(this.isUserQuotaFull=!0,Y())},W=>{const X=W.contentUrl;L.setImgName(X),this.updateDesignJson(),this.replaceRemoveBgURL(Z.src,X),$()},z)})})})}}}if(this.audioObjs&&this.audioObjs.length>0)for(let j of this.audioObjs)for(let L=0;L<j.audioSrcArray.length;L++){let U=j.audioSrcArray[L];U.includes("blob:http")&&(w[w.length]=new Promise((z,Z)=>{fetch(U).then($=>{$.blob().then(Y=>{this.uploadService.addAudioBlob(Y,Q=>{this.isUserQuotaFull=!1,!1===Q.status&&(this.isUserQuotaFull=!0,Z())},Q=>{const K=Q.contentUrl;j.audioSrcArray[L]=K,this.updateDesignJson(),this.replaceRemoveBgURL(U,K),z()},"audio/wav")})})}))}0===w.length?y():Promise.all(w).then(()=>{y()}).catch(()=>{O()})})}checkAnyUploadIsAlreadyInProgress(){return new Promise((y,O)=>{const w=new Array;for(const j of this.scenes){for(const U of j.getDesignItemList()){const z=U.getDesignItem();if(U.getDesignItem().itemType===d.SP.MEDIA_CONTAINER){const $=U.getMediaObjects();if($&&$.length>0){let Y=0;for(const Q of $){if("image"!==Q.type||Q.getElement()instanceof HTMLVideoElement){if(Q.getElement()instanceof HTMLVideoElement){const W=z.box.imgArray[Y].imgName;if(W.includes("blob:http")){let X=this.uploadService.uploadPromises.get(W);X&&w.push(X)}}}else{let K=Q.getElement();if("IMG"!==K.tagName&&(K=Q._originalElement),"IMG"==K.tagName&&K.src&&(K.src.includes("blob:http")||K.src.includes("pixabay"))){let W=this.uploadService.uploadPromises.get(K.src);W&&w.push(W)}}Y++}}}}const L=j.getBackgroundMedia();if(L&&1===L.getMediaType()){const U=L.getImgName();if(U.includes("blob:http")&&this.templateService.needtoUploadVideoFile){let z=this.uploadService.uploadPromises.get(U);z&&w.push(z)}}if(L&&0===L.getMediaType()){const U=L.getImgName();if(U.includes("blob:http")||U.includes("pixabay")){let z=this.uploadService.uploadPromises.get(U);z&&w.push(z)}}}if(this.audioObjs&&this.audioObjs.length>0)for(let j of this.audioObjs)for(let L=0;L<j.audioSrcArray.length;L++){let U=j.audioSrcArray[L];if(U.includes("blob:http")){let z=this.uploadService.uploadPromises.get(U);z&&w.push(z)}}0===w.length?y():Promise.all(w).then(()=>{y()}).catch(()=>{O()})})}syncAssetURL(y,O,w){return new Promise((j,L)=>{this.expectedBlobUploadMap.clear();const U=new Array;for(const z of this.scenes){for(const $ of z.getDesignItemList()){const Y=$.getDesignItem();if($.getDesignItem().itemType===d.SP.MEDIA_CONTAINER){const Q=$,K=Q.getMediaObjects();if(K&&K.length>0){let W=0;
1for(const X of K){if("image"!==X.type||X.getElement()instanceof HTMLVideoElement){if(X.getElement()instanceof HTMLVideoElement){const V=Y.box.imgArray[W].imgName;V==y&&U.push(new Promise((le,fe)=>{const Ce=O;this.videoRepository.setVideoURLBlob(Ce,this.videoRepository.getVideoURLFile(y)),Q.addUpdateAsset(Ce,1,"",w,!1,this.design.templateType,!0).promise.then(()=>{this.updateDesignJson(),this.replaceRemoveBgURL(V,Ce),le()})}))}}else{let F=X.getElement();"IMG"!==F.tagName&&(F=X._originalElement),"IMG"==F.tagName&&F.src&&F.src==y&&U.push(new Promise((V,le)=>{const fe=O,Ce=w;Q.selectedMediaItemIndex=0,Q.changeSrc(fe,Ce,()=>{this.updateDesignJson(),this.replaceRemoveBgURL(F.src,fe),this.uploadService.removeLocalFile("temp-"+F.src),V()})}))}W++}}}}const Z=z.getBackgroundMedia();Z&&1===Z.getMediaType()&&Z.getImgName()==y&&U.push(new Promise((Y,Q)=>{const K=Z.toJson();K.imgName=O,Z.bgImageObj=K,Z.parseBG(!1).then(()=>{this.canvas.clear(),this.selectedScene.addToCanvas(this.canvas),Y()}).catch(()=>{Q()})})),Z&&0===Z.getMediaType()&&Z.getImgName()==y&&U.push(new Promise((Y,Q)=>{let K=Z.oImg.getElement();const W=O;Z.setImgName(W),this.updateDesignJson(),this.replaceRemoveBgURL(K.src,W),Y()}))}if(this.audioObjs&&this.audioObjs.length>0)for(let z of this.audioObjs)for(let Z=0;Z<z.audioSrcArray.length;Z++){let $=z.audioSrcArray[Z];$==y&&U.push(new Promise((Y,Q)=>{const K=O;z.audioSrcArray[Z]=K,this.updateDesignJson(),this.replaceRemoveBgURL($,K),Y()}))}0===U.length?j():Promise.all(U).then(()=>{j()}).catch(()=>{L()})})}uploadVideoFileToServer(){const y=new Array;for(const O of this.expectedBlobUploadMap.keys())y[y.length]=new Promise((w,j)=>{this.uploadService.addVideoFile(this.videoRepository.getVideoURLFile(O),L=>{this.isUserQuotaFull=!1,!1===L.status&&(this.isUserQuotaFull=!0,j())},L=>{L||j(),L.contentUrl||j();const U=L.contentUrl;this.videoRepository.setVideoURLBlob(U,this.videoRepository.getVideoURLFile(O));const z=L.assetId,Z=this.expectedBlobUploadMap.get(O),$=[];for(const Y of Z)$[$.length+1]=new Promise((Q,K)=>{Y.addUpdateAsset(U,1,"",z,!1,this.design.templateType,!0).promise.then(()=>{this.updateDesignJson(),this.replaceRemoveBgURL(O,U),Q()})});Promise.all($).then(()=>{w()}).catch(()=>{j()})},this.design.templateType)});return y}replaceRemoveBgURL(y,O){const w=new RegExp(y,"g");this.historyJsonArray.forEach(j=>{j.replace(w,O)})}updateDesignJson(){let y=this.getAudioJson();y&&y.length>0?(this.design.metadata.data.veMusic=y,this.design.metadata.data.music=y[0]):(delete this.design.metadata.data.music,delete this.design.metadata.data.veMusic),this.scenes.forEach(O=>O.toJson())}getUpdatedProjectJson(){for(const O of this.scenes)O.toJson();let y=this.getAudioJson();return y&&y.length>0?(this.design.metadata.data.veMusic=y,this.design.metadata.data.music=y[0]):(delete this.design.metadata.data.music,delete this.design.metadata.data.veMusic),JSON.parse(JSON.stringify(this.design.metadata.data))}duplicateScene(y){const O=this.scenes[y].toJson(),w=JSON.stringify(O),j=JSON.parse(w);this.addScene(j,O.pro,y+1),this.setDirty()}addScene(y,O,w){return y.pro=O,!w&&0!==w&&(w=this.design.metadata.data.sceneItems.length),new Promise((j,L)=>{this.inProgress=!0,this.design.metadata.data.sceneItems.splice(w,0,y),this.sceneParser.parseScene(y,this.canvas,!0).then(U=>{this.scenes.splice(w,0,U),this.inProgress=!1,U.setSceneThumbGenerator(this.sceneThumbGenerator),U.generateThumb(),U.onMediaAdjust=this.onMediaAdjust,U.onDirty=this.getOnDirtyFn(),U.onAddRemove=()=>{this.checkAndUpdateWatermark()},this.setDirty(),this.markWaterMakedRequired(),j(!0)})})}delete(y){return y>=0&&y<this.design.metadata.data.sceneItems.length&&this.design.metadata.data.sceneItems.length>1&&(this.design.metadata.data.sceneItems.splice(y,1),this.scenes.splice(y,1),this.markWaterMakedRequired(),this.selectScene(y===this.design.metadata.data.sceneItems.length?y-1:y),this.setDirty(),!0)}getAudioJson(){let y=null;if(this.audioObjs&&this.audioObjs.length>0){y=[];for(const O of this.audioObjs)y.push({volume:O.volume,end:O.startTime+(O.trimEnd-O.trimStart),start:O.startTime,localPath:"",trimStart:O.trimStart,loop:O.loop,trimEnd:O.trimEnd,filePath:O.audioSrcArray[0],fileFormat:O.format,assetId:O.assetId,name:O.name,startTime:O.startTime,order:O.order,trackId:O.trackId,trackItemId:O.trackItemId,speedFactor:O.speedFactor})}return y}playScene(y,O,w=null,j=!1){this.sceneParser.parseAnimation(y),y.getSceneAnimation().canvas=O,y.getSceneAnimation().play(!1,L=>{this.isPlaying=!0,this.playSceneAudio(j)},L=>{w&&w(),this.isPlaying=!1,this.pauseSceneAudio()},L=>{},j)}pauseSceneAudio(){this.audioObjs&&this.audioObjs.length>0&&this.audioObjs.forEach(y=>y.pause())}selectedSceneStartTime(){const y=this.scenes.indexOf(this.selectedScene);let O=0;for(let w=0;w<y;w++)O+=this.scenes[w].getDuration();return O}playSceneAudio(y=!1){if(this.audioObjs&&this.audioObjs.length>0)for(const O of this.audioObjs){let w=O.trimStart+this.selectedSceneStartTime()/1e3;O.playSceneAudio(w,O.trimEnd,this.editorVolume)}}
1stop(){o.fabric.util.requestAnimFrame(()=>{})}addAudioToProject(y,O,w={}){setTimeout(()=>{let j;if(this.audioObjs?w.isDetach?this.audioObjs.unshift(y):this.audioObjs.push(y):this.audioObjs=[y],j=w.trimEnd,this.onChange&&this.onChange({name:"music-add"}),this.state.editorType!=e._Y.VideoEditor){let L=this.getVideoDuration();y.trimEnd=y.audioElementDuration>L?L:y.audioElementDuration}else this.state.editorType===e._Y.VideoEditor&&(j||(y.trimEnd=y.audioElementDuration));O(),this.state.editorType!=e._Y.VideoEditor&&this.state.editorType!=e._Y.VideoTemplate&&this.setDirty()},0)}deleteAudioFromProject(y=!1){this.audioObjs&&this.audioObjs.length>0&&(this.pauseSceneAudio(),this.audioObjs=y?null:this.audioObjs.filter(O=>O!==this.selectedAudioObject),this.selectedAudioObject=null,this.onChange&&this.onChange({name:"music-delete"}),this.state.editorType!=e._Y.VideoEditor&&this.state.editorType!=e._Y.VideoTemplate&&this.setDirty())}getVideoDuration(){let y=0;for(let O=0;O<this.scenes.length;O++)y+=this.scenes[O].getDuration();return y}deleteSeletedDesignItem(){return this.selectedScene.deleteSeletedDesignItem()}duplicate(){this.selectedScene.selectedDesignItem&&this.selectedScene.selectedDesignItem.isOverlay()&&(this.inProgress=!0,this.mixedGroupBuilder.duplicate(this.selectedScene,this.canvas).finally(()=>this.inProgress=!1))}duplicateVideoEditor(y=null){this.selectedScene.selectedDesignItem&&this.selectedScene.selectedDesignItem.isOverlay()&&(this.inProgress=!0,this.mixedGroupBuilder.duplicate(this.selectedScene,this.canvas).then(O=>{y&&y(O)}).finally(()=>this.inProgress=!1))}deselectAll(){this.selectedScene&&this.selectedScene.deselectAll(this.state.editorType),this.selectedAudioObject=null}setDirty(y=!0){this.addHistory(this.design,y),this.dirty=!0}formatScene(y,O){this.canvas.clear();const w=l.Z.divideRatio(y,O);this.design.metadata.data.hRatio=w.hRatio,this.design.metadata.data.wRatio=w.wRatio,this.scenes.forEach(j=>j.formatScene(w.wRatio,w.hRatio,this.canvas,this.orignalwRatio,this.orignalhRatio)),this.selectedScene.addToCanvas(this.canvas),this.onFormate&&this.onFormate(),this.updateDesignJson(),this.setDirty(),this.checkAndUpdateWatermark()}reset(){this.selectedScene=null,this.design=null,this.scenes=[],this.audioObjs=null,this.isPlaying=!1,this.currentPlayTime=0,this.inProgress=!1}resetTimeline(){this.historyJsonArray=[],this.historyRemoveBgArray=new Array,this.historyPointer=-1,this.audioObjs&&this.deleteAudioFromProject(!0)}moveToNext(y){var O=this.scenes[y];this.scenes.splice(y,1),this.scenes.splice(y+1,0,O);let w=this.design.metadata.data.sceneItems[y];this.design.metadata.data.sceneItems.splice(y,1),this.design.metadata.data.sceneItems.splice(y+1,0,w),this.setDirty()}moveToPrev(y){var O=this.scenes[y];this.scenes.splice(y,1),this.scenes.splice(y-1,0,O);let w=this.design.metadata.data.sceneItems[y];this.design.metadata.data.sceneItems.splice(y,1),this.design.metadata.data.sceneItems.splice(y-1,0,w),this.setDirty()}cancelDownloading(){this.cancelDownloadingCallback()}setCancelDownloadingCallback(y){this.cancelDownloadingCallback=y}replaceTemplate(y,O,w,j,L){this.inProgress=!0,this.updateDesign(y,O,w,j),this.onMediaAdjust=L;const U=this.design.metadata.data;return this.markWaterMakedRequired(),this.sceneParser.parseProject(U,this.canvas,!0,this.onMediaAdjust).then(z=>{let Z=this.scenes[0];this.previousSceneWithCutout&&(Z=this.previousSceneWithCutout,this.previousSceneWithCutout=null),this.checkProfileTemplate(y,z[0],Z).then(()=>{this.scenes=z,this.selectScene(0),this.inProgress=!1,this.updateDesignJson(),this.setDirty(),z.forEach($=>{$.onDirty=this.getOnDirtyFn(),$.onAddRemove=()=>{this.checkAndUpdateWatermark()}})})})}checkProfileTemplate(y,O,w){return new Promise((j,L)=>{this.canvasService.replaceWithCutout2(O,w).then(U=>{U||(this.previousSceneWithCutout=w),j()})})}updateDesign(y,O,w,j){this.design.metadata.data={hRatio:O.hRatio,wRatio:O.wRatio,sceneItems:[O]},this.design.properties.aspect=y.aspect,this.design.properties.blendType=y.blendType,this.design.properties.dimension=y.dimension,this.design.properties.fill=y.fill,this.design.properties.format=y.format,this.design.properties.imageDisplayNameId=y.imageDisplayNameId,this.design.properties.imageFormat=y.imageFormat,this.design.properties.maintainAspect=y.maintainAspect,this.design.properties.opacity=y.opacity,this.design.properties.pro=y.pro,this.design.properties.hasProElements=0,this.design.properties.productImageId=y.productImageId,this.design.properties.repeat=y.repeat,this.design.properties.width=w,this.design.properties.height=j,this.design.properties.socialPlatformId=y.socialPlatformId,this.design.properties.originalSocialPlatformId=this.design.properties.socialPlatformId,this.design.properties.originalFormat=this.design.properties.format,this.design.properties.originalWidth=this.design.properties.width,this.design.properties.originalHeight=this.design.properties.height,this.orignalwRatio=this.design.metadata.data.wRatio,this.orignalhRatio=this.design.metadata.data.hRatio,this.design.metadata.data.sceneItems.forEac
1h(L=>L.pro=y.pro),this.design.properties.productId=y.productId}getExportedVideoUrl(y){return this.exportedVideos.get(y)}setExportedVideoUrl(y,O){this.exportedVideos.set(y,O)}release(){for(let y=0;y<this.scenes.length;y++){let O=this.scenes[y];for(let w=0;w<O.designItemList.length;w++){let j=O.designItemList[w];if("andorLottie"===j.type)lottie.destroy(j.lottieItem.name);else if("mediacontainer"===j.type)for(let L=0;L<j._mediaObjects.length;L++){let U=j._mediaObjects[L];U._element&&U._element.nodeName&&"VIDEO"===U._element.nodeName.toUpperCase()&&(U._element.src="",U._element.load(),U._element.remove(),U._element=null),U._originalElement&&U._originalElement.nodeName&&"VIDEO"===U._originalElement.nodeName.toUpperCase()&&(U._originalElement.src="",U._originalElement.load(),U._originalElement.remove(),U._originalElement=null)}}}}destroyAllLottie(){lottie.destroy()}getAllTextFonts(y,O){const w=[];for(const j of y)if(j instanceof P.$)for(const L of j._objects)if(L instanceof C.L){const U=L.getBaseText().fontFamily;U&&(w.find(Z=>Z.name===U)||w.push(O.getFontOption(U)))}return w}groupActiveSelection(y=[],O=null){if(O)return new S.y(O).andorObjList.forEach(L=>{y.push(L.getDesignItem().designEntityId)}),y;if(y&&y.length){const w=[];this.selectedScene.getDesignItemList().filter(U=>y.indexOf(U.getDesignItem().designEntityId)>-1).forEach(U=>{w.push(U.getboundingBox())});const L=new o.fabric.ActiveSelection(w,{canvas:this.canvas});this.canvas.setActiveObject(L)}}}return(k=A).\u0275fac=function(y){return new(y||k)(x.KVO(E.q),x.KVO(M.A),x.KVO(R.c),x.KVO(I.I),x.KVO(D.W),x.KVO(p.B),x.KVO(u.I),x.KVO(m.I))},k.\u0275prov=x.jDH({token:k,factory:k.\u0275fac}),A})()},66518:(_e,ie,g)=>{"use strict";g.d(ie,{k:()=>G});var n=g(16471),o=g(54438);let G=(()=>{var P;class h{constructor(){}setIconName(d){return n._Y.AIPhoto==d.editorType?d.iconName="aitoolsgrey":n._Y.Photo==d.editorType||n._Y.BatchEditor==d.editorType?d.iconName="photoeditor":n._Y.DesignTemplate==d.editorType?d.iconName="uploadimage":n._Y.VideoTemplate==d.editorType?d.iconName="videotemplates":n._Y.VideoEditor==d.editorType&&(d.iconName="videoeditor"),d}resetHistory(){localStorage.removeItem("toolHistory")}addToHistory(d){if(d?.toolName&&d?.title){let e=JSON.parse(localStorage.getItem("toolHistory")||"[]");const l=e.findIndex(_=>_.toolName==d.toolName&&_.editorType==d.editorType&&_.title==d.title);-1!==l&&e.splice(l,1),d=this.setIconName(d),e.unshift(d),e.length>10&&(e=e.slice(0,10)),localStorage.setItem("toolHistory",JSON.stringify(e))}}getHistory(){return JSON.parse(localStorage.getItem("toolHistory")||"[]")}}return(P=h).\u0275fac=function(d){return new(d||P)},P.\u0275prov=o.jDH({token:P,factory:P.\u0275fac,providedIn:"root"}),h})()},72662:(_e,ie,g)=>{"use strict";g.d(ie,{P:()=>h});var n=g(16471),o=g(67294),G=g(54321),P=g(54438);let h=(()=>{var a;class d{getTools(){return G.f_}getToolByFeatureType(l){return this.getTools().find(_=>_.featureType===l)}isEcommerceFeatureType(l){return(0,G.ZR)(l)}hasSlot(l,_){return!!l?.slots?.includes(_)}getAspectIcon(l){return"auto"!==l?.id&&l?.value?{"1:1":"squareicon","3:4":"portraiticon3_4","4:3":"landscapeicon4_3","9:16":"portraiticon9_16","16:9":"landscapeicon16_9","2:3":"portraiticon2_3","3:2":"landscapeicon3_2"}[l.value]||"squareicon":"autoratio"}getAspectPayload(l,_){return this.hasSlot(l,"aspect")&&null!=_?.qType?{[l?.aspect?.apiKey||"quality"]:_.qType}:{}}getTextPromptPayload(l,_,C){const S=(C||"").trim(),x=l?.prompt?.apiKey||"textPrompt";if(this.hasSlot(l,"color")){const E=(_||"").replace(/^#/,"").trim(),M=S?`${E}|${S}`:E;return M?{[x]:M,isCustomPrompt:1}:{}}return S?{[x]:S,isCustomPrompt:1}:{}}getMobileListLinks(){return this.getListLinks(o.sv.AI_QUICK_EDIT_TOOL)}getDesktopListLinks(){return this.getListLinks("aitools","aitools")}getListLinks(l,_){return this.getTools().map(C=>({id:`ecom-${C.featureType}`,text:C.featureName,url:C.squareVideoUrl,icon:C.icon,metadata:{featureType:C.featureType,iconUrl:C.mobileResponsiveWebFeatureIcon,isNew:C.isNew,isEcommerce:!0,tabName:l,toolName:_||C.featureType,subTool:C.featureType,editorType:n._Y.Photo}}))}}return(a=d).\u0275fac=function(l){return new(l||a)},a.\u0275prov=P.jDH({token:a,factory:a.\u0275fac}),d})()},40618:(_e,ie,g)=>{"use strict";g.d(ie,{s:()=>Ze});var n=g(10467),o=g(54438),G=g(16471),P=g(16478),h=g(74710),a=g(80006),d=g(33391),e=g(94223),l=g(65290),_=g(10634),C=g(68287),S=g(74983),x=g(68010),E=g(630),M=g(79829),R=g(60177),I=g(68064),D=g(18545);const p=de=>({"d-none":de}),u=de=>[de],m=de=>({"pe-none":de});function b(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",12),o.bIt("click",function(){const be=o.eBV(ue).$implicit;o.XpG(3);const ye=o.sdS(3),Ve=o.XpG();return o.Njj(Ve.changeStep(be,ye))}),o.j41(1,"div",13),o.EFF(2),o.k0s(),o.nrm(3,"img",14),o.k0s()}if(2&de){const ue=Ie.$implicit;
1o.R7$(2),o.JRh(ue.featureName),o.R7$(),o.FS9("src",ue.mobileAppFeatureIcon,o.B4B)}}function k(de,Ie){if(1&de&&(o.qex(0),o.j41(1,"div",10),o.DNE(2,b,4,2,"div",11),o.k0s(),o.bVm()),2&de){const ue=o.XpG(3);o.R7$(2),o.Y8G("ngForOf",ue.tools)}}function A(de,Ie){1&de&&o.nrm(0,"div",16)}function B(de,Ie){if(1&de&&(o.qex(0),o.DNE(1,A,1,0,"div",15),o.bVm()),2&de){const ue=o.XpG(3);o.R7$(),o.Y8G("ngForOf",ue.tools)}}function y(de,Ie){if(1&de){const ue=o.RV6();o.qex(0),o.j41(1,"div",3)(2,"div",4)(3,"div",5)(4,"div",6),o.EFF(5,"Quick Edit Tools"),o.k0s(),o.j41(6,"div",7)(7,"pi",8),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(2);return o.Njj(be.closeDrawer(!0))}),o.k0s()()(),o.j41(8,"div",9),o.DNE(9,k,3,1,"ng-container",1)(10,B,2,1,"ng-container",1),o.k0s()()(),o.bVm()}if(2&de){const ue=o.XpG(2);o.R7$(9),o.Y8G("ngIf",ue.isLoaded),o.R7$(),o.Y8G("ngIf",!ue.isLoaded)}}function O(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",26),o.bIt("pointerdown",function(){o.eBV(ue);const be=o.XpG(4);return o.Njj(be.onPointerDown())})("pointerup",function(){o.eBV(ue);const be=o.XpG(4);return o.Njj(be.onPointerUp())})("pointercancel",function(){o.eBV(ue);const be=o.XpG(4);return o.Njj(be.onPointerUp())})("pointerleave",function(){o.eBV(ue);const be=o.XpG(4);return o.Njj(be.onPointerUp())}),o.nrm(1,"pi",27),o.k0s()}}function w(de,Ie){if(1&de&&(o.j41(0,"div",22)(1,"div",23),o.nrm(2,"img",24),o.nI1(3,"safe"),o.nrm(4,"img",24),o.nI1(5,"safe"),o.DNE(6,O,2,0,"div",25),o.k0s()()),2&de){const ue=o.XpG(3);o.R7$(2),o.Y8G("src",o.i5U(3,5,ue.imgUrl,"url"),o.B4B)("ngClass",o.eq3(11,p,ue.isCompare)),o.R7$(2),o.Y8G("src",o.i5U(5,8,ue.aiPhotoService.compareImageUrl,"url"),o.B4B)("ngClass",ue.isCompare?"d-block":"d-none"),o.R7$(2),o.Y8G("ngIf",ue.aiPhotoService.isDirty)}}function j(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",28)(1,"button",29),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(3);return o.Njj(be.download())}),o.EFF(2," Download "),o.k0s()()}}function L(de,Ie){1&de&&(o.j41(0,"div",36)(1,"span",37),o.EFF(2,"
1Loading..."),o.k0s()())}function U(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",28)(1,"button",30),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(3);return o.Njj(be.generate(be.selectedTool))}),o.DNE(2,L,3,0,"div",31),o.j41(3,"span",32),o.EFF(4),o.k0s(),o.j41(5,"span",33),o.nrm(6,"img",34),o.j41(7,"b",35),o.EFF(8),o.k0s()()()()}if(2&de){const ue=o.XpG(3);o.R7$(2),o.Y8G("ngIf",ue.aiPhotoService.inProgress),o.R7$(2),o.JRh((null==ue.selectedTool?null:ue.selectedTool.featureName)||(null==ue.selectedTool?null:ue.selectedTool.text)),o.R7$(4),o.JRh(ue.quality)}}function z(de,Ie){if(1&de&&(o.qex(0),o.j41(1,"div",17)(2,"div",18)(3,"div",19),o.DNE(4,w,7,13,"div",20),o.k0s()(),o.DNE(5,j,3,0,"div",21)(6,U,9,3,"div",21),o.k0s(),o.bVm()),2&de){const ue=o.XpG(2);o.R7$(4),o.Y8G("ngIf",""!=ue.imgUrl),o.R7$(),o.Y8G("ngIf",ue.aiPhotoService.isDirty),o.R7$(),o.Y8G("ngIf",!ue.aiPhotoService.isDirty)}}function Z(de,Ie){if(1&de){const ue=o.RV6();o.qex(0),o.DNE(1,y,11,2,"ng-container",1),o.j41(2,"input",2,0),o.bIt("change",function(be){o.eBV(ue);const ye=o.XpG();return o.Njj(ye.onFileUploaded(be.srcElement.files))})("click",function(){o.eBV(ue);const be=o.sdS(3);return o.Njj(be.value="")}
1),o.k0s(),o.DNE(4,z,7,3,"ng-container",1),o.bVm()}if(2&de){const ue=o.XpG();o.R7$(),o.Y8G("ngIf",1==ue.step),o.R7$(),o.Y8G("accept",ue.aiUploadImageService.fileImageAccept),o.R7$(2),o.Y8G("ngIf",2==ue.step&&ue.selectedTool)}}function $(de,Ie){1&de&&o.nrm(0,"div",51)}function Y(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"a",44),o.bIt("click",function(){const be=o.eBV(ue).$implicit,ye=o.XpG(4);return o.Njj(ye.changeStep(be))}),o.j41(1,"div",45),o.bIt("mouseenter",function(){const be=o.eBV(ue).$implicit,ye=o.XpG(4);return o.Njj(ye.playVideo("video"+be.id,be.id))})("mouseleave",function(){const be=o.eBV(ue).$implicit,ye=o.XpG(4);return o.Njj(ye.pauseVideo("video"+be.id,be.id))}),o.DNE(2,$,1,0,"div",46),o.j41(3,"div",47)(4,"video",48),o.nrm(5,"source",49),o.EFF(6," Your browser does not support the video tag. "),o.k0s()(),o.j41(7,"div",50),o.EFF(8),o.k0s()()()}if(2&de){const ue=Ie.$implicit,ge=o.XpG(4);o.R7$(2),o.Y8G("ngIf",1==ue.isNew),o.R7$(2),o.AVh("playing",ge.isPlaying(ue.id)),o.FS9("id","video"+ue.id),o.R7$(),o.FS9("src",ue.squareVideoUrl,o.B4B),o.R7$(3),o.JRh(ue.featureName)}}function Q(de,Ie){if(1&de&&(o.j41(0,"div",42),o.DNE(1,Y,9,6,"a",43),o.k0s()),2&de){const ue=o.XpG(3);o.Y8G("ngClass",o.eq3(2,u,ue.inProgress?"pe-none":"lllll")),o.R7$(),o.Y8G("ngForOf",ue.tools)}}function K(de,Ie){1&de&&(o.j41(0,"a")(1,"div",54),o.nrm(2,"div",47),o.k0s()())}function W(de,Ie){if(1&de&&(o.j41(0,"div",52),o.DNE(1,K,3,0,"a",53),o.k0s()),2&de){const ue=o.XpG(3);o.R7$(),o.Y8G("ngForOf",ue.tools)}}function X(de,Ie){if(1&de&&(o.qex(0),o.j41(1,"div",38)(2,"span",39),o.EFF(3,"Quick Edits "),o.k0s()(),o.DNE(4,Q,2,4,"div",40)(5,W,2,1,"div",41),o.bVm()),2&de){const ue=o.XpG(2);o.R7$(4),o.Y8G("ngIf",ue.isLoaded),o.R7$(),o.Y8G("ngIf",!ue.isLoaded)}}function F(de,Ie){if(1&de&&(o.j41(0,"div",62)(1,"video",63),o.nrm(2,"source",49),o.EFF(3," Your browser does not support the video tag. "),o.k0s()()),2&de){const ue=o.XpG(3);o.R7$(),o.AVh("playing",ue.videoPlaying),o.FS9("id","video"+ue.selectedTool.id),o.R7$(),o.FS9("src",ue.selectedTool.landscapeVideoUrl,o.B4B)}}function V(de,Ie){1&de&&o.nrm(0,"div",36)}function le(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",64)(1,"div",65),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(3);return o.Njj(be.generate(be.selectedTool))}),o.j41(2,"button",66),o.DNE(3,V,1,0,"div",31),o.j41(4,"span",67),o.EFF(5),o.k0s()()(),o.j41(6,"div",68)(7,"span"),o.EFF(8,"1 generation ="),o.k0s(),o.j41(9,"span",69),o.nrm(10,"img",70),o.k0s(),o.j41(11,"span"),o.EFF(12),o.k0s()()()}if(2&de){const ue=o.XpG(3);o.R7$(2),o.Y8G("disabled",!ue.imgUrl||""==ue.imgUrl),o.R7$(),o.Y8G("ngIf",""==ue.imgUrl),o.R7$(2),o.JRh(ue.selectedTool.featureName),o.R7$(7),o.SpI("",ue.quality," credits")}}function fe(de,Ie){if(1&de){const ue=o.RV6();o.j41(0,"div",71)(1,"div",72)(2,"button",73),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(3);return o.Njj(be.closeDrawer(!0))}),o.EFF(3,"Cancel"),o.k0s(),o.j41(4,"button",74),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(3);return o.Njj(be.apply())}),o.EFF(5,"Apply"),o.k0s()()()}if(2&de){const ue=o.XpG(3);o.R7$(2),o.Y8G("disabled",ue.aiPhotoService.inProgress),o.R7$(2),o.Y8G("disabled",ue.aiPhotoService.inProgress)}}function Ce(de,Ie){if(1&de){const ue=o.RV6();o.qex(0),o.j41(1,"div",55)(2,"div",56)(3,"pi",57),o.bIt("click",function(){o.eBV(ue);const be=o.XpG(2);return o.Njj(be.backDrawer(!1))}),o.k0s(),o.j41(4,"span",58),o.EFF(5),o.k0s()(),o.DNE(6,F,4,4,"div",59)(7,le,13,4,"div",60)(8,fe,6,2,"div",61),o.k0s(),o.bVm()}if(2&de){const ue=o.XpG(2);o.R7$(3),o.Y8G("ngClass",o.eq3(5,m,ue.aiPhotoService.inProgress)),o.R7$(2),o.JRh(ue.selectedTool.featureName),o.R7$(),o.Y8G("ngIf",!ue.videoload&&(null==ue.selectedTool?null:ue.selectedTool.landscapeVideoUrl)),o.R7$(),o.Y8G("ngIf",!ue.aiPhotoService.isDirty&&!ue.aiPhotoService.inProgress),o.R7$(),o.Y8G("ngIf",ue.aiPhotoService.isDirty||ue.aiPhotoService.inProgress)}}function Ne(de,Ie){if(1&de&&(o.qex(0),o.DNE(1,X,6,2,"ng-container",1)(2,Ce,9,7,"ng-container",1),o.bVm()),2&de){const ue=o.XpG();o.R7$(),o.Y8G("ngIf",1==ue.step),o.R7$(),o.Y8G("ngIf",2==ue.step&&ue.selectedTool)}}let Ze=(()=>{var de;class Ie{constructor(ge,be,ye,Ve,ot,ct,pe,rt,he,ze,Fe,we,qe){this.activatedRoute=ge,this.router=be,this.aiUploadImageService=ye,this.activeModal=Ve,this.aiPhotoService=ot,this.quickEditService=ct,this.paymentService=pe,this.offcanvasService=rt,this.env=he,this.toast=ze,this.authService=Fe,this.createPopupService=we,this.photoEditorService=qe,this.isCompare=!1,this.isDialog=!1,this.inProgress=!1,this.openCloseEvent=ne
1w o.bkB,this.updateImageEvent=new o.bkB,this.applyImageEvent=new o.bkB,this.videoPlaying=!1,this.step=1,this.tools=[],this.pageNumber=0,this.isLoaded=!1,this.disabled=!1,this.isFocused=!1,this.quality=1,this.prompts=[],this.imageproductId=2,this.originalImageUrl="",this.videoload=!1,this.isShowPreview=!1,this.firstImageLoaded=!1,this.playingSet=new Set,this.user=this.authService.currentUser(),this.loggedInObserver=this.authService.loggedIn.subscribe(et=>{this.user=this.authService.currentUser()}),this.updateBehaviorUserAiConis=this.authService.updateBehaviorUserAiConis.subscribe(et=>{this.user=this.authService.currentUser(),et&&setTimeout(()=>{},200)}),this.usrPropChangedObserver=this.authService.usrPropChanged.subscribe(et=>{this.user=this.authService.currentUser(),et&&this.authService.updateUserAiConis(()=>{})}),this.usrAICreditChanged=this.authService.usrAICreditChanged.subscribe(et=>{this.user=this.authService.currentUser(),et&&this.authService.updateUserAiConis(()=>{})}),this.imageUploadChnage=this.aiPhotoService.imageUpload.subscribe(et=>{if(et){this.videoload=!0,this.aiPhotoService.isDirty=!1;const Ct=String(this.imgUrl||this.aiPhotoService.imgUrl||"");if(Ct&&(this.aiPhotoService.compareImageUrl=Ct),ot.quickEditReset&&(this.selectedTool=null,ot.quickEditReset=!1),2==this.step&&this.selectedTool)this.changeStep(this.selectedTool,null,!0);else if(this.tools.length>0){const kt=this.router.routerState.snapshot.root.queryParamMap.get("subTool"),xt=this.tools.find(Tt=>Tt.featureType==kt);xt?this.changeStep(xt,null,!0):(this.selectedTool=null,this.step=1)}else this.selectedTool=null,this.step=1}else!et&&!this.imgUrl&&1!=this.step&&(this.step=1);setTimeout(()=>{this.videoload=!1},400)}),this.paymentServiceSubs=this.paymentService.configUpdated.subscribe(et=>{et&&!this.config&&this.getModels()})}getModels(){this.config=this.paymentService.config}getToolQuality(ge){const be=ge?.metadata?.featureType||ge?.featureType;return this.config?.creditInfo?.[be]??1}ngOnChanges(ge){if(ge.imgUrl&&""!=ge.imgUrl.currentValue){const be=this.aiPhotoService.isDirty;this.aiPhotoService.inProgress=!1,this.env.isMobileView?this.aiPhotoService.aiImages=[]:this.aiPhotoService.isDirty=!1,be||(this.aiPhotoService.compareImageUrl=String(ge.imgUrl.currentValue||""))}ge.inProgress&&ge.inProgress.currentValue&&(this.inProgress=ge.inProgress.currentValue)}ngOnInit(){this.aiPhotoService.inProgress=!1,this.aiPhotoService.isDirty=!1,this.env.isMobileView&&this.selectedTool?this.quality=this.getToolQuality(this.selectedTool):this.getQuickEditTools()}ngOnDestroy(){this.reset()}reset(){this.aiPhotoService.inProgress=!1,this.aiPhotoService.isDirty=!1,this.inProgress=!1,this.aiPhotoService.aiImages=[]}isWebpUrl(ge){return!!ge&&String(ge).split("#")[0].split("?")[0].toLowerCase().endsWith(".webp")}getQuickEditTools(){this.isLoaded=!1,this.quickEditService.getQuickEditsLists(this.pageNumber,ge=>{setTimeout(()=>{this.isLoaded=!0},200),ge&&ge?.body&&(this.tools=ge?.body.dynamicFeatureTypes||[],this.aiPhotoService.quickEditTools=this.tools,this.tools.length>0&&!this.isDialog&&this.getdeeplink())},ge=>{this.isLoaded=!0})}getdeeplink(){const ge=this.router.routerState.snapshot.root.queryParamMap.get("subTool"),be=this.router.routerState.snapshot.root.queryParamMap.get("toolName");let ye=ge?this.tools.find(Ve=>Ve.featureType==ge):null;!ye&&be&&(ye=this.tools.find(Ve=>
1Ve.featureType==be)),ye&&(this.quality=this.getToolQuality(ye),this.changeStep(ye,null,!0))}toggleVideo(ge){this.videoPlaying=!this.videoPlaying;const be=document.getElementById(ge);this.videoPlaying?be.play():(be.pause(),setTimeout(()=>{be.currentTime=0},200))}changeStep(ge,be=null,ye=!1){this.env.isMobileView?(this.selectedTool=ge,this.activeModal.close(ge)):(this.imgUrl||ye||this.aiPhotoService.elementClick?(this.step=2,this.selectedTool=ge,ye=!!this.aiPhotoService.elementClick||ye,this.aiPhotoService.elementClick=!1):(this.step=1,this.selectedTool=null),this.aiPhotoService.selectedTool=this.selectedTool,this.quality=this.getToolQuality(ge),this.openCloseEvent.emit({isQuickEditOpen:!0,isImg:ye,subTool:ge.featureType,title:ge?.featureName}),setTimeout(()=>{this.reset()},200))}onFileUploaded(ge){ge&&(this.file=ge[0],this.imgUrl=this.aiPhotoService.imgUrl=window.URL.createObjectURL(this.file))}download(){this.aiPhotoService.downloadImg(this.imgUrl)}apply(){this.step=1,this.selectedTool=null,this.openCloseEvent.emit({isQuickEditOpen:!1,isApply:!0})}generate(ge,be=!1){if(this.selectedTool=ge,this.aiPhotoService.isCancel)return void this.toast.showErrorSingle(P.b.message.uploadNewImage);if(this.aiPhotoService.inProgress&&!be)return;let ye="";if(!this.imgUrl&&!this.aiPhotoService.compareImageUrl&&(ye=this.router.routerState.snapshot.root.queryParamMap.get("img"),this.imgUrl=this.aiPhotoService.compareImageUrl=ye),!this.aiPhotoService.isDirty){const pe=this.imgUrl||this.aiPhotoService.compareImageUrl||ye;pe&&(this.aiPhotoService.compareImageUrl=pe)}let Ve=this.selectedTool?.featureType;if(this.selectedTool?.metadata?.featureType&&(Ve=this.selectedTool?.metadata?.featureType),Ve=Ve||"image2image",!(this.user&&this.user.remainingCoins>=this.quality))return void(this.env.isMobileView?this.loginAndAICredit(this.selectedTool):this.aiPhotoService.openAICreditPopup(()=>{this.user=this.authService.currentUser(),this.generate(this.selectedTool)},this.quality));const ot=this.imgUrl||this.aiPhotoService.compareImageUrl||ye;if(this.aiUploadImageService.isBlobUrl(ot)||this.isWebpUrl(ot))return this.imgUrl=ot,this.startQuickEditProgress(Ve),this.updateImageEvent.emit(this.aiPhotoService),void this.generateImage(ge);const ct={imageUrl:this.imgUrl?this.imgUrl:this.aiPhotoService.compareImageUrl?this.aiPhotoService.compareImageUrl:ye,featureType:Ve};this.aiPhotoService.processingProgress?.isActive?(this.aiPhotoService.inProgress=!0,this.photoEditorService&&(this.aiPhotoService.processingProgress.progressMessage=P.b.label.generatingImage,this.photoEditorService.inProgress=!0)):this.startQuickEditProgress(Ve),this.updateImageEvent.emit(this.aiPhotoService),this.aiPhotoService.generateImage(ct,pe=>{pe&&pe.assetId?(pe.toolPrompt=this.aiPhotoService.textPrompt||"",pe.width=Number(this.aiPhotoService.queryParams?._w),pe.height=Number(this.aiPhotoService.queryParams?._h),pe.featureType=G.Fs.ImageToImage,pe.toolName=P.b.label.text2Image,this.aiPhotoService.checkStatus(pe,0,he=>{he&&he.urls&&he.urls.length>0?(this.user.remainingCoins=he.remainingCalls,this.aiPhotoService.isDirty=!0,this.imgUrl=he.urls[0],this.updateImageEvent.emit(he.urls[0]),this.aiPhotoService.generateImageFn({isQuickEdit:!0})):(this.aiPhotoService.clearGenerationProgress(),this.updateImageEvent.emit(this.aiPhotoService))}
1,he=>{this.displayErrorMsg(he)})):this.displayErrorMsg(pe)},pe=>{this.displayErrorMsg(pe)})}displayErrorMsg(ge=null){this.aiPhotoService.clearGenerationProgress(),this.photoEditorService?.clearProcessingProgress(),this.updateImageEvent.emit(this.aiPhotoService);let be=ge?.description;this.createPopupService.openWarningDialog("Error",be)}startQuickEditProgress(ge){if(this.photoEditorService)return this.photoEditorService.startGenerationProgress({featureType:ge}),void(this.aiPhotoService.inProgress=!0);this.aiPhotoService.startGenerationProgress({featureType:ge})}closeDrawer(ge=!1){this.env.isMobileView?this.activeModal.close():(this.reset(),this.step=1,this.openCloseEvent.emit({isQuickEditOpen:!1,isCancel:ge}))}backDrawer(ge=!1){this.env.isMobileView?this.activeModal.close():(this.step=1,this.openCloseEvent.emit({isQuickEditOpen:!1,isback:!0,isReset:this.aiPhotoService.isDirty}),this.reset())}touchstart(){this.isCompare=!0}touchend(){this.isCompare=!1}onPointerDown(){clearTimeout(this.compareTimeout),this.compareTimeout=setTimeout(()=>{this.isCompare=!0},50)}onPointerUp(){clearTimeout(this.compareTimeout),this.isCompare=!1}generateImage(ge){var be=this;return(0,n.A)(function*(){try{const ye=yield be.aiUploadImageService.blobImageUrlToFile(be.imgUrl,"untitled.png");be.aiUploadImageService.aiUploadImage(ye,{tab:"aitools",uploadProgress:"none",isStyleRefImage:!0}).then(Ve=>{Ve.imgUrl?(be.imgUrl=Ve.imgUrl,be.generate(ge,!0)):be.displayErrorMsg(Ve)}).catch(Ve=>{be.displayErrorMsg(Ve)})}catch(ye){be.displayErrorMsg(ye)}})()}loginAndAICredit(ge){this.user?this.user.remainingCoins>=this.quality?this.generate(this.selectedTool):this.openCloseEvent.emit({addCredit:!0}):this.aiPhotoService.loginAndAICredit(be=>{this.user=this.authService.currentUser(),this.user&&(this.user.remainingCoins<this.quality?this.openCloseEvent.emit({addCredit:!0}):this.generate(ge))})}isPlaying(ge){return this.playingSet.has(ge)}playVideo(ge,be){const ye=document.getElementById(ge);ye&&ye.play().then(()=>{this.playingSet.add(be)}).catch(()=>{this.playingSet.delete(be)})}pauseVideo(ge,be){const ye=document.getElementById(ge);ye&&(ye.pause(),ye.currentTime=0,this.playingSet.delete(be))}}return(de=Ie).\u0275fac=function(ge){return new(ge||de)(o.rXU(h.nX),o.rXU(h.Ix),o.rXU(a.M),o.rXU(d.Lw),o.rXU(e.s),o.rXU(l.P),o.rXU(_.W),o.rXU(d.RS),o.rXU(C.L),o.rXU(S.f),o.rXU(x.u),o.rXU(E.A),o.rXU(M.p,8))},de.\u0275cmp=o.VBU({type:de,selectors:[["quick-edits"]],inputs:{isDialog:"isDialog",selectedTool:"selectedTool",imgUrl:"imgUrl",inProgress:"inProgress",step:"step"},outputs:{openCloseEvent:"openCloseEvent",updateImageEvent:"updateImageEvent",applyImageEvent:"applyImageEvent"},features:[o.OA$],decls:2,vars:2,consts:[["file",""],[4,"ngIf"],["id","tools","name","tools","type","file",1,"custom-file-input","d-none",3,"change","click","accept"],[1,"ps-3","pe-1","pt-3"],[1,"bg-white","border-radius-20","w-100",2,"min-height","336px"],[1,"d-flex","align-items-center","justify-content-between","pb-2"],[1,"text-lg","text-semi","text-dark"],[1,"pr-8"],["name","previewclose",3,"click"],[1,"overflow-auto",2,"max-height","85dvh","min-height","100%"],[2,"padding","0 12px 0 0"],["class","d-flex align-items-center justify-content-between toolBox mt-2",3,"click",4,"ngFor","ngForOf"],[1,"d-flex","align-items-center","justify-content-between","toolBox","mt-2",3,"click"],[1,"text-12","text-semi","text-dark"],["width","66","height","48",1,"border-radius-8",3,"src"],["class","toolBoxPlaceholder mb-2",4,"ngFor","ngForOf"],[1,"toolBoxPlaceholder","mb-2"],[1,"position-relative",2,"height","max-content"],[1,"drawer-elements","ai-drawer-elements"],[1,"d-flex","align-items-center","justify-content-center","overflow-hidden","w-100","flex-column","p-3","text-image-height",2,"height","calc(100dvh - 114px)"],["class","res-round h-100 d-flex align-items-center w-100",4,"ngIf"],["class","position-fixed ps-3 pe-3 d-flex align-items-center justify-content-center w-100 mb-1",4,"ngIf"],[1,"res-round","h-100","d-flex","align-items-center","w-100"],[1,"position-relative","quick-edit-height","bg-grey3","border-radius-12","w-100"],["height","","width","",1,"pe-none",3,"src","ngClass"],["class","d-flex align-items-center justify-content-center position-absolute hw-40 border-radius-50 btn-alpha","style","bottom: 8px; left: 8px;z-index: 10;",3,"pointerdown","pointerup","pointercancel","pointerleave",4,"ngIf"],[1,"d-flex","align-items-center","justify-content-center","position-absolute","hw-40","border-radius-50","btn-alpha",2,"bottom","8px","left","8px","z-index","10",3,"pointerdown","pointerup","pointercancel","pointerleave"],["name","comparewhite",1,"f-24","text-white"],[1,"position-fixed","ps-3","pe-3","d-flex","align-items-center","justify-content-center","w-100","mb-1"],["
1id","gtm-generate",1,"btn","btn-primary","btn-primary-m","text-lg","btn-h48","w-100","d-flex","align-items-center","justify-content-center",3,"click"],["id","gtm-generate-mob",1,"btn","btn-primary-gradient","border-0","btn-primary-m","text-lg","btn-h44","w-100","d-flex","align-items-center","justify-content-center",3,"click"],["class","spinner-border spinner-border-lg me-2 hw-24","role","status",4,"ngIf"],[1,"text-lg"],[1,"coin-count","d-inline-flex","align-items-center","justify-content-center","ms-2"],["src","https://static.lightxeditor.com/assets/images/Coin-AI-16.svg","height","16px","width","16px",1,"inable"],[1,"text-11","text-semi",2,"padding-left","2px"],["role","status",1,"spinner-border","spinner-border-lg","me-2","hw-24"],[1,"sr-only","text-nowrap","border-0","position-absolute","overflow-hidden"],[1,"d-flex","align-items-center","justify-content-between",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125"],["class","ai-video-list d-flex align-items-start h-100",3,"ngClass",4,"ngIf"],["class","ai-video-list d-flex align-items-start mb-8","style","min-height: 200px;",4,"ngIf"],[1,"ai-video-list","d-flex","align-items-start","h-100",3,"ngClass"],["target","_blank",3,"click",4,"ngFor","ngForOf"],["target","_blank",3,"click"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-3","position-relative",3,"mouseenter","mouseleave"],["class","new_item",4,"ngIf"],[1,"videoThumb"],["loop","",2,"border-radius","8px","width","100%",3,"id"],["type","video/mp4",3,"src"],[1,"tool-name","text-medium","mt-1"],[1,"new_item"],[1,"ai-video-list","d-flex","align-items-start","mb-8",2,"min-height","200px"],[4,"ngFor","ngForOf"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-9","position-relative",2,"background","rgba(160, 159, 175, .1)"],[1,"quickEditDrawer"],[1,"d-flex","align-items-center","w-100",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click","ngClass"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["class","d-flex align-items-center justify-content-between",4,"ngIf"],["class","position-fixed fixed-bottom pb-1 pt-8 ps-3 pe-3 bg-white",4,"ngIf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3",4,"ngIf"],[1,"d-flex","align-items-center","justify-content-between"],["loop","","muted","","autoplay","","playsinline","",1,"w-100","border-radius-12",3,"id"],[1,"position-fixed","fixed-bottom","pb-1","pt-8","ps-3","pe-3","bg-white"],[1,"d-flex","align-items-center","justify-content-center","w-100","mb-1","isgenerate","pointer",3,"click"],["id","gtm-generate",1,"btn","btn-primary-gradient","text-13","btn-h40","w-100","d-flex","align-items-center","justify-content-center",3,"disabled"],[1,"text-13"],[1,"credit-description","d-flex","align-items-center","justify-content-center","w-100"],[1,"ms-2","me-2"],["src","https://static.lightxeditor.com/assets/images/coin-lottie-s-anim.gif","width","24px","height","24px","alt","Coin Lottie"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"]],template:function(ge,be){1&ge&&o.DNE(0,Z,5,3,"ng-container",1)(1,Ne,3,2,"ng-container",1),2&ge&&(o.Y8G("ngIf",be.env.isMobileView),o.R7$(),o.Y8G("ngIf",!be.env.isMobileView))},dependencies:[R.YU,R.Sq,R.bT,I.b,h.wQ,D.m],styles:[".ai-video-list[_ngcontent-%COMP%]{flex-flow:wrap;justify-content:space-between}.ai-video-list[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{text-decoration:none;outline:none}.ai-video-list[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:none}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]{width:84px;flex-direction:column;border-radius:8px;justify-content:flex-end;cursor:pointer}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]:hover .tool-name[_ng
1content-%COMP%]{color:#000;transition:color .3s ease-in-out}.videoThumb[_ngcontent-%COMP%]{width:84px;height:84px;overflow:hidden;display:flex;align-items:center;justify-content:center;border-radius:8px;transition:opacity .3s ease-in,visibility .3s ease-in!important}.videoThumb[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{transform:scale(1.1);transition:transform .2s ease-in}.videoThumb[_ngcontent-%COMP%]:hover video[_ngcontent-%COMP%]{transform:scale(1);transition:transform .2s ease-in}.tool-name[_ngcontent-%COMP%]{width:100%;position:relative;font-size:12px;color:#4a4f5e;text-align:center;padding:0;line-height:140%}.new_item[_ngcontent-%COMP%], .new_badge[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;padding-right:0;z-index:1}.new_item[_ngcontent-%COMP%]:after, .new_badge[_ngcontent-%COMP%]:after{content:url(https://static.lightxeditor.com/assets/icons/newbadge.svg);position:relative;top:0}.toolBox[_ngcontent-%COMP%]{border-radius:12px;background:#626adf0d;min-height:56px;padding:0 4px 0 12px}.toolBox[_ngcontent-%COMP%]:last-child{margin-bottom:16px}[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #e2e3e9;border-radius:12px;margin-top:5px;margin-bottom:5px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#b0b3bf;border-radius:12px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#b0b3bf}.btn[_ngcontent-%COMP%]:disabled .coin-count[_ngcontent-%COMP%]{background:#0000001a}.coin-count[_ngcontent-%COMP%]{border-radius:48px;background:#0006;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);height:18px;padding:1px 4px 1px 1px}.coin-count[_ngcontent-%COMP%] b[_ngcontent-%COMP%]{color:#fff!important}.toolBoxPlaceholder[_ngcontent-%COMP%]{border-radius:12px;background:#a09faf1a;min-height:56px;padding:0 4px 0 12px}.res-round[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:100%;max-height:100%}.report-flag[_ngcontent-%COMP%]{border-radius:100px;background:#60657633;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);right:8px}"]}),Ie})()},65290:(_e,ie,g)=>{"use strict";g.d(ie,{P:()=>P});var n=g(45312),o=g(54438),G=g(95301);let P=(()=>{var h;class a{constructor(e){this.dataService=e,this.baseUrl=n.c.baseUrl,this.centralStoreUrl=n.c.centralStoreUrl,this.centralStoreUrlPart=n.c.centralStoreUrlPart+"central/",this.webcentralStoreUrlPart=n.c.centralStoreUrlPart+"webcentral/",this.quickEditTools=[]}getQuickEditsLists(e,l,_){this.dataService.get(this.centralStoreUrl+this.centralStoreUrlPart+"getDynamicFeatureTypes?categoryId=&start=0&rows=99",!0).subscribe(x=>{x&&2e3===x.statusCode?(this.quickEditTools=x?.body?.dynamicFeatureTypes||[],l(x)):_(x.description)},x=>{_()})}}return(h=a).\u0275fac=function(e){return new(e||h)(o.KVO(G.u))},h.\u0275prov=o.jDH({token:h,factory:h.\u0275fac,providedIn:"root"}),a})()},18050:(_e,ie,g)=>{"use strict";g.d(ie,{y:()=>l});var n=g(60177),o=g(33726),G=g(70152),P=g(23294),h=g(79358),a=g(54438);const d=["expander"],e=(_,C)=>({"touch-bg":_,"expander-size-sm":C});let l=(()=>{var _;class C{constructor(x,E){this._document=x,this.bodyReshapeService=E,this.position={x:-1,y:-1},this.size={w:200,h:200},this.minSize={w:200,h:200},this.isResizing=!1,this.currentHandle=null,this.initialZoom=0,this.rightBottom={left:"0",top:"0"},this.leftBottom={left:"0",top:"0"},this.touchType=-1,this.isDraggingEnabled=!0,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.dragStartLeft=0,this.dragStartTop=0,this.isRoundInstance2=!1,this.touchBg=!1,this.isControlJustChange=!1,this.controlSize="md",this.roundSize=50,this.offsetPrecision=20,this.resizeMouseDiff=0,this.lastDownX=0,this.lastDownY=0,this.startResize=(M,R)=>{let I,D,p,u;if(this.isResizing=!0,this.currentHandle=R,typeof TouchEvent<"u"&&M instanceof TouchEvent){const m=M.touches[0];I=m.clientX,D=m.clientY;const b=M.target.getBoundingClientRect();p=I-b.left,u=D-b.top}else I=M.clientX,D=M.clientY,p=M.offsetX,u=M.offsetY;M.preventDefault(),M.stopPropagation(),this.resizeMouseDiff="top"===R||"bottom"===R?this.offsetPrecision-u:"left"===R||"right"===R?this.offsetPrecision-p:0,this._document.addEventListener("mousemove",this.resize),this._document.addEventListener("mouseup",this.stopResize),this._document.addEventListener("touchmove",this.resize,{passive:!1}),this._document.addEventListener("touchend",this.stopResize),this.touchBg=!0},this.stopResize=()=>{this.isResizing=!1,this.currentHandle=null,document.removeEventListener("mousemove",this.resize),document.removeEventListener("mouseup",this.stopResize),document.removeEventListener("touchmove",this.resize),document.removeEventListener("touchend",this.stopResize),this.updateOverlayBaseFromCurrent(),this.setClientRectangle(),this.touchBg=!1,this.isControlJustChange=!1},this.resize=M=>{if(!this.isResizing)return;let R,I;if(typeof TouchEvent<"u"&&M instanceof TouchEvent){const O=M.touches[0];R=O.clientX,I=O.clientY,M.preventDefault()}else R=M.clientX,I=M.clientY;this.isControlJustChange||(this.isControlJustChange=!0,this.bodyReshapeService.setOnChange("startResize",{type:this.touchType}));const D=this.resizer.getBoundingClientRect(),p=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),u=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),m=u.top-p.top,b=u.bottom-p.top,k=u.left-p.left,A=u.right-p.left;let y=40;if(this.touchType===h.J.Waist&&(y=60),"top"===this.currentHandle)if(this.touchType===h.J.Waist){const j=D.top-p.top+D.height/2;let U=2*(j-Math.max(m,I+this.resizeMouseDiff-p.top+0));j+U/2>b&&(U=2*(b-j)),U>=y&&(this.position.y=j-U/2,this.size.h=U)}else{const w=Math.max(m,Math.min(I+this.resizeMouseDiff-p.top,b-20)),j=D.bottom-(w+p.top);j>=y&&(this.position.y=w,this.size.h=j)}else if("bottom"===this.currentHandle)if(this.touchType===h.J.Waist){const j=D.top-p.top+D.height/2;let U=2*(Math.min(b,I+this.resizeMouseDiff-p.top)-j);j-U/2<m&&(U=2*(j-m)),U>=y&&(this.position.y=j-U/2,this.size.h=U)}else{const w=Math.max(m+this.offsetPrecision,Math.min(I+this.resizeMouseDiff-p.top,b))-(D.top-p.top);w>=y&&(this.size.h=w)}else if("left"===this.currentHandle)if(this.touchType===h.J.Waist){const j=D.left-p.left+D.width/2;let U=2*(j-Math.max(k,R+this.resizeMouseDiff-p.left));j+U/2>A&&(U=2*(A-j)),U>=y&&(this.position.x=j-U/2,this.size.w=U)}else{const O=Math.max(k,Math.min(R+this.resizeMouseDiff-p.left,A-20)),w=D.right-(O+p.left);w>=y&&(this.position.x=O,this.size.w=w)}else if("right"===this.currentHandle)if(this.touchType===h.J.Waist){const j=D.left-p.left+D.width/2;let U=2*(Math.min(A,R+this.resizeMouseDiff-p.left)-j);j-U/2<k&&(U=2*(j-k)),U>=y&&(this.position.x=j-U/2,this.size.w=U)}else{const w=Math.max(k+20,Math.min(R+this.resizeMouseDiff-p.left,A))-(D.left-p.left);w>=y&&(this.size.w=w)}else if("right-bottom"===this.currentHandle){let O,w,j;const L=D.left+D.width/2,U=D.top+D.height/2,$=(R-L+(I-U))/Math.sqrt(2);j=Math.max(this.roundSize,2*Math.max(0,$));const Y=Math.min(Math.max(L-k,A-L,10),Math.max(U-m,b-U,10));j=Math.max(this.roundSize,Math.min(j,2*Y)),O=L-j/2-p.left,w=U-j/2-p.top,O=Math.max(k-j/2,Math.min(O,A-j/2)),w=Math.max(m-j/2,Math.min(w,b-j/2)),this.position.x=O,this.position.y=w,this.size.w=j,this.size.h=j}else if("left-bottom"===this.currentHandle){let O,w,j;const L=D.left+D.width/2,U=D.top+D.height/2,$=(I-U-(R-L))/Math.sqrt(2);j=Math.max(this.roundSize,2*Math.max(0,$));const Y=Math.min(Math.max(L-k,A-L,10),Math.max(U-m,b-U,10));j=Math.max(this.roundSize,Math.min(j,2*Y)),O=L-j/2-p.left,w=U-j/2-p.top,O=Math.max(k-j/2,Math.min(O,A-j/2)),w=Math.max(m-j/2,Math.min(w,b-j/2)),this.position.x=O,this.position.y=w,this.size.w=j,this.size.h=j}requestAnimationFrame(()=>{this.updateCornerHandlePositions()})},this.updateCornerHandlePositions=()=>{const R=this.resizer.getBoundingClientRect().width/2,I=R,D=R,p=Math.PI/4,u=I+R*Math.cos(p),m=D+R*Math.sin(p);"sm"===this.controlSize?(this.rightBottom.left=u-22+"px",this.rightBottom.top=m-22+"px"):(this.rightBottom.left=u-20+"px",this.rightBottom.top=m-20+"px");const b=5*Math.PI/4,k=I+R*Math.cos(b),A=D+R*Math.sin(p);"sm"===this.controlSize?(this.leftBottom.left=k-22+"px",this.leftBottom.top=A-22+"px"):(this.leftBottom.left=k-20+"px",this.leftBottom.top=A-20+"px")},this.startDrag=M=>{if(!this.isDraggingEnabled||this.isResizing||M.target.classList.contains("resize-handle"))return;let R,I;if(this.isDragging=!0,typeof TouchEvent<"u"&&M instanceof TouchEvent){const D=M.touches[0];R=D.clientX,I=D.clientY,M.preventDefault()}else R=M.clientX,I=M.clientY,M.preventDefault();this.dragStartX=R,this.dragStartY=I,this.dragStartLeft=this.position.x||0,this.dragStartTop=this.position.y||0,this._document.addEventListener("mousemove",this.drag),this._document.addEventListener("mouseup",this.stopDrag),this._document.addEventListener("touchmove",this.drag,{passive:!1}),this._document.addEventListener("touchend",this.stopDrag)},this.stopDrag=()=>{this.isDragging=!1,this.isControlJustChange=!1,document.removeEventListener("mousemove",this.drag),document.removeEventListener("mouseup",this.stopDrag),document.removeEventListener("touchmove",this.drag),document.removeEventListener("touchend",this.stopDrag),this.updateOverlayBaseFromCurrent(),this.setClientRectangle()},this.drag=M=>{if(!this.isDragging)return;let R,I;if(typeof TouchEvent<"u"&&M instanceof TouchEvent){const D=M.touches[0];R=D.clientX,I=D.clientY,M.preventDefault()}else R=M.clientX,I=M.clientY;if(this.isControlJustChange||(this.isControlJustChange=!0,this.bodyReshapeService.setOnChange("startDrag",{type:this.touchType})),2===this.touchType||3===this.touchType){const D=this.resizer.getBoundingClientRect(),p=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),u=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),m=u.top-p.top,b=u.bottom-p.top;let O=this.dragStartLeft+(R-this.dragStartX),w=this.dragStartTop+(I-this.dragStartY);O=Math.max(u.left-p.left-D.width/2,Math.min(O,u.right-p.left-D.width/2)),w=Math.max(m-D.height/2,Math.min(w,b-D.height/2)),requestAnimationFrame(()=>{this.position.x=O,this.position.y=w,this.updateCornerHandlePositions()})}else{const D=this.resizer.getBoundingClientRect(),p=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),u=this.mainCanvasNative?.nativeElement.getBoundingClientRect(),m=u.top-p.top,b=u.bottom-p.top;let O=this.dragStartLeft+(R-this.dragStartX),w=this.dragStartTop+(I-this.dragStartY);O=Math.max(u.left-p.left,Math.min(O,u.right-p.left-D.width)),w=Math.max(m,Math.min(w,b-D.height)),requestAnimationFrame(()=>{this.position.x=O,this.position.y=w,this.updateCornerHandlePositions()})}},this.onChangeObserv=this.bodyReshapeService.onChange.subscribe(M=>{M&&"bodyPartType"===M.name?(this.isControlJustChange=!1,this.touchType=M.options.type,this.setInitial(M.options),this.setPos()):M&&"visibility"===M.name?(this.touchType=M.options.type,this.touchBg=!1):M&&"setPos"===M.name&&this.setPos()}),this.onUndoRedoObserv=this.bodyReshapeService.onUndoRedo.subscribe(()=>{this.touchBg=!0}),this.resizeSubscribe=(0,o.R)(window,"resize").pipe((0,G.B)(200),(0,P.F)()).subscribe(()=>{this.setPos()})}setInitial(x){let E=this.mainCanvas.width,M=this.mainCanvas.height,R=this.mainCanvas.getZoom();if(0===this.touchType)this.extenderBase={x:x.x?x.x:0,y:x.y?x.y:x.height?x.height:M
1/3/R,width:x.width?x.width:E/R,height:x.height?x.height:M/3/R},this.touchBg=!0;else if(1===this.touchType)this.extenderBase={x:x.x?x.x:x.width?x.width:E/3/R,y:x.y?x.y:0,width:x.width?x.width:E/3/R,height:x.height?x.height:M/R},this.touchBg=!0;else if(2===this.touchType){Math.min(E,M);let D=M/3;this.extenderBase={x:x.x?x.x:x.width?x.width:(E-D)/2/R,y:x.y?x.y:x.height?x.height:(M-D)/2/R,width:x.width?x.width:D/R,height:x.width?x.width:D/R}}else if(3===this.touchType){Math.min(E,M);let D=M/5;this.extenderBase=this.isRoundInstance2?{x:x.x?x.x:x.width?x.width:(E/2+50)/R,y:x.y?x.y:x.height?x.height:(M-D)/2/R,width:x.width?x.width:M/5/R,height:x.width?x.width:M/5/R}:{x:x.x?x.x:x.width?x.width:(E/2-D)/R,y:x.y?x.y:x.height?x.height:(M-D)/2/R,width:x.width?x.width:M/5/R,height:x.width?x.width:M/5/R}}else if(4===this.touchType){let I=Math.min(E,M);this.extenderBase={x:x.x?x.x:x.width?x.width:E/3/R,y:x.y?x.y:x.height?x.height:M/3/R,width:x.width?x.width:I/3/R,height:x.width?x.width:I/2/R}}}ngOnDestroy(){this.resizeSubscribe&&this.resizeSubscribe.unsubscribe(),this.zoomserviceSubscription&&this.zoomserviceSubscription.unsubscribe(),this.onChangeObserv&&this.onChangeObserv.unsubscribe(),this.onUndoRedoObserv&&this.onUndoRedoObserv.unsubscribe()}ngOnInit(){this.initialZoom=this.mainCanvas.getZoom(),this.roundSize="sm"===this.controlSize?40:50,this.offsetPrecision="sm"===this.controlSize?10:20}setPos(){this.resizer=this.expander.nativeElement;const x=this.mainCanvas.getZoom();this.position.x=this.extenderBase.x*x,this.position.y=this.extenderBase.y*x,this.size.w=this.extenderBase.width*x,this.size.h=this.extenderBase.height*x,setTimeout(()=>{this.checkBoundary(),this.updateOverlayBaseFromCurrent(),this.updateCornerHandlePositions(),this.setClientRectangle()})}checkBoundary(){const x=this.resizer.getBoundingClientRect(),E=this.mainCanvasNative?.nativeElement.getBoundingClientRect();this.touchType===h.J.Tall?(this.size.w=this.mainCanvas.width,x.bottom>E.bottom&&(this.size.h=this.size.h-(x.bottom-E.bottom))):this.touchType===h.J.Slim&&(this.size.h=this.mainCanvas.height,x.right>E.right)&&(this.size.w=this.size.w-(x.right-E.right)),this.updateOverlayBaseFromCurrent()}change(x){this.setPos()}setClientRectangle(){const x=this.resizer.getBoundingClientRect(),E=this.mainCanvasNative?.nativeElement.getBoundingClientRect();let M=this.bodyReshapeService.clientRectangle;const R=this.mainCanvas.getZoom();return this.isRoundInstance2?(M.centerX2=(x.left-E.left+x.width/2)/R,M.centerY2=(x.top-E.top+x.height/2)/R,M.radius2=x.height/2/R):(M.top=Math.floor((x.top-E.top)/R),M.left=Math.floor((x.left-E.left)/R),M.bottom=Math.floor((x.bottom-E.top)/R),M.right=Math.floor((x.right-E.left)/R),M.centerX=(x.left-E.left+x.width/2)/R,M.centerY=(x.top-E.top+x.height/2)/R,M.radius=x.height/2/R),this.bodyReshapeService.clientRectangle=M,M}updateOverlayBaseFromCurrent(){const x=this.mainCanvas.getZoom();this.extenderBase={x:parseFloat(this.resizer.style.left)/x,y:parseFloat(this.resizer.style.top)/x,width:parseFloat(this.resizer.style.width)/x,height:parseFloat(this.resizer.style.height)/x}}}return(_=C).\u0275fac=function(x){return new(x||_)(a.rXU(n.qQ),a.rXU(h.E))},_.\u0275cmp=a.VBU({type:_,selectors:[["app-body-expander"]],viewQuery:function(x,E){if(1&x&&a.GBs(d,5),2&x){let M;a.mGM(M=a.lsd())&&(E.expander=M.first)}},inputs:{mainCanvas:"mainCanvas",mainCanvasNative:"mainCanvasNative",isRoundInstance2:"isRoundInstance2",controlSize:"controlSize"},decls:68,vars:40,consts:[["expander",""],["id","app-body-expander",3,"mousedown","touchstart","ngClass"],[1,"resize-handle","body-resize-hendle","top",3,"mousedown","touchstart","hidden"],[3,"hidden"],["xmlns","http://www.w3.org/2000/svg","width","1em","height","1em","fill","none","viewBox","0 0 44 44",2,"font-size","40px"],["width","40","height","40","x","42","y","2.5","fill","#fff","rx","20","shape-rendering","crispEdges","transform","rotate(90 42 2.5)"],["fill","#272B34","d","m22.012 12.61-4.95 4.95a1 1 0 1 1-1.414-1.415l5.657-5.657a1 1 0 0 1 1.414 0l5.657 5.657a1 1 0 0 1-1.414 1.414zM22 32.395l4.95-4.95a1 1 0 0 1 1.414 1.414l-5.657 5.657a1 1 0 0 1-1.414 0l-5.657-5.657a1 1 0 0 1 1.414-1.414z"],["xmlns","http://www.w3.org/2000/svg","width","1em","height","1em","viewBox","0 0 44 44","fill","none",2,"font-size","40px"],["x","2","y","2.5","width","40","height","40","rx","20","fill","white","shape-rendering","crispEdges"],["d","M18 23.5L22 19.5L26 23.5","stroke","#272B34","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"resize-handle","body-resize-hendle","bottom",3,"mousedown","touchstart","hidden"],["d","M18 21.5L22 25.5L26 21.5","stroke","#272B34","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"resize-handle","body-resize-hendle","left",3,"mousedown","touchstart","hidden"],["width","40","height","40","x","42","y","42.5","fill","#fff","rx","20","shape-rendering","crispEdges","transform","rotate(-180 42 42.5)"],["fill","#272B34","d","m31.894 22.512-4.95-4.95a1 1 0 1 1 1.414-1.415l5.657 5.658a1 1 0 0 1 0 1.413l-5.657 5.657a1 1 0 0 1-1.414-1.413zM12.106 22.504l4.95 4.95a1 1 0 0 1-1.414 1.414L9.985 23.21a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 0 1 1.414 1.414z"],["d","M23 26.5L19 22.5L23 18.5","stroke","#272B34","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"resize-handle","body-resize-hendle","right",3,"mousedown","touchstart","hidden"],["d","M21 26.5L25 22.5L21 18.5","stroke","#272B34","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],[1,"resize-handle","body-resize-hendle","right-bottom",3,"mousedown","touchstart","hidden"],["xmlns","http://www.w3.org/2000/svg","width","1em","height","1em","viewBox","0,0,256,256",2,"font-size","40px"],["fill","none","stroke","none","stroke-width","1","stroke-linecap","butt","stroke-linejoin","miter","stroke-miterlimit","10","stroke-dasharray","","stroke-dashoffset","0","font-family","none","font-weight","none","font-size","none","text-anchor","none",2,"mix-blend-mode","normal"],["transform","translate(-54.93313,135.52726) rotate(-48) scale(5.81818,5.81818)"],["x","2.5","y","-42","transform","rotate(90)","width","40","height","40","rx","20","ry","0","fill","#ffffff"],["d","M22.012,12.61l-4.95,4.95c-0.39074,0.39047 -1.
102403,0.39024 -1.4145,-0.0005c-0.39047,-0.39074 -0.39024,-1.02403 0.0005,-1.4145l5.657,-5.657c0.3905,-0.39038 1.0235,-0.39038 1.414,0l5.657,5.657c0.37897,0.39238 0.37355,1.01608 -0.01218,1.40182c-0.38573,0.38573 -1.00944,0.39115 -1.40182,0.01218zM22,32.395l4.95,-4.95c0.39238,-0.37897 1.01608,-0.37355 1.40182,0.01218c0.38573,0.38573 0.39115,1.00944 0.01218,1.40182l-5.657,5.657c-0.3905,0.39038 -1.0235,0.39038 -1.414,0l-5.657,-5.657c-0.37897,-0.39238 -0.37355,-1.01608 0.01218,-1.40182c0.38573,-0.38573 1.00944,-0.39115 1.40182,-0.01218z","fill","currentColor"],[1,"resize-handle","body-resize-hendle","left-bottom",3,"mousedown","touchstart","hidden"],["fill","none","stroke","none","stroke-width","1","stroke-linejoin","miter","stroke-miterlimit","10","stroke-dasharray","","stroke-dashoffset","0","font-family","none","font-weight","none","font-size","none","text-anchor","none",2,"mix-blend-mode","normal"],["transform","translate(139.6357,-54.71782) rotate(48) scale(5.81818,5.81818)"],[1,"hr",3,"hidden"],[2,"position","absolute","left","-16px","height","100%",3,"hidden"],["_ngcontent-hse-c219","","xmlns","http://www.w3.org/2000/svg","id","mySvg","width","20","viewBox","0 0 9 110","fill","none","preserveAspectRatio","none",2,"height","100%"],["_ngcontent-hse-c219","","d","M3 105.5L5.66082 86.5548C8.79242 64.2575 8.77956 41.3122 5.62295 19.0219L3 0.5","stroke","white","stroke-width",".8"],[2,"position","absolute","right","-13px","height","100%",3,"hidden"],["id","mySvg","xmlns","http://www.w3.org/2000/svg","width","20","viewBox","0 0 9 110","fill","none","preserveAspectRatio","none",2,"height","100%"],["d","M8 105.5L5.33918 86.5548C2.20758 64.2575 2.22044 41.3122 5.37705 19.0219L8 0.5","stroke","white","stroke-width",".9"]],template:function(x,E){if(1&x){const M=a.RV6();a.j41(0,"div",1,0),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startDrag(I))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startDrag(I))}),a.j41(2,"div",2),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"top"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"top"))}),a.j41(3,"div",3),a.qSk(),a.j41(4,"svg",4)(5,"g"),a.nrm(6,"rect",5)(7,"path",6),a.k0s()()(),a.joV(),a.j41(8,"div",3),a.qSk(),a.j41(9,"svg",7)(10,"g"),a.nrm(11,"rect",8)(12,"path",9),a.k0s()()()(),a.joV(),a.j41(13,"div",10),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"bottom"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"bottom"))}),a.j41(14,"div",3),a.qSk(),a.j41(15,"svg",4)(16,"g"),a.nrm(17,"rect",5)(18,"path",6),a.k0s()()(),a.joV(),a.j41(19,"div",3),a.qSk(),a.j41(20,"svg",7)(21,"g"),a.nrm(22,"rect",8)(23,"path",11),a.k0s()()()(),a.joV(),a.j41(24,"div",12),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"left"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"left"))}),a.j41(25,"div",3),a.qSk(),a.j41(26,"svg",4)(27,"g"),a.nrm(28,"rect",13)(29,"path",14),a.k0s()()(),a.joV(),a.j41(30,"div",3),a.qSk(),a.j41(31,"svg",7)(32,"g"),a.nrm(33,"rect",8)(34,"path",15),a.k0s()()()(),a.joV(),a.j41(35,"div",16),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"right"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"right"))}),a.j41(36,"div",3),a.qSk(),a.j41(37,"svg",4)(38,"g"),a.nrm(39,"rect",13)(40,"path",14),a.k0s()()(),a.joV(),a.j41(41,"div",3),a.qSk(),a.j41(42,"svg",7)(43,"g"),a.nrm(44,"rect",8)(45,"path",17),a.k0s()()()(),a.joV(),a.j41(46,"div",18),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"right-bottom"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"right-bottom"))}),a.qSk(),a.j41(47,"svg",19)(48,"g",20)(49,"g",21)(50,"g"),a.nrm(51,"rect",22)(52,"path",23),a.k0s()()()()(),a.joV(),a.j41(53,"div",24),a.bIt("mousedown",function(I){return a.eBV(M),a.Njj(E.startResize(I,"left-bottom"))})("touchstart",function(I){return a.eBV(M),a.Njj(E.startResize(I,"left-bottom"))}),a.qSk(),a.j41(54,"svg",19)(55,"g",25)(56,"g",26)(57,"g"),a.nrm(58,"rect",22)(59,"path",23),a.k0s()()()()(),a.joV(),a.nrm(60,"div",27),a.j41(61,"div",28),a.qSk(),a.j41(62,"svg",29),a.nrm(63,"path",30),a.k0s()(),a.joV(),a.j41(64,"div",31),a.qSk(),a.j41(65,"svg",32)(66,"g"),a.nrm(67,"path",33),a.k0s()()()()}2&x&&(a.ZvI("app-body-expander touch-",E.touchType,""),a.xc7("top",E.position.y,"px")("left",E.position.x,"px")("width",E.size.w,"px")("height",E.size.h,"px"),a.Y8G("ngClass",a.l_i(37,e,E.touchBg,"sm"==E.controlSize)),a.R7$(2),a.Y8G("hidden",0!=E.touchType&&4!=E.touchType),a.R7$(),a.Y8G("hidden",0!=E.touchType),a.R7$(5),a.Y8G("hidden",4!=E.touchType),a.R7$(5),a.Y8G("hidden",0!=E.touchType&&4!=E.touchType),a.R7$(),a.Y8G("hidden",0!=E.touchType),a.R7$(5),a.Y8G("hidden",4!=E.touchType),a.R7$(5),a.Y8G("hidden",1!=E.touchType&&4!=E.touchType),a.R7$(),a.Y8G("hidden",1!=E.touchType),a.R7$(5),a.Y8G("hidden",4!=E.touchType),a.R7$(5),a.Y8G("hidden",1!=E.touchType&&4!=E.touchType),a.R7$(),a.Y8G("hidden",1!=E.touchType),a.R7$(5),a.Y8G("hidden",4!=E.touchType),a.R7$(5),a.xc7("left",E.rightBottom.left)("top",E.rightBottom.top),a.Y8G("hidden",2!=E.touchType&&(3!=E.touchType||!E.isRoundInstance2)),a.R7$(7),a.xc7("left",E.leftBottom.left)("top",E.leftBottom.top),a.Y8G("hidden",3!=E.touchType||E.isRoundInstance2),a.R7$(7),a.Y8G("hidden",4!=E.touchType),a.R7$(),a.Y8G("hidden",4!=E.touchType),a.R7$(3),a.Y8G("hidden",4!=E.touchType))},dependencies:[n.YU],styles:[".app-body-expander[_ngcontent-%COMP%]{position:absolute}.app-body-expander[_ngcontent-%COMP%] .hr[_ngcontent-%COMP%]{position:absolute;
1left:calc(50% - 1px);width:2px;height:100%;background:#fff}.app-body-expander.touch-4[_ngcontent-%COMP%]{background:transparent}.app-body-expander.touch--1[_ngcontent-%COMP%]{display:none}.body-resize-hendle[_ngcontent-%COMP%]{position:absolute;width:40px;height:40px;border-radius:50%;background:#fff;z-index:1;clip-path:circle(50% at 50% 50%);-webkit-clip-path:circle(50% at 50% 50%);pointer-events:auto}.body-resize-hendle.top[_ngcontent-%COMP%]{top:-20px;transform:translate(-50%);left:50%;cursor:ns-resize}.body-resize-hendle.bottom[_ngcontent-%COMP%]{bottom:-20px;left:50%;transform:translate(-50%);cursor:ns-resize}.body-resize-hendle.left[_ngcontent-%COMP%]{left:-20px;top:50%;transform:translateY(-50%);cursor:ew-resize}.body-resize-hendle.right[_ngcontent-%COMP%]{right:-20px;top:50%;transform:translateY(-50%);cursor:ew-resize}.body-resize-hendle.right-bottom[_ngcontent-%COMP%]{cursor:se-resize}.body-resize-hendle.left-bottom[_ngcontent-%COMP%]{cursor:ne-resize}.touch-0[_ngcontent-%COMP%]{border-top:2px solid #fff;border-bottom:2px solid #fff}.touch-0[_ngcontent-%COMP%] .body-resize-hendle.left[_ngcontent-%COMP%], .touch-0[_ngcontent-%COMP%] .body-resize-hendle.right[_ngcontent-%COMP%]{display:none}.touch-1[_ngcontent-%COMP%]{border-left:2px solid #fff;border-right:2px solid #fff}.touch-1[_ngcontent-%COMP%] .body-resize-hendle.top[_ngcontent-%COMP%], .touch-1[_ngcontent-%COMP%] .body-resize-hendle.bottom[_ngcontent-%COMP%]{display:none}.touch-1.touch-bg[_ngcontent-%COMP%], .touch-0.touch-bg[_ngcontent-%COMP%]{background:#626adf8c}.touch-2[_ngcontent-%COMP%], .touch-3[_ngcontent-%COMP%]{border:2px solid #fff;border-radius:50%}.touch-2[_ngcontent-%COMP%] .body-resize-hendle.left[_ngcontent-%COMP%], .touch-3[_ngcontent-%COMP%] .body-resize-hendle.left[_ngcontent-%COMP%], .touch-2[_ngcontent-%COMP%] .body-resize-hendle.right[_ngcontent-%COMP%], .touch-3[_ngcontent-%COMP%] .body-resize-hendle.right[_ngcontent-%COMP%], .touch-2[_ngcontent-%COMP%] .body-resize-hendle.top[_ngcontent-%COMP%], .touch-3[_ngcontent-%COMP%] .body-resize-hendle.top[_ngcontent-%COMP%], .touch-2[_ngcontent-%COMP%] .body-resize-hendle.bottom[_ngcontent-%COMP%], .touch-3[_ngcontent-%COMP%] .body-resize-hendle.bottom[_ngcontent-%COMP%]{display:none}.expander-size-sm[_ngcontent-%COMP%] .body-resize-hendle[_ngcontent-%COMP%]{transform:scale(.5)}.expander-size-sm[_ngcontent-%COMP%] .body-resize-hendle.top[_ngcontent-%COMP%], .expander-size-sm[_ngcontent-%COMP%] .body-resize-hendle.bottom[_ngcontent-%COMP%]{left:calc(50% - 20px)}.expander-size-sm[_ngcontent-%COMP%] .body-resize-hendle.left[_ngcontent-%COMP%], .expander-size-sm[_ngcontent-%COMP%] .body-resize-hendle.right[_ngcontent-%COMP%]{top:calc(50% - 20px)}"]}),C})()},57110:(_e,ie,g)=>{"use strict";g.d(ie,{W:()=>x});var n=g(16478),o=g(54438),G=g(33391),P=g(79301),h=g(6755),a=g(345),d=g(74983),e=g(60177),l=g(68064);function _(E,M){if(1&E){const R=o.RV6();o.j41(0,"label",17),o.bIt("click",function(){o.eBV(R);const D=o.XpG();return o.Njj(D.profile())}),o.EFF(1,"Try another image ?"),o.k0s()}}function C(E,M){1&E&&(o.j41(0,"label",18),o.EFF(1,"Try another image ?"),o.k0s())}const S=["image/jpg","image/jpeg","image/pjpeg","image/png"];let x=(()=>{var E;class M{constructor(I,D,p,u,m){this.activeModal=I,this.commonService=D,this.uploadImageService=p,this.sanitizer=u,this.toastService=m,this.message="",this.tab="",this.Isprofile=!1,this.downloadpng=this.sanitizer.bypassSecurityTrustUrl("https://static.lightxeditor.com/assets/images/img-success-Download.png"),this.imgQueryParams={imageUrl:"",tabName:"",from:"",editorType:""},this.fileUploadAccept=S.join(",")}ngOnInit(){}onFileUpload(I){if(this.activeModal.close(),!I.length)return;const D=I[0];let p=D.name.split(".")[1];if(this.uploadImageService.imgFormat=p,S.indexOf(D.type)<0)return void this.toastService.showErrorSingle(n.b.message.validImageMessageForEdit);const u=URL.createObjectURL(D);this.imgQueryParams.imageUrl=u,this.imgQueryParams.from="header",this.imgQueryParams.tabName=this.tab,this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{})}profile(){this.activeModal.close(1)}}return(E=M).\u0275fac=function(I){return new(I||E)(o.rXU(G.Lw),o.rXU(P.h),o.rXU(h.A),o.rXU(a.up),o.rXU(d.f))},E.\u0275cmp=o.VBU({type:E,selectors:[["download-message-with-upload"]],inputs:{message:"message",tab:"tab",Isprofile:"Isprofile"},decls:19,vars:7,consts:[["file",""],[1,"modal-header","border-0","upgrade-page"],["type","button","aria-hidden","close",1,"close","btn-trans",3,"click"],["name","closelogin",1,"f-30"],[1,"popup_wrapper","text-center"],[1,"item_wrapper"],[1,""],["src","https://static.lightxeditor.com/assets/images/DowloadSuccess.jpg","width","124px","height","124px","loading","lazy"],[1,"heading","mt-3","text-bold"],[1,"footerSec","position-relative"],[1,"mt-3"],["class","try-ano m-0 text-semi",3,"click",4,"ngIf"],["for","fileInputUpload","class","try-ano m-0 text-semi",4,"ngIf"],["id","fileInputUpload","name","fileInputUpload","type","file",1,"custom-file-input","d-none",3,"change","accept"],[1,"app-sto","text-semi"],["target","_blank",3,"href"],["height","48px",1,"download-btn-grey",3,"src"],[1,"try-ano","m-0","text-semi",3,"click"],["for","fileInputUpload",1,"try-ano","m-0","text-semi"]],template:function(I,D){if(1&I){const p=o.RV6();o.j41(0,"div",1)(1,"button",2),o.bIt("click",function(){return o.eBV(p),o.Njj(D.activeModal.close())}),o.nrm(2,"pi",3),o.k0s()(),o.j41(3,"div",4)(4,"div",5)(5,"div",6),o.nrm(6,"img",7),o.k0s(),o.j41(7,"div",8),o.EFF(8),o.k0s()(),o.j41(9,"div",9)(10,"div",10),o.DNE(11,_,2,0,"label",11)(12,C,2,0,"label",12),o.j41(13,"input",13,0),o.bIt("change",function(m){return o.eBV(p),o.Njj(D.onFileUpload(m.srcElement.files))}),o.k0s(),o.j41(15,"p",14),o.EFF(16),o.k0s(),o.j41(17,"a",15),o.nrm(18,"img",16),o.k0s()()()()}2&I&&(o.R7$(8),o.JRh(D.message),o.R7$(3),o.Y8G("ngIf",D.Isprofile),o.R7$(),o.Y8G("ngIf",!D.Isprofile),o.R7$(),o.Y8G("accept",D.fileUploadAccept),o.R7$(3),o.SpI("To explore extra added features, visit our app from ",D.commonService.message,""),o.R7$(),o.FS9("href",D.commonService.playStorUrl,o.B4B),o.R7$(),o.FS9("src",D.commonService.appImageUrl,o.B4B))},dependencies:[e.bT,l.b],styles:[".popup_wrapper[_ngcontent-%COMP%]{padding:8px 15px 40px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%]{border-radius:8px;overflow:hidden;scroll-behavior:auto;margin-bottom:0;padding:0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:0;padding:0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%]{list-style:none;margin:11px 0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{background:#626adf0d;align-items:center;border-radius:5px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:inline-block;font-size:14px;color:#000}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-style:normal;font-size:14px;line-height:19px;color:#b0b3bf;margin-left:6px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-style:normal;font-size:24px;color:#272b34}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] .secondary-text[_ngcontent-%COMP%]{font-size:16px;font-weight:400;color:#4a4f5e}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] .secondary-text-link[_ngcontent-%COMP%]{font-size:16px;font-weight:400;color:#4a4f5e;text-decoration:underline}.footerSec[_ngcontent-%COMP%]{width:100%}.btn-edit[_ngcontent-%COMP%]{font-weight:600;font-size:14px!important}.try-ano[_ngcontent-%COMP%]{display:inline-flex;font-style:normal;font-size:13px;line-height:18px;color:#626adf;cursor:pointer}.app-sto[_ngcontent-%COMP%]{font-style:normal;font-size:13px;line-height:18px;text-align:center;color:#4a4f5e;margin:35px 0 12px;padding:0 20px}.btn-trans[_ngcontent-%COMP%]{background:transparent!important}.custom-file-input[_ngcontent-%COMP%]{position:absolute;z-index:-99}@media (max-width: 576px){.popup_wrapper[_ngcontent-%COMP%]{padding:8px 14px 40px}.popup_wrapper[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-size:22px!important}}"]}),M})()},26494:(_e,ie,g)=>{"use strict";g.d(ie,{M:()=>G});var n=g(54438),o=g(33391);let G=(()=>{var P;class h{constructor(d,e){this.activeModal=d,this.config=e,this.proItems=[],this.progressBarWidth=0,this.progressWidth=0,e.max=100,e.striped=!0,e.animated=!0,e.type="success",e.height="10px"}ngOnInit(){}cancel(){this.activeModal.close("cancel")}move(){if(0==this.progressBarWidth){let _=function(){e>=100?(clearInterval(l),this.progressBarWidth=0,this.progressWidth=0):(e++,d.style.width=e+"%",setTimeout(()=>this.progressWidth=e,0))};this.progressBarWidth=1;var d=document.getElementById("myBar"),e=1,l=setInterval(_,10)}}}return(P=h).\u0275fac=function(d){return new(d||P)(n.rXU(o.Lw),n.rXU(o.ck))},P.\u0275cmp=n.VBU({type:P,selectors:[["download-progress-bar"]],inputs:{proItems:"proItems"},decls:10,vars:1,consts:[[1,"popup_wrapper"],[1,"item_wrapper"],[1,"heading"],[1,"mt-13"],["type","primary",3,"value"],[1,"footerSec"],["color","primary",1,"btn","btn-primary","btn-h40",2,"margin","0 auto !important",3,"click"]],template:function(d,e){1&d&&(n.j41(0,"div",0)(1,"div",1)(2,"div",2),n.EFF(3," Your work is being downloaded. please wait for moment"),n.k0s()(),n.j41(4,"div",3),n.nrm(5,"ngb-progressbar",4),n.k0s(),n.j41(6,"div",5)(7,"div",3)(8,"button",6),n.bIt("click",function(){return e.cancel()}),n.EFF(9," Cancel"),n.k0s()()()()),2&d&&(n.R7$(5),n.Y8G("value",100))},dependencies:[o.EH],styles:[".popup_wrapper[_ngcontent-%COMP%]{padding:40px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%]{border-radius:8px;overflow:hidden;scroll-behavior:auto;margin-bottom:0;padding:0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin:0;padding:0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%]{list-style:none;margin:11px 0}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{background:#626adf0d;align-items:center;border-radius:5px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:inline-block;font-weight:700;font-size:14px;color:#000}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li.item_list[_ngcontent-%COMP%] p[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-style:normal;font-weight:600;font-size:14px;line-height:19px;color:#b0b3bf;margin-left:6px}.popup_wrapper[_ngcontent-%COMP%] .item_wrapper[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-style:normal;font-weight:600;font-size:16px;color:#272b34;text-align:center}.footerSec[_ngcontent-%COMP%]{text-align:center;width:100%;margin:0 auto!important}.textLabel[_ngcontent-%COMP%]{font-weight:600;font-size:15px;color:#626adf;white-space:normal!important}[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #e2e3e9;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#626adf;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#626adf}img[_ngcontent-%COMP%]{width:42px;height:40px;background:#0000000a;border-radius:8px}.type-heading[_ngcontent-%COMP%]{font-weight:700;font-size:14px;color:#272b34}.item-category[_ngcontent-%COMP%]{font-size:14px;font-weight:600;color:#b0b3bf}#myProgress[_ngcontent-%COMP%]{width:100%;background-color:#ddd}#myBar[_ngcontent-%COMP%]{width:1%;background-color:#626adf}"]}),h})()},6762:(_e,ie,g)=>{"use strict";g.d(ie,{Z:()=>P});var n=g(75243),o=g(78582),G=g(32970);class P{constructor(){this.adjustment=[],this.undoSteps=[],this.redoSteps=[],this.selectedAjustment=0;for(let d=0;d<3;d++)this.adjustment[d]=new o.Y}setSelectedAjustment(d){this.selectedAjustment=d}reset(){this.undoSteps.length=0,this.redoSteps.length=0,this.adjustment.forEach(d=>d.init()),this.brush&&this.brush.reset()}getImageAdjust(){return this.adjustment[this.selectedAjustment].imageAdjust}getAdjustedValues(){return this.adjustment[this.selectedAjustment].adjustedValues}createSplash(d,e,l,_){null==this.brush&&(this.brush=new G.Z(d,e.data,l,_))}isUndoModeAvailable(){return this.undoSteps.length>0}isRedoModeAvailable(){return this.redoSteps.length>0}undo(){if(this.isUndoModeAvailable()){let d=this.undoSteps.pop();
1if(d.undoType==n.l3.ERASE)this.brush.undo(),this.redoSteps.length>=20&&(this.undoSteps=[],this.brush.undo()),this.redoSteps.push(d);else{this.createAdjustmentRedoState();for(let e=0;e<3;e++)this.adjustment[e].setImageAdjust(d.model[e])}}}redo(){if(this.isRedoModeAvailable()){let d=this.redoSteps.pop();if(d.undoType==n.l3.ERASE)this.brush.redo(),this.undoSteps.push(d);else{this.createAdjustmentUndoState(!1);for(let e=0;e<3;e++)this.adjustment[e].setImageAdjust(d.model[e])}}}getSplash(){return this.brush}onMouseUp(){this.brush.onMouseUp(),this.createUndoState(n.l3.ERASE,[])}createUndoState(d,e){let l=new h;l.model=e,l.undoType=d,this.undoSteps.push(l),this.redoSteps.length=0}createAdjustmentUndoState(d){let e=new h;for(let l=0;l<3;l++)e.model[l]=this.adjustment[l].copy(this.adjustment[l].imageAdjust);e.undoType=n.l3.ADJUST,this.undoSteps.push(e),d&&(this.redoSteps.length=0)}createAdjustmentRedoState(){let d=new h;for(let e=0;e<3;e++)d.model[e]=this.adjustment[e].copy(this.adjustment[e].imageAdjust);d.undoType=n.l3.ADJUST,this.redoSteps.push(d)}addPoint(d,e){this.brush.addPoint(d,e)}updateBrightness(d,e){this.adjustment[this.selectedAjustment].updateBrightness(d)}updateContrast(d,e){this.adjustment[this.selectedAjustment].updateContrast(d)}updateExposure(d,e){this.adjustment[this.selectedAjustment].updateExposure(d)}updateShadows(d,e){this.adjustment[this.selectedAjustment].updateShadows(d)}updateHighlights(d,e){this.adjustment[this.selectedAjustment].updateHighlights(d)}updateBlur(d,e){this.adjustment[this.selectedAjustment].updateBlur(d)}updateGamma(d,e){this.adjustment[this.selectedAjustment].updateGamma(d)}updateHue(d,e){this.adjustment[this.selectedAjustment].updateHue(d)}updateSaturation(d,e){this.adjustment[this.selectedAjustment].updateSaturation(d)}updateHueIntensity(d,e){this.adjustment[this.selectedAjustment].updateHueIntensity(d)}updateTemperature(d,e){this.adjustment[this.selectedAjustment].updateTemperature(d)}updateTint(d,e){this.adjustment[this.selectedAjustment].updateTint(d)}updateRed(d,e){this.adjustment[this.selectedAjustment].updateRed(d)}updateBlue(d,e){this.adjustment[this.selectedAjustment].updateBlue(d)}updateGreen(d,e){this.adjustment[this.selectedAjustment].updateGreen(d)}updateIntensity(d,e){this.adjustment[this.selectedAjustment].updateIntensity(d)}setRedControlPoints(d){this.adjustment[this.selectedAjustment].setRedControlPoints(d)}delete(){this.brush&&this.brush.delete()}getAdjustment(){return this.adjustment}}class h{constructor(){this.model=[]}}},8071:(_e,ie,g)=>{"use strict";g.d(ie,{ZX:()=>h,cB:()=>a});var n=g(75243),o=g(10467),G=g(25880);class P{constructor(l,_,C,S){this.points=new Array,this.DESIRED_SIZE=100,this.image=_,this.module=l,this.width=C,this.height=S,this.zoomFactor=2,this.brushRadius=50,this.edgeStrength=50,this.selectedOption=0,this.api={setBaseImage:l.cwrap("nativeCutoutSetBaseImage","number",["array","number","number"]),getMaskMat:l.cwrap("nativeCutoutGetMaskMat","number",["number"]),getSmoothMaskMat:l.cwrap("nativeCutoutGetSmoothMaskMat","number",["number"]),getOriginalMaskMat:l.cwrap("nativeCutoutGetOriginalMaskMat","number",["number"]),addErasePoint:l.cwrap("nativeCutoutAddErasePoint","",["number","number","number"]),addBrushPoint:l.cwrap("nativeCutoutAddBrushPoint","",["number","number","number"]),addManualErasePoint:l.cwrap("nativeCutoutAddManualErasePoint","",["number","number","number"]),addManualBrushPoint:l.cwrap("nativeCutoutAddManualBrushPoint","",["number","number","number"]),addSmartSelectionPoint:l.cwrap("nativeCutoutAddSmartSelectionPoint","",["number","number","number"]),addAutoCutoutForegroundPoints:l.cwrap("nativeCutoutAddAutoCutoutForegroundPoints","",["number","number","number"]),setBrushSize:l.cwrap("nativeCutoutSetBrushSize","",["number","number","number"]),setEdgeStrength:l.cwrap("nativeCutoutSetEdgeStrength","",["number","number"]),clearSmartSelectionPoint:l.cwrap("nativeCutoutClearSmartSelectionPoint","",["number"]),applyBackgroundPoints:l.cwrap("nativeCutoutApplyBackgroundPoints","",["number"]),applyForegroundPoints:l.cwrap("nativeCutoutApplyForegroundPoints","",["number"]),applyAutoCutoutForegroundPoints:l.cwrap("nativeCutoutApplyAutoCutoutForegroundPoints","",["number"]),isUndoModeAvailable:l.cwrap("nativeCutoutIsUndoModeAvailable","boolean",["number"]),isRedoModeAvailable:l.cwrap("nativeCutoutIsRedoModeAvailable","boolean",["number"]),undo:l.cwrap("nativeCutoutUndoFilter","",["number"]),redo:l.cwrap("nativeCutoutApplyRedoMode","",["number"]),setBrushPointArray:l.cwrap("nativeCutoutSetBrushPointArray","",["number"]),setErasePointArray:l.cwrap("nativeCutoutSetErasePointArray","",["number"]),enableMagicEraseMode:l.cwrap("nativeCutoutEnableMagicEraseMode","",["number"]),enableMagicBrushMode:l.cwrap("nativeCutoutEnableMagicBrushMode","",["number"]),enableManualMode:l.cwrap("nativeCutoutEnableManualMode","",["number"]),setManualBrushPointArray:l.cwrap("nativeCutoutSetManualBrushPointArray","",["number"]),setManualErasePointArray:l.cwrap("nativeCutoutSetManualErasePointArray","",["number"]),delete:l.cwrap("nativeCutoutDelete","",["number"]),reset:l.cwrap("nativeCutoutReset","",["number"]),invert:l.cwrap("nativeCutoutInvertMaskMat","",["number"]),applyFilterOnMask:l.cwrap("nativeApplyFilterOnMask","",["number"])},this.maskWrapper=this.api.setBaseImage(this.image,this.width,this.height),this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor),this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20),this.api.addManualErasePoint(this.maskWrapper,0,0),this.api.setManualErasePointArray(this.maskWrapper)}setBrushSize(l){this.selectedOption==n.MY||this.selectedOption==n.WM?(this.edgeStrength=l,this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20)):(this.brushRadius=l,this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor))}isUndoModeAvailable(){return this.api.isUndoModeAvailable(this.maskWrapper)}isRedoModeAvailable(){return this.api.isRedoModeAvailable(this.maskWrapper)}undo(){return this.api.undo(this.maskWrapper)}redo(){return this.api.redo(this.maskWrapper)}enableMagicEraseMode(){return this.api.enableMagicEraseMode(this.maskWrapper)}enableMagicBrushMode(){return this.api.enableMagicBrushMode(this.maskWrapper)}enableManualMode(){return this.api.enableManualMode(this.maskWrapper)}setBrushPointArray(){this.api.setBrushPointArray(this.maskWrapper)}setErasePointArray(){this.api.setErasePointArray(this.maskWrapper)}setManualErasePointArray(){this.api.setManualErasePointArray(this.maskWrapper)}setManualBrushPointArray(){this.api.setManualBrushPointArray(this.maskWrapper)}setSelectedOption(l){this.selectedOption=l,this.selectedOption==n.MY?this.enableMagicEraseMode():this.selectedOption==n.WM?this.enableMagicBrushMode():(this.selectedOption==n.l4||this.selectedOption==n.lh)&&this.enableManualMode()}onMouseDown(l,_){this.points.length=0,this.api.clearSmartSelectionPoint(this.maskWrapper),this.addPoint(l,_)}onMouseMove(l,_){this.addPoint(l,_)}onMouseUp(){this.selectedOption==n.Uq||this.selectedOption==n.e_?this.interpolateAndAddPoints():this.selectedOption==n.MY?this.setErasePointArray():this.selectedOption==n.WM?this.setBrushPointArray():this.selectedOption==n.l4?this.setManualBrushPointArray():this.selectedOption==n.lh&&this.setManualErasePointArray(),this.api.clearSmartSelectionPoint(this.maskWrapper)}interpolateAndAddPoints(){this.points.length<this.DESIRED_SIZE&&this.interpolate();for(let l=0;l<this.points.length;l++)this.api.addSmartSelectionPoint(this.maskWrapper,this.points[l].x,this.points[l].y);this.selectedOption==n.Uq?this.api.applyForegroundPoints(this.maskWrapper):this.selectedOption==n.e_&&this.api.applyBackgroun
1dPoints(this.maskWrapper),this.points.length=0}interpolate(){let l=this.points.length;if(l>0){let _=Math.floor(this.DESIRED_SIZE/l);for(let C=0;C<this.DESIRED_SIZE;C=+C+_+1)this.points.length>C+1&&this.getMorePoints(this.points[C],this.points[C+1],_,C)}}getMorePoints(l,_,C,S){let x=(_.x-l.x)/C,E=(_.y-l.y)/C,M=new Array;if(0==x&&0==E)return M;for(let R=1;R<=C;R++){let D=l.y+E*R,p=new G.b(Math.round(100*(l.x+x*R))/100,Math.round(100*D)/100);this.points.splice(S+R,0,p)}return M}addPoint(l,_){if(-1==this.maskWrapper)throw new Error("Base mask not set..");switch(this.selectedOption){case n.WM:this.api.addBrushPoint(this.maskWrapper,l,_);break;case n.MY:this.api.addErasePoint(this.maskWrapper,l,_);break;case n.l4:this.api.addManualBrushPoint(this.maskWrapper,l,_);break;case n.lh:this.api.addManualErasePoint(this.maskWrapper,l,_);break;case n.Uq:case n.e_:this.points.push(new G.b(l,_))}}isPathMode(){return this.selectedOption==n.Uq||this.selectedOption==n.e_}getSelectedOption(){return this.selectedOption}getMaskMat(){if(-1!=this.maskWrapper){const l=this.api.getMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,l)}throw new Error("Base mask not set..")}getSmoothMaskMat(){if(-1!=this.maskWrapper){const l=this.api.getSmoothMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,l)}throw new Error("Base mask not set..")}delete(){var l=this;return(0,o.A)(function*(){-1!=l.maskWrapper&&(yield l.api.delete(l.maskWrapper))})()}reset(){var l=this;return(0,o.A)(function*(){-1!=l.maskWrapper&&(yield l.api.reset(l.maskWrapper))})()}invert(){-1!=this.maskWrapper&&this.api.invert(this.maskWrapper)}getOriginalProcessedMaskMat(){if(-1!=this.maskWrapper){const l=this.api.getOriginalMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,l)}}}class h{constructor(){this.undoSteps=[],this.redoSteps=[],this.undoImageSteps=[],this.redoImageSteps=[],this.undoStepcount=20}reset(){this.undoSteps.length=0,this.redoSteps.length=0,this.cutout&&this.cutout.reset()}createCutout(l,_,C,S){null==this.cutout&&(this.cutout=new P(l,_.data,C,S))}isUndoModeAvailable(){return this.undoSteps.length>0}isRedoModeAvailable(){return this.redoSteps.length>0}undo(){if(this.isUndoModeAvailable()){let l=this.undoSteps.pop();l.undoType==n.l3.ERASE&&(this.cutout.undo(),this.redoSteps.length>=this.undoStepcount&&(this.undoSteps=[],this.cutout.undo()),this.redoSteps.push(l))}}aiUndo(){if(this.isUndoModeAvailable()){let l=this.undoSteps.pop();l.undoType==n.l3.ERASE&&(this.cutout.undo(),this.redoSteps.length>=20&&(this.undoSteps=[],this.cutout.undo()),this.redoSteps.push(l))}}redo(){if(this.isRedoModeAvailable()){let l=this.redoSteps.pop();l.undoType==n.l3.ERASE&&(this.cutout.redo(),this.undoSteps.push(l))}}getCutout(){return this.cutout}onMouseUp(){this.cutout.onMouseUp(),this.createUndoState(n.l3.ERASE,null)}createUndoState(l,_){let C=new a;C.model=_,C.undoType=l,this.undoSteps.push(C),this.redoSteps.length=0}addPoint(l,_){this.cutout.addPoint(l,_)}delete(){this.cutout&&this.cutout.delete()}invert(){this.cutout.invert()}undoImage(l,_){if(this.isUndoImageModeAvailable()){let C=this.undoImageSteps.pop();return this.redoImageSteps.push({imageUrl:l,objEraseResizedUploaedImg:_}),C}return null}undoImageReset(){return this.isUndoImageModeAvailable()?this.undoImageSteps.shift():null}redoImage(l,_){if(this.isRedoImageModeAvailable()){let C=this.redoImageSteps.pop();return this.undoImageSteps.push({imageUrl:l,objEraseResizedUploaedImg:_}),C}}isUndoImageModeAvailable(){return this.undoImageSteps.length>0}isRedoImageModeAvailable(){return this.redoImageSteps.length>0}createUndoImageState(l,_){this.undoImageSteps.push({imageUrl:l,objEraseResizedUploaedImg:_}),this.redoImageSteps=[]}getFirstUndoModel(){if(this.isUndoImageModeAvailable())return this.undoImageSteps[0]}}class a{}},32970:(_e,ie,g)=>{"use strict";g.d(ie,{Z:()=>P});var n=g(10467),o=g(75243),G=g(25880);class P{constructor(a,d,e,l){this.points=new Array,this.DESIRED_SIZE=100,this.image=d,this.module=a,this.width=e,this.height=l,this.zoomFactor=2,this.brushRadius=50,this.edgeStrength=50,this.selectedOption=0,this.api={updateMaskMat:a.cwrap("nativeEraserUpdateMaskMat","",["number","array","number","number"]),setBaseImage:a.cwrap("nativeCutoutSetBaseImage","number",["array","number","number"]),getMaskMat:a.cwrap("nativeCutoutGetMaskMat","number",["number"]),getSmoothMaskMat:a.cwrap("nativeCutoutGetSmoothMaskMat","number",["number"]),getOriginalMaskMat:a.cwrap("nativeCutoutGetOriginalMaskMat","number",["number"]),addErasePoint:a.cwrap("nativeCutoutAddErasePoint","",["number","number","number"]),addBrushPoint:a.cwrap("nativeCutoutAddBrushPoint","",["number","number","number"]),addManualErasePoint:a.cwrap("nativeCutoutAddManualErasePoint","",["number","number","number"]),addManualBrushPoint:a.cwrap("nativeCutoutAddManualBrushPoint","",["number","number","number"]),addSmartSelectionPoint:a.cwrap("nativeCutoutAddSmartSelectionPoint","",["number","number","number"]),addAutoCutoutForegroundPoints:a.cwrap("nativeCutoutAddAutoCutoutForegroundPoints","",["number","number","number"]),setBrushSize:a.cwrap("nativeCutoutSetBrushSize","",["number","number","number"]),setEdgeStrength:a.cwrap("nativeCutoutSetEdgeStrength","",["number","number"]),clearSmartSelectionPoint:a.cwrap("nativeCutoutClearSmartSelectionPoint","",["number"]),applyBackgroun
1dPoints:a.cwrap("nativeCutoutApplyBackgroundPoints","",["number"]),applyForegroundPoints:a.cwrap("nativeCutoutApplyForegroundPoints","",["number"]),applyAutoCutoutForegroundPoints:a.cwrap("nativeCutoutApplyAutoCutoutForegroundPoints","",["number"]),isUndoModeAvailable:a.cwrap("nativeCutoutIsUndoModeAvailable","boolean",["number"]),isRedoModeAvailable:a.cwrap("nativeCutoutIsRedoModeAvailable","boolean",["number"]),undo:a.cwrap("nativeCutoutUndoFilter","",["number"]),redo:a.cwrap("nativeCutoutApplyRedoMode","",["number"]),setBrushPointArray:a.cwrap("nativeCutoutSetBrushPointArray","",["number"]),setErasePointArray:a.cwrap("nativeCutoutSetErasePointArray","",["number"]),enableMagicEraseMode:a.cwrap("nativeCutoutEnableMagicEraseMode","",["number"]),enableMagicBrushMode:a.cwrap("nativeCutoutEnableMagicBrushMode","",["number"]),enableManualMode:a.cwrap("nativeCutoutEnableManualMode","",["number"]),setManualBrushPointArray:a.cwrap("nativeCutoutSetManualBrushPointArray","",["number"]),setManualErasePointArray:a.cwrap("nativeCutoutSetManualErasePointArray","",["number"]),delete:a.cwrap("nativeCutoutDelete","",["number"]),reset:a.cwrap("nativeCutoutReset","",["number"]),invert:a.cwrap("nativeCutoutInvertMaskMat","",["number"]),applyFilterOnMask:a.cwrap("nativeApplyFilterOnMask","",["number"])},this.maskWrapper=this.api.setBaseImage(this.image,this.width,this.height),this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor),this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20),this.api.addManualErasePoint(this.maskWrapper,0,0),this.api.setManualErasePointArray(this.maskWrapper)}setBrushSize(a){this.selectedOption==o.MY||this.selectedOption==o.WM?(this.edgeStrength=a,this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20)):(this.brushRadius=a,this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor))}isUndoModeAvailable(){return this.api.isUndoModeAvailable(this.maskWrapper)}isRedoModeAvailable(){return this.api.isRedoModeAvailable(this.maskWrapper)}undo(){return this.api.undo(this.maskWrapper)}redo(){return this.api.redo(this.maskWrapper)}enableMagicEraseMode(){return this.api.enableMagicEraseMode(this.maskWrapper)}enableMagicBrushMode(){return this.api.enableMagicBrushMode(this.maskWrapper)}enableManualMode(){return this.api.enableManualMode(this.maskWrapper)}setBrushPointArray(){this.api.setBrushPointArray(this.maskWrapper)}setErasePointArray(){this.api.setErasePointArray(this.maskWrapper)}setManualErasePointArray(){this.api.setManualErasePointArray(this.maskWrapper)}setManualBrushPointArray(){this.api.setManualBrushPointArray(this.maskWrapper)}setSelectedOption(a){this.selectedOption=a,this.selectedOption==o.MY?this.enableMagicEraseMode():this.selectedOption==o.WM?this.enableMagicBrushMode():(this.selectedOption==o.l4||this.selectedOption==o.lh)&&this.enableManualMode()}onMouseDown(a,d){this.points.length=0,this.api.clearSmartSelectionPoint(this.maskWrapper),this.addPoint(a,d)}onMouseMove(a,d){this.addPoint(a,d)}onMouseUp(){this.selectedOption==o.Uq||this.selectedOption==o.e_?this.interpolateAndAddPoints():this.selectedOption==o.MY?this.setErasePointArray():this.selectedOption==o.WM?this.setBrushPointArray():this.selectedOption==o.l4?this.setManualBrushPointArray():this.selectedOption==o.lh&&this.setManualErasePointArray(),this.api.clearSmartSelectionPoint(this.maskWrapper)}interpolateAndAddPoints(){this.points.length<this.DESIRED_SIZE&&this.interpolate();for(let a=0;a<this.points.length;a++)this.api.addSmartSelectionPoint(this.maskWrapper,this.points[a].x,this.points[a].y);this.selectedOption==o.Uq?this.api.applyForegroundPoints(this.maskWrapper):this.selectedOption==o.e_&&this.api.applyBackgroundPoints(this.maskWrapper),this.points.length=0}interpolate(){let a=this.points.length;if(a>0){let d=Math.floor(this.DESIRED_SIZE/a);for(let e=0;e<this.DESIRED_SIZE;e=+e+d+1)this.points.length>e+1&&this.getMorePoints(this.points[e],this.points[e+1],d,e)}}getMorePoints(a,d,e,l){let _=(d.x-a.x)/e,C=(d.y-a.y)/e,S=new Array;if(0==_&&0==C)return S;for(let x=1;x<=e;x++){let M=a.y+C*x,R=new G.b(Math.round(100*(a.x+_*x))/100,Math.round(100*M)/100);
1this.points.splice(l+x,0,R)}return S}addPoint(a,d){if(-1==this.maskWrapper)throw new Error("Base mask not set..");switch(this.selectedOption){case o.WM:this.api.addBrushPoint(this.maskWrapper,a,d);break;case o.MY:this.api.addErasePoint(this.maskWrapper,a,d);break;case o.l4:this.api.addManualBrushPoint(this.maskWrapper,a,d);break;case o.lh:this.api.addManualErasePoint(this.maskWrapper,a,d);break;case o.Uq:case o.e_:this.points.push(new G.b(a,d))}}isPathMode(){return this.selectedOption==o.Uq||this.selectedOption==o.e_}getSelectedOption(){return this.selectedOption}getMaskMat(){if(-1!=this.maskWrapper){const a=this.api.getMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,a)}throw new Error("Base mask not set..")}getSmoothMaskMat(){if(-1!=this.maskWrapper){const a=this.api.getSmoothMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,a)}throw new Error("Base mask not set..")}applyBgMaskNew(a,d=null){this.maskData=a,d&&d(),this.updateMaskMat()}updateMaskMat(){if(-1!=this.maskWrapper){const d=new Uint8ClampedArray(this.width*this.height*4);for(let l=0;l<this.maskData.data.length;l+=4)d[l]=this.maskData.data[l],d[l+1]=this.maskData.data[l+1],d[l+2]=this.maskData.data[l+2],d[l+3]=this.maskData.data[l+3];const e=new ImageData(d,this.width,this.height);this.api.updateMaskMat(this.maskWrapper,e.data,this.width,this.height),this.renderCallback()}}applyBgMask(a,d=null){let e=new Image;e.crossOrigin="Anonymous",e.addEventListener("load",()=>{let l=e.width,_=e.height,C=document.createElement("canvas");C.width=l,C.height=_;const S=C.getContext("2d");S.clearRect(0,0,l,_),S.drawImage(e,0,0,l,_),this.resize(S.getImageData(0,0,l,_)),d&&d()},!1),e.src=a}resize(a,d=null){this.resizeImageData(a,this.width,this.height).then(e=>{this.maskData=e,this.updateMaskMat(),d&&d()})}resizeImageData(a,d,e){return(0,n.A)(function*(){const l=0|d,_=0|e,C=yield window.createImageBitmap(a,0,0,a.width,a.height,{resizeWidth:l,resizeHeight:_}),S=document.createElement("canvas");S.width=l,S.height=_;const x=S.getContext("2d");return x.drawImage(C,0,0),x.getImageData(0,0,l,_)})()}delete(){var a=this;return(0,n.A)(function*(){-1!=a.maskWrapper&&(yield a.api.delete(a.maskWrapper))})()}reset(){var a=this;return(0,n.A)(function*(){-1!=a.maskWrapper&&(yield a.api.reset(a.maskWrapper))})()}invert(){-1!=this.maskWrapper&&this.api.invert(this.maskWrapper)}getOriginalProcessedMaskMat(){if(-1!=this.maskWrapper){const a=this.api.getOriginalMaskMat(this.maskWrapper);return G.A.unpackProcessImageResult(this.module,a)}}}},34110:(_e,ie,g)=>{"use strict";function o(P,h,a){let d=document.getElementById(P);return d?Promise.resolve():new Promise((e,l)=>{var _=new XMLHttpRequest;_.addEventListener("progress",function(C){C.lengthComputable&&a(C.loaded/C.total)},!1),_.addEventListener("load",function(C){d=document.createElement("script"),document.body.appendChild(d),d.onload=()=>{e()},d.onerror=S=>{l(S.error)},d.id=P,d.async=!0,d.src=h},!1),_.open("GET",h),_.send()})}g.d(ie,{f7:()=>o})},27222:(_e,ie,g)=>{"use strict";g.d(ie,{f:()=>Mc});var n=g(10467),o=g(1408),G=g(3781),P=g(94475),h=g(67294),a=g(45312),d=g(34110),e=g(54438),l=g(79829);const _=c=>c;let C=(()=>{var c;class v{constructor(i,t,r){this.moduleExportName=i,this.wasmJavaScriptLoader=t,this.photoEditorService=r}get module(){return this.resolvedModule}resolveModule(i=null){return(0,d.f7)(this.moduleExportName,`${a.c.wasmAssetsPath}/${this.wasmJavaScriptLoader}`,r=>{i&&i(r)}).then(()=>{const r={locateFile:T=>`${a.c.wasmAssetsPath}/${T}?ver=${a.c.lightXWasmVersion}`};return(this.moduleDecorator||_)(r),window[this.moduleExportName](r)}).then(r=>new Promise((f,T)=>{var N=r.addFunction(H=>{1==H?(this.photoEditorService.resolvedModule=r,this.resolvedModule=r,f()):T()},"vi");r.cwrap("initWasm",null,["number"])(N)}))}}return(c=v).\u0275fac=function(i){e.QTQ()},c.\u0275dir=e.FsC({type:c}),v})();const S=["image/bmp","image/x-windows-bmp","image/jpeg","image/pjpeg","image/png"];class x extends C{constructor(v,s,i,t){super(v,s,i),this.stateService=t,this.fileUploadAccept=S.join(",")}}var E=g(16471),M=g(27707),R=g(33674),I=g(60177),D=g(70372);const p=["resizeCorner"],u=["wrapper"],m=["topBar"];let b=(()=>{var c;class v{constructor(i,t,r,f,T){this._document=i,this._el=t,this.renderer=r,this.photoEditorService=f,this.expandDrawerService=T,this.position={x:100,y:100}
1,this.size={w:200,h:200},this.minSize={w:200,h:200},this.minLeft=0,this.minTop=0,this.minRight=0,this.minBottom=0,this.maxLeft=0,this.maxTop=0,this.maxRight=0,this.maxBottom=0,this.isDragEnabled=!1,this.isExpandFree=!0,this.afterExpandFreeformResized=new e.bkB,this.afterExpandFreeformDragged=new e.bkB,this.marginInPercent=15}ngOnDestroy(){this.changedObserv&&this.changedObserv.unsubscribe()}ngOnInit(){this.setPos(),this.limitCrop(),this.changedObserv=this.expandDrawerService.changeCropBox.subscribe(i=>{if(i){let t=this._document.getElementById("ai-expand-image"),r=t.clientWidth,f=t.clientHeight,T=r/100*i.leftPadding,N=r/100*i.rightPadding,H=f/100*i.bottomPadding,q=f/100*i.topPadding;this.position.x=this.img.offsetLeft-T,this.position.y=this.img.offsetTop-q,this.size.h=this.img.clientHeight+q+H,this.size.w=this.img.clientWidth+T+N}})}setPos(){if(this.container=this._document.getElementById("expand-container"),this.img=this._document.getElementById("ai-expand-image"),this.isExpandFree){let t=(this.container.clientHeight-this.img.clientHeight)/2;this.position.x=(this.container.clientWidth-this.img.clientWidth)/2,this.position.y=t,this.size.h=this.img.clientHeight,this.size.w=this.img.clientWidth}else this.position.x=this.img.offsetLeft,this.position.y=this.img.offsetTop,this.size.h=this.img.clientHeight,this.size.w=this.img.clientWidth}change(i){"EXPAND-FREE"===i.value?(this.isExpandFree=!0,this.setPos(),this.limitCrop()):(this.isExpandFree=!1,this.setPos(),this.limitCrop())}limitCrop(){let i=this.img,t=this.img;if(i.getBoundingClientRect(),this.isExpandFree){let T=t.offsetTop-i.clientHeight*this.marginInPercent/100;this.minLeft=t.offsetLeft-i.clientWidth*this.marginInPercent/100,this.minTop=T,this.maxLeft=t.offsetLeft,this.maxTop=t.offsetTop,this.minRight=t.offsetLeft+i.clientWidth,this.minBottom=t.offsetTop+i.clientHeight,this.maxRight=t.offsetLeft+i.clientWidth+i.clientWidth*this.marginInPercent/100,this.maxBottom=t.offsetTop+i.clientHeight+i.clientHeight*this.marginInPercent/100}else{let T=this.container.offsetTop;this.minLeft=this.container.offsetLeft,this.minTop=T,this.maxLeft=i.offsetLeft,this.maxTop=i.offsetTop,this.minRight=i.offsetLeft+i.clientWidth,this.minBottom=i.offsetTop+i.clientHeight,this.maxRight=this.container.offsetLeft+this.container.clientWidth,this.maxBottom=this.container.offsetTop+this.container.clientHeight}}startDrag(i){if(this.isExpandFree)return;i.preventDefault();const t=i.clientX,r=i.clientY,f=this.position.x,T=this.position.y,N=q=>{let ae=f+(q.clientX-t),ce=T+(q.clientY-r);ae<this.minLeft&&(ae=this.minLeft),ce<this.minTop&&(ce=this.minTop),ae+this.size.w>this.maxRight&&(ae=this.maxRight-this.size.w),ce+this.size.h>this.maxBottom&&(ce=this.maxBottom-this.size.h),this.position.x=ae,this.position.y=ce,this.lastPosition={...this.position},this.syncImageOnDrag()},H=q=>{this._document.removeEventListener("mousemove",N),this._document.removeEventListener("mouseup",H),this.syncImageOnDrag(),this.expandDrawerService._onChange.next({name:"drag"})};this._document.addEventListener("mousemove",N),this._document.addEventListener("mouseup",H)}syncImageOnDrag(){this.renderer.setStyle(this.img,"top",this._el.nativeElement.children[0].offsetTop+"px"),this.renderer.setStyle(this.img,"left",this._el.nativeElement.children[0].offsetLeft+"px")}startResize(i,t,r){if(i.preventDefault(),!this.isExpandFree&&("x"===r||"y"===r))return;const f=i.clientX,T=i.clientY,N=this.position.x,H=this.position.y,q=this.resizeCornerRef.nativeElement.parentNode.offsetWidth,ne=this.resizeCornerRef.nativeElement.parentNode.offsetHeight,se=ce=>{let ve=q,Se=ne;("x"===r||"xy"===r)&&(t.includes("left")?ve+=f-ce.clientX:t.includes("right")&&(ve-=f-ce.clientX)),("y"===r||"xy"===r)&&(t.includes("top")?Se+=T-ce.clientY:t.includes("bottom")&&(Se-=T-ce.clientY));let xe=N+ce.clientX-f,ke=H+ce.clientY-T;if(t.includes("left")&&this.isExpandFree){let Te=Math.max(xe,this.minLeft);xe<this.minLeft?ve+=xe-this.minLeft:xe>this.maxLeft&&(ve+=xe-this.maxLeft,Te=Math.min(xe,this.maxLeft)),this.position.x=Te,this.size.w=ve}if(t.includes("top")&&this.isExpandFree){let Te=Math.max(ke,this.minTop);ke<this.minTop?Se+=ke-this.minTop:ke>
1this.maxTop&&(Se+=ke-this.maxTop,Te=Math.min(ke,this.maxTop)),this.position.y=Te,this.size.h=Se}if(t.includes("bottom")||t.includes("right")){let Te=this.position.x+ve,We=this.position.y+Se;Te>this.maxRight?ve=this.maxRight-this.position.x:Te<this.minRight&&(ve=this.minRight-this.position.x),We>this.maxBottom?Se=this.maxBottom-this.position.y:We<this.minBottom&&(Se=this.minBottom-this.position.y),this.size.w=ve,this.size.h=Se}this.lastSize={...this.size}},ae=ce=>{this._document.removeEventListener("mousemove",se),this._document.removeEventListener("mouseup",ae),this.expandDrawerService._onChange.next({name:"resize"})};this._document.addEventListener("mousemove",se),this._document.addEventListener("mouseup",ae)}removeListener(i,t,r){var f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},T=r;t.trim().split("/ss*/").forEach(function(N){var H=i.listeners;H&&H[N]&&H[N][r]&&(T=H[N][r],delete H[N][r],0===Object.keys(H[N]).length&&delete H[N],0===Object.keys(H).length&&delete i.listeners),i.removeEventListener(N,T,f)})}addListener(i,t,r){var f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},T=r;t.trim().split("/ss*/").forEach(function(N){if(f.once){var H=i.listeners,q=void 0===H?{}:H;T=function(){delete q[N][r],i.removeEventListener(N,T,f);for(var se=arguments.length,ae=new Array(se),ce=0;ce<se;ce++)ae[ce]=arguments[ce];r.apply(i,ae)},q[N]||(q[N]={}),q[N][r]&&i.removeEventListener(N,q[N][r],f),q[N][r]=T,i.listeners=q}i.addEventListener(N,T,f)})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(I.qQ),e.rXU(e.aKT),e.rXU(e.sFG),e.rXU(l.p),e.rXU(D.F))},c.\u0275cmp=e.VBU({type:c,selectors:[["app-crop-frame"]],viewQuery:function(i,t){if(1&i&&(e.GBs(p,5),e.GBs(u,5),e.GBs(m,5)),2&i){let r;e.mGM(r=e.lsd())&&(t.resizeCornerRef=r.first),e.mGM(r=e.lsd())&&(t.wrapperRef=r.first),e.mGM(r=e.lsd())&&(t.topBarRef=r.first)}},outputs:{afterExpandFreeformResized:"afterExpandFreeformResized",afterExpandFreeformDragged:"afterExpandFreeformDragged"},decls:16,vars:12,consts:[["wrapper",""],["topBar",""],["resizeCorner",""],["id","crop-frame",1,"frame-wrapper"],[1,"content-wrapper"],[1,"top-bar-wrapper",3,"mousedown"],[1,"resizers"],[1,"resizer","right",3,"mousedown"],[1,"resizer","left",3,"mousedown"],[1,"resizer","bottom",3,"mousedown"],[1,"resizer","top",3,"mousedown"],[1,"resizer","top-right",3,"mousedown"],[1,"resizer","top-left",3,"mousedown"],[1,"resizer","bottom-left",3,"mousedown"],[1,"resizer","bottom-right",3,"mousedown"]],template:function(i,t){if(1&i){const r=e.RV6();e.j41(0,"div",3,0),e.nrm(2,"div",null,1),e.j41(4,"div",4)(5,"div",5),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startDrag(T))}),e.k0s()(),e.j41(6,"div",6)(7,"div",7),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["right"],"x"))}),e.k0s(),e.j41(8,"div",8),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["left"],"x"))}),e.k0s(),e.j41(9,"div",9),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["bottom"],"y"))}),e.k0s(),e.j41(10,"div",10),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["top"],"y"))}),e.k0s(),e.j41(11,"div",11),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["top","right"],"xy"))}),e.k0s(),e.j41(12,"div",12),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["top","left"],"xy"))}),e.k0s(),e.j41(13,"div",13),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["bottom","left"],"xy"))}),e.k0s(),e.j41(14,"div",14,2),e.bIt("mousedown",function(T){return e.eBV(r),e.Njj(t.startResize(T,["bottom","right"],"xy"))}),e.k0s()()()}2&i&&(e.xc7("top",t.position.y,"px")("left",t.position.x,"px"),e.R7$(4),e.xc7("width",t.size.w,"px")("height",t.size.h,"px"),e.R7$(2),e.xc7("width",t.size.w,"px")("height",t.size.h,"px"))},styles:['.frame-wrapper[_ngcontent-%COMP%]{position:absolute}.content-wrapper[_ngcontent-%COMP%]{position:absolute;background-color:transparent;overflow:auto}.top-bar-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;background-color:transparent}.resizers[_ngcontent-%COMP%]{box-sizing:border-box}.resizers[_ngcontent-%COMP%] .resizer[_ngcontent-%COMP%]{width:2px;height:2px;border:0px dashed #626ADF;position:absolute;filter:drop-shadow(0px 0px 2px rgba(0,0,0,.16))}.resizers[_ngcontent-%COMP%] .right[_ngcontent-%COMP%]{top:0;right:-2px;height:100%;cursor:ew-resize;background:url(https://static.lightxeditor.com/assets/images/expand-dot-y.png) left top repeat-y}.resizers[_ngcontent-%COMP%] .right[_ngcontent-%COMP%]:before{position:absolute;content:"";background:url(https://static.lightxeditor.com/assets/icons/crop-handle.svg) center center no-repeat;width:22px;height:8px;z-index:999;left:calc(50% - 11px);top:calc(50% - 4px);transform:rotate(90deg)}.resizers[_ngcontent-%COMP%] .bottom[_ngcontent-%COMP%]{bottom:-2px;left:0;width:100%;cursor:ns-resize;background:url(https://static.lightxeditor.com/assets/images/expand-dot.png) left top repeat-x}.resizers[_ngcontent-%COMP%] .bottom[_ngcontent-%COMP%]:before{position:absolute;content:"";background:url(https://static.lightxeditor.com/assets/icons/crop-handle.svg) center center no-repeat;width:22px;height:8px;z-index:999;top:-4px;left:calc(50% - 11px)}
1.resizers[_ngcontent-%COMP%] .top[_ngcontent-%COMP%]{top:-1px;left:0;width:100%;cursor:ns-resize;background:url(https://static.lightxeditor.com/assets/images/expand-dot.png) left top repeat-x}.resizers[_ngcontent-%COMP%] .top[_ngcontent-%COMP%]:before{position:absolute;content:"";background:url(https://static.lightxeditor.com/assets/icons/crop-handle.svg) center center no-repeat;width:22px;height:8px;z-index:999;top:-4px;left:calc(50% - 11px)}.resizers[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]{top:0;left:-2px;height:100%;cursor:ew-resize;background:url(https://static.lightxeditor.com/assets/images/expand-dot-y.png) left top repeat-y}.resizers[_ngcontent-%COMP%] .left[_ngcontent-%COMP%]:before{position:absolute;content:"";background:url(https://static.lightxeditor.com/assets/icons/crop-handle.svg) center center no-repeat;width:22px;height:8px;z-index:999;left:calc(50% - 11px);top:calc(50% - 4px);transform:rotate(90deg)}.resizers[_ngcontent-%COMP%] .bottom-right[_ngcontent-%COMP%]{right:-8px;bottom:-8px;cursor:nwse-resize}.resizers[_ngcontent-%COMP%] .top-right[_ngcontent-%COMP%]{right:-8px;top:-8px;cursor:nesw-resize}.resizers[_ngcontent-%COMP%] .top-left[_ngcontent-%COMP%]{left:-8px;top:-8px;cursor:nwse-resize}.resizers[_ngcontent-%COMP%] .bottom-left[_ngcontent-%COMP%]{left:-8px;bottom:-8px;cursor:nesw-resize}.resizers[_ngcontent-%COMP%] .bottom-right[_ngcontent-%COMP%], .resizers[_ngcontent-%COMP%] .top-right[_ngcontent-%COMP%], .resizers[_ngcontent-%COMP%] .top-left[_ngcontent-%COMP%], .resizers[_ngcontent-%COMP%] .bottom-left[_ngcontent-%COMP%]{width:16px;height:16px;border-radius:8px;border:3px solid #626ADF;background-color:#fff}']}),v})();var k=g(95894),A=g(28567),B=g(18050),y=g(79358),O=g(95659),w=g(16478),j=g(66518),L=g(94223),U=g(49449),z=g(74710),Z=g(74983),$=g(68010),Y=g(33391),Q=g(68287),K=g(41300),W=g(91367),X=g(22154),F=g(6755),V=g(65356),le=g(82853),fe=g(90858),Ce=g(68064),Ne=g(64141),Ze=g(49969),de=g(33645);const Ie=c=>({"pe-none":c}),ue=c=>({"is-active-tool":c}),ge=c=>({new_item:c});function be(c,v){if(1&c&&(e.j41(0,"a",8)(1,"div",9),e.nrm(2,"pi",10),e.k0s(),e.j41(3,"span",11),e.EFF(4),e.k0s()()),2&c){const s=e.XpG(2).$implicit;e.R7$(),e.Y8G("ngClass",e.eq3(3,ge,"adjustment"==s.name||"aitools"==s.name||"batch"==s.name)),e.R7$(),e.Y8G("name",s.icon),e.R7$(2),e.JRh(s.title)}}function ye(c,v){if(1&c&&(e.j41(0,"div"),e.DNE(1,be,5,5,"a",7),e.k0s()),2&c){const s=e.XpG().$implicit;e.R7$(),e.Y8G("ngIf",0==s.subNavs.length&&s.enable)}}function Ve(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",3),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG();return e.Njj(r.executeAction(t))}),e.DNE(1,ye,2,1,"div",4),e.nrm(2,"span",5)(3,"span",6),e.k0s()}if(2&c){const s=v.$implicit,i=e.XpG();e.Y8G("ngClass",e.eq3(2,ue,i.activeTool==s.name)),e.R7$(),e.Y8G("ngIf",s.visible)}}let ot=(()=>{var c;class v{constructor(i,t,r,f,T){this.editorService=i,this.modalService=t,this.photoEditorService=r,this.subsService=f,this.confirmDialogService=T,this.tools=M.Ed.toolbar.nav.items,this.toggleSliderEvent=new e.bkB,this.editorService.activeToolPanel.subscribe(N=>{this.activeTool=N.panel})}ngOnInit(){}executeAction(i){setTimeout(()=>{this.subsService.openPromotionPopup()},500),i.name!=this.activeTool&&this.photoEditorService.isDirty?this.confirmDialogService.open({title:w.b.message.warningMessage,okButtonText:"Okay"},()=>{this.editorService.replace=!1,""!=i.name&&(this.photoEditorService.activeTool=i.name),this.editorService.setActiveToolPanel({panel:i.action,from:"nav"})},()=>{}):(this.editorService.replace=!1,""!=i.name&&(this.photoEditorService.activeTool=i.name),this.editorService.setActiveToolPanel({panel:i.action,from:"nav"}))}toggleSliderOpen(i){this.toggleSliderEvent.emit(i)}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(o.x),e.rXU(Y.Bq),e.rXU(l.p),e.rXU(U.n),e.rXU(K.g))},c.\u0275cmp=e.VBU({type:c,selectors:[["toolbar-navigation"]],inputs:{sldBtn:"sldBtn",activeTool:"activeTool"},outputs:{toggleSliderEvent:"toggleSliderEvent"},decls:3,vars:4,consts:[[1,"menu","left-panel-bgcolor","photo-left-panel",2,"height","100%",3,"ngClass"],["customScrollDir","",1,"navigation-item","is-popover-tb-n","ps-0","m-0","pb-3","scroll-container"],["class","inner-nav 11 text-center","style","margin-top:15px;",3,"ngClass","click",4,"ngFor","ngForOf"],[1,"inner-nav","11","text-center",2,"margin-top","15px",3,"click","ngClass"],[4,"ngIf"],[1,"curve-before","curve"],[1,"curve-after","curve"],["class","nav d-block",4,"ngIf"],[1,"nav","d-block"],[1,"hw-40","icon","m-auto","photoEditor","d-flex","align-items-center","justify-content-center",3,"ngClass"],[1,"f-24",3,"name"],[1,"nav-title","text-semi"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"div",1),e.DNE(2,Ve,4,4,"div",2),e.k0s()()),2&i&&(e.Y8G("ngClass",e.eq3(2,Ie,t.ph
1otoEditorService.inProgress)),e.R7$(2),e.Y8G("ngForOf",t.tools))},dependencies:[I.YU,I.Sq,I.bT,de.q,Ce.b],styles:[".menu[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%]:hover .icon[_ngcontent-%COMP%]{background:#626adf0d;color:#606576}.menu[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] .nav-title[_ngcontent-%COMP%]{visibility:visible;position:relative;color:#606576;top:3px}.menu[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%]:hover .nav-title[_ngcontent-%COMP%]{visibility:visible;color:#606576}.menu[_ngcontent-%COMP%] .is-active-tool[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] .nav-title[_ngcontent-%COMP%]{visibility:visible;position:relative;top:3px;color:#626adf!important}.left-panel-bgcolor[_ngcontent-%COMP%]{background:#f8f9f9;border-radius:0 16px 0 0}.new_item[_ngcontent-%COMP%]{position:relative;padding-right:13px}.new_item[_ngcontent-%COMP%]:after{content:url(https://static.lightxeditor.com/assets/icons/newbadge.svg);position:absolute;top:1px;padding-left:47px}.navigation-item[_ngcontent-%COMP%]{padding-right:2px!important}"],data:{animation:[(0,Ze.hZ)("controlsAnimation",[(0,Ze.kY)(":enter",[(0,Ze.iF)({opacity:0}),(0,Ze.i0)("225ms cubic-bezier(.4,0,.2,1)",(0,Ze.iF)({opacity:1}))]),(0,Ze.kY)(":leave",[(0,Ze.i0)("0ms cubic-bezier(.4,0,.2,1)",(0,Ze.iF)({opacity:0}))])])]}}),v})();var ct=g(26494),pe=g(93552),rt=g(630),he=g(55756),ze=g(10634),Fe=g(2820),we=g(84341),qe=g(19338);const et=["resSlider"];function Ct(c,v){1&c&&(e.j41(0,"span"),e.nrm(1,"pi",31),e.k0s())}function kt(c,v){if(1&c&&(e.j41(0,"span",32),e.EFF(1),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.Lme("",s.width," X ",s.height," px")}}function xt(c,v){if(1&c){const s=e.RV6();e.j41(0,"mv-slider",33),e.bIt("valueChange",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.resulationSlider(t))}),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("value",s.resulationSliderValue)("min",s.resulationSliderValueMin)("max",s.resulationSliderValueMax)("step",1)("enabled",s.enableSlider)}}function Tt(c,v){1&c&&(e.j41(0,"span"),e.nrm(1,"pi",34),e.k0s())}function Wt(c,v){if(1&c&&(e.j41(0,"div",35),e.EFF(1),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.SpI(" ",s.errorsmsg," ")}}
1function Yt(c,v){1&c&&(e.j41(0,"button",36)(1,"div",37)(2,"span",38),e.EFF(3,"Loading..."),e.k0s()()())}function $t(c,v){1&c&&(e.j41(0,"div",44)(1,"span",38),e.EFF(2,"Loading..."),e.k0s()())}function Ht(c,v){1&c&&(e.j41(0,"span",45),e.EFF(1,"Download"),e.k0s())}function Kt(c,v){1&c&&(e.j41(0,"span",46),e.EFF(1,"Downloading..."),e.k0s())}function Zt(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",39),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.download())}),e.j41(1,"div",40),e.DNE(2,$t,3,0,"div",41)(3,Ht,2,0,"span",42)(4,Kt,2,0,"span",43),e.k0s()()}if(2&c){const s=e.XpG();e.Y8G("disabled",s.isDisabled),e.R7$(2),e.Y8G("ngIf",s.inDownloadProgress),e.R7$(),e.Y8G("ngIf",!s.inDownloadProgress),e.R7$(),e.Y8G("ngIf",s.inDownloadProgress)}}function Qt(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",47),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.upgradeAndDownload("loginToDownLoad"))}),e.EFF(1,"Download"),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("disabled",s.isDisabled)}}function Jt(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",48),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.upgradeAndDownload("upgrade"))}),e.EFF(1),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("disabled",s.isDisabled),e.R7$(),e.JRh(s.upgradeBtnText)}}let qt=(()=>{var c;class v{constructor(i,t,r,f,T,N,H,q){this.createPopupService=i,this.activeModal=t,this.authService=r,this.modalService=f,this.document=T,this.gtmService=N,this.zone=H,this.paymentService=q,this.width=1080,this.height=1080,this.nonproResolution=512,this.maxResolution=4096,this.minResolution=40,this.resulationSliderValue=0,this.resulationSliderValueMax=this.maxResolution,this.resulationSliderValueMin=this.minResolution,this.qualityOptionList=[],this.switchValue="png",this.qualityDisable=!0,this.errorsmsg=null,this.isDisabled=!1,this.isNeedUpgrade=!1,this.ischeck=!0,this.isProgress=!0,this.proUser=!1,this.enableSlider=!0,this.upgradeBtnText="Upgrade to Pro",this.inDownloadProgress=!1,this.needTodownload=!1}ngOnDestroy(){pe.fabric.perfLimitSizeTotal=this.perfLimitSizeTotal}ngAfterViewInit(){let i=this.resSlider&&this.resSlider.slider;if(i&&!this.proUser){let r=i&&i.sliderElem,f=r.firstElementChild||r.firstChild,T=268/this.maxResolution*512,N=268-T;(i&&i.trackSelection).style.background="linear-gradient(90deg, #626adf "+T+"px, #ec4e4e "+T+"px, #ec4e4e "+N+"px)",f.style.background="linear-gradient(90deg, #E2E3E9 "+T+"px, #ec4e4e "+T+"px, #ec4e4e "+N+"px)"}}checkUser(i){this.user&&!this.user.email?this.authService.getUserDetails(this.user.systemRefKey,t=>{t&&(this.user=this.authService.currentUser(),i())},t=>{i()}):i()}checkMaxResolution(){if("sticker"===this.photoEditorService.toolNameForDownload){let i=this.trim(this.stateService.mainCanvas.toCanvasElement(1/this.zoomService.currentZoom));const r=i.right-i.left+1;this.trimedValues={left:i.left,top:i.top,width:r,height:i.bottom-i.top+1,radio:this.stateService.mainCanvas.width/(r*this.zoomService.currentZoom)},this.maxResolution=Math.floor(r*(this.maxResolution*this.zoomService.currentZoom/this.stateService.mainCanvas.width)),this.resulationSliderValueMax=this.maxResolution}}ngOnInit(){this.perfLimitSizeTotal=pe.fabric.perfLimitSizeTotal,pe.fabric.perfLimitSizeTotal=16777216,this.proUser=!(!this.user||!this.user.subscribed),this.photoEditorService.isResizeCropTool&&(this.proUser=!0),this.maxResolution=this.photoEditorService.getMaxResolution(),this.resulationSliderValueMax=this.maxResolution,this.checkMaxResolution(),"expand"===this.photoEditorService.activeSubTool&&this.photoEditorService.selectedExpandedImage?(this.width=this.photoEditorService.selectedExpandedImage.width,this.height=this.photoEditorService.selectedExpandedImage.height):"sticker"===this.photoEditorService.toolNameForDownload?(this.width=this.trimedValues.width,this.height=this.trimedValues.height):"aireshape"===this.photoEditorService.toolNameForDownload?(this.width=Math.round(this.stateService.mainCanvas.width/this.stateService.mainCanvas.getZoom()),this.height=Math.round(this.stateService.mainCanvas.height/this.stateService.mainCanvas.getZoom())):(this.width=this.stateService.original.width,this.height=this.stateService.original.height),this.qual
1ityOptionList=[{id:1,name:"Low"},{id:2,name:"Medium"},{id:3,name:"High"}],this.selectedQuality=this.qualityOptionList[2].name,!this.proUser&&(this.width>this.nonproResolution||this.height>this.nonproResolution)&&(this.width<this.height?(this.width=Math.floor(this.width*this.nonproResolution/this.height),this.height=this.nonproResolution):(this.height=Math.floor(this.height*this.nonproResolution/this.width),this.width=this.nonproResolution)),this.projectJson={hRatio:this.height,wRatio:this.width},this.projectJson.wRatio>this.projectJson.hRatio?(this.maxWidth=this.maxResolution,this.maxHeight=Math.floor(this.maxResolution*this.projectJson.hRatio/this.projectJson.wRatio),this.minHeight=this.minResolution,this.minWidth=Math.floor(this.minResolution*this.projectJson.wRatio/this.projectJson.hRatio)):(this.maxHeight=this.maxResolution,this.maxWidth=Math.floor(this.maxResolution*this.projectJson.wRatio/this.projectJson.hRatio),this.minWidth=this.minResolution,this.minHeight=Math.floor(this.minResolution*this.projectJson.hRatio/this.projectJson.wRatio)),this.width>=this.height&&this.width>this.maxWidth&&(this.width=this.maxWidth,this.height=Math.round(this.width*this.projectJson.hRatio/this.projectJson.wRatio)),this.height>this.width&&this.height>this.maxHeight&&(this.height=this.maxHeight,this.width=Math.round(this.height*this.projectJson.wRatio/this.projectJson.hRatio)),this.errorsmsgCONST=`Image Dimension should range from this ${this.minResolution} to ${this.maxResolution} px`,this.setSliderValue(),this.isProgress=!0,this.checkUser(i=>{this.isProgress=!1,this.setTrialPeriod()}),!this.proUser&&this.switchView(null,"png"),this.needTodownload&&(this.needTodownload=!1,this.height=this.photoEditorService.PreviousdownloadHight,this.width=this.photoEditorService.previousdownloadWidth,this.switchValue=this.photoEditorService.downloadswitchValue,this.resulationSliderValue=this.photoEditorService.downloadresulationSliderValue,this.switchView(null,this.switchValue),this.download())}setTrialPeriod(){let i=this.paymentService.getTrialUi("Upgrade and Download");this.upgradeBtnText=i.upgradeBtnText}setSliderValue(){this.resulationSliderValue=this.width<this.height?this.height:this.width}trimFinal(i,t,r){"sticker"===this.photoEditorService.toolNameForDownload?pe.fabric.util.loadImage(i,f=>{const T=pe.fabric.util.createCanvasElement();T.width=f.width,T.height=f.height;const N=T.getContext("2d");N.drawImage(f,0,0);const H=this.width/this.trimedValues.width,se=this.width,ae=this.height,ce=N.getImageData(this.trimedValues.left*H,this.trimedValues.top*H,se,ae),ve=this.createCanvas(se,ae).getContext("2d");ve.putImageData(ce,0,0),r(ve.canvas.toDataURL(t))}):r(i)}resulationSlider(i){!this.proUser&&i>this.nonproResolution&&i<550&&(i=this.nonproResolution),this.resulationSliderValue=i,this.width<this.height?(this.height=this.resulationSliderValue,this.width=Math.floor(this.height*this.projectJson.wRatio/this.projectJson.hRatio)):(this.width=this.resulationSliderValue,this.height=Math.floor(this.width*this.projectJson.hRatio/this.projectJson.wRatio)),this.isNeedUpgrade=!this.proUser&&(this.width>this.nonproResolution||this.height>this.nonproResolution),this.checkValidate(),this.width&&this.height&&(this.width=parseInt(this.width.toString()),this.height=parseInt(this.height.toString()))}inputWidthSize(i){this.width=i,this.height=Math.floor(this.width*this.projectJson.hRatio/this.projectJson.wRatio),this.checkValidate(),this.setSliderValue()}inputHeighthSize(i){this.height=i,this.width=Math.floor(this.height*this.projectJson.wRatio/this.projectJson.hRatio),this.checkValidate(),this.setSliderValue()}checkValidate(){let i=!1;i=!(this.width<this.minWidth||this.width>this.maxWidth||this.height<this.minHeight||this.height>this.maxHeight),i?(this.isDisabled=!1,this.errorsmsg=null):(this.isDisabled=!0,this.errorsmsg=this.errorsmsgCONST)}download(){this.zone.run(()=>{this.inDownloadProgress=!0}),this.photoEditorService.hide(),setTimeout(()=>{this.doDownload()},200)}doDownload(){let i=null;const t=this.photoEditorService.toolNameForDownload;if(t)switch(t){case"blur":case"splash":i=this.photoEditorService.restoreResolution(this.width)}i?i.then(r=>{this.zone.run(()=>{this.inDownloadProgress=!1}),this.download2(),r()}):(this.download2(),this.inDownloadProgress=!1)}download2(){this.isDisabled=!0;const i={format:this.switchValue};let t=1;if("jpeg"===this.switchValue)switch(this.selectedQuality){case"Low":t=.5;break;case"High":t=1;break;case"Medium":t=.75}i.quality=t,i.multiplier="sticker"===this.photoEditorService.toolNameForDownload?this.width*this.trimedValues.radio/this.stateService.mainCanvas.width:this.width/this.stateService.mainCanvas.width,this.render(i),setTimeout(()=>{this.gtmDownloadEvent(),this.photoEditorService.show()})}render(i){let r,t=!1;this.stateService.mainCanvas.renderAll(),"jpeg"===this.switchValue&&(this.stateService.mainCanvas.backgroundImage||this.stateService.mainCanvas.backgroundColor||(t=!0,this.stateService.mainCanvas.setBackgroun
1dColor("#ffffff",()=>{this.stateService.mainCanvas.renderAll()}))),r=this.getDataURL(i),this.trimFinal(r,i,f=>{r=f,t&&this.stateService.mainCanvas.setBackgroundColor(null,()=>{this.stateService.mainCanvas.renderAll()}),this.progressBarModalRef&&this.progressBarModalRef.close("ok"),this.activeModal.close(),this.downloadUrl(r,this.photoEditorService.projectName+"."+this.switchValue),this.isDisabled=!1,this.showSubscriptionDialog()})}getDataURL(i){if("objEraser"==this.photoEditorService.toolNameForDownload){const t=this.photoEditorService.theOriginalOriginalImage,r=pe.fabric.util.createCanvasElement();r.width=t.width,r.height=t.height;const f=new pe.fabric.StaticCanvas(r,{enableRetinaScaling:!1}),T=new pe.fabric.Image(this.photoEditorService.theOriginalOriginalImage);return f.add(T),i.multiplier=this.width/t.width,f.toDataURL(i)}return this.stateService.mainCanvas.toDataURL(i)}showSubscriptionDialog(){(!this.user||!this.user.subscribed)&&this.downloadSuccessModel()}upgradeAndDownload(i){this.photoEditorService.PreviousdownloadHight=this.height,this.photoEditorService.previousdownloadWidth=this.width,this.photoEditorService.downloadswitchValue=this.switchValue,this.photoEditorService.downloadresulationSliderValue=this.resulationSliderValue,this.activeModal.close(i)}downloadUrl(i,t){const r=document.createElement("a");r.href=i,r.download=t,document.body.appendChild(r),r.style="display: none",r.click(),r.remove()}onQualityChange(){}switchView(i,t){this.proUser||"png"!==t?(this.enableSlider=!0,this.width&&this.resulationSlider(this.resulationSliderValue)):(this.isNeedUpgrade=!0,this.enableSlider=!1),this.switchValue=t,this.qualityDisable="png"===this.switchValue,this.ngAfterViewInit()}startProgressBar(){this.progressBarModalRef=this.modalService.open(ct.M,{centered:!0,size:"md",backdrop:"static",windowClass:"downloadprogress"}),this.progressBarModalRef.result.then(i=>{"cancel"===i?this.isDisabled=!1:this.user&&!this.user.subscribed?this.downloadSuccessModel():this.user||this.downloadSuccessModel()})}downloadSuccessModel(){this.createPopupService.openSocialShareDialog()}createCanvas(i,t){return Object.assign(document.createElement("canvas"),{width:i,height:t})}trim(i){const t=i.getContext("2d"),f=(this.createCanvas(i.width,i.height).getContext("2d"),t.getImageData(0,0,i.width,i.height));let H={top:null,left:null,right:null,bottom:null};return H=this.getTrimmedBound(f,i.width),H}getTrimmedBound(i,t){let r,f,T={top:null,left:null,right:null,bottom:null};for(let N=0;N<i.data.length;N+=4)0!==i.data[N+3]&&(r=N/4%t,f=~~(N/4/t),null===T.top&&(T.top=f),(null===T.left||r<T.left)&&(T.left=r),(null===T.right||T.right<r)&&(T.right=r),(null===T.bottom||T.bottom<f)&&(T.bottom=f));return T}gtmDownloadEvent(){let i="",t="";const r=this.document.getElementById("gtm-photo-editor-active-tool"),f=this.document.getElementById("gtm-photo-editor-active-sub-tool");f?i=f.getAttribute("value"):(i=r.getAttribute("value"),i=i&&i.charAt(0).toUpperCase()+i.slice(1)),i&&(t=i+" - "+this.switchValue),i&&t&&this.gtmService.pushTag({eventName:w.b.gtm.eventname.photoEditorDownload,itemName:i,itemType:t})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(rt.A),e.rXU(Y.Lw),e.rXU($.u),e.rXU(Y.Bq),e.rXU(I.qQ),e.rXU(he.y),e.rXU(e.SKi),e.rXU(ze.W))},c.\u0275cmp=e.VBU({type:c,selectors:[["export-settings"]],viewQuery:function(i,t){if(1&i&&e.GBs(et,5),2&i){let r;e.mGM(r=e.lsd())&&(t.resSlider=r.first)}},inputs:{stateService:"stateService",photoEditorService:"photoEditorService",zoomService:"zoomService",canvasService:"canvasService",ischeck:"ischeck",user:"user",needTodownload:"needTodownload"},decls:43,vars:23,consts:[["resSlider",""],[1,"popup_wrapper"],[1,"d-flex","justify-content-between","align-items-center"],[1,"text-normal","text-dark","lh-p4","text-bold"],[1,"pointer",3,"click"],["name","closeexport",1,"f-24"],[1,"toggle","mt-9","position-relative"],["type","button",1,"btn","btn-primary","align-self-center","ms-1",3,"click","ngClass"],[1,"d-inline-block"],["type","button",1,"btn","btn-primary","align-self-center","ms-4",3,"click","ngClass"],[4,"ngIf"],[1,"card","drawer-card","mt-10"],[1,"card-body"],[1,"m-0","text-semi",3,"ngClass"],["class","text-13 text-primary lh-p5 float-end text-bold",4,"ngIf"],[1,"float-end"],[1,"d-flex","mt-9"],[1,"wp-100","d-flex","align-items-center","pro-download"],["enabled","true",1,"opacity-slider",2,"width","100%",3,"valueChange","hidden","value","min","max","step","ngClass"],["style","width:100%","class","opacity-slider",3,"value","min","max","step","enabled","valueChange",4,"ngIf"],[1,"card","drawer-card","mb-0","mt-10"],[1,"d-flex","align-items-center","justify-content-between"],[1,""],["type","text","numbersOnly","","maxlength","4",1,"form-control","form-input-md","text-normal","text-black",3,"ngModelChange","disabled","ngModel"],["name","downloadequal",1,"align-self-center","ml-7","mr-7"],["class","scratch-slider mt-2","style","color: #E20E33;",4,"ngIf"],[1,"d-flex","justify-content-center"],["type","button","class","btn btn-primary btn-full btn-block text-white btn-h40 mt-3",4,"ngIf"],["type","button","class","btn btn-primary btn-h40 w-100 mt-10 text-13 d-flex align-items-center justify-content-center","id","photo_editor_download",3,"disabled","click",4,"ngIf"],["type","button","class","btn btn-primary btn-h40 w-100 mt-10 text-13","id","photo_editor_dw_login",3,"disabled","click",4,"ngIf"],["type","button","class","btn btn-primary btn-upgrade btn-h40 w-100 mt-10 text-13","id","photo_editor_dw_upgrade",3,"disabled","click",4,"ngIf"],["name","proicon",1,"position-absolute",2,"top","0","right","13px"],[1,"text-13","text-primary","lh-p5","float-end","text-bold"],[1,"opacity-slider",2,"width","100%",3,"valueChange","value","min","max","step","enabled"],["name","proicon"],[1,"scratch-slider","mt-2",2,"color","#E20E33"],["type","button",1,"btn","btn-primary","btn-full","btn-block","text-white","btn-h40","mt-3"],["role","status",1,"spinner-border"],[1,"sr-only","text-nowrap","border-0","position-absolute","overflow-hidden"],["type","button","id","photo_editor_download",1,"btn","btn-primary","btn-h40","w-100","mt-10","text-13","d-flex","align-items-center","justify-content-center",3,"click","disabled"],[1,"pe-none"],["class","spinner-border spinner-border-lg me-2 hw-24","role","status",4,"ngIf"],["id","button-text",4,"ngIf"],["id"," button-text",4,"ngIf"],["role","status",1,"spinner-border","spinner-border-lg","me-2","hw-24"],["id","button-text"],["id"," button-text"],["type","button","id","photo_editor_dw_login",1,"btn","btn-primary","btn-h40","w-100","mt-10","text-13",3,"click","disabled"],["type","button","id","photo_editor_dw_upgrade",1,"btn","btn-primary","btn-upgrade","btn-h40","w-100","mt-10","text-13",3,"click","disabled"]],template:function(i,t){if(1&i){const r=e.RV6();e.j41(0,"div",1)(1,"div",2)(2,"div",3),e.EFF(3,"Format"),e.k0s(),e.j41(4,"div",4),e.bIt("click",function(){return e.eBV(r),e.Njj(t.activeModal.dismiss("Cross click"))}),e.nrm(5,"pi",5),e.k0s()(),e.j41(6,"div",6)(7,"button",7),e.bIt("click",function(T){return e.eBV(r),e.Njj(t.switchView(T,"jpeg"))}),e.j41(8,"span",8),e.EFF(9,"JPEG"),e.k0s()(),e.j41(10,"button",9),e.bIt("click",function(T){return e.eBV(r),e.Njj(t.switchView(T,"png"))}),e.j41(11,"span",8),e.EFF(12,"PNG"),e.k0s(),e.DNE(13,Ct,2,0,"span",10),e.k0s()(),e.j41(14,"div",11)(15,"div",12)(16,"h5",13),e.EFF(17,"Resolution "),e.DNE(18,kt,2,2,"span",14),e.nrm(19,"span",15),e.k0s(),e.j41(20,"div",16)(21,"div",17)(22,"mv-slider",18,0),e.bIt("valueChange",function(T){return e.eBV(r),e.Njj(t.resulationSlider(T))}),e.k0s(),e.DNE(24,xt,1,5,"mv-slider",19),e.k0s()()()(),e.j41(25,"div",20)(26,"div",12)(27,"div",21)(28,"h5",13),e.EFF(29,"Custom (width x height)"),e.k0s(),e.DNE(30,Tt,2,0,"span",10),e.k0s(),e.j41(31,"div",16)(32,"div",22)(33,"input",23),e.mxI("ngModelChange",function(T){return e.eBV(r),e.D
1H7(t.width,T)||(t.width=T),e.Njj(T)}),e.bIt("ngModelChange",function(T){return e.eBV(r),e.Njj(t.inputWidthSize(T))}),e.k0s()(),e.nrm(34,"pi",24),e.j41(35,"div",22)(36,"input",23),e.mxI("ngModelChange",function(T){return e.eBV(r),e.DH7(t.height,T)||(t.height=T),e.Njj(T)}),e.bIt("ngModelChange",function(T){return e.eBV(r),e.Njj(t.inputHeighthSize(T))}),e.k0s()()()(),e.DNE(37,Wt,2,1,"div",25),e.k0s(),e.j41(38,"div",26),e.DNE(39,Yt,4,0,"button",27)(40,Zt,5,4,"button",28)(41,Qt,2,1,"button",29)(42,Jt,2,2,"button",30),e.k0s()()}2&i&&(e.R7$(7),e.Y8G("ngClass","jpeg"===t.switchValue?"":"btn-png"),e.R7$(3),e.Y8G("ngClass","png"===t.switchValue?"":"btn-png"),e.R7$(3),e.Y8G("ngIf",!t.proUser),e.R7$(3),e.Y8G("ngClass",t.enableSlider?"text-normal text-dark lh-p4":"disabled"),e.R7$(2),e.Y8G("ngIf",null==t.errorsmsg),e.R7$(4),e.Y8G("hidden",!t.enableSlider)("value",t.resulationSliderValue)("min",t.resulationSliderValueMin)("max",t.resulationSliderValueMax)("step",1)("ngClass",t.proUser?"":"upgradeplanSlider"),e.R7$(2),e.Y8G("ngIf",!t.enableSlider),e.R7$(4),e.Y8G("ngClass",t.proUser?"text-normal text-dark lh-p4":"disabled"),e.R7$(2),e.Y8G("ngIf",!t.proUser),e.R7$(3),e.Y8G("disabled",!t.proUser),e.R50("ngModel",t.width),e.R7$(3),e.Y8G("disabled",!t.proUser),e.R50("ngModel",t.height),e.R7$(),e.Y8G("ngIf",""!=t.errorsmsg),e.R7$(2),e.Y8G("ngIf",t.isProgress),e.R7$(),e.Y8G("ngIf",!t.isProgress&&!t.isNeedUpgrade&&t.user),e.R7$(),e.Y8G("ngIf",!t.isProgress&&!t.isNeedUpgrade&&!t.user),e.R7$(),e.Y8G("ngIf",!t.isProgress&&t.isNeedUpgrade))},dependencies:[I.YU,I.bT,Fe.Z,we.me,we.BC,we.tU,we.vS,qe.d1,Ce.b],styles:['.popup-alignment[_ngcontent-%COMP%]{right:18px!important;top:-77px;position:absolute}.popup_wrapper[_ngcontent-%COMP%]{padding:16px;width:300px}.popup_wrapper[_ngcontent-%COMP%] .popupText[_ngcontent-%COMP%]{border:1px solid #B0B3BF;box-sizing:border-box;border-radius:12px;text-align:center;color:#272b34}.popup_wrapper[_ngcontent-%COMP%] .cross[_ngcontent-%COMP%]{margin:0 15px;font-size:12px;line-height:36px}.popup_wrapper[_ngcontent-%COMP%] .label[_ngcontent-%COMP%]{font-style:normal;font-size:14px;line-height:19px;color:#272b34;margin-left:16px}.popup_wrapper[_ngcontent-%COMP%] .toggle[_ngcontent-%COMP%]{display:inline-flex;width:268px;height:40px;background:#626adf1a;border:1px solid #E2E3E9;border-radius:12px}.popup_wrapper[_ngcontent-%COMP%] .toggle[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{width:117px;height:32px;border-radius:8px;border:0px!important;outline:none!important}.popup_wrapper[_ngcontent-%COMP%] .toggle[_ngcontent-%COMP%] .btn-png[_ngcontent-%COMP%]{background:transparent;color:#272b34!important;border:0px!important;outline:none!important}.checkmark[_ngcontent-%COMP%]{position:absolute;top:0;left:0;height:25px;width:25px;background-color:#eee}.container[_ngcontent-%COMP%]:hover input[_ngcontent-%COMP%] ~ .checkmark[_ngcontent-%COMP%]{background-color:#ccc}.container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:checked ~ .checkmark[_ngcontent-%COMP%]{background-color:#2196f3}.checkmark[_ngcontent-%COMP%]:after{content:"";position:absolute;display:none}.container[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:checked ~ .checkmark[_ngcontent-%COMP%]:after{display:block}.container[_ngcontent-%COMP%] .checkmark[_ngcontent-%COMP%]:after{left:9px;top:5px;width:5px;height:10px;border:solid white;border-width:0 3px 3px 0;transform:rotate(45deg)}.form-control[_ngcontent-%COMP%]{border:1px solid #B0B3BF;box-sizing:border-box;border-radius:12px;text-align:center;color:#272b34}.form-control[_ngcontent-%COMP%]:hover{border:1px solid #4A4F5E}.form-control[_ngcontent-%COMP%]:focus{border:1px solid #4A4F5E}.disabled[_ngcontent-%COMP%]{font-size:14px;line-height:19.07px;color:#b0b3bf}']}),v})();var ei=g(24886),Bt=g(43695),Dt=g(55349),ti=g(68887),Ft=g(92838),ii=g(34183),St=g(80006),oi=g(94375),ni=g(55445);const si=["maskDiv"],ri=["inputRef"],ai=c=>({"pe-none":c}),li=c=>({"min-width":c}),ci=c=>({"for-login":c}),hi=c=>({new_item:c}),di=c=>({"no-credit-item":c});function pi(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"nav",1)(2,"div",2)(3,"div",3)(4,"a",4),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.handler())}),e.j41(5,"span",5),e.nrm(6,"img",6),e.k0s(),e.j41(7,"span",7),e.nrm(8,"img",6),e.k0s()()()()(),e.bVm()}}function ui(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",34),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.openLoginDialog())}),e.EFF(1,"My Projects"),e.k0s()}}function mi(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",55)(2,"div",56),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG().index,f=e.XpG(6);return f.menuClick(t),e.Njj(f.hideMenubar("menu-"+(r+1)))}),e.j41(3,"div",57),e.nrm(4,"img",58),e.k0s(),e.j41(5,"div",59)(6,"h3",60),e.EFF(7),e.k0s()()()(),e.bVm()}if(2&c){const s=v.$implicit;e.R7$(4),e.FS9("src",s.url,e.B4B),e.FS9("alt",s.text),e.R7$(2),e.Y8G("ngClass",e.eq3(4,hi,1==(null==s||null==s.metadata?null:s.metadata.isNew))),e.R7$(),e.JRh(s.text)}}function gi(c,v){if(1&c&&(e.j41(0,"div",51)(1,"div",52)(2,"h3",53),e.EFF(3),e.k0s()(),e.DNE(4,mi,8,6,"ng-container",54),e.k0s()),2&c){const s=v.$implicit;e.R7$(3),e.JRh(s.title),e.R7$(),e.Y8G("ngForOf",s.links)}}function _i(c,v){if(1&c&&(e.j41(0,"div",44)(1,"div",45)(2,"div",46)(3,"div",47)(4,"div",48)(5,"div",49),e.DNE(6,gi,5,2,"div",50),e.k0s()()()()()()),2&c){const s=e.XpG(2).index,i=e.XpG(3);e.Mz_("id","mg-menu-panel-",s+1,""),e.Y8G("ngClass",e.eq3(4,ci,i.user)),e.R7$(6),e.Y8G("ngForOf",i.storyPage.sections)}}function fi(c,v){if(1&c&&(e.qex(0),e.j41(1,"a",39)(2,"div",40)(3,"span",41),e.EFF(4,"All Tools"),e.k0s(),e.nrm(5,"pi",42),e.k0s()(),e.DNE(6,_i,7,6,"div",43),e.bVm()),2&c){const s=e.XpG(4);e.R7$(6),e.Y8G("ngIf",null==s.storyPage?null:s.storyPage.sections)}}function vi(c,v){if(1&c){const s=e.RV6();e.j41(0,"li",38),e.bIt("mouseenter",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.resetMenu(t))}),e.DNE(1,fi,7,1,"ng-container",0),e.k0s()}if(2&c){const s=v.$implicit,i=v.index;e.FS9("tabindex",5+i),e.Mz_("id","menu-",i+1,""),e.R7$(),e.Y8G("ngIf",s.type)}}function Fi(c,v){if(1&c&&(e.j41(0,"div",35)(1,"ul",36),e.DNE(2,vi,2,4,"li",37),e.k0s()()),2&c){const s=e.XpG(2);e.R7$(2),e.Y8G("ngForOf",s.mainSection)}}function bi(c,v){1&c&&e.nrm(0,"div",61)}function oe(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",62),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.redirectToPage("upgrade-plan"))}),e.nrm(1,"pi",63),e.EFF(2,"\xa0 Try Lightx Pro "),e.k0s()}}function Ee(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",62),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.redirectToPage("upgrade-plan"))}),e.nrm(1,"pi",63),e.EFF(2,"\xa0 Try Lightx Pro "),e.k0s()}}function J(c,v){if(1&c&&(e.j41(0,"span",69),e.EFF(1),e.k0s()),2&c){const s=e.XpG(3);e.R7$(),e.JRh(s.user.remainingCoins)}}function ee(c,v){1&c&&(e.j41(0,"span",69),e.EFF(1,"00"),e.k0s())}function te(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",70),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.upgradePlanDirectPayment())}),e.EFF(1,"Unlock Full Credits"),e.k0s()}}function re(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",71),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.addCredits())}),e.EFF(1,"Add Credits"),e.k0s()}}function Pe(c,v){if(1&c&&(e.j41(0,"div",64),e.nrm(1,"img",65),e.DNE(2,J,2,1,"span",66)(3,ee,2,0,"span",66)(4,te,2,0,"button",67)(5,re,2,0,"button",68),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(4,di,!s.user.remainingCoins)),e.R7$(2),e.Y8G("ngIf",s.user.remainingCoins>0),e.R7$(),e.Y8G("ngIf",!s.user.remainingCoins||s.user.remainingCoins<0),e.R7$(),e.vxM(s.isInTrialPeriod&&s.isTrialCredit
1Cap?4:5)}}function Be(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",72),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.getCredits())}),e.nrm(1,"img",65),e.EFF(2," Get Credits "),e.k0s()}}function Oe(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"nav",8)(2,"div",9)(3,"div",10)(4,"a",4),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.handler())}),e.j41(5,"span",5),e.nrm(6,"img",11),e.k0s(),e.j41(7,"span",7),e.nrm(8,"img",11),e.k0s()(),e.DNE(9,ui,2,0,"button",12),e.j41(10,"button",13),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.redirectToPage("open-image"))}),e.EFF(11,"Open Image"),e.k0s(),e.j41(12,"div",14),e.nrm(13,"pi",15),e.k0s(),e.j41(14,"div",16),e.qex(15),e.j41(16,"div",17)(17,"nav",18),e.DNE(18,Fi,3,1,"div",19),e.k0s()(),e.bVm(),e.k0s(),e.j41(19,"div",20)(20,"div",21)(21,"div",22)(22,"div",23)(23,"div",24)(24,"app-dashboard-search",25),e.bIt("ngOpenChange",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onDashboardSearchOpenChange(t))})("template",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.template(t))}),e.k0s()()()()(),e.DNE(25,bi,1,0,"div",26),e.k0s(),e.DNE(26,oe,3,0,"div",27)(27,Ee,3,0,"div",27),e.k0s(),e.j41(28,"div",28),e.DNE(29,Pe,6,6,"div",29)(30,Be,3,0,"button",30),e.j41(31,"div",31),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.export())}),e.j41(32,"button",32),e.nrm(33,"pi",33),e.EFF(34,"Download "),e.k0s()()()()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(),e.Y8G("ngClass",e.eq3(15,ai,s.photoEditorService.inProgress)),e.R7$(8),e.Y8G("ngIf",s.user),e.R7$(9),e.Y8G("ngIf",s.storyPage&&(null==s.storyPage||null==s.storyPage.sections?null:s.storyPage.sections.length)>0),e.R7$(2),e.Y8G("ngClass",s.ngOpenValue?"position-absolute template-search-bar-container-active border-radius-12":"position-relative template-search-bar-container"),e.R7$(3),e.Y8G("ngStyle",e.eq3(17,li,s.ngOpenValue?"400px":"")),e.R7$(),e.Y8G("isheader",!0)("searchReset",s.searchReset)("templateType",s.templateTypeForSearch)("placeholder",s.searchPlaceholder),e.R7$(),e.Y8G("ngIf",s.ngOpenValue),e.R7$(),e.Y8G("ngIf",!s.user),e.R7$(),e.Y8G("ngIf",s.user&&!s.user.subscribed),e.R7$(2),e.Y8G("ngIf",s.user&&s.activeTool==s.aitoolTabName),e.R7$(),e.Y8G("ngIf",!s.user&&s.activeTool==s.aitoolTabName),e.R7$(2),e.Y8G("disabled",!s.photoEditorService.isExportable||!s.photoEditorService.originalImage)}}let ht=(()=>{var c;class v{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se,xe,ke,Te,We,Me,Ae,Re,Ge,je,Xe,Ke,Ye,Je,st,tt){this._router=i,this.route=t,this.toastService=r,this.modalService=f,this.authService=T,this.subsService=N,this.editorUiService=H,this.photoEditorService=q,this.dialogService=ne,this.zoomService=se,this.projectSyncService=ae,this.canvasStateService=ce,this.loginService=ve,this.envService=Se,this.canvasService=xe,this.renderer=ke,this.document=Te,this.router=We,this.aIService=Me,this.storyPageService=Ae,this.uploadImageService=Re,this.editorService=Ge,this.gtmService=je,this.aiUploadImageService=Xe,this.toolhistoryservice=Ke,this.menuService=Ye,this.confirmDialogService=Je,this.aiPhotoService=st,this.paymentService=tt,this.ngOpenValue=!1,this.ntfInProgress=!1,this.markAsRead=new e.bkB,this.link="/",this.isOpen=!1,this.actionIcon="editdone",this.projectName="",this.maxWidth=200,this.inputWidth=75,this.inFocused=!1,this.aitoolTabName="aitools",this.megaMenuItem=!1,this.toolType="photo-all-tools",this.mainSection=[],this.templateTypeForSearch=ei.If.NONE,this.searchPlaceholder="Search tools",this.isTrialCreditCap=!1,this.isInTrialPeriod=!1,this.needTodownload=!1,this.imgQueryParams={imageUrl:"",tabName:"",from:"",editorType:"",openNewTab:!1,attr:"",isBlank:!1},this.body=this.document.getElementsByTagName("body"),this.user=this.authService.currentUser(),this.slug=this.route.snapshot.paramMap.get("slug"),this.setHomeUrl(),this.refreshTrialAndPaymentFlags(),this.getAllToolContent(),this.loggedInObserver=this.authService.loggedIn.subscribe(at=>{this.user=this.authService.currentUser(),this.setHomeUrl(),this.refreshTrialAndPaymentFlags()}),this.usrPropChangedObserver=this.authService.usrPropChanged.subscribe(at=>{this.user=this.authService.currentUser(),this.setHomeUrl(),this.refreshTrialAndPaymentFlags()}),this.updateConfigObserver=this.paymentService.updateConfig.subscribe(at=>{at&&this.refreshTrialAndPaymentFlags()})}
1refreshTrialAndPaymentFlags(){this.isTrialCreditCap=!0,this.isInTrialPeriod=this.authService.getSubscription()?.upgrade}getAllToolContent(){this.storyPageService.getStoryPageContent("all-tools","all-tools","all-tools",i=>{if(this.storyPage=i.body.storyPage,this.storyPage){const t=this.storyPage?.sections.filter(r=>r.type==this.toolType);this.mainSection=t&&t.length>0?t:[],this.mainSection.length>0&&(this.mainSection[0].pageTitle="All tools"),this.mainSection.forEach(r=>{r.links?.sort((f,T)=>f?.metadata?.order-T?.metadata?.order)})}this.isLoaded=!0},i=>{i&&1e3===i.statusCode&&this.router.navigate(["/404"])})}setHomeUrl(){this.link=this.user?w.b.AFTER_LOGIN_REDIRATION_URI:"/"}ngOnDestroy(){this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.usrPropChangedObserver&&this.usrPropChangedObserver.unsubscribe(),this.updateConfigObserver&&this.updateConfigObserver.unsubscribe()}onDashboardSearchOpenChange(i){this.ngOpenValue=i}handler(){this._router.navigate(this.envService.isMobileView?["/"]:[this.link])}saveProject(i,t=null){this.document.createElement("canvas"),this.document.createElement("canvas"),this.photoEditorService.tempSavePhotoEditorImage().then(T=>i(T)).catch(()=>{t&&t()})}save(){this.saveProject(()=>{})}logout(){}ngOnInit(){this.queryParams=this.route.snapshot.queryParams,this.assetId=this.route.snapshot.queryParamMap.get("assetId"),this.imgName=this.route.snapshot.queryParamMap.get("imgName"),this.imgName&&(this.photoEditorService.projectName=this.imgName,this.photoEditorService.originalProjectName=this.imgName)}
1inFocus(){this.actionIcon="editinprogress"}upgradePlanDirectPayment(){let i=this.paymentService?.config?.aiSubscriptionCredits;this.subsService.upgradePlanDirectPayment({plan_type:"yearly",isDirectPayment:!0,aiSubscriptionCredits:i})}downloadUrl(i,t="untitled"){console.log("downloadUrl",i,t),Bt.k.downloadFile(i,t)}GetTitel(i){switch(i){case"replace":case"aireplace":return"AI Replace";case"aieraser":return"AI Cleanup";case"upscale":return"AI Upscale";case"remove_bg":return"Remove Background";case"adjustment":return"Adjustment";case"expand":return"AI Expand";case"changecameraangle":return"Change Camera Angle";case"changelighting":return"Change Lighting";default:return i}}export(){if(!this.photoEditorService.isExportable||!this.photoEditorService.originalImage)return;const i=this.photoEditorService.isFreeTool,t=this.photoEditorService.activeSubTool;let r=JSON.parse(JSON.stringify(this.photoEditorService.activeSubTool));const f=this.photoEditorService.activeTool||this.photoEditorService.selectedTool;if(f)if("aitools"==f&&""!=t){var T="quickedits"==t?this.photoEditorService.photoEditorOptions.subTool:t;""==this.photoEditorService.title?this.photoEditorService.title=this.GetTitel(t):""==this.photoEditorService.title&&f&&(this.photoEditorService.title=this.GetTitel(f)),this.toolhistoryservice.addToHistory({title:this.photoEditorService.title||t,toolName:f,editorType:E._Y.Photo,subTool:T})}else if("aitools"!=f){if(""==this.photoEditorService.title&&t)this.photoEditorService.title=this.GetTitel(t);else if(""==t&&f){var N=this.GetTitel(f);f!=N&&(this.photoEditorService.title=N)}this.toolhistoryservice.addToHistory({title:this.photoEditorService.title||t||f,toolName:f,editorType:E._Y.Photo,subTool:t})}if(i&&"aieraser"!=t&&this.photoEditorService.isExportable){const H=this.photoEditorService.downloadImgUrl;"replace"==t&&this.photoEditorService.aiReplaceGenUrl?this.downloadUrl(this.photoEditorService.aiReplaceGenUrl,"replace"):"upscale"==t&&this.photoEditorService.selectedUpscaleItem&&this.photoEditorService.selectedUpscaleItem.outputSrc?(r="upscale - "+this.photoEditorService.selectedUpscaleItem?.id,this.downloadUrl(this.photoEditorService.selectedUpscaleItem?.outputSrc,"upscale")):"expand"==t&&this.photoEditorService.selectedExpandedImage&&this.photoEditorService.selectedExpandedImage?.url?this.downloadUrl(this.photoEditorService.selectedExpandedImage.url,"expand"):"quickedits"==t&&this.photoEditorService.imgUrl?(r="quickedits",this.downloadUrl(this.photoEditorService?.imgUrl,"quickedits")):H&&this.downloadUrl(H),this.gtmService.pushTag({eventName:w.b.gtm.eventname.aiToolsPhotoEditorDownload,itemName:r||"Choose AI Tool - Page"})}else this.photoEditorService.isExportable&&(this.modalService.hasOpenModals()?this.modalService.dismissAll():this.openExportSettings())}openExportSettings(){const i=this.modalService.open(qt,{centered:!1,size:"sm",backdrop:!0,windowClass:"export-project-dialog",backdropClass:"show-header-backdrop"});i.componentInstance.user=this.user,i.componentInstance.stateService=this.canvasStateService,i.componentInstance.photoEditorService=this.photoEditorService,i.componentInstance.zoomService=this.zoomService,i.componentInstance.canvasService=this.canvasService,i.componentInstance.needTodownload=this.needTodownload,i.result.then(t=>{this.needTodownload=!1,"login"===t?this.user||this.openLoginDialogWithSubscription(r=>{this.export()}):"loginToDownLoad"===t?this.user||this.loginService.openLoginDialog(f=>{this.user=this.authService.currentUser(),this.user&&(this.needTodownload=!0,this.export())},!0,{ui:w.b.screen.loginToDownload}):"upgrade"===t&&(this.user?this.proceedForSubscription(""):this.openLoginDialogWithSubscription())}).catch(()=>{})}proceedForSubscription(i=null){let t=this.dialogService.showProgress();this.activeTool==E.Fs.AIQuickEdit?(t.close(),this.subsService.upgradePlanCheckout("","","Upgrade_"+this.activeTool,r=>{this.user=this.authService.currentUser(),i&&i()})):this.saveProject(r=>{t.close(),this.toastService.removeAll();let f="",T=location.pathname;T.includes("/dev/")&&(T=T.replace("/dev/","/")),T.includes("/qa/")&&(T=T.replace("/qa/","/")),f=T,this.route.
1snapshot.queryParamMap.keys.forEach((N,H)=>{let q=H?"&":"?";"img"===N?(f=f+q+N+"="+encodeURIComponent(r),this._router.navigate([],{relativeTo:this.route,queryParams:{img:r},queryParamsHandling:"merge"})):f=f+q+N+"="+this.route.snapshot.queryParamMap.get(N)}),this.subsService.upgradePlanCheckout("","","Upgrade_"+this.activeTool,N=>{this.user=this.authService.currentUser(),i&&i()})},()=>{t.close()})}renameProjectName(){(!this.photoEditorService.projectName||""===this.photoEditorService.projectName.trim())&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName);const i=this.imgName&&this.imgName?.trim();if(this.photoEditorService.projectName.trim()!==i){this.inProgress=!0;let t={assetId:this.name.assetId,name:this.photoEditorService.projectName.trim()};this.projectSyncService.updatePhotoEditProjectName(t,r=>{"SUCCESS"==r.status&&(this.toastService.showSuccess(w.b.message.saveSuccess),this.inProgress=!1)},r=>{this.toastService.showError(r.description||r.message),this.inProgress=!1})}else this.inProgress=!1}openLoginDialogWithSubscription(i=null,t=null){this.loginService.openLoginDialog(r=>{this.user=this.authService.currentUser(),this.user&&!this.user.subscribed?this.proceedForSubscription(()=>{i&&i()}):i&&i()},!0,t)}loginToSave(){this.loginService.openLoginDialog(i=>{this.user=this.authService.currentUser(),this.user&&this.save()})}openLoginDialog(){this.user?this._router.navigate(["/my/projects"]):this.loginService.openLoginDialog(i=>{this.user=this.authService.currentUser(),this.user&&(this.user=this.authService.currentUser(),this._router.navigate(["/my/projects"]))})}redirectToPage(i){this.openSaveChangesPopup(i)}openSaveChangesPopup(i){this.photoEditorService.isDirty?this.confirmDialogService.open({title:w.b.message.warningMessage,okButtonText:"Okay"},()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.isCompareEnable=!1,this.toNavigate(i)},()=>{}):this.toNavigate(i)}toNavigate(i){switch(i){case"upgrade-plan":this.user?this.subsService.upgradePlanCheckout("","","Try_LightX_Pro_"+this.activeTool,r=>{this.user=this.authService.currentUser()}):this.openLoginDialogWithSubscription();break;case"open-image":this.photoEditorService.activeTool&&""!=this.photoEditorService.activeTool&&this.photoEditorService.activeTool!=this.activeTool&&(this.activeTool=this.photoEditorService.activeTool),this.editorUiService.uploadOpenImageModal(this.activeTool,"header").result.then(r=>{"ok"===r&&(this.photoEditorService.isError=!1),"cancel"===r&&this.photoEditorService.imageUpload.next(!1)}).catch(r=>{})}}onInput(){setTimeout(()=>{this.maskDiv&&(this.renderer.setProperty(this.maskDiv.nativeElement,"textContent",this.projectName||"Untitled"),this.inputWidth=Math.max(22,this.maskDiv.nativeElement.offsetWidth),this.inputWidth=this.inputWidth+24)})}getCredits(){this.aIService.openAICreditPopup()}addCredits(){this.aIService.aiCreditPlanCheckout({toolName:this.activeTool},this.activeTool)}resetMenu(i){this.megaMenuItem=!0,this.designItem=JSON.parse(JSON.stringify(i))}onMenuMouseEnter(i,t){this.menuService.showMenuPanel(i),this.resetMenu(t)}uploadOpenImageModal(){this.editorUiService.uploadOpenImageModal(this.imgQueryParams.tabName,"header",this.imgQueryParams)}menuClick(i){let t=this.dialogService.showProgress();this.getStoryPage(i,r=>{if(r){if(this.storyPage){const q=JSON.parse(JSON.stringify(this.storyPage.sections));this.storyPage.sections=null,setTimeout(()=>{this.storyPage.sections=q},50)}window.scrollTo(0,0);let f=Object.assign({},r.sections[0].metadata,r.metadata);if(f?.queryString){const q=this.aiUploadImageService.getParams(f?.queryString);f=Object.assign({},f,q),this.queryString=q}const T=r.sections[0];if("mixed-banner-header"==T.type&&T.links?.length){const q=T.links[0].metadata;let ne=this.aiUploadImageService.getParams(q?.queryString);f=Object.assign({},f,q,ne)}if(f.editorType==E._Y.ImageTool||f.editorType==E._Y.VideoTemplate||f.editorType==E._Y.DesignTemplate)return window.open(a.c.siteUrl+"/"+i.type+"/"+i.subType,"_blank"),void setTimeout(()=>{t.close()},200);let N=!1;if(f.editorType==E._Y.BatchEditor)return this.aiUploadImageService.navigateToBatchEditor(f),void setTimeout(()=>{t.close()},200);if(f.editorType==E._Y.Photo&&f.toolName!=E.z6.ProfileMaker&&f.toolName!=E.z6.ProductShowcase&&f.toolName!=E.z6.PhotoResizer&&(f.toolName!=E.z6.Tools||f.subTool!=E.z6.Resize))return this.editorService.setActiveToolPanel(f.subTool?{panel:f.toolName,from:"nav",subTool:f?.subTool}:{panel:f.toolName,from:"nav"}),setTimeout(()=>{t.close()},200),void this.gtmService.pushTag({eventName:w.b.gtm.eventname.allToolsClick,itemName:i.text,itemType:i.metadata?.toolName,itemValue:"Photo
1Editor"});if(this.imgQueryParams.openNewTab=!0,this.imgQueryParams.imageUrl=this.photoEditorService.imgUrl?this.photoEditorService.imgUrl:this.imgUrl?this.imgUrl:this.queryParams?.imgUrl?this.queryParams?.imgUrl:this.queryParams?.img,this.imgQueryParams.from=this.slug,f.toolName&&(this.imgQueryParams.toolName=f.toolName),this.imgQueryParams.tabName=f?.tab||f.toolName,this.imgQueryParams.editorType=f.editorType,f.toolName==E.z6.ProfileMaker?(this.imgQueryParams.targetPage=w.b.targetPage.profilePicture,this.imgQueryParams.pid=f?.id||f?.productId,this.imgQueryParams.stagid=f?.subId||f?.tagId,N=!0):f.toolName==E.z6.ProductShowcase?(this.imgQueryParams.targetPage=w.b.targetPage.productShowcase,this.imgQueryParams.pid=f?.id||f?.productId,this.imgQueryParams.stagid=f?.subId||f?.tagId,N=!0):f.toolName==E.z6.PhotoResizer||f.toolName==E.z6.Tools&&f.subTool==E.z6.Resize?(this.imgQueryParams.targetPage=w.b.targetPage.photoResizer,this.imgQueryParams.pid=f?.id||f?.productId,f.toolName==E.z6.Tools&&f.subTool==E.z6.Resize&&(this.imgQueryParams.subTool=f?.subTool,this.imgQueryParams.from=r?.subType?r?.subType:"photo-resizer"),N=!0):(this.imgQueryParams.targetPage=E._Y.Photo==f.editorType?"/edit-tools/edit":f.editorType==E._Y.AIPhoto?"/ai-photo-editor/edit":f?.targetPage?f.targetPage:"",this.imgQueryParams.subTool=f?.subTool,this.imgQueryParams.pid=this.uploadImageService.storyMetaData?.productId?this.uploadImageService.storyMetaData?.productId:"0",this.imgQueryParams.stagid=this.uploadImageService.storyMetaData?.storeAddtlTagId?this.uploadImageService.storyMetaData?.storeAddtlTagId:"0",this.uploadImageService.storyMetaData=f),this.isBlobUrl(this.imgQueryParams.imageUrl))return void this.validateImageBlobUrl(this.imgQueryParams.imageUrl).then(q=>{q?fetch(this.imgQueryParams.imageUrl).then(ne=>{ne.blob().then(se=>{const ae=f;ae.isBlank=!0,ae.fromEditor="",ae.from="",ae.uploadProgress=!0,ae.openNewTab=!0;const ce=new File([se],"untitled.jpg",{type:se.type});f.editorType==E._Y.AIPhoto?this.aiUploadImageService.aiUploadImage(ce,ae).then(ve=>{t.close()}):this.aiUploadImageService.aiUploadImage(ce,ae).then(ve=>{this.imgQueryParams.imageUrl=ve.imgUrl,this.queryString?.productId&&(this.imgQueryParams.pid=this.queryString.productId),this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{t.close()})})})}).catch(()=>{}):!q&&N?this.uploadOpenImageModal():!q&&this.imgQueryParams?.openNewTab&&(this.imgQueryParams.imageUrl="",f.editorType==E._Y.AIPhoto?this.aiPhotoService.getAllowedTypesSearch().includes(i?.type)?(f.openNewTab=!0,this.aiUploadImageService.loadInputTextToAiEditor(f)):this.aiUploadImageService.aiUploadImageWithoutImage(this.imgQueryParams):this.uploadImageService.loadWithoutImage(this.imgQueryParams,()=>{})),setTimeout(()=>{t.close()},200)});if(this.isValidImageDataUrl(this.imgQueryParams.imageUrl))if(f.editorType==E._Y.Photo)this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{});else{const q=this.dataURLtoFile(this.imgQueryParams.imageUrl,"image.png");this.onFileUploadedOnLoad(q)}else N?(this.imgQueryParams.imageUrl?this.uploadImageService.loadInputImage(this.imgQueryParams,q=>{q&&"ERROR"==q&&this.uploadOpenImageModal()}):this.uploadOpenImageModal(),setTimeout(()=>{t.close()},200)):this.imgQueryParams.imageUrl?fetch(this.imgQueryParams.imageUrl).then(q=>{q.blob().then(ne=>{const se=f;se.isBlank=!0,se.fromEditor="",se.from="",se.uploadProgress=!0,se.openNewTab=!0;const ae=new File([ne],"untitled.jpg",{type:ne.type});f.editorType==E._Y.AIPhoto?this.aiUploadImageService.aiUploadImage(ae,se).then(ce=>{t.close()}):this.aiUploadImageService.aiUploadImage(ae,se).then(ce=>{this.imgQueryParams.imageUrl=ce.imgUrl,this.queryString?.productId&&(this.imgQueryParams.pid=this.queryString.productId),this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{t.close()})})})}).catch(()=>{}):this.imgQueryParams.imageUrl&&!this.isBlobUrl(this.imgQueryParams.imageUrl)?this.uploadImageService.loadInputImage(this.imgQueryParams,q=>{q&&"ERROR"==q&&(this.imgQueryParams.imageUrl="",f.editorType==E._Y.AIPhoto?this.aiPhotoService.getAllowedTypesSearch().includes(i?.type)?(f.openNewTab=!0,this.aiUploadImageService.loadInputTextToAiEditor(f)):this.aiUploadImageService.aiUploadImageWithoutImage(this.imgQueryParams):this.uploadImageService.loadWithoutImage(this.imgQueryParams,()=>{}))}):(this.imgQueryParams.imageUrl="",f.editorType==E._Y.AIPhoto?this.aiPhotoService.getAllowedTypesSearch().includes(i?.type)?(f.openNewTab=!0,this.aiUploadImageService.loadInputTextToAiEditor(f)):this.aiUploadImageService.aiUploadImageWithoutImage(this.imgQueryParams):this.uploadImageService.loadWithoutImage(this.imgQueryParams,()=>{}));t.close(),this.gtmService.pushTag({eventName:w.b.gtm.eventname.allToolsClick,itemName:i?.text,itemType:i?.metadata?.toolName,itemValue:"Photo
1Editor"})}else this.toastService.showError("Story Page Not Found"),setTimeout(()=>{t.close()},200)})}validateImageBlobUrl(i){return new Promise(t=>{if(!i||!i.startsWith("blob:"))return void t(!1);const r=new Image;r.src=i,r.onload=()=>t(!0),r.onerror=()=>t(!1)})}isValidImageDataUrl(i){return/^data:image\/(png|jpeg|jpg|gif|bmp|webp);base64,[A-Za-z0-9+/=]+$/.test(i)}dataURLtoFile(i,t){const r=i.split(","),f=r[0].match(/:(.*?);/)[1],T=atob(r[1]);let N=T.length;const H=new Uint8Array(N);for(;N--;)H[N]=T.charCodeAt(N);return new File([H],t,{type:f})}isBlobUrl(i){try{return"blob:"===new URL(i).protocol}catch{return!1}}blobImageUrlToFile(i,t){return(0,n.A)(function*(){const f=yield(yield fetch(i)).blob();return new File([f],t,{type:f.type||"image/png"})})()}onFileUploadedOnLoad(i){i&&this.aiUploadImageService.aiUploadImage(i,{tab:this.imgQueryParams.tabName,toolName:this.imgQueryParams.toolName,from:this.queryParams.from,subTool:this.imgQueryParams.subTool,productId:this.queryString?.productId,prodImageId:this.queryString?.prodImageId,openNewTab:this.imgQueryParams.openNewTab}).then(f=>{this.imgQueryParams.imageUrl=f.imgUrl,this.photoEditorService.imgUrl=f.imgUrl})}hideMenubar(i){this.document.getElementById(i)?.classList?.remove("show"),this.body[0]?.classList?.remove("scroll-stop")}getStoryPage(i,t=null){this.storyPageService.getStoryPageContent(i.type,w.b.pageType,i.subType,r=>{const f=r.body.storyPage;f?t&&t(f):t(null)},()=>{},"en")}downloadFromCanvas(){this.doDownload(()=>{this.photoEditorService.getMaxResolution();const r={format:"jpeg",quality:1};r.multiplier=this.canvasStateService.original.width/this.canvasStateService.mainCanvas.width,this.canvasStateService.mainCanvas.renderAll();const f=this.canvasStateService.mainCanvas.toDataURL(r);this.downloadUrl(f,this.photoEditorService.projectName+".jpeg")})}doDownload(i){let t=null;t=this.photoEditorService.restoreResolution(this.photoEditorService.theOriginalOriginalImage.width),t&&t.then(()=>{i()})}template(i){this.aiPhotoService.getAllowedTypesSearch().includes(i.type)?this.menuClick(i):window.open(a.c.siteUrl+"/"+i.type.replace(/ai-design-templates$/,"ai-design")+"/"+(i.intermediateSlug?i.intermediateSlug+"/":"")+i.subType,"_blank")}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(z.Ix),e.rXU(z.nX),e.rXU(Z.f),e.rXU(Y.Bq),e.rXU($.u),e.rXU(U.n),e.rXU(Dt.f),e.rXU(l.p),e.rXU(K.g),e.rXU(A.n),e.rXU(ti.A),e.rXU(G.X),e.rXU(W.H),e.rXU(Q.L),e.rXU(Ft.W),e.rXU(e.sFG),e.rXU(I.qQ),e.rXU(z.Ix),e.rXU(R.U),e.rXU(ii.K),e.rXU(F.A),e.rXU(o.x),e.rXU(he.y),e.rXU(St.M),e.rXU(j.k),e.rXU(oi.$),e.rXU(K.g),e.rXU(L.s),e.rXU(ze.W))},c.\u0275cmp=e.VBU({type:c,selectors:[["editor-header"]],viewQuery:function(i,t){if(1&i&&(e.GBs(si,5),e.GBs(ri,5)),2&i){let r;e.mGM(r=e.lsd())&&(t.maskDiv=r.first),e.mGM(r=e.lsd())&&(t.inputElement=r.first)}},inputs:{alerts:"alerts",alertCount:"alertCount",activeTool:"activeTool",projectName:"projectName",imgUrl:"imgUrl",name:"name",expandImageUrl:"expandImageUrl"},outputs:{markAsRead:"markAsRead"},decls:2,vars:2,consts:[[4,"ngIf"],[1,"header","navbar-fixed-top","position-relative",2,"z-index","9999"],["role","banner",1,"editor-header"],[1,"navbar-brand-box","text-start","p-0",2,"display","inline-flex"],[1,"logo","link","lh-normal",3,"click"],[1,"logo-sm"],["src","https://static.lightxeditor.com/assets/images/lightx-logo-lg-new.png","alt","Lightxeditor Logo","width","104px","height","40px"],[1,"logo-lg"],[1,"header","navbar-fixed-top","position-relative",2,"z-index","1054",3,"ngClass"],["role","banner",1,"editor-header","d-flex","align-items-center","justify-content-between","w-100","position-relative","bg-white","pl-10","pr-10",2,"height","56px"],[1,"navbar-brand-box","text-start","p-0","align-items-center",2,"display","inline-flex"],["src","https://static.lightxeditor.com/assets/images/new-logo-editor.png","alt","Lightxeditor Logo","width","40px","height","40px"],["class","btn btn-grey text-13 btn-h40 ml-10 border-0 text-dark ps-3 pe-3","color","primary","placement","bottom",3,"click",4,"ngIf"],["color","primary","placement","bottom",1,"btn","btn-grey","text-13","ms-2","border-0","text-dark","btnHeight","text-nowrap","h-40",3,"click"],[1,"d-flex","align-items-center"],["name","separator",1,"ms-3","me-3"],[1,"editor-megamenu","d-flex","align-items-center","justify-content-center","me-2"],[1,"topnav"],[1,"navbar","navbar-light","navbar-expand-lg","topnav-menu","d-flex","mx-auto",2,"flex-wrap","nowrap"],["class","mx-auto",4,"ngIf"],[1,"position-relative","d-flex","align-items-center",2,"max-width","240px"],[1,"d-block","w-100",3,"ngClass"],[1,"row","g-0"],[1,"col-12","p-0"],[1,"me-lg-0","template-search-bar-wrap","border-radius-12","w-100","mw-100","position-relative","bg-white",3,"ngStyle"],[1,"template-search-main","editor-search-bar","position-relative",3,"ngOpenChange","template","isheader","searchReset","templateType","placeholder"],["class","search-div",4,"ngIf"],["id","photo-editor_try_lightx_pro","class","btn border-btn-gradiant text-13 btn-h40 d-flex align-items-center border-0 text-semi",3,"click",4,"ngIf"],[1,"d-flex","pe-0","ms-2"],["class","credit-btn-outer d-flex align-items-center justify-content-center me-2",3,"ngClass",4,"ngIf"],["class","btn btn-outline-primary btn-h40 pl-9 pr-9 d-flex align-items-center text-13 text-semi me-2","style","border: 1px solid;",3,"click",4,"ngIf"],["ngbDropdown","","id","page-header-user-dropdown","ngbDropdownToggle","",1,"dropdown","d-lg-block","float-start","userdownload",3,"click"],["color","primary",1,"btn","btn-primary","btn-h40","pl-9","pr-9","d-flex","align-items-center","text-13","text-semi",3,"disabled"],["name","downloadwhite",1,"icon","f-22","me-2"],["color","primary","placement","bottom",1,"btn","btn-grey","text-13","btn-h40","ml-10","border-0","text-dark","ps-3","pe-3",3,"click"],[1,"mx-auto"],[1,"navbar-nav","w-100"],["class","dropdown-toggle nav-item text-semi dropdown mg-nav-item","onmouseenter","showMenuPanel(event)","onmouseleave","hideMenuPanel(event,'leave')","routerLinkActive","activenew",3,"tabindex","id","mouseenter",4,"ngFor","ngForOf"],["onmouseenter","showMenuPanel(event)","onmouseleave","hideMenuPanel(event,'leave')","routerLinkActive","activenew",1,"dropdown-toggle","nav-item","text-semi","dropdown","mg-nav-item",3,"mouseenter","tabindex","id"],["id","","role","button",1,"nav-link","arrow-none"],[1,"d-flex","align-items-center","justify-content-center","text-dark"],[1,"me-1"],["name","dropdownArrowUp",1,"f-24","align-middle","arrowUp"],["class","mx-auto p-0 menu-panel dropdown-menu",3,"id","ngClass",4,"ngIf"],[1,"mx-auto","p-0","menu-panel","dropdown-menu",3,"id","ngClass"],[1,"inner"],[1,"navigation-right-column","p-0","d-inline-flex","m-0"],["customScrollDir","",1,"is-popover-tb","pe-1","pt-3","pb-3","scroll-container"],[1,"row","g-0","w-100"],[1,"mx-auto","swap-page","d-flex","w-100","flex-column"],["class","d-flex scroll-items w-100 order-lg-1","style","flex-wrap: wrap;",4,"ngFor","ngForOf"],[1,"d-flex","scroll-items","w-100","order-lg-1",2,"flex-wrap","wrap"],[1,"d-flex","align-items-center","justify-content-start","w-100","mb-2"],[1,"text-13","grey-800","text-semi","m-0","lh-125","mt-2"],[4,"ngFor","ngForOf"],[1,"col-12","col-md-4","col-lg-4","col-xl-3","col-xxl-3","p-0","mb-2","border-radius-lg","lh-normal"],[1,"d-inline-flex","align-items-center","justify-content-start","thumb-menu-item","pointer","p-1","me-2","border-radius-12",3,"click"],[1,"d-inline-flex","align-items-center","justify-content-center","border-radius-8","thumb-image"],[1,"border-radius-8",3,"src","alt"],[1,"d-inline-flex","align-items-start","justify-content-start","flex-column","ml-9","overflow-hidden",2,"white-space","break-spaces"],[1,"text-14","text-semi","grey-600","mb-0","lh-p3","pe-0",3,"ngClass"],[1,"search-div"],["id","photo-editor_try_lightx_pro",1,"btn","border-btn-gradiant","text-13","btn-h40","d-flex","align-items-center","border-0","text-semi",3,"click"],["name","prousernew",1,"f-24"],[1,"credit-btn-outer","d-flex","align-items-center","justify-content-center","me-2",3,"ngClass"],["src","https://static.lightxeditor.com/assets/images/coin-lottie-s-anim.gif","alt","Credit Coin","width","24px","height","24px",1,"me-2"],["class","text-semi mr-9",4,"ngIf"],["id","gtm-add-credits",1,"btn-all","border-btn-gradiant","text-13","btn-h32","border-0","border-radius-8","text-semi","pl-9","pr-9"],[1,"btn-all","border-btn-gradiant","text-13","btn-h32","border-0","border-radius-8","text-semi","pl-9","pr-9"],[1,"text-semi","mr-9"],["id","gtm-add-credits",1,"btn-all","border-btn-gradiant","text-13","btn-h32","border-0","border-radius-8","text-semi","pl-9","pr-9",3,"click"],[1,"btn-all","border-btn-gradiant","text-13","btn-h32","border-0","border-radius-8","text-semi","pl-9","pr-9",3,"click"],[1,"btn","btn-outline-primary","btn-h40","pl-9","pr-9","d-flex","align-items-center","text-13","text-semi","me-2",2,"border","1p
1x solid",3,"click"]],template:function(i,t){1&i&&e.DNE(0,pi,9,0,"ng-container",0)(1,Oe,35,19,"ng-container",0),2&i&&(e.Y8G("ngIf",t.envService.isMobileView),e.R7$(),e.Y8G("ngIf",!t.envService.isMobileView))},dependencies:[I.YU,I.Sq,I.bT,I.B3,de.q,Y.tg,Y.do,z.wQ,Ce.b,ni.G],styles:[".editMenuLinks[_ngcontent-%COMP%]{color:#626adf;display:inline-flex;cursor:pointer;align-items:center;white-space:nowrap}.projectTitle[_ngcontent-%COMP%]{margin:auto;position:relative;min-width:240px}.projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{height:40px;border:1px solid transparent;background:none;text-align:center;border-radius:12px;padding:12px 10px;font-size:13px;outline:none;font-weight:400;color:#606576;max-width:200px;min-width:22px;-webkit-appearance:none;appearance:none;background:transparent;box-sizing:border-box;font-variant-ligatures:none;left:auto;margin:0;outline:0 none;position:absolute;top:0;width:100%}.projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus, .projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#272b34}.projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:hover{border:1px solid transparent}.projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus{border:1px solid #626ADF}.projectTitle[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:focus:hover{background:#626adf1a;color:#272b34}.header[_ngcontent-%COMP%]{background:linear-gradient(90deg,#eea8ff -4%,#83e1ff) bottom/100% 1px no-repeat;height:57px}.logo[_ngcontent-%COMP%]{line-height:unset}.pop-setting[_ngcontent-%COMP%]{right:0;margin-top:1rem}.projectfiled[_ngcontent-%COMP%]{position:relative;max-width:200px}.projectfiled[_ngcontent-%COMP%] .mask[_ngcontent-%COMP%]{opacity:0;pointer-events:none;position:relative;white-space:pre;-webkit-appearance:none;appearance:none;background:transparent;box-sizing:border-box;font-variant-ligatures:none;left:0;margin:0;outline:0 none;text-overflow:ellipsis;top:0;height:40px;max-width:200px}.text-eclipse[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.credit-btn-outer[_ngcontent-%COMP%]{height:40px;padding:0 4px 0 8px;border-radius:12px;background:linear-gradient(90deg,#fc5cff1a,#2520f61a)}.credit-btn-outer[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:16px;color:#626adf;line-height:24px}.credit-btn-outer[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:before{border-radius:8px!important}.btn-h32[_ngcontent-%COMP%]{height:32px;padding:0 12px}.border-btn-gradiant[_ngcontent-%COMP%]{background:linear-gradient(90deg,#fc5cff0d,#2520f60d)!important}.border-btn-gradiant[_ngcontent-%COMP%]:hover{background:linear-gradient(90deg,#fc5cff1a,#2520f61a)!important}.editor-megamenu[_ngcontent-%COMP%] .topnav[_ngcontent-%COMP%] .navbar-nav[_ngcontent-%COMP%]{width:110px!important;flex-direction:row!important}.editor-megamenu[_ngcontent-%COMP%] .topnav[_ngcontent-%COMP%] .navbar-nav[_ngcontent-%COMP%] .nav-item[_ngcontent-%COMP%]{height:40px;border-bottom:0px solid transparent;border-radius:12px 0 0 12px;background:#626adf0d;padding:8px 12px 8px 16px}.editor-megamenu[_ngcontent-%COMP%] .topnav[_ngcontent-%COMP%] .navbar-nav[_ngcontent-%COMP%] .nav-item[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:0!important}.editor-megamenu[_ngcontent-%COMP%] .topnav[_ngcontent-%COMP%] .navbar-nav[_ngcontent-%COMP%] .nav-item[_ngcontent-%COMP%]:hover{background:#626adf1a}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%]{margin-top:16px;min-width:calc(100vw - 160px)!important}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%]{padding:16px 0 16px 16px;width:100%!important;max-height:530px;overflow:auto}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%] .thumb-menu-item[_ngcontent-%COMP%]{background:#626adf00;min-width:280px;width:calc(100% - 8px)}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%] .thumb-menu-item[_ngcontent-%COMP%] .thumb-image[_ngcontent-%COMP%]{width:60px;height:45px}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%] .thumb-menu-item[_ngcontent-%COMP%] .thumb-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{object-fit:cover;max-height:45px;height:100%;width:100%}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%] .thumb-menu-item[_ngcontent-%COMP%]:hover{background:#626adf0d}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%]{left:-130px!important;min-width:auto!important}.editor-megamenu[_ngcontent-%COMP%] .for-login[_ngcontent-%COMP%]{left:-258px!important}@media (min-width: 768px) and (max-width: 1280px){.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%]{left:-170px!important;min-width:auto!important}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%]{min-width:calc(100vw - 80px)!important}.editor-megamenu[_ngcontent-%COMP%] .for-login[_ngcontent-%COMP%]{left:-298px!important}}@media (min-width: 990px) and (max-width: 1368px){.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%]{overflow:auto!important;padding-left:0;padding-right:0}.editor-megamenu[_ngcontent-%COMP%] .dropdown-menu[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .navigation-right-column[_ngcontent-%COMP%] .scroll-items[_ngcontent-%COMP%]{padding-bottom:0!important;overflow-x:hidden!important}}.new_item[_ngcontent-%COMP%]:after{top:5px!important}.swap-page[_ngcontent-%COMP%] .order-lg-1[_ngcontent-%COMP%]:nth-child(1) h3.mt-2[_ngcontent-%COMP%]{margin-top:0!important}.template-search-bar-container-active[_ngcontent-%COMP%]{max-width:400px;background:#fff;left:-6px!important}.template-search-bar-container[_ngcontent-%COMP%]{left:-6px}.template-search-bar-wrap[_ngcontent-%COMP%]{min-width:240px;z-index:1;transition:width .25s ease,z-index 0s}.template-search-bar-wrap[_ngcontent-%COMP%]:focus-within{z-index:1050;transition:width .25s ease,z-index 0s 0s}.search-div[_ngcontent-%COMP%]{min-width:240px}@media (max-width: 1140px){.template-search-bar-wrap[_ngcontent-%COMP%], .search-div[_ngcontent-%COMP%]{min-width:47px}}@media (min-width: 1141px) and (max-width: 1365px){.template-search-bar-wrap[_ngcontent-%COMP%], .search-div[_ngcontent-%COMP%]{min-width:185px}}"]}),v})();var $e=g(84634),me=g(75243),ft=g(78582),Ci=g(84412),gt=g(71971),xi=g(1680),Ue=g(94996);class He{constructor(v,s,i=!0,t){this.canvas=s,this.inputImage=t,this._tansformation=new Ci.t("y"),this.tansformation=this._tansformation.asObservable(),this._frameObject=null,this._svgMask=null,this._mediaObjects=null,this._mediaObjects=v,this._mediaObjects.zOrder=19,this._frameObject=ne
1w pe.fabric.Rect({left:v.left,top:v.top,width:v.width*v.scaleX,height:v.height*v.scaleY,fill:null,zOrder:20,angle:v.angle}),i?Ue._.setControlUi(this._frameObject,!1):this._frameObject.set({selectable:!1,evented:!1}),v.set({selectable:!1,evented:!1});const r=this.cloneFrameObject(this._frameObject);this._svgMask=new xi.d(r),this.bindTwo(this._frameObject,this._svgMask.getBaseSVGObject()),this.bindTwo(this._frameObject,this._mediaObjects),i&&(this._frameObject.on("rotating",()=>this.updateAllMinion()),this._frameObject.on("moving",()=>this.updateAllMinion()),this._frameObject.on("scaling",()=>this.updateAllMinion())),this._mediaObjects.clipPath=this._svgMask.getBaseSVGObject()}updateAllMinion(){this.minionUpdate(this._frameObject,this._mediaObjects),this.minionUpdate(this._frameObject,this._svgMask.getBaseSVGObject())}addToCanvas(v){v.add(this._mediaObjects),v.add(this._frameObject),v.renderAll()}removeFromCanvas(v){v.remove(this._mediaObjects),v.remove(this._frameObject),v.renderAll()}getScale(){let v,s;return this.canvas.clipPath?(v=this.canvas.clipPath.width,s=this.canvas.clipPath.height):(v=this.canvas.width/this.canvas.viewportTransform[0],s=this.canvas.height/this.canvas.viewportTransform[3]),this._frameObject.width*this._frameObject.scaleX/v}setScale(v,s){let i,t;this.canvas.clipPath?(i=this.canvas.clipPath.width,t=this.canvas.clipPath.height):(i=this.canvas.width/this.canvas.viewportTransform[0],t=this.canvas.height/this.canvas.viewportTransform[3]);const r=v*i/this._frameObject.width,N=r*this._frameObject.width/(this._frameObject.width*this._frameObject.scaleX/(this._frameObject.height*this._frameObject.scaleY))/this._frameObject.height;this._frameObject._setOriginToCenter(),this._frameObject.set({scaleX:r,scaleY:N}),this._frameObject._resetOrigin(),this._frameObject.setCoords(),this.updateAllMinion(),this.canvas.requestRenderAll()}getFlipX(){return this._frameObject.flipX}getFlipY(){return this._frameObject.flipY}getAngle(){return this._frameObject.angle}getPosition(){return{left:this._frameObject.left,top:this._frameObject.top}}setPosition(v){this._frameObject.set({left:v.left,top:v.top}),this._frameObject.setCoords(!1,!1),this.updateAllMinion(),this.canvas.requestRenderAll()}setAngle(v,s){this._frameObject.rotate(v),this.updateAllMinion(),this.canvas.requestRenderAll()}align(v){let s,i;switch(this.canvas.clipPath?(s=this.canvas.clipPath.width,i=this.canvas.clipPath.height):(s=this.canvas.width/this.canvas.viewportTransform[0],i=this.canvas.height/this.canvas.viewportTransform[3]),v){case gt.W3.RIGHT:case gt.W3.LEFT:case gt.W3.TOP:case gt.W3.BOTTOM:break;case gt.W3.CENTER:this._frameObject.viewportCenterH();break;case gt.W3.MIDDLE:this._frameObject.viewportCenterV()}this._frameObject.setCoords(!1,!1),this.updateAllMinion(),this.canvas.renderAll()}xFlip(){const v=this._frameObject.angle;this._frameObject.rotate(0),this.updateAllMinion();const s=this._frameObject.left-this._mediaObjects.left,i=this._frameObject.left+this._frameObject.width*this._frameObject.scaleX-(this._mediaObjects.left+this._mediaObjects.width*this._mediaObjects.scaleX);this._frameObject.set({flipX:!this._frameObject.flipX}),this._mediaObjects.set({top:this._mediaObjects.top,left:this._mediaObjects.left+s+i,selectable:!1,evented:!1}),this._frameObject.rotate(v),this.updateAllMinion(),this.canvas.renderAll()}yFlip(){const v=this._frameObject.angle;this._frameObject.rotate(0),this.updateAllMinion();const s=this._frameObject.top-this._mediaObjects.top,i=this._frameObject.top+this._frameObject.height*this._frameObject.scaleY-(this._mediaObjects.top+this._mediaObjects.height*this._mediaObjects.scaleY);this._frameObject.set({flipY:!this._frameObject.flipY}),this._mediaObjects.set({left:this._mediaObjects.left,top:this._mediaObjects.top+s+i,selectable:!1,evented:!1}),this._frameObject.rotate(v),this.updateAllMinion(),this.canvas.renderAll()}isFlipable(){return!0}crop(v,s=!1,i){const t=this._mediaObjects;t.set({clipPath:null});const r=new pe.fabric.Rect({left:this._frameObject.left,top:this._frameObject.top,width:this._frameObject.width*this._frameObject.scaleX,height:this._frameObject.height*this._frameObject.scaleY,fill:null,angle:this._frameObject.angle,lockRotation:!0});this.cropRect=r;const f=new pe.fabric.Rect({left:this._frameObject.left,top:this._frameObject.top,width:this._frameObject.width*this._frameObject.scaleX,height:this._frameObject.height*this._frameObject.scaleY,fill:null,angle:this._frameObject.angle,lockRotation:!0,absolutePositioned:!0,inverted:!0});this.bindTwo(r,f),this.clipRect=f;const T=new pe.fabric.Rect({left:this._mediaObjects.left,top:this._mediaObjects.top,width:this._mediaObjects.width*this._mediaObjects.scaleX,height:this._mediaObjects.height*this._mediaObjects.scaleY,fill:"black",opacity:.4,angle:this._mediaObjects.angle,lockRotation:!0,selectable:!1,evented:!1,clipPath:f});this.canvas.add(T);const N=Ae=>{let Re=!0;for(const Ge of Ae.composedPath())if(Ge instanceof HTMLElement){let je=Ge.className;je&&(je=je.trim(),je.indexOf("upper-canvas")>-1&&(Re=!1))}Re&&r.fire("deselected")};this.eventHandler=N,v.addEventListener("mousedown",N),Ue._.setControlUiForCrop(r),this.canvas.remove(this._frameObject);let H=t.left,q=t.top;if(this._frameObject.flipX){const Ae=pe.fabric.util.rotatePoint(new pe.fabric.Point(t.left,t.top),t.getCenterPoint(),pe.fabric.util.degreesToRadians(-180));H=Ae.x,q=Ae.y}const ne=this._frameObject.getCenterPoint(),se=this._frameObject.flipX?t.angle+180:t.angle,ae=pe.fabric.util.degreesToRadians(-se),ce=pe.fabric.util.degreesToRadians(se),ve=pe.fabric.util.rotatePoint(new pe.fabric.Point(H,q),ne,ae),Se=ve.x,xe=Se+t.width*t.scaleX,ke=ve.y,Te=ke+t.height*t.scaleY;r.on("moving",Ae=>{var Re=r;const Ge=pe.fabric.util.rotatePoint(new pe.fabric.Point(Re.left,Re.top),ne,ae),je=Ge.x,Xe=Ge.y;let Je=je,st=Xe;je<Se?Je=Se:je+r.width*r.scaleX>xe&&(Je=xe-r.width*r.scaleX),Xe<ke?st=ke:Xe+r.height*r.scaleY>Te&&(st=Te-r.height*r.scaleY);const tt=pe.fabric.util.rotatePoint(new pe.fabric.Point(Je,st),ne,ce);Re.set({left:tt.x,top:tt.y}),this.minionUpdate(r,f)});let We=1,Me=1;r.on("scaling",Ae=>{const Re=pe.fabric.util.rotatePoint(new pe.fabric.Point(r.left,r.top),ne,ae),Xe=Re.x,Ke=Re.y,Ye=Xe+r.width*r.scaleX,Je=Ke+r.height*r.scaleY;let st=r.scaleX,tt=r.scaleY;(Math.floor(Xe)<Math.floor(Se)||Math.floor(Ye)>Math.floor(xe))&&(st=We||Ae.transform.original.scaleX),(Math.floor(Ke)<Math.floor(ke)||Math.floor(Je)>Math.floor(Te))&&(tt=Me||Ae.transform.original.scaleY),r.set({scaleX:st,scaleY:tt}),We=st,Me=tt;let at=this.clamp(Re.x,Se,xe-r.width*r.scaleX),wt=this.clamp(Re.y,ke,Te-r.height*r.scaleY);const _t=pe.fabric.util.rotatePoint(new pe.fabric.Point(at,wt),ne,ce);r.set({left:_t.x,top:_t.y}),this.minionUpdate(r,f)}),!s&&r.on("deselected",()=>{t.set({clipPath:this._svgMask.getBaseSVGObject()}),t.dirty=!0;const Ae=r.getCenterPoint();this._frameObject.set({width:r.width*r.scaleX,height:r.height*r.scaleY,scaleX:1,scaleY:1}
1),this._frameObject.setPositionByOrigin(Ae,"center","center"),this._svgMask.getBaseSVGObject().set({width:r.width*r.scaleX,height:r.height*r.scaleY,scaleX:1,scaleY:1}),this._svgMask.getBaseSVGObject().setPositionByOrigin(Ae,"center","center"),this._tansformation.next("y"),this.bindTwo(this._frameObject,this._mediaObjects),this.bindTwo(this._frameObject,this._svgMask.getBaseSVGObject()),this.canvas.add(this._frameObject),this.canvas.remove(r),this.canvas.remove(T),this.canvas.renderAll(),v.removeEventListener("mousedown",this.eventHandler),this.eventHandler=null,i&&i(this._svgMask.getBaseSVGObject(),r)}),this.canvas.add(r),this.canvas.setActiveObject(r),this.canvas.renderAll()}controlHandle(v){this.cropRect.setControlsVisibility(v?{mt:!1,mb:!1,ml:!1,mr:!1}:{mt:!0,mb:!0,ml:!0,mr:!0}),this.canvas.renderAll()}setCropSize(v,s){const i=this._mediaObjects,t=this.cropRect;if(v>i.width||s>i.height)return;const r=t.width*t.scaleX,f=t.height*t.scaleY;let T=0,N=0;const H=v-r,q=s-f,ne=t.left-H/2,ae=t.top-q/2;T=ne>=i.left&&t.left+r+H/2<=i.left+i.width*i.scaleX?ne:t.left-H>=i.left?t.left-H:t.left,N=ae>=i.top&&t.top+f+q/2<=i.top+i.height*i.scaleY?ae:t.top-q>=i.top?t.top-q:t.top;const ke=i.height-s;t.set({left:this.clamp(T,0,i.width-v),top:this.clamp(N,0,ke),scaleX:v/t.width,scaleY:s/t.height}),t.setCoords(),this.minionUpdate(this.cropRect,this.clipRect),this.clipRect.setCoords(),this.canvas.renderAll()}cropResize(v,s){const i=this.cropRect,t=this._mediaObjects.width*this._mediaObjects.scaleX,r=this._mediaObjects.height*this._mediaObjects.scaleY;let f=0,T=0;t>r?(f=r,T=f*v/s,T>t&&(T=t,f=T*s/v)):(T=t,f=t*s/v,f>r&&(f=r,T=f*v/s)),i.set({scaleX:T/i.width,scaleY:f/i.height,left:this._mediaObjects.left+(t-T)/2,top:this._mediaObjects.top+(r-f)/2}),i.setCoords(),this.minionUpdate(i,this.clipRect),this.clipRect.setCoords(),this.canvas.renderAll()}bindTwo(v,s){var i=v.calcTransformMatrix(),t=pe.fabric.util.invertTransform(i),r=pe.fabric.util.multiplyTransformMatrices(t,s.calcTransformMatrix());s.relationship=r}minionUpdate(v,s){var i=s.relationship,t=pe.fabric.util.multiplyTransformMatrices(v.calcTransformMatrix(),i);const r=pe.fabric.util.qrDecompose(t);s.set({flipX:!1,flipY:!1}),s.set(r),s.setPositionByOrigin({x:r.translateX,y:r.translateY},"center","center"),s.setCoords(!1,!0),this._tansformation.next("y")}clamp(v,s,i){return Math.min(Math.max(v,s),i)}getBoundingBox(){return this.cropRect}resizeCanvas(v,s,i=!1){this.canvasWidth=v,this.canvasHeight=s;const t=this._frameObject,r=t.width/t.height,f=v/s;if(i)if(r<=f){t.scale(v/t.width);const N=0,H=(s-t.getScaledHeight())/2;t.set({left:N,top:H})}else{t.scale(s/t.height);const N=(v-t.getScaledWidth())/2;t.set({left:N,top:0})}else if(r>=f){t.scale(v/t.width);const N=0,H=(s-t.getScaledHeight())/2;t.set({left:N,top:H})}else{t.scale(s/t.height);const N=(v-t.getScaledWidth())/2;t.set({left:N,top:0})}this.updateAllMinion(),this.canvas.renderAll()}mouseDown(v){this._isMouseDown=!0,this._initialDragPoint=v.pointer,this._initialImagePoint={left:this._mediaObjects.left,top:this._mediaObjects.top}}mouseMove(v){if(this._isMouseDown){this._isDragOn=!0;const s=(v.pointer.x-this._initialDragPoint.x)/this._mediaObjects.canvas.getZoom(),i=(v.pointer.y-this._initialDragPoint.y)/this._mediaObjects.canvas.getZoom();let t,r;this._mediaObjects.set({left:this._initialImagePoint.left+s,top:this._initialImagePoint.top+i}),this.canvas.clipPath?(t=this.canvas.clipPath.width,r=this.canvas.clipPath.height):(t=this.canvas.width/this.canvas.viewportTransform[0],r=this.canvas.height/this.canvas.viewportTransform[3]);const N=0-this._mediaObjects.height*this._mediaObjects.scaleY+r;this._mediaObjects.set({left:this.clamp(this._mediaObjects.left,0+t-this._mediaObjects.width*this._mediaObjects.scaleX,0),top:this.clamp(this._mediaObjects.top,N,0)}),this.canvas.requestRenderAll()}}mouseUp(v){this._isMouseDown=!1,this._isDragOn&&(this._isDragOn=!1)}getResizeScale(){const v=this._mediaObjects;let s,i;return this.canvas.clipPath?(s=this.canvas.clipPath.width,i=this.canvas.clipPath.height):(s=this.canvas.width/this.canvas.viewportTransform[0],i=this.canvas.height/this.canvas.viewportTransform[3]),v.width/v.height<=this.canvasWidth/this.canvasHeight?v.width*v.scaleX/s:v.height*v.scaleY/i}setResizeScale(v,s){const i=this._mediaObjects;let t,r,N;this.canvas.clipPath?(t=this.canvas.clipPath.width,r=this.canvas.clipPath.height):(t=this.canvas.width/this.canvas.viewportTransform[0],r=this.canvas.height/this.canvas.viewportTransform[3]),N=i.width/i.height<=this.canvasWidth/this.canvasHeight?v*t/i.width:v*r/i.height,i._setOriginToCenter(),i.scale(N),i._resetOrigin();const xe=0+r-i.height*i.scaleY;i.set({left:this.clamp(i.left,0+t-i.width*i.scaleX,0),top:this.clamp(i.top,xe,0)}),i.canvas.requestRenderAll(),this._tansformation.next("y")}cloneFrameObject(v){if(v instanceof pe.fabric.Group){const s=v.getObjects(),i=[];for(let t=0;t<s.length;t++)i[t]=pe.fabric.util.object.clone(s[t]);return pe.fabric.util.groupSVGElements(i,{left:v.left,top:v.top,scaleX:v.scaleX,scaleY:v.scaleY})}return pe.fabric.util.object.clone(this._frameObject)}}var it=g(8071),Le=g(25880);class dt{constructor(v,s,i,t,r){this.image=s,this.module=v,this.width=t,this.height=r,this.zoomFactor=2,this.brushRadius=10,this.edgeStrength=10,this.selectedOption=0,this.maskImageUrl=i,this.api={updateMaskMat:v.cwrap("nativeEraserUpdateMaskMat","",["number","array","number","number"]),setBaseImage:v.cwrap("nativeEraserSetBaseImage","number",["array","number","number"]),addErasePoint:v.cwrap("nativeEraserAddErasePoint","",["number","number","number"]),addBrushPoint:v.cwrap("nativeEraserAddBrushPoint","",["number","number","number"]),addManualBrushPoint:v.cwrap("nativeEraserAddManualBrushPoint","",["number","number","number"]),addManualErasePoint:v.cwrap("nativeEraserAddManualErasePoint","",["number","number","number"]),getMaskMat:v.cwrap("nativeEraserGetMaskMat","number",["number"]),updateProcessedMaskMatArray:v.cwrap("nativeEraserUpdateProcessedMaskMatArray","",["number"]),setBrushSize:v.cwrap("nativeEraserSetBrushSize","",["number","number","number"]),setEdgeStrength:v.cwrap("nativeEraserSetEdgeStrength","",["number","number"]),isUndoModeAvailable:v.cwrap("nativeEraserIsUndoModeAvailable","boolean",["number"]),isRedoModeAvailable:v.cwrap("nativeEraserIsRedoModeAvailable","boolean",["number"]),undo:v.cwrap("nativeEraserUndoFilter","",["number"]),redo:v.cwrap("nativeEraserApply
1RedoMode","",["number"]),delete:v.cwrap("nativeEraserDelete","",["number"]),reset:v.cwrap("nativeEraserReset","",["number"])},this.maskWrapper=this.api.setBaseImage(this.image.data,this.width,this.height),this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor),this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength)}setBrushSize(v){this.selectedOption==me.MY||this.selectedOption==me.WM?(this.edgeStrength=v,this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/5)):(this.brushRadius=v,this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor))}resize(v,s=null){this.resizeImageData(v,this.width,this.height).then(i=>{this.maskData=i,this.updateMaskMat(),s&&s()})}resizeImageData(v,s,i){return(0,n.A)(function*(){const t=0|s,r=0|i,f=yield window.createImageBitmap(v,0,0,v.width,v.height,{resizeWidth:t,resizeHeight:r}),T=document.createElement("canvas");T.width=t,T.height=r;const N=T.getContext("2d");return N.drawImage(f,0,0),N.getImageData(0,0,t,r)})()}setSelectedOption(v){this.selectedOption=v}isUndoModeAvailable(){return this.api.isUndoModeAvailable(this.maskWrapper)}isRedoModeAvailable(){return this.api.isRedoModeAvailable(this.maskWrapper)}undo(){return this.api.undo(this.maskWrapper)}redo(){return this.api.redo(this.maskWrapper)}addPoint(v,s){if(-1==this.maskWrapper)throw new Error("Base mask not set..");switch(this.selectedOption){case me.WM:this.api.addBrushPoint(this.maskWrapper,v,s);break;case me.MY:this.api.addErasePoint(this.maskWrapper,v,s);break;case me.l4:this.api.addManualBrushPoint(this.maskWrapper,v,s);break;case me.lh:this.api.addManualErasePoint(this.maskWrapper,v,s);break;case me.Uq:case me.e_:this.api.addSmartSelectionPoint(this.maskWrapper,v,s)}}getSmoothMaskMat(){return this.getMaskMat()}getMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getMaskMat(this.maskWrapper);return Le.A.unpackProcessImageResult(this.module,v)}throw new Error("Base mask not set..")}onMouseUp(){if(-1==this.maskWrapper)throw new Error("Base mask not set..");this.api.updateProcessedMaskMatArray(this.maskWrapper)}updateMaskMat(){if(-1!=this.maskWrapper){const s=new Uint8ClampedArray(this.width*this.height*4);for(let t=0;t<this.maskData.data.length;t+=4)s[t]=this.maskData.data[t],s[t+1]=this.maskData.data[t+1],s[t+2]=this.maskData.data[t+2],s[t+3]=this.maskData.data[t+3];const i=new ImageData(s,this.width,this.height);this.api.updateMaskMat(this.maskWrapper,i.data,this.width,this.height),this.renderCallback()}}applySegmentation(v){var s=this;return(0,n.A)(function*(){yield s.selfieSegmentation.send({image:v})})()}applyBgMaskNew(v,s=null){this.maskData=v,s&&s(),this.updateMaskMat()}applyBgMask(v,s=null){let i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",()=>{let t=i.width,r=i.height,f=document.createElement("canvas");f.width=t,f.height=r;const T=f.getContext("2d");T.clearRect(0,0,t,r),T.drawImage(i,0,0,t,r),this.resize(T.getImageData(0,0,t,r)),s&&s()},!1),i.src=v}delete(){-1!=this.maskWrapper&&this.api.delete(this.maskWrapper)}reset(){var v=this;return(0,n.A)(function*(){-1!=v.maskWrapper&&(yield v.api.reset(v.maskWrapper))})()}invert(){-1!=this.maskWrapper&&this.api.invert(this.maskWrapper)}}class Si{constructor(){this.undoSteps=[],this.redoSteps=[]}reset(){this.undoSteps.length=0,this.redoSteps.length=0,this.brush&&this.brush.reset()}getCutout(){return this.brush}createBrush(v,s,i,t,r){null==this.brush&&(this.brush=new dt(v,s,i,t,r))}isUndoModeAvailable(){return this.undoSteps.length>0}isRedoModeAvailable(){return this.redoSteps.length>0}undo(){if(this.isUndoModeAvailable()){let v=this.undoSteps.pop();v.undoType==me.l3.ERASE&&(this.brush.undo(),this.redoSteps.length>=20&&(this.undoSteps=[],this.brush.undo()),this.redoSteps.push(v))}}redo(){if(this.isRedoModeAvailable()){let v=this.redoSteps.pop();v.undoType==me.l3.ERASE&&(this.brush.redo(),this.undoSteps.push(v))}}getBrush(){return this.brush}onMouseUp(){this.brush.onMouseUp(),this.createUndoState(me.l3.ERASE,null)}createUndoState(v,s){let i=new it.cB;i.model=s,i.undoType=v,this.undoSteps.push(i),this.redoSteps.length=0}delete(){this.brush&&this.brush.delete()}addPoint(v,s){this.brush.addPoint(v,s)}}var vt=g(94449),nt=g(45975),Ei=g(67298),Mo=g(46631),jo=g(75270),Oo=g(20999),Ao=g(6421),Ui=g(99404),Li=g(68465),Ro=g(25119),Bo=g(62261),Ni=g(48039),Do=g(52581),Gi=g(69333),Pt=g(36561),Fo=g(86820);const Uo=c=>({"strip-h":c}),yi=c=>({"tab-child-active":c}),wi=c=>({"active-btn-tab":c});function Lo(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",18),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activatePane("fill"))}),e.EFF(1,"Fill"),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("ngClass",e.eq3(1,wi,"fill"==s.activePane))}}function No(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",18),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activatePane("library"))}),e.EFF(1,"Library"),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("ngClass",e.eq3(1,wi,"library"==s.activePane))}}function Go(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",18),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activatePane("upload"))}),e.EFF(1,"Uploads"),e.k0s()}if(2&c){const s=e.XpG();e.Y8G("ngClass",e.eq3(1,wi,"upload"==s.activePane))}}function Vo(c,v){1&c&&e.nrm(0,"span",30)}function Xo(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",26),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(2);return e.Njj(r.addBgImage(t.imgUrl))}),e.j41(1,"div",27),e.DNE(2,Vo,1,0,"span",28),e.nrm(3,"img",29),e.k0s()()}if(2&c){const s=v.$implicit,i=e.XpG(2);e.R7$(2),e.Y8G("ngIf",1==s.pro&&!(i.user&&i.user.subscribed)),e.R7$(),e.Y8G("src",s.imgUrl,e.B4B)}}function zo(c,v){1&c&&(e.j41(0,"div",31),e.nrm(1,"element-placeholder",32),e.k0s()),2&c&&(e.R7$(),e.Y8G("count",4)("col",2))}function Wo(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",19)(1,"div",20)(2,"div",21)(3,"div",22,1),e.bIt("scrolled",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.scrollDrawerEndLibrary())}
1),e.j41(5,"div",23),e.DNE(6,Xo,4,2,"div",24),e.k0s(),e.DNE(7,zo,2,2,"div",25),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("scrollWindow",!1)("infiniteScrollDistance",.5)("infiniteScrollUpDistance",2)("infiniteScrollThrottle",50),e.R7$(3),e.Y8G("ngForOf",s.bgLibraryImages),e.R7$(),e.Y8G("ngIf",s.isPatternLoadProgressLibrary)}}function Yo(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",40)(1,"h5",41),e.EFF(2,"Current color"),e.k0s(),e.j41(3,"div",42)(4,"div",43)(5,"button",44),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.bgColorPanelVisible=!0)}),e.nrm(6,"pi",45),e.k0s()()()()}if(2&c){const s=e.XpG(2);e.R7$(5),e.xc7("background",s.selectedBgColor)}}function $o(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",46)(1,"h5",41),e.EFF(2,"Preset colors"),e.k0s(),e.j41(3,"div",47)(4,"div",48)(5,"buttons-scroll-menu",49),e.bIt("selectMenu",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeColor(t))}),e.k0s()()()()}if(2&c){const s=e.XpG(2);e.R7$(5),e.Y8G("items",s.colorsBgPresets)("type","colortab")}}function Ho(c,v){1&c&&(e.j41(0,"div",31),e.nrm(1,"element-placeholder",32),e.k0s()),2&c&&(e.R7$(),e.Y8G("count",4)("col",3))}function Ko(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",62),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.changeColor(t))}),e.k0s()}2&c&&e.xc7("background",v.$implicit)}function Zo(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",62),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(4);return e.Njj(r.changeColor(t))}),e.k0s()}2&c&&e.xc7("background",v.$implicit)}function Qo(c,v){if(1&c&&(e.j41(0,"div",63)(1,"div",43)(2,"div",58),e.DNE(3,Zo,1,2,"button",59),e.k0s()()()),2&c){const s=e.XpG(3);e.R7$(3),e.Y8G("ngForOf",s.colorsBgPresets.slice(6))}}function Jo(c,v){if(1&c&&(e.j41(0,"div",50,2)(2,"div",51)(3,"div",52)(4,"button",53)(5,"h5",54),e.EFF(6,"Present color"),e.k0s()(),e.j41(7,"button",55)(8,"span",56),e.EFF(9,"See less"),e.k0s(),e.j41(10,"span",57),e.EFF(11,"See all"),e.k0s()()(),e.j41(12,"div",43)(13,"div",58),e.DNE(14,Ko,1,2,"button",59),e.k0s()()(),e.j41(15,"div",60)(16,"div",61),e.DNE(17,Qo,4,1,"ng-template"),e.k0s()()()),2&c){const s=e.XpG(2);e.R7$(14),e.Y8G("ngForOf",s.colorsBgPresets.slice(0,6))}}function qo(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",69),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.addPattern(t))}),e.j41(1,"div",70),e.nrm(2,"img",29),e.k0s()()}if(2&c){const s=v.$implicit;e.R7$(2),e.Y8G("src",s.thumbUrl,e.B4B)}}function en(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",26),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(4);return e.Njj(r.addPattern(t))}),e.j41(1,"div",70),e.nrm(2,"img",29),e.k0s()()}if(2&c){const s=v.$implicit;e.R7$(2),e.Y8G("src",s.thumbUrl,e.B4B)}}function tn(c,v){if(1&c&&(e.j41(0,"div",63),e.DNE(1,en,3,1,"div",24),e.k0s()),2&c){const s=e.XpG().$implicit;e.R7$(),e.Y8G("ngForOf",s.storeProductImages.slice(3))}}function on(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",64,2)(2,"div",51)(3,"div",65)(4,"button",53)(5,"h5",66),e.EFF(6),e.k0s()(),e.j41(7,"button",55)(8,"span",56),e.EFF(9,"See less"),e.k0s(),e.j41(10,"span",67),e.bIt("click",function(t){const r=e.eBV(s).index,f=e.XpG(2);return e.Njj(f.resetProduct(r,t))}),e.EFF(11,"See all"),e.k0s()()(),e.DNE(12,qo,3,1,"div",68),e.k0s(),e.j41(13,"div",60)(14,"div",61),e.DNE(15,tn,2,1,"ng-template"),e.k0s()()()}if(2&c){const s=v.$implicit;e.Mz_("ngbAccordionItem","sticker-panel-",v.index,""),e.R7$(6),e.JRh(s.displayName),e.R7$(6),e.Y8G("ngForOf",s.storeProductImages.slice(0,3))}}function nn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div")(1,"div",20)(2,"div",21)(3,"div",33),e.bIt("scrolled",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.scrollDrawerEnd(t))}),e.j41(4,"div",34),e.DNE(5,Yo,7,2,"div",35)(6,$o,6,2,"div",36)(7,Ho,2,2,"div",25),e.j41(8,"div",37),e.DNE(9,Jo,18,1,"div",38)(10,on,16,4,"div",39),e.k0s()()()()()()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("scrollWindow",!1)("infiniteScrollDistance",.5)("infiniteScrollUpDistance",2)("infiniteScrollThrottle",50),e.R7$(2),e.Y8G("ngIf",!s.selectedBgMedia&&s.selectedBgColor&&!s.createScratch),e.R7$(),e.Y8G("ngIf",!s.createScratch),e.R7$(),e.Y8G("ngIf",s.isPatternLoadProgress),e.R7$(),e.Y8G("closeOthers",!0)("destroyOnHide",!0),e.R7$(),e.Y8G("ngIf",s.createScratch),e.R7$(),e.Y8G("ngForOf",s.storePatternProducts)}}function sn(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",79),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.uploadModal())}),e.nrm(1,"pi",80),e.EFF(2," Uploads "),e.k0s()}}function rn(c,v){if(1&c&&(e.j41(0,"button",81),e.nrm(1,"pi",80),e.EFF(2," Uploads "),e.k0s()),2&c){e.XpG(3);const s=e.sdS(20);e.Y8G("ngbPopover",s)}}function an(c,v){if(1&c&&(e.j41(0,"div",76),e.DNE(1,sn,3,0,"button",77)(2,rn,3,1,"button",78),e.k0s()),2&c){const s=e.XpG(2);e.R7$(),e.Y8G("ngIf",!s.isDataLimit),e.R7$(),e.Y8G("ngIf",s.isDataLimit)}}function ln(c,v){if(1&c){const s=e.RV6();e.j41(0,"div")(1,"div",20)(2,"div",71)(3,"div",34),e.DNE(4,an,3,2,"div",72),e.j41(5,"div",73)(6,"div",74)(7,"uploaded-media-list",75),e.bIt("addUploadedMedia",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.addUploadedAsset(t))}),e.k0s()()()()()()()}if(2&c){const s=e.XpG();e.R7$(4),e.Y8G("ngIf",s.user),e.R7$(3),e.Y8G("isUploadedMediaLoaded",s.isUploadedImageLoaded)("uplodedAssets",s.uplodedAssets)("editorType",s.editorType)}}function cn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",20)(1,"div",82)(2,"div",83)(3,"div",84)(4,"button",85),e.EFF(5,"Custom"),e.k0s(),e.j41(6,"button",86),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.colorPickerClose(t.selectedBgColor,t.entiry))}),e.nrm(7,"pi",87),e.k0s()(),e.j41(8,"app-color-picker-panel",88),e.bIt("colorEnable",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.colorPickerClose(t.selectedBgColor,t.entiry))})("changed",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeColor(t))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(8),e.Y8G("selectedColor",s.selectedBgColor)}}function hn(c,v){1&c&&e.eu8(0)}function dn(c,v){if(1&c&&e.DNE(0,hn,1,0,"ng-container",89),2&c){const s=e.XpG();e.Y8G("ngComponentOutlet",s.propopover)("ngComponentOutletInjector",s.injector)}}let ki=(()=>{var c;class v extends Ro._{constructor(i,t,r,f,T,N,H,q,ne){super(),this.mediaContentService=i,this.authService=t,this.ngZone=r,this.editorUiService=f,this.injector=T,this.stateService=N,this.photoEditorService=H,this.zoomService=q,this.config=ne,this.editorType=E._Y.Photo,this.stockVideos=[],this.activePane="fill",this.stockVideosPageNumber=1,this.isVideoProgress=!1,this.searchTerm="",this.searchMode="image",this.basePixabayVideoThumbUrl=a.c.basePixabayVideoThumbUrl,this.stockImages=[],this.stockImagePageNumber=1,this.library
1ImagePageNumber=0,this.patternPageEndLibrary=!1,this.isImageProgress=!1,this.storePatternProducts=[],this.isPatternLoadProgress=!1,this.isPatternLoadProgressLibrary=!1,this.bgColorPanelVisible=!1,this.colors=["rgb(0,0,0)","rgb(255, 255, 255)","rgb(242, 38, 19)","rgb(249, 105, 14)","rgb(253, 227, 167)"],this.progressChanged=new e.bkB,this.cancelAdjust=new e.bkB,this.executeAction=new e.bkB,this.backToBackground=new e.bkB,this.uplodedAssets=[],this.recentlyUsed=[],this.colorsBgPresets=[],this.createScratch=!1,this.bgLibrary=!1,this.isUploadedImageLoaded=!1,this.isUploadedImageProgress=!1,this.mediaAccept="image/bmp,image/x-windows-bmp,image/jpeg,image/pjpeg,image/png,image/webp",this.pageSize=14,this.filters=[{name:"none",title:"None",icon:"https://static.lightxeditor.com/assets/images/none.png"},{name:"grayscale",title:"Grayscale",icon:"https://static.lightxeditor.com/assets/images/grayscale.png"},{name:"sepia",title:"Sepia",icon:"https://static.lightxeditor.com/assets/images/sepia.png"},{name:"bw",title:"Black/White",icon:"https://static.lightxeditor.com/assets/images/black-white.png"},{name:"brownie",title:"Brownie",icon:"https://static.lightxeditor.com/assets/images/brownie.png"},{name:"vintage",title:"Vintage",icon:"https://static.lightxeditor.com/assets/images/vintage.png"},{name:"kodachrome",title:"Kodachrome",icon:"https://static.lightxeditor.com/assets/images/kodachrom.png"},{name:"technicolor",title:"Technicolor",icon:"https://static.lightxeditor.com/assets/images/technicolor.png"},{name:"polaroid",title:"Polaroid",icon:"https://static.lightxeditor.com/assets/images/polarid.png"}],this.videoVolume=0,this.videoLoop=0,this.dirty=!1,this.propopover=Ao.A,this.isDataLimit=!1,this.changeScale=new e.bkB,this.bgChanged=new e.bkB,this.pagenumber=0,this.patternPageEnd=!1,this.subscription=[],this.bgLibraryImages=[],this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota),this.colorsBgPresets=M.PV.ui.colorBgPresets.items;let se=this.authService.usrPropChanged.subscribe(ae=>{this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota)});this.subscription.push(se),this.injector=this.createInjector(),se=this.authService.loggedIn.subscribe(ae=>{this.user=this.authService.currentUser()}),this.subscription.push(se)}ngOnChanges(){}backToRemoveBg(){this.backToBackground.emit(!1)}ngOnInit(){this.bg&&this.bg.color&&(this.selectedBgColor=this.bg.color),this.bgLibrary?(this.activePane="library",this.getBgLibrary()):this.getBackgroundPatterns(()=>{this.showProductTop()})}handleMediaFileInput(i){const t=i[0];t&&(URL.createObjectURL(t),this.progressChanged.emit(!0))}addBaseVideo(i){}addBaseImage(i){this.addBgImage(i.fullHDURL)}addBgImage(i){var t=this;this.photoEditorService.inProgress=!0,this.photoEditorService.loadBgImage(i,function(){var r=(0,n.A)(function*(f){let T=t.activeObject;yield t.zoomService.initWithoutClear(26,f.width,f.height);const N=new Ui.b(null,f.width,f.height,1);return{promise:N.addBgImageFromHTMLImage(f).then(q=>{t.stateService.mainCanvas.setBackgroundColor(null,()=>{}),t.selectedBgColor=null,t.zoomService.defaultZoom=!0,t.zoomService.fitToScreen(),t.bgChanged.emit({url:i,pattern:!1,fabricBgImage:q}),N.addToCanvas(t.stateService.mainCanvas),t.photoEditorService.inProgress=!1,T.getScale(),t.scaleMask(f.width,f.height,T),t.activeObject.align(4),t.activeObject.align(5)}),cancel:null}});return function(f){return r.apply(this,arguments)}}())}scaleMask(i,t,r,f=60){let ne,se,T=i,H=r._mediaObjects.width,q=r._mediaObjects.height,ae=1;ne=t>=f?t-f:t,se=ne*(H/q),se=Math.ceil(se),se>T&&(se=T>=f?T-f:T,ne=Math.ceil(se*(q/H))),ae=Math.min(se/H,ne/q),ae=parseFloat(ae.toFixed(3)),this.changeScale.emit(ae),r._mediaObjects.set({scaleX:ae,scaleY:ae}),r._frameObject.set({scaleX:ae,scaleY:ae}),r.oScale=ae}addUploadedImage(i){this.addBgImage(i.metadata.contentUrl)}addUploadedAsset(i){this.addUploadedImage(i)}scrollDrawerEnd(i){!this.patternPageEnd&&this.pagenumber>0&&this.getBackgroundPatterns()}getBackgroundPatterns(i=null){this.isPatternLoadProgress=!0,this.pagenumber++,this.mediaContentService.getProductDetails(Li.KK.AIRemBgBackgroun
1d,this.pagenumber-1,t=>{t&&t.body&&t.body.storeProducts.length>0?this.storePatternProducts=this.pagenumber>0?this.storePatternProducts.concat(t.body.storeProducts):t.body.storeProducts:this.patternPageEnd=!0,this.isPatternLoadProgress=!1,this.isImageProgress=!1,i&&i()},t=>{this.isImageProgress=!1})}activatePane(i){this.activePane=i}changeColor(i){var t=this;this.selectedBgMedia=null,this.selectedBgColor=i,this.bgChanged.emit(i?{color:i}:null),this.stateService.mainCanvas.backgroundImage?this.stateService.mainCanvas.setBackgroundImage(null,(0,n.A)(function*(){let r=t.activeObject,f=r._mediaObjects.width,T=r._mediaObjects.height;yield t.zoomService.initWithoutClear(26,f,T),t.zoomService.defaultZoom=!0,t.zoomService.fitToScreen(),1===r.getScale()&&t.scaleMask(f,T,r),t.activeObject.align(4),t.activeObject.align(5),t.photoEditorService.changeBgColor(i)})):this.photoEditorService.changeBgColor(i)}addPattern(i){let t,r;this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clipPath?(t=this.stateService.mainCanvas.clipPath.width,r=this.stateService.mainCanvas.clipPath.height):(t=this.stateService.mainCanvas.width/this.stateService.mainCanvas.viewportTransform[0],r=this.stateService.mainCanvas.height/this.stateService.mainCanvas.viewportTransform[3]);const f=new jo.b(null,t,r,0,0,null);return{promise:f.addBgImage(i.imgUrl,null).then(N=>{this.bgChanged.emit({url:i.imgUrl,pattern:!0,fabricBgImage:N}),this.selectedBgColor=null,f.addToCanvas(this.stateService.mainCanvas),this.photoEditorService.inProgress=!1}),cancel:null}}adjust(){this.executeAction.emit({name:"show_adjust",val:!0})}cancelBackgroundAdjust(){this.executeAction.emit({name:"apply_adjust",val:!0})}applyBackgroundAdjust(){this.executeAction.emit({name:"apply_adjust",val:!0})}bgDone(){}sortNull(i,t){return 0}openColorPanel(i,t){(!this.selectedEntryKeyVal||this.selectedEntryKeyVal&&this.selectedEntryKeyVal.key!==i.key)&&(this.bgColorPanelVisible&&this.colorPickerClose(this.selectedEntryKeyVal.key,this.entiry),this.bgColorPanelVisible=!0,this.selectedEntryKeyVal=i,this.entiry=t,this.selectedColorKey=i.key)}colorPickerClose(i,t){this.bgColorPanelVisible=!1,this.dirty=!1}resetProduct(i,t){if(t){let r=document.getElementById("scroll-adjuster");r&&t.target&&this.setActiveScrollPos(r,t.target.parentElement)}}ngOnDestroy(){this.dirty&&this.colorPickerClose(this.selectedEntryKeyVal.key,this.entiry),this.subscription.length>0&&this.subscription.forEach(i=>{i.unsubscribe()})}getStockImages(){this.isUploadedImageProgress=!1,this.mediaContentService.getImages(this.stockImagePageNumber,this.pageSize,i=>{this.ngZone.run(()=>{this.isUploadedImageProgress=!0,this.uplodedAssets=i.hits}),i.hits&&(this.isUploadedImageLoaded=!0),setTimeout(()=>{},200),setTimeout(()=>{this.isUploadedImageProgress=!1},800)},i=>{this.isUploadedImageProgress=!1})}uploadModal(){this.editorUiService.uploadModal(this.mediaAccept,E._Y.Photo)}createInjector(){let i;return i={title:w.b.popover.dataLimitTitle,desc:w.b.popover.dataLimitDesc,name:"datalimit"},e.zZn.create([{provide:Oo.hl,useValue:i}],this.injector)}scrollDrawerEndLibrary(){this.patternPageEndLibrary||this.isPatternLoadProgressLibrary||this.getBgLibrary()}getBgLibrary(){this.patternPageEndLibrary=!1,this.isPatternLoadProgressLibrary=!0,this.mediaContentService.getBgTemplateByProductId(Li.KK.BgLibrary,this.libraryImagePageNumber++,i=>{i&&i.storeProductImages.length>0?(this.libraryImagePageNumber=this.libraryImagePageNumber+1,this.bgLibraryImages=this.libraryImagePageNumber>=0?this.bgLibraryImages.concat(i.storeProductImages):i.storeProductImages):this.patternPageEndLibrary=!0,setTimeout(()=>{this.isPatternLoadProgressLibrary=!1},500)},i=>{})}showProductTop(){const i=this.storePatternProducts,t=Number(this.photoEditorService.photoEditorOptions?.productId);if(i?.length&&t){const r=i.findIndex(f=>f.productId==t);if(r>0&&-1!=r){const f=i[r];this.storePatternProducts.splice(r,1),this.storePatternProducts.splice(0,0,f)}else this.getTemplateByProductId(t)}}getTemplateByProductId(i){this.mediaContentService.getTemplateByProductId(i,0,t=>{t&&t.storeProductImages&&t.storeProductImages.length>0&&(t.productId=i,t.displayName=t.productDisplayName,this.storePatternProducts.splice(0,0,t))},t=>{})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(Bo.Z),e.rXU($.u),e.rXU(e.SKi),e.rXU(Dt.f),e.rXU(e.zZn),e.rXU(G.X),e.rXU(l.p),e.rXU(A.n),e.rXU(X.w))},c.\u0275cmp=e.VBU({type:c,selectors:[["background-drawer"]],inputs:{createScratch:"createScratch",bgLibrary:"bgLibrary",activeObject:"activeObject",bg:"bg"}
1,outputs:{progressChanged:"progressChanged",cancelAdjust:"cancelAdjust",executeAction:"executeAction",backToBackground:"backToBackground",changeScale:"changeScale",bgChanged:"bgChanged"},features:[e.Vt3,e.OA$],decls:21,vars:19,consts:[["popContent",""],["stockSb",""],["accItem","ngbAccordionItem"],[1,"backgound-content","h-100",3,"ngClass"],[1,"d-flex","align-items-center","ps-3","pe-3",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],[1,"common-container","pb-1"],[1,"wp-100","btn-tabs-editor"],[1,"d-flex","align-items-center","h-100"],["class","btn btn-tab-inner ms-1 me-1",3,"ngClass","click",4,"ngIf"],[1,"inner-strip-h",2,"height","calc(100vh - 170px)"],[1,"tab-child-item","one",3,"ngClass"],["class","silhouetteTool",4,"ngIf"],[1,"tab-child-item","one","marginTopBgDrawer",3,"ngClass"],[4,"ngIf"],[1,"tab-child-item","three",3,"ngClass"],["class","pane-section","style","position: initial !important;",4,"ngIf"],[1,"btn","btn-tab-inner","ms-1","me-1",3,"click","ngClass"],[1,"silhouetteTool"],[1,"pane-section",2,"position","initial !important"],[1,"scroll-content",2,"height","calc(100% - var(--sales-height))"],["customScrollDir","","infiniteScroll","",1,"scroll-container",2,"padding-right","2px",3,"scrolled","scrollWindow","infiniteScrollDistance","infiniteScrollUpDistance","infiniteScrollThrottle"],[1,"content","pt-9"],["class","sticker-thumb position-relative",3,"click",4,"ngFor","ngForOf"],["class","blank-preview",4,"ngIf"],[1,"sticker-thumb","position-relative",3,"click"],[1,"inner"],["class","hw-20 icon pro-asset-icon",4,"ngIf"],[3,"src"],[1,"hw-20","icon","pro-asset-icon"],[1,"blank-preview"],[3,"count","col"],["id","scroll-adjuster","customScrollDir","","infiniteScroll","",1,"scroll-container",3,"scrolled","scrollWindow","infiniteScrollDistance","infiniteScrollUpDistance","infiniteScrollThrottle"],[1,"drawer-content"],["class","card-body mt-10",4,"ngIf"],["class","card-body mt-10 mb-2",4,"ngIf"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["ngbAccordionItem","sticker-panel-00","class","tab-div",4,"ngIf"],["class","tab-div",3,"ngbAccordionItem",4,"ngFor","ngForOf"],[1,"card-body","mt-10"],[1,"text-normal","text-semi","text-black","m-0"],[1,"d-flex","mt-9","document-color",2,"height","38px"],[1,"colors-bg"],["placement","top","ngbTooltip","Change Color","container","body","tooltipClass","tooltip-custom-all min-82",1,"no-style","color","control","p-0","me-2",3,"click"],["name","currentcoloricon",1,"f-24"],[1,"card-body","mt-10","mb-2"],[1,"d-flex","mt-7","document-color"],[1,"colors-bg","sticker-buttons-scroll","scrollWidth-300"],[3,"selectMenu","items","type"],["ngbAccordionItem","sticker-panel-00",1,"tab-div"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","justify-content-between"],["type","button",1,"btn-acc-title","pe-none",2,"width","auto !important"],[1,"m-0","btn","btn-link","text-normal","text-semi","text-black","1"],["type","button","ngbAccordionButton","",1,"btn-collapse-expand","d-flex","align-items-center","border-radius-8","p-1","border-0","h-24","me-2"],[1,"collapse-text","text-11","grey-600"],[1,"expand-text","text-11","grey-600"],[1,"colors","color-thumbPc","mt-9","presets"],["class","no-style color control p-0 color-boxPc",3,"background","click",4,"ngFor","ngForOf"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],[1,"no-style","color","control","p-0","color-boxPc",3,"click"],[1,"content"],[1,"tab-div",3,"ngbAccordionItem"],[1,"d-flex","align-items-center","mt-2","justify-content-between"],[1,"m-0","btn","btn-link","text-normal","text-semi","text-black"],[1,"expand-text","text-11","grey-600",3,"click"],["class","sticker-thumb mt-2 position-relative",3,"click",4,"ngFor","ngForOf"],[1,"sticker-thumb","mt-2","position-relative",3,"click"],[1,"inner",2,"min-height","84px"],[1,"scroll-content"],["class","common-container pt-3 position-absolute top-0","style","z-index: 3;\n width: calc(100% - 16px);background: #ffffff;",4,"ngIf"],[1,"pane-section"],[1,"scroll-content","uploaded-content",2,"height","calc(100% - var(--sales-height))"],[3,"addUploadedMedia","isUploadedMediaLoaded","uplodedAssets","editorType"],[1,"common-container","pt-3","position-absolute","top-0",2,"z-index","3","width","calc(100% - 16px)","background","#ffffff"],["class","btn-all btn-outline-primary btn-editor-panel w-100 h-40 border-radius-12 text-13","style","line-height: 36px;",3,"click",4,"ngIf"],["class","btn-all btn-outline-primary btn-editor-panel w-100 h-40 border-radius-12 text-13","style","line-height: 36px;","container","body",3,"ngbPopover",4,"ngIf"],[1,"btn-all","btn-outline-primary","btn-editor-panel","w-100","h-40","border-radius-12","text-13",2,"line-height","36px",3,"click"],["name","uploadmediaNew",1,"me-2","f-24"],["container","body",1,"btn-all","btn-outline-primary","btn-editor-panel","w-100","h-40","border-radius-12","text-13",2,"line-height","36px",3,"ngbPopover"],[1,"scroll-content","bg-color-picker"],[1,"bg-color-panel","pe-3","ps-3","pt-10"],[1,""],[1,"btn-all","p-0","m-0","btn-left-color","text-normal"],[1,"btn-all","p-0","m-0","btn-right-color","float-end",3,"click"],["name","closecolortool"],[3,"colorEnable","changed","selectedColor"],[4,"ngComponentOutlet","ngComponentOutletInjector"]],template:function(i,t){if(1&i){const r=e.RV6();e.j41(0,"div",3)(1,"div",4)(2,"pi",5),e.bIt("click",function(){return e.eBV(r),e.Njj(t.backToRemoveBg())}
1),e.k0s(),e.j41(3,"span",6),e.EFF(4,"Choose Background"),e.k0s()(),e.j41(5,"div",7)(6,"div",8)(7,"div",9),e.DNE(8,Lo,2,3,"button",10)(9,No,2,3,"button",10)(10,Go,2,3,"button",10),e.k0s()()(),e.j41(11,"div",11)(12,"div",12),e.DNE(13,Wo,8,6,"div",13),e.k0s(),e.j41(14,"div",14),e.DNE(15,nn,11,11,"div",15),e.k0s(),e.j41(16,"div",16),e.DNE(17,ln,8,4,"div",15),e.k0s(),e.DNE(18,cn,9,1,"div",17),e.k0s(),e.DNE(19,dn,1,2,"ng-template",null,0,e.C5r),e.k0s()}2&i&&(e.Y8G("ngClass",e.eq3(11,Uo,t.config.appMessage&&t.config.appMessage.show&&!(t.user&&t.user.subscribed))),e.R7$(8),e.Y8G("ngIf",!t.bgLibrary),e.R7$(),e.Y8G("ngIf",t.bgLibrary),e.R7$(),e.Y8G("ngIf",t.user),e.R7$(2),e.Y8G("ngClass",e.eq3(13,yi,"library"===t.activePane)),e.R7$(),e.Y8G("ngIf","library"===t.activePane),e.R7$(),e.Y8G("ngClass",e.eq3(15,yi,"fill"===t.activePane)),e.R7$(),e.Y8G("ngIf","fill"===t.activePane),e.R7$(),e.Y8G("ngClass",e.eq3(17,yi,"upload"===t.activePane)),e.R7$(),e.Y8G("ngIf","upload"===t.activePane),e.R7$(),e.Y8G("ngIf",t.bgColorPanelVisible))},dependencies:[I.YU,I.OI,I.Sq,I.bT,Ni.n,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.ZM,Y.md,Do.K,Gi.n,Ce.b,Pt.B,Fo.D],styles:[".silhouetteTool[_ngcontent-%COMP%] .sticker-thumb[_ngcontent-%COMP%]{height:auto;width:50%;float:left;padding:0 8px 8px 0}.silhouetteTool[_ngcontent-%COMP%] .sticker-thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{height:126px}.sticker-thumb[_ngcontent-%COMP%]{height:auto;width:33.3%;float:left;padding:0 8px 8px 0}.sticker-thumb[_ngcontent-%COMP%] .pro-asset-icon[_ngcontent-%COMP%]{bottom:12px;z-index:99}.sticker-thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:8px;cursor:pointer}.sticker-thumb[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%]{background:#272b34;height:100%}.sticker-thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]:hover{transform:scale(1.03)}.bg-color-picker[_ngcontent-%COMP%]{background:#ffffffb3;-webkit-backdrop-filter:blur(14.2933px);backdrop-filter:blur(14.2933px);z-index:9}.bg-color-panel[_ngcontent-%COMP%]{position:absolute;top:0;background:#fff;height:317px;width:100%;z-index:9}.colors[_ngcontent-%COMP%]{display:flex;justify-content:left}.color-thumbPc[_ngcontent-%COMP%]{display:block!important;padding:0}.color-thumbPc[_ngcontent-%COMP%] .color-boxPc[_ngcontent-%COMP%]{margin:0 0 8px 6px}.document-color[_ngcontent-%COMP%] button.color[_ngcontent-%COMP%], .document-color[_ngcontent-%COMP%] .colors-bg[_ngcontent-%COMP%] button.color[_ngcontent-%COMP%]{margin:0 8px 0 0!important;width:38px!important;height:38px!important}.btn-acc-title[_ngcontent-%COMP%] .btn-link[_ngcontent-%COMP%]{padding:0!important}.strip-h[_ngcontent-%COMP%] .inner-strip-h[_ngcontent-%COMP%]{height:calc(100% - 3.2rem - 58px)!important}.one[_ngcontent-%COMP%]{transform:translate(-20px)}.two[_ngcontent-%COMP%], .three[_ngcontent-%COMP%]{transform:translate(20px)}.mid[_ngcontent-%COMP%]{transform:translate(-20px)!important}.tab-child-item[_ngcontent-%COMP%]{overflow:hidden;width:100%;height:0px;opacity:0;transition-duration:.35s;transition-property:opacity,transform;transition-timing-function:ease-in-out}.tab-child-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translate(0)}"]}),v})();g(14890);var Ut=g(93391),pt=g(85188),It=g(41067);function pn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",1)(1,"div",2)(2,"div",3)(3,"h5",4),e.EFF(4,"Blur Intensity"),e.k0s()(),e.j41(5,"div",5)(6,"div",3)(7,"mv-slider",6),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.input(t))}),e.k0s()(),e.j41(8,"div",7)(9,"input",8),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.input(t))}),e.k0s()()()()()}if(2&c){const s=e.XpG();e.R7$(7),e.Y8G("value",s.blur)("min",0)("max",100)("step",1),e.R7$(2),e.Y8G("ngModel",s.blur)}}function un(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",1)(1,"div",2)(2,"div",9)(3,"div",10)(4,"input",11),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.input(t))}),e.k0s(),e.j41(5,"div")(6,"mv-slider",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.input(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.input(t))}),e.k0s()()()()()()}if(2&c){const s=e.XpG();e.R7$(4),e.Y8G("ngModel",s.blur),e.R7$(2),e.Y8G("orientation",s.vertical)("value",s.blur)("min",0)("max",100)("step",1)}}let mn=(()=>{var c;class v{constructor(){this.blur=100,this.vertical="vertical"}
1ngOnChanges(){this.blur=Math.round(100*this.imageFilterUtil.getBlur())}changeBlur(i,t){this.imageFilterUtil.inputBlur(i/100,t),this.imageFilterUtil.selectedImage.canvas.renderAll(),this.blur=Math.round(100*this.imageFilterUtil.getBlur())}input(i){let t,r;i.newValue?(t=i.newValue,r=!1):(t=i,r=!0),t>0?t>100?setTimeout(()=>{this.changeBlur(100,r)},0):setTimeout(()=>{this.changeBlur(t,r)},0):setTimeout(()=>{this.changeBlur(0,r)},0)}}return(c=v).\u0275fac=function(i){return new(i||c)},c.\u0275cmp=e.VBU({type:c,selectors:[["blur-tool"]],inputs:{imageFilterUtil:"imageFilterUtil",verticalOrientation:"verticalOrientation"},features:[e.OA$],decls:2,vars:2,consts:[["class","card drawer-card",4,"ngIf"],[1,"card","drawer-card"],[1,"card-body"],[1,"wp-100"],[1,"card-title","m-0"],[1,"d-flex","mt-1","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","value","min","max","step"],[1,"ml-9"],["type","text","mask","000",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","ngModel"],[1,"d-flex"],[2,"margin","0 auto !important"],["type","text","mask","000",1,"form-control","text-normal","text-black","form-input-sm","mb-3",3,"ngModelChange","ngModel"],["reversed","true",1,"opacity-slider-reverse","opacity-slider",3,"change","slideStop","orientation","value","min","max","step"]],template:function(i,t){1&i&&e.DNE(0,pn,10,5,"div",0)(1,un,7,6,"div",0),2&i&&(e.Y8G("ngIf",!t.verticalOrientation),e.R7$(),e.Y8G("ngIf",t.verticalOrientation))},dependencies:[I.bT,we.me,we.BC,we.vS,qe.d1,pt.Zr],styles:[".button-row[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{display:table-cell;margin-right:8px}.button-row[_ngcontent-%COMP%]{display:inline-block}.tool-card[_ngcontent-%COMP%]{margin-bottom:10px}.rotate-button[_ngcontent-%COMP%]{text-align:center;cursor:pointer;margin:0 5px;padding:5px;width:45px;height:45px;flex-shrink:0;border-radius:4px;border:1px solid #eee;background-color:#fff;transition:box-shadow .3s ease}.animation-type-section[_ngcontent-%COMP%]{margin-top:20px}.in-animation-section[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:13px;padding-left:8px}.anim-tool[_ngcontent-%COMP%]{display:inline-block;margin:auto;width:25%}.slider[_ngcontent-%COMP%]{display:flex;align-items:center}.is-active[_ngcontent-%COMP%]{border:2px solid #007AFF!important}button[_ngcontent-%COMP%]:focus{outline:#007AFF auto 1px}.form-input-sm[_ngcontent-%COMP%]{width:44px;height:32px;letter-spacing:.28px;text-align:center;padding:0;border:1px solid #E2E3E9;border-radius:12px}"]}),v})();const gn=c=>({disabled:c}),_n=c=>({btnActive:c});function fn(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",14),e.bIt("click",function(){e.eBV(s);const t=e.XpG().$implicit,r=e.XpG();return e.Njj(r.onMaskTypeChange(t.id))}),e.EFF(1),e.k0s()}if(2&c){const s=e.XpG().$implicit,i=e.XpG();e.Y8G("ngClass",e.eq3(2,_n,i.activePane==s.id)),e.R7$(),e.JRh(s.text)}}function vn(c,v){if(1&c&&(e.qex(0),e.DNE(1,fn,2,4,"button",13),e.bVm()),2&c){const s=v.$implicit;e.R7$(),e.Y8G("ngIf",!s.hide)}}function bn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",15)(1,"div",8)(2,"div",16),e.EFF(3,"Show Mask"),e.k0s()(),e.j41(4,"div",17)(5,"toggle-switch",18),e.bIt("changeT",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.toggleMask(t))}),e.k0s()()()}if(2&c){const s=e.XpG();e.R7$(5),e.Y8G("selected",s.showmask)}}function Cn(c,v){1&c&&(e.j41(0,"div",15)(1,"div",8)(2,"div",16),e.EFF(3,"Blur Intensity"),e.k0s()(),e.j41(4,"div",17),e.nrm(5,"blur-tool"),e.k0s()())}function xn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",15)(1,"div",8)(2,"div",19),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.setInverTool())}),e.EFF(3,"Invert Selection"),e.k0s()(),e.j41(4,"div",17),e.nrm(5,"pei",20),e.k0s()()}}let Et=(()=>{var c;class v{constructor(){this.activePane=4,this.tabPane="",this.Showblur=!1,this.isAuto=!1,this.ShowInvert=!1,this.brushSize=50,this.selectedPremiumPlan=!1,this.f=pe.fabric.Image.filters,this.change=new e.bkB,this.invertSelection=!1,this.maskOptionList=[],this.showMaskVisible=!0,this.brushSizeDisable=!1,this.changeBruceSize=new e.bkB,this.brushSizeLabel="",this.showmask=!1}getMaskList(){return[{name:"Smart Select",id:me.Uq,text:"Smart Select",hide:"removebg"==this.tabPane},{name:"Smart Erase",id:me.e_,text:"Smart Erase",hide:"removebg"==this.tabPane},{name:"Magic Brush",id:me.WM,text:"Magic Brush"},{name:"Magic Erase",id:me.MY,text:"Magic Erase"},{name:"Manual Brush",id:me.l4,text:"Brush"},{name:"Manual Erase",id:me.lh,text:"Erase"}]}getAutoMaskList(){return[{name:"Smart Select",id:me.Uq,text:"Smart Select",hide:"removebg"==this.tabPane},{name:"Smart Erase",id:me.e_,text:"Smart Erase",hide:"removebg"==this.tabPane},{name:"Magic Brush",id:me.MY,text:"Magic Brush"},{name:"Magic Erase",id:me.WM,text:"Magic Erase"},{name:"Manual Brush",id:me.lh,text:"Brush"},{name:"Manual Erase",id:me.l4,text:"Erase"}]}onMaskTypeChange(i){this.activePane=i,i===me.Uq||i===me.e_?(this.brushSizeDisable=!1,this.brushSize=0,this.change.emit({
1name:"size",value:0,selectedOption:i})):(this.brushSizeDisable=!0,0===this.brushSize?setTimeout(()=>{this.brushSize=50,this.change.emit({name:"size",value:50,selectedOption:i})},0):this.change.emit({name:"size",value:this.brushSize,selectedOption:i})),this.isAuto?this.setBrushSizeLabelForAutoBlur():this.setBrushSizeLabel(),this.change.emit({name:"mask",value:i,selectedOption:i})}changeBrush(i,t=0){let r,f;i.newValue?(r=i.newValue,f=!1):(r=i>t?t:i<1?1:i,f=!0),setTimeout(()=>{this.brushSize=r,this.change.emit({name:"size",value:r,selectedOption:this.activePane})},0)}toggleMask(i){this.change.emit({name:"showmask",value:i,selectedOption:this.activePane})}onRangeMouseUp(){this.activePane!==me.l4&&this.activePane!==me.lh||this.changeBruceSize.emit({value:!1,selectedErase:!0})}onRangeMousedown(){if(this.activePane===me.l4||this.activePane===me.lh){var i=!1;this.activePane===me.lh&&(i=!0),this.changeBruceSize.emit({value:!0,selectedErase:i})}}changePremiumPlan(i){this.selectedPremiumPlan=!!i}toggleInvert(){this.change.emit({name:"invert",value:!this.invertSelection})}ngOnInit(){this.maskOptionList=this.isAuto?this.getAutoMaskList():this.getMaskList(),this.isAuto&&(this.activePane=me.MY),this.onMaskTypeChange(this.activePane)}ngOnDestroy(){}setBrushSizeLabel(){let i=this.activePane;this.brushSizeLabel=i==me.WM?"Brush Strength":i==me.l4?"Brush Size":i==me.MY?"Eraser Strength":i==me.lh?"Eraser Size":"Brush Size"}setBrushSizeLabelForAutoBlur(){let i=this.activePane;this.brushSizeLabel=i==me.WM?"Eraser Strength":i==me.l4?"Eraser Size":i==me.MY?"Brush Strength":i==me.lh?"Brush Size":"Eraser Size"}setInverTool(){setTimeout(()=>{this.change.emit({name:"invert",value:1,selectedOption:this.activePane})},0)}}return(c=v).\u0275fac=function(i){return new(i||c)},c.\u0275cmp=e.VBU({type:c,selectors:[["refine-mask-edit-tools"]],inputs:{activePane:"activePane",tabPane:"tabPane",activeObject:"activeObject",Showblur:"Showblur",isAuto:"isAuto",ShowInvert:"ShowInvert",showMaskVisible:"showMaskVisible",showmask:"showmask"},outputs:{change:"change",changeBruceSize:"changeBruceSize"},decls:16,vars:15,consts:[[1,""],[1,"edit-content","mt-2","mb-3"],[1,"d-flex","flex-wrap","justify-content-between","common-container","p-0","m-0"],[4,"ngFor","ngForOf"],[1,"mt-2","common-container","p-0","ms-0","me-0"],[1,"card-body"],[1,"text-normal","text-dark","text-semi","lh-125","border-0",3,"ngClass"],[1,"d-flex","align-items-center","mt-9"],[1,"wp-100"],[1,"opacity-slider",2,"width","100%",3,"mouseup","slideStop","mousedown","change","value","min","max","step","enabled"],[1,"ml-9"],["type","text","mask","000",1,"form-control","form-input-sm","text-normal","text-black","brush-input",3,"ngModelChange","ngModel","disabled"],["class","d-flex align-items-center mt-10 mb-10",4,"ngIf"],["class","btn-all btn-editor-tool mb-2","routerLinkActive","router-link-active",3,"ngClass","click",4,"ngIf"],["routerLinkActive","router-link-active",1,"btn-all","btn-editor-tool","mb-2",3,"click","ngClass"],[1,"d-flex","align-items-center","mt-10","mb-10"],[1,"text-normal","text-dark","text-semi","lh-125"],[1,"editor-toggle"],[1,"d-flex","align-items-center",3,"changeT","selected"],[1,"text-normal","text-dark","text-semi","lh-125",3,"click"],["name","blurauto"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"div",1)(2,"div",2),e.DNE(3,vn,2,1,"ng-container",3),e.k0s(),e.j41(4,"div",4)(5,"div",5)(6,"div",6),e.EFF(7),e.k0s(),e.j41(8,"div",7)(9,"div",8)(10,"mv-slider",9),e.bIt("mouseup",function(){return t.onRangeMouseUp()})("slideStop",function(){return t.onRangeMouseUp()})("mousedown",function(){return t.onRangeMousedown()})("change",function(f){return t.changeBrush(f)}),e.k0s()(),e.j41(11,"div",10)(12,"input",11),e.bIt("ngModelChange",function(f){return t.changeBrush(f,100)}),e.k0s()()(),e.DNE(13,bn,6,1,"div",12)(14,Cn,6,0,"div",12)(15,xn,6,0,"div",12),e.k0s()()()()),2&i&&(e.R7$(3),e.Y8G("ngForOf",t.maskOptionList),e.R7$(3),e.Y8G("ngClass",e.eq3(13,gn,!t.brushSizeDisable)),e.R7$(),e.JRh(t.brushSizeLabel),e.R7$(3),e.Y8G("value",t.brushSize)("min",5)("max",100)("step",5)("enabled",t.brushSizeDisable),e.R7$(2),e.Y8G("ngModel",t.brushSize)("disabled",!t.brushSizeDisable),e.R7$(),e.Y8G("ngIf",t.showMaskVisible),e.R7$(),e.Y8G("ngIf",t.Showblur),e.R7$(),e.Y8G("ngIf",t.ShowInvert))},dependencies:[I.YU,I.Sq,I.bT,Ut.C,we.me,we.BC,we.vS,z.wQ,qe.d1,pt.Zr,It.LR,mn],styles:[".btn-editor-tool[_ngcontent-%COMP%]{min-width:114px;width:48.6%;height:40px;font-size:13px;color:#272b34;background:transparent;border:1px solid #E2E3E9;border-radius:12px;outline:none}.btn-editor-tool[_ngcontent-%COMP%]:hover{background:#626adf0d}.btn-editor-tool[_ngcontent-%COMP%]:focus-visible, .btn-editor-tool[_ngcontent-%COMP%]:active{outline:none;border:1px solid #E2E3E9}.btnActive[_ngcontent-%COMP%]{background:#626adf0d!important;border:1px solid #626ADF!important;color:#626adf!important;border-radius:12px!important}.btnActive[_ngcontent-%COMP%]:hover{background:#626adf1a!important}"]}),v})();var Ti=g(79301);const Vi=["image/jpg","image/jpeg","image/pjpeg","image/png","image/webp"];let Sn=(()=>{var c;class v{constructor(i,t,r,f,T){this.photoEditorService=i,this.commonService=t,this.uploadImageService=r,this.toastService=f,this.route=T,this.imgQueryParams={imageUrl:"",tabName:"",from:"",editorType:""},this.fileUploadAccept=Vi.join(",")}
1ngOnInit(){this.slug=this.route.snapshot.queryParamMap.get("tab");let i=this.route.snapshot.queryParamMap.get("img");if(i){let t=i.substring(i.lastIndexOf("/")+1);if(t){let r=t.split(".")[1];this.uploadImageService.imgFormat=r}}}download(){this.photoEditorService.download(this.slug,this.uploadImageService.imgFormat,this.width/this.mainCanvasWidth)}onFileUploaded(i){if(!i.length)return;const t=i[0];let r=t.name.split(".")[1];if(this.uploadImageService.imgFormat=r,Vi.indexOf(t.type)<0)return void this.toastService.showErrorSingle(w.b.message.validImageMessageForEdit);const f=URL.createObjectURL(t);this.imgQueryParams.imageUrl=f,this.imgQueryParams.from="header",this.imgQueryParams.tabName=this.slug,this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(l.p),e.rXU(Ti.h),e.rXU(F.A),e.rXU(Z.f),e.rXU(z.nX))},c.\u0275cmp=e.VBU({type:c,selectors:[["removebg-mobile-tools"]],inputs:{width:"width",height:"height",mainCanvasWidth:"mainCanvasWidth"},decls:21,vars:5,consts:[["file",""],[1,"row","g-0","m-b-btn"],[1,"col-xs-12","col-lg-12","mb-3"],[1,"btn","btn-outline-primary","btn-h48","p-0","w-100",3,"href"],[1,"col-6","col-lg-6","pe-2"],["id","re_bg_m_v_dw",1,"btn","btn-primary","btn-h48","p-0","w-100","mb-1",3,"click"],[1,"dim-text","text-semi"],[1,"col-6","col-lg-6","ps-2"],["id","go_to_pl_st",1,"btn","btn-primary","btn-h48","p-0","w-100","mb-1",3,"href"],[1,"icon","hw-24","me-2"],["name","prousernew",1,"f-24"],[1,"d-inline-block"],["for","fileInput",1,"try-ano","text-semi","w-auto"],["id","fileInput","name","fileInput","type","file",1,"custom-file-input","d-none",3,"change","accept"]],template:function(i,t){if(1&i){const r=e.RV6();e.j41(0,"div",1)(1,"div",2)(2,"a",3),e.EFF(3," Change Background "),e.k0s()(),e.j41(4,"div",4)(5,"button",5),e.bIt("click",function(){return e.eBV(r),e.Njj(t.download())}),e.EFF(6," Download "),e.k0s(),e.j41(7,"span",6),e.EFF(8),e.k0s()(),e.j41(9,"div",7)(10,"a",8)(11,"i",9),e.nrm(12,"pi",10),e.k0s(),e.j41(13,"span",11),e.EFF(14,"Download HD"),e.k0s()(),e.j41(15,"span",6),e.EFF(16,"4000 x 4000 px"),e.k0s()(),e.j41(17,"label",12),e.EFF(18,"Try another image ?"),e.k0s(),e.j41(19,"input",13,0),e.bIt("change",function(T){return e.eBV(r),e.Njj(t.onFileUploaded(T.srcElement.files))}),e.k0s()()}2&i&&(e.R7$(2),e.FS9("href",t.commonService.playStorUrl,e.B4B),e.R7$(6),e.Lme("",t.width," x ",t.height," px"),e.R7$(2),e.FS9("href",t.commonService.playStorUrl,e.B4B),e.R7$(9),e.Y8G("accept",t.fileUploadAccept))},dependencies:[Ce.b],styles:[".m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%], .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;justify-content:center}.m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:focus, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:visited, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:hover, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:active{color:#fff;background-color:#626adf;border-color:#626adf}.m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:focus, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:visited, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:hover, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:active{background:#626adf0d;border:2px solid #626ADF;color:#626adf}.m-b-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{vertical-align:baseline}.m-b-btn[_ngcontent-%COMP%] .dim-text[_ngcontent-%COMP%]{display:block;font-style:normal;font-size:13px;line-height:18px;text-align:center;color:#b0b3bf}.m-b-btn[_ngcontent-%COMP%] .try-ano[_ngcontent-%COMP%]{display:inline-flex;font-style:normal;font-size:13px;line-height:18px;color:#626adf;margin:8px auto 12px;cursor:pointer}.m-b-btn[_ngcontent-%COMP%] .custom-file-input[_ngcontent-%COMP%]{position:absolute;z-index:-99}"]}),v})();const Pi=c=>({"drawer-active":c}),En=c=>({"pb-2":c}),yn=c=>({"pe-none":c}),wn=(c,v)=>({"background-image":c,"background-color":v});function kn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",7)(1,"remove-bg-panel",8),e.bIt("startObjectRembg",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.startObjectRembg(t))}),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("theme","light")("inProgress",s.photoEditorService.inProgress)}}function Tn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",9)(1,"background-drawer",10),e.bIt("bgChanged",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.bgChangedhandler(t))}
1)("backToBackground",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.backToBackground(t))})("changeScale",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeScale(t))}),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("bg",s.bg)("activeObject",s.activeObject)}}function Pn(c,v){if(1&c){const s=e.RV6();e.j41(0,"pi",16),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.exitRefine())}),e.k0s()}}function In(c,v){if(1&c){const s=e.RV6();e.j41(0,"div")(1,"div",11),e.DNE(2,Pn,1,0,"pi",12),e.j41(3,"span",13),e.EFF(4,"Refine Cutout"),e.k0s()(),e.j41(5,"div",14)(6,"refine-mask-edit-tools",15),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeTools(t))}),e.k0s()()()}if(2&c){const s=e.XpG(2);e.R7$(2),e.Y8G("ngIf",!s.isDialog),e.R7$(),e.Y8G("ngClass",e.eq3(4,En,s.isDialog)),e.R7$(3),e.Y8G("tabPane",s.tabPane)("activePane",s.selectMaskVal)}}function Mn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",41)(1,"div",42)(2,"button",43),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.crop())}),e.EFF(3,"Crop"),e.k0s(),e.j41(4,"div",44),e.nrm(5,"adjust-tool",45),e.k0s()()()}if(2&c){const s=e.XpG(3);e.R7$(5),e.Y8G("activeObject",s.activeObject)("Align",!1)("Scale",!0)("Rotate",!0)("Flip",!0)}}function jn(c,v){1&c&&e.nrm(0,"pi",46)}function On(c,v){if(1&c&&e.nrm(0,"div",47),2&c){const s=e.XpG(3);e.Y8G("ngStyle",e.l_i(1,wn,s.bg.url?"url("+s.bg.url+")":"none",s.bg.color?s.bg.color:"none"))}}function An(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",50)(1,"button",51),e.bIt("click",function(){e.eBV(s);const t=e.XpG(4);return e.Njj(t.reset())}),e.EFF(2,"Cancel"),e.k0s(),e.j41(3,"button",52),e.bIt("click",function(){e.eBV(s);const t=e.XpG(4);return e.Njj(t.apply(!1))}),e.EFF(4,"Apply"),e.k0s()()}if(2&c){const s=e.XpG(4);e.R7$(),e.Y8G("disabled",s.photoEditorService.inProgress),e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress)}}function Rn(c,v){if(1&c&&(e.j41(0,"div",48),e.DNE(1,An,5,2,"div",49),e.k0s()),2&c){const s=e.XpG(3);e.R7$(),e.Y8G("ngIf",!s.bgColorPanelVisible)}}function Bn(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",17)(2,"div",18)(3,"div",19)(4,"div",20)(5,"span",21),e.EFF(6,"Remove Backgroun
1d"),e.k0s()(),e.j41(7,"button",22),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.refineMask())}),e.EFF(8,"Refine Cutout"),e.k0s(),e.j41(9,"div",23)(10,"div",24)(11,"div",25)(12,"div",26)(13,"button",27)(14,"div",28),e.EFF(15,"Transform"),e.k0s()(),e.j41(16,"button",29)(17,"span",30),e.nrm(18,"pi",31),e.k0s(),e.j41(19,"span",32),e.nrm(20,"pi",33),e.k0s()()()(),e.j41(21,"div",34)(22,"div",35),e.DNE(23,Mn,6,5,"ng-template"),e.k0s()()(),e.j41(24,"div",36)(25,"div",25)(26,"div",37),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.bgColorPanelVisible=!0)}),e.j41(27,"button",27)(28,"h5",28),e.EFF(29,"Background"),e.k0s()(),e.j41(30,"button",29),e.DNE(31,jn,1,0,"pi",38)(32,On,1,4,"div",39),e.k0s()()()()()()()(),e.DNE(33,Rn,2,1,"div",40),e.bVm()}if(2&c){const s=e.XpG(2);e.R7$(3),e.Y8G("ngClass",e.eq3(6,yn,s.photoEditorService.inProgress)),e.R7$(6),e.Y8G("closeOthers",!0)("destroyOnHide",!0),e.R7$(22),e.Y8G("ngIf",!s.bg),e.R7$(),e.Y8G("ngIf",s.bg),e.R7$(),e.Y8G("ngIf",2==s.step)}}function Dn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",50)(1,"button",54),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.dismissDialog())}),e.EFF(2,"Cancel"),e.k0s(),e.j41(3,"button",55),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.applyRefineAndCloseDialog())}),e.EFF(4,"Apply"),e.k0s()()}}function Fn(c,v){if(1&c&&(e.j41(0,"div",53),e.DNE(1,Dn,5,0,"div",49),e.k0s()),2&c){const s=e.XpG(2);e.R7$(),e.Y8G("ngIf",!s.bgColorPanelVisible)}}function Un(c,v){if(1&c&&(e.qex(0),e.j41(1,"div",1)(2,"div")(3,"div",2)(4,"div",3),e.DNE(5,kn,2,2,"div",4),e.k0s(),e.DNE(6,Tn,2,2,"div",5),e.j41(7,"div",3),e.DNE(8,In,7,6,"div",0),e.k0s(),e.j41(9,"div",3),e.DNE(10,Bn,34,8,"ng-container",0),e.k0s(),e.DNE(11,Fn,2,1,"div",6),e.k0s()()(),e.bVm()),2&c){const s=e.XpG();e.R7$(4),e.Y8G("ngClass",e.eq3(8,Pi,0==s.step)),e.R7$(),e.Y8G("ngIf",0==s.step),e.R7$(),e.Y8G("ngIf",s.bgColorPanelVisible),e.R7$(),e.Y8G("ngClass",e.eq3(10,Pi,1==s.step)),e.R7$(),e.Y8G("ngIf",1==s.step),e.R7$(),e.Y8G("ngClass",e.eq3(12,Pi,2==s.step&&!s.bgColorPanelVisible)),e.R7$(),e.Y8G("ngIf",2==s.step&&!s.bgColorPanelVisible),e.R7$(),e.Y8G("ngIf",s.isDialog)}}function Ln(c,v){if(1&c&&(e.qex(0),e.nrm(1,"removebg-mobile-tools",56),e.bVm()),2&c){const s=e.XpG();e.R7$(),e.Y8G("width",s.width)("height",s.height)("mainCanvasWidth",s.mainCanvasWidth)}}let Nn=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce){super(r,f,T,N,se),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.removeBgService=q,this.document=ne,this.route=se,this.aiUploadImageService=ae,this.toastService=ce,this.uplodedAssets=[],this.selectMaskVal=me.WM,this.isEdit=!1,this.isApply=!1,this.isUploadedImageProgress=!1,this.step=0,this.bgColorPanelVisible=!1,this.isDataLimit=!1,this.previewMode=!1,this.f=pe.fabric.Image.filters,this.isMobileView=!1,this.tabPane="removebg",this.refineMaskPanelVisible=!1,this.invertMask=!1,this.activePaneChange=new e.bkB,this.isDialog=!1,this.activeAccPanelId="",this.width=512,this.height=512,this.imgParams={},this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota),this.authService.usrPropChanged.subscribe(ve=>{this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota)}),this.loggedInObserver=this.authService.loggedIn.subscribe(ve=>{this.user=this.authService.currentUser()}),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ve=>{ve&&(this.selectMaskVal=me.WM,this.invertMask=!1,this.actionController.reset(),this.actionController.delete(),this.actionController=new Si,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.bgColorPanelVisible=!1,this.bg=null,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),setTimeout(()=>{this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCurs
1or="move",this.step=0,this.photoEditorService.isCompareEnable=!1,this.init(()=>{})},500))})}accPanelChanged(i){"transform-panel-0"===i.panelId&&(this.activeAccPanelId=i.nextState?i.panelId:"null")}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.photoEditorService.photoEditorOptions.productId=0,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset&&this.actionController.reset(),this.actionController.delete&&this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.photoEditorService.isCompareEnable=!0,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnInit(){this.photoEditorService.toolNameForDownload="removeBg",this.actionController||(this.actionController=new Si),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.step=0,this.unconfigureFabricCanvas(),this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1})):(this.photoEditorService.photoEditorOptions.isDialog?(this.refineMaskPanelVisible=!0,this.bgColorPanelVisible=!1,this.step=1,this.isEdit=!0,this.unconfigureFabricCanvas(),this.previewMode=!0,this.bgColorPanelVisible=!1,this.isDialog=!0):this.step=0,this.bg=null,this.init(()=>{const i=this.photoEditorService.photoEditorOptions.maskUrl;i&&this.getMaskImageDataFromMaskUrl(i,()=>{this.step=1,this.photoEditorService.photoEditorOptions.maskUrl=null})})),this.onInit()}bgChangedhandler(i){this.photoEditorService.isDirty=!0,this.bg=i}startObjectRembg(i,t=null){this.photoEditorService.originalImage&&!this.photoEditorService.inProgress&&(this.photoEditorService.isCompareEnable=!0,this.removeBgService.closeProgress(),this.photoEditorService.startProcessingProgress({featureType:"rembg",message:w.b.label.processingImage}),setTimeout(()=>{this.getMaskFromRemote(r=>{this.finalMask=r,this.photoEditorService.completeProcessingProgress(()=>{this.gotoPreview(!1,!1),t&&t()})},()=>{this.photoEditorService.clearProcessingProgress()})},1e3))}getMaskFromRemote(i,t=null){this.removeBgService.cachedMaskedImage[this.photoEditorService.originalImage.src]?i(this.removeBgService.cachedMaskedImage[this.photoEditorService.originalImage.src]):this.removeBgService.prepareInputImageRemoteBg(this.photoEditorService.originalImage).then(r=>{this.aiUploadImageService.uploadImage(r,{tab:"rembg",fileName:"untitled.jpeg"},f=>{f&&"FAIL"!==f.status?this.removeBgService.getRemBGFromRemote(f.contentUrl,this.photoEditorService.originalImage).then(N=>{this.removeBgService.cachedMaskedImage[this.photoEditorService.originalImage.src]=N,this.removeBgService.addcache(this.photoEditorService.originalImage.src,N),i(N)}).catch(N=>{this.toastService.showError(w.b.message.somethingWrong),t&&t(N)}):(this.toastService.showError(w.b.message.somethingWrong),t&&t(f))})})}afterImageLoad(i){this.resolvedModule=i.module,this.photoEditorService.photoEditorOptions.mask&&(this.actionController.createBrush(this.resolvedModule,i.imageData,this.photoEditorService.bgmaskImgUrl,i.imageData.width,i.imageData.height),this.actionController.getBrush().applyBgMaskNew(this.photoEditorService.photoEditorOptions.mask,t=>{this.actionController.getBrush().renderCallback=()=>{this.photoEditorService.photoEditorOptions.mask=null,this.processResult(),this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1}}),this.photoEditorService.inProgress=!1)}setMask(i){this.selectMaskVal=i,this.actionController.getBrush()&&this.actionController.getBrush().setSelectedOption(this.selectMaskVal)}changeBruceSize(i){this.photoEditorService.brushSizeDisable=i}onMouseMove(i){0!==this.step&&(super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResult()))}onMouseUp(i){0!==this.step&&(this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),super.onMouseUp(i))}drawOutputImage(i,t){this.baseFilter.image=i,this.baseFilter.previewMode=this.previewMode?1:0,this.baseFilter.invertMask=this.invertMask?1:0,super.drawOutputImage(i,t)}onMouseDown(i){0!==this.step&&(this.step=1,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult())}addFilter(){if(null==this.baseFilter){let i=new ft.Y;
1this.baseFilter=new pe.fabric.Image.filters.CutoutFilter({image:null,adjustment:i.adjustedValues})}super.addFilter()}renderAll(){this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}processResult(){const i=this.actionController.getBrush().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo not available!!")}exitRefine(){const i=this.actionController.getBrush().getMaskMat();this.reloadImage(()=>{const t=this.photoEditorService.originalImage;this.finalMask=this.photoEditorService.upScaleByResizeFilter(t.width,t.height,1,i.image),this.gotoPreview(!0)})}gotoPreview(i=!1,t=!0){t&&(this.photoEditorService.inProgress=!0),this.previewMode=!0,this.drawOutputImage(this.finalMask,this.stateService.mainCanvasNative),this.stateService.mainCanvas.hoverCursor="move",this.selectedOption=null,this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.isExportable=!0,this.unconfigureFabricCanvas();let r=pe.fabric.util.object.clone(this.inputImage),f=pe.fabric.util.object.clone(this.baseFilter);f.previewMode=1,r.filters.push(f),r.applyFilters(),r.lockMovementX=!1,r.lockMovementY=!1,r.hasControls=!0,r.selectable=!0,this.stateService.mainCanvas.selection=!0,this.stateService.mainCanvas.clear();let T=new He(r,this.stateService.mainCanvas,!0);this.photoEditorService.inputImageRefForDownload=r,T.addToCanvas(this.stateService.mainCanvas),this.activeObject=T,this.addBgIfAny(),i&&this.setImgParams(),setTimeout(()=>{this.step=2,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,t&&(this.photoEditorService.inProgress=!1)},100)}addBgIfAny(){this.bg&&(this.bg.color&&this.photoEditorService.changeBgColor(this.bg.color),this.bg.url&&(this.bg.pattern?this.photoEditorService.addPattern({imgUrl:this.bg.url}).then(()=>{}):this.photoEditorService.addBgImage(this.bg.url,this.activeObject,i=>{})))}changeTools(i){"mask"===i.name?this.setMask(i.value):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption),this.actionController.getBrush().selectedOption=i.selectedOption,this.actionController.getBrush().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!i.value,this.processResult(),this.photoEditorService.isDirty=!0):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult(),this.photoEditorService.isDirty=!0)}backToBackground(i){this.bgColorPanelVisible=i}changeScale(i){this.photoEditorService.isDirty=!0}crop(){this.photoEditorService.isDirty=!0,this.activeObject.crop(this.stateService.page)}getImgParams(){let i={scale:this.activeObject.getScale(),angle:this.activeObject.getAngle(),flipX:this.activeObject.getFlipX(),flipY:this.activeObject.getFlipY(),pos:this.activeObject.getPosition()};this.imgParams=i}setImgParams(){this.activeObject.setScale(this.imgParams.scale,!0),this.activeObject.setAngle(this.imgParams.angle,!0),this.imgParams.flipX&&this.activeObject.xFlip(),this.imgParams.flipY&&this.activeObject.yFlip(),this.activeObject.setPosition(this.imgParams.pos)}refineMask(){this.getImgParams();const i=this.photoEditorService.getPhotoEditorInputImages().resolutionMax1080;this.photoEditorService.photoEditorOptions.mask=this.photoEditorService.upScaleByResizeFilter(i.width,i.height,1,this.finalMask),this.refineMaskPanelVisible=!0,this.bgColorPanelVisible=!1,this.step=1,this.isEdit=!0,this.unconfigureFabricCanvas(),this.previewMode=!0,this.photoEditorService.isExportable=!1,this.stateService.mainCanvas.clear(),this.bgColorPanelVisible=!1,this.reloadImage(()=>{this.processResult()},!0,!0)}reset(i=0,t=!1){this.photoEditorService.inProgress=!0,this.actionController.reset(),this.finalMask=null,this.photoEditorService.photoEditorOptions.mask=null,this.unconfigureFabricCanvas(),this.previewMode=!1,this.stateService.mainCanvas.clear(),this.photoEditorService.isCompareEnable=!1,this.invertMask=!1,this.setMask(me.WM),this.bg=null,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.reloadImage(()=>{this.step=i,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=t,this.photoEditorService.inProgress=!1}),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}bgDone(){this.bgColorPanelVisible=!1}applyChanges(i,t=null){this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1;let r=i.image;if(this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),this.bg=null,this.zoomService.fitToScreen(),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(f,r,i.uri,t)}}applyRefineAndCloseDialog(){this.baseFilter.previewMode=1,this.baseFilter.invertMask=0,this.setBruceIcon(0,4),this.inputImage.applyFilters(),this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1,this.photoEditorService.inProgress=!0;let i=this.document.createElement("canvas");this.photoEditorService.getImageFromCanvas2(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,i).then(t=>{const r=new vt.a;r.url=URL.createObjectURL(t),r.mask=this.baseFilter.image,r.blob=t,this.photoEditorService.ph
1otoEditorOptions.activeModal.close(r)})}dismissDialog(){this.photoEditorService.photoEditorOptions.activeModal.dismiss()}loadImageAfterApply(i){this.selectMaskVal=me.WM,this.finalMask=null,this.photoEditorService.photoEditorOptions.mask=null,this.actionController.reset(),this.actionController.delete(),this.actionController=new Si,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.reloadImage(()=>{setTimeout(()=>{this.photoEditorService.inProgress=!1},1e3),this.step=0,this.photoEditorService.imgUrl=i,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.isDirty=!1})}getMaskImageDataFromMaskUrl(i,t=null){if(this.photoEditorService.originalImage&&!this.photoEditorService.inProgress){this.photoEditorService.isCompareEnable=!0,this.removeBgService.closeProgress(),this.photoEditorService.inProgress=!0;const r=this.route.snapshot.queryParamMap.get("bgColor"),f=this.route.snapshot.queryParamMap.get("bgImg");r&&(this.bg={color:r}),f&&(this.bg={url:f,pattern:f}),setTimeout(()=>{this.removeBgService.getMaskImageDataFromMaskUrl(i,this.photoEditorService.originalImage).then(T=>{this.finalMask=T,this.gotoPreview(),this.photoEditorService.inProgress=!1,this.bgColorPanelVisible=!0,t&&t(),this.photoEditorService.inProgress=!1})},1e3)}}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(vt.r),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(St.M),e.rXU(Z.f))},c.\u0275cmp=e.VBU({type:c,selectors:[["remove-bg-drawer"]],inputs:{isMobileView:"isMobileView"},outputs:{activePaneChange:"activePaneChange"},features:[e.Vt3],decls:2,vars:2,consts:[[4,"ngIf"],[1,"drawer-content"],[1,"scroll-content"],[1,"child-drawer",3,"ngClass"],["class","",4,"ngIf"],["class","h-100",4,"ngIf"],["class","position-absolute fixed-bottom mb-9 ps-3 pe-3",4,"ngIf"],[1,""],[3,"startObjectRembg","theme","inProgress"],[1,"h-100"],[3,"bgChanged","backToBackground","changeScale","bg","activeObject"],[1,"d-flex","align-items-center","common-container","pt-9"],["name","leftarrow","class","back-icon f-24 d-flex align-items-center justify-content-center pointer border-radius-8",3,"click",4,"ngIf"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2",3,"ngClass"],[1,"ps-3","pe-3"],[3,"changeBruceSize","change","tabPane","activePane"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"scroll-content",2,"height","calc(100% - 4rem)"],["customScrollDir","",1,"scroll-container"],[1,"ngb-btn","common-container","p-0","m-0",3,"ngClass"],[1,"d-flex","align-items-center","justify-content-between",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],[1,"btn-all","btn-outline-primary","btn-editor-panel","mb-9","w-100","h-40","border-radius-12","text-13",3,"click"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["ngbAccordionItem","transform-panel-0",1,"tab-div"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],["ngbAccordionItem","cutout-panel-1",1,"tab-div"],[1,"d-flex","align-items-center","wp-100",3,"click"],["name","lineicon","class","f-40",4,"ngIf"],["class","hw-40 btn-bg-preview",3,"ngStyle",4,"ngIf"],["class","position-fixed fixed-bottom mb-9 ps-3 pe-3",4,"ngIf"],[1,"btn-panel"],[1,"common-container","mt-2"],["type","button",1,"btn-all","btn-outline-primary","btn-editor-panel","w-100","h-40","border-radius-12","text-13",3,"click"],[1,"mt-10"],[3,"activeObject","Align","Scale","Rotate","Flip"],["name","lineicon",1,"f-40"],[1,"hw-40","btn-bg-preview",3,"ngStyle"],[1,"position-fixed","fixed-bottom","mb-9","ps-3","pe-3"],["class","d-flex wp-100 justify-content-between",4,"ngIf"],[1,"d-flex","wp-100","justify-content-between"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"],[1,"position-absolute","fixed-bottom","mb-9","ps-3","pe-3"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"],[3,"width","height","mainCanvasWidth"]],template:function(i,t){1&i&&e.DNE(0,Un,12,14,"ng-container",0)(1,Ln,2,3,"ng-container",0),2&i&&(e.Y8G("ngIf",!t.isMobileView),e.R7$(),e.Y8G("ngIf",t.isMobileView))},dependencies:[I.YU,I.bT,I.B3,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,z.wQ,Ei.v,Mo.f,Ce.b,ki,Et,Sn],styles:[".child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}"]}),v})();var Lt=g(89818);const Xi=c=>({"btn-bottom-active":c}),Gn=c=>({"grey-100 expand-input":c});let Vn=(()=>{var c;class v{constructor(i,t){this.zoomService=i,this.zoomGenericService=t,this.files=[],this.viewZo
1om="Fit",this.changeZoom=new e.bkB,this.isButtonFocusedzoomOut=!1,this.isButtonFocusedzoomIn=!1,this.baseSizeOptionList=[{val:3,name:"300%"},{val:2,name:"200%"},{val:1,name:"100%"},{val:.75,name:"75%"},{val:.5,name:"50%"},{val:.25,name:"25%"},{val:.1,name:"10%"},{val:0,name:"Fit"},{val:-1,name:"Fill"}],this.baseZoomVals=[10,20,25,35,50,65,75,90,100,125,150,175,200,250,300],this.sizeOptionList=[...this.baseSizeOptionList],this.zoomVals=[...this.baseZoomVals],this.disabled=!0,this.maxZoomPercent=300,this.zoomVal=this.zoomService.viewZoom}setZoomService(i){this.zoom="NORMAL"===i?this.zoomService:this.zoomGenericService,this.recomputeZoomOptions()}ngOnInit(){this.setZoomService(this._photoEditorType),this.zoomService.zoomDropdownReset.subscribe(i=>{i&&(this.recomputeZoomOptions(),this.resetZoomSelect())}),this.zoomValueSub=this.zoomService.zoomValue$.subscribe(()=>{this.selectZoomVal=-2}),this.maxScaleSub=this.zoomService.maxScaleChanged.subscribe(()=>{this.recomputeZoomOptions()}),this.recomputeZoomOptions()}ngOnDestroy(){this.zoomValueSub?.unsubscribe(),this.maxScaleSub?.unsubscribe()}onZoomSizeChange(){this.changeZoom.emit(this.selectZoomVal)}zoomIn(){this.selectZoomVal=-2,this.zoomVal=this.zoom.viewZoom;let i=this.getNextZoomVal(this.zoomVal);this.changeZoom.emit(i/100)}zoomOut(){this.selectZoomVal=-2,this.zoomVal=this.zoom.viewZoom;let i=this.getPrevZoomVal(this.zoomVal);this.changeZoom.emit(i/100)}getPrevZoomVal(i){let t;for(let r=this.zoomVals.length;r>-1;r--)if(i>this.zoomVals[r]){t=this.zoomVals[r];break}return t||(t=this.zoomVals[0]),t}getNextZoomVal(i){let t;for(let r=0;r<this.zoomVals.length;r++)if(i<this.zoomVals[r]){t=this.zoomVals[r];break}return t||(t=this.zoomVals[this.zoomVals.length]),t}mouseupzoomOut(){setTimeout(()=>{this.isButtonFocusedzoomOut=!1})}mouseupzoomIn(){setTimeout(()=>{this.isButtonFocusedzoomIn=!1})}resetZoomSelect(){this.selectZoomVal=0}recomputeZoomOptions(){const i=this.zoomService&&this.zoomService.maxScale?this.zoomService.maxScale:3,t=Math.floor(100*i);this.maxZoomPercent=t,this.sizeOptionList=this.baseSizeOptionList.filter(r=>r.val<=0||r.val<=i+1e-6),this.zoomVals=this.baseZoomVals.filter(r=>r<=t),0===this.zoomVals.length&&(this.zoomVals=[10]),"number"==typeof this.selectZoomVal&&this.selectZoomVal>0&&100*this.selectZoomVal>t&&this.resetZoomSelect()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(A.n),e.rXU(k.u))},c.\u0275cmp=e.VBU({type:c,selectors:[["zoom-select"]],inputs:{accept:"accept",_photoEditorType:"_photoEditorType",selectedToolName:"selectedToolName"},outputs:{changeZoom:"changeZoom"},decls:8,vars:17,consts:[[1,"zoom-ctrl"],["color","primary","placement","top","ngbTooltip","Zoom Out","triggers","mouseenter:mouseleave","tooltipClass","tooltip-custom-all",1,"btn-all","btn-bottom","mr-8",3,"click","mousedown","mouseup","disabled","ngClass"],["name","zoomoutnew",1,"f-24"],[1,"zoom-size"],["type","text","disabled","","suffix","%","mask","9999",1,"zoom-input",3,"ngModelChange","ngModel","ngClass"],["bindLabel","name","bindValue","val",1,"select-menu",3,"ngModelChange","change","disabled","items","ngModel","searchable","clearable"],["color","primary","placement","top","ngbTooltip","Zoom In","tooltipClass","tooltip-custom-all","triggers","mouseenter:mouseleave",1,"btn-all","btn-bottom","ml-8",3,"click","mousedown","mouseup","disabled","ngClass"],["name","zoominnew",1,"f-24"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"button",1),e.bIt("click",function(){return t.zoomOut()})("mousedown",function(){return t.isButtonFocusedzoomOut=!0})("mouseup",function(){return t.mouseupzoomOut()}),e.nrm(2,"pi",2),e.k0s(),e.j41(3,"div",3)(4,"input",4),e.mxI("ngModelChange",function(f){return e.DH7(t.zoom.viewZoom,f)||(t.zoom.viewZoom=f),f}),e.k0s(),e.j41(5,"ng-select",5),e.mxI("ngModelChange",function(f){return e.DH7(t.selectZoomVal,f)||(t.selectZoomVal=f),f}),e.bIt("change",function(){return t.onZoomSizeChange()}),e.k0s()(),e.j41(6,"button",6),e.bIt("click",function(){return t.zoomIn()})("mousedown",function(){return t.isButtonFocusedzoomIn=!0})("mouseup",function(){return t.mouseupzoomIn()}),e.nrm(7,"pi",7),e.k0s()()),2&i&&(e.R7$(),e.Y8G("disabled",10===t.zoom.viewZoom||"EXPAND"===t._photoEditorType||"BODY_RETOUCH"===t.selectedToolName)("ngClass",e.eq3(11,Xi,t.isButtonFocusedzoomOut)),e.R7$(3),e.R50("ngModel",t.zoom.viewZoom),e.Y8G("ngClass",e.eq3(13,Gn,"EXPAND"==t._photoEditorType||"BODY_RETOUCH"===t.selectedToolName)),e.R7$(),e.Y8G("disabled","EXPAND"===t._photoEditorType||"BODY_RETOUCH"===t.selectedToolName)("items",t.sizeOptionList),e.R50("ngModel",t.selectZoomVal),e.Y8G("searchable",!1)("clearable",!1),e.R7$(),e.Y8G("disabled",t.zoom.viewZoom===t.maxZoomPercent||"EXPAND"===t._photoEditorType||"BODY_RETOUCH"===t.selectedToolName)("ngClass",e.eq3(15,Xi,t.isButtonFocusedzoomIn)))},dependencies:[I.YU,Y.md,we.me,we.BC,we.vS,Lt.vr,pt.Zr,Ce.b],styles:[".zoom-input[_ngcontent-%COMP%]{width:70%;position:absolute;height:80%;border:none;padding-left:15px;background:#f8f8fb;margin:3px;border-radius:4px}.zoom-size[_ngcontent-%COMP%]{position:relative}.zoom-ctrl[_ngcontent-%COMP%]{display:flex}.btn-bottom[_ngcontent-%COMP%]{width:40px;height:40px;padding:0rem;border-radius:12px;background:transparent}.btn-bottom[_ngcontent-%COMP%]:hover{background:#626adf0d}.btn-bottom[_ngcontent-%COMP%]:focus-visible{outline:none}.btn-bottom-active[_ngcontent-%COMP%]{background:#626adf1a!important}.btn-bottom[_ngcontent-%COMP%]:disabled{background:transparent!important;color:#b0b3bf;opacity:.3;cursor:text}.btn-bottom[_ngcontent-%COMP%]:disabled:hover{background:transparent!important}"]}),v})();var Xn=g(549),zn=g(32970);class Nt{constructor(){this.undoSteps=[],this.redoSteps=[],this.undoStepcount=20,this.adjustment=new ft.Y,this.adjustment.imageAdjust.exposure=.5,this.adjustment.adjustedValues.exposure=.5}reset(){this.undoSteps.length=0,this.redoSteps.length=0,this.adjustment.init(),this.brush&&this.brush.reset()}getImageAdjust(){return this.adjustment.imageAdjust}getAdjustedValues(){return this.adjustment.adjustedValues}createSplash(v,s,i,t){null==this.brush&&(this.brush=new zn.Z(v,s.data,i,t))}isUndoModeAvailable(){return this.undoSteps.length>0}isRedoModeAvailable(){return this.redoSteps.length>0}undo(){if(this.isUndoModeAvailable()){let v=this.undoSteps.pop();
1v.undoType==me.l3.ERASE?(this.brush.undo(),this.redoSteps.length>=this.undoStepcount&&(this.undoSteps=[],this.brush.undo()),this.redoSteps.push(v)):(this.createAdjustmentRedoState(),this.adjustment.setImageAdjust(v.model))}}redo(){if(this.isRedoModeAvailable()){let v=this.redoSteps.pop();v.undoType==me.l3.ERASE?(this.brush.redo(),this.undoSteps.push(v)):(this.createAdjustmentUndoState(!1),this.adjustment.setImageAdjust(v.model))}}getSplash(){return this.brush}onMouseUp(){this.brush.onMouseUp(),this.createUndoState(me.l3.ERASE,null)}createUndoState(v,s){let i=new it.cB;i.model=s,i.undoType=v,this.undoSteps.push(i),this.redoSteps.length=0}createAdjustmentUndoState(v){let s=new it.cB;s.model=this.adjustment.copy(this.adjustment.imageAdjust),s.undoType=me.l3.ADJUST,this.undoSteps.push(s),v&&(this.redoSteps.length=0)}createAdjustmentRedoState(){let v=new it.cB;v.model=this.adjustment.copy(this.adjustment.imageAdjust),v.undoType=me.l3.ADJUST,this.redoSteps.push(v)}addPoint(v,s){this.brush.addPoint(v,s)}updateBrightness(v,s){this.adjustment.updateBrightness(v)}updateContrast(v,s){this.adjustment.updateContrast(v)}updateExposure(v,s){this.adjustment.updateExposure(v)}updateBlur(v,s){this.adjustment.updateBlur(v)}updateGamma(v,s){this.adjustment.updateGamma(v)}updateHue(v,s){this.adjustment.updateHue(v)}updateSaturation(v,s){this.adjustment.updateSaturation(v)}updateTemperature(v,s){this.adjustment.updateTemperature(v)}updateTint(v,s){this.adjustment.updateTint(v)}updateRed(v,s){this.adjustment.updateRed(v)}updateBlue(v,s){this.adjustment.updateBlue(v)}updateGreen(v,s){this.adjustment.updateGreen(v)}updateShadows(v,s){this.adjustment.updateShadows(v)}updateHighlights(v,s){this.adjustment.updateHighlights(v)}updateIntensity(v,s){this.adjustment.updateIntensity(v)}updateHueIntensity(v,s){this.adjustment.updateHueIntensity(v)}setRedControlPoints(v){this.adjustment.setRedControlPoints(v)}delete(){this.brush&&this.brush.delete()}getAdjustment(){return this.adjustment}}g(54777);var Ii=g(93226),Mt=g(20753);function Wn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",6)(1,"div",0)(2,"label",7),e.EFF(3,"Contrast"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputContrast(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeContrast(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeContrast(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.contrast)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.contrast)}}function Yn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Brightness"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputBrightness(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBrightness(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBrightness(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.brightness)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.brightness)}}function $n(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Exposure"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputExposure(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeExposure(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeExposure(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.exposure)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.exposure)}}function Hn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Highlights"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputHighlights(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeHighlights(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeHighlights(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.highlights)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.highlights)}}function Kn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Shadows"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputShadows(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeShadows(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeShadows(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.shadows)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.shadows)}}function Zn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",6)(1,"div",0)(2,"label",7),e.EFF(3,"Hue"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputHue(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeHue(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeHue(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.hue)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.hue)}}function Qn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Saturation"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",14),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputSaturation(t))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeSaturation(t,!0))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeSaturation(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.saturation)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.saturation)}}function Jn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",6)(1,"div",0)(2,"label",7),e.EFF(3,"Temperature"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputTemperature(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTemperature(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTemperature(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.temperature)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.temperature)}}function qn(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Tint"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",14),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputTint(t))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTint(t,!0))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTint(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.tint)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.tint)}}function es(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",6)(1,"div",0)(2,"label",7),e.EFF(3,"Red"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputRed(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeRed(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeRed(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.red)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.red)}}function ts(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Green"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputGreen(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeGreen(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeGreen(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.green)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.green)}}function is(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",0)(2,"label",7),e.EFF(3,"Blue"),e.k0s()(),e.j41(4,"div",8)(5,"div",9)(6,"mv-slider",10),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputBlue(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBlue(t,!0))})("slideStart",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlideStart(t))}),e.k0s()(),e.j41(7,"div",11)(8,"input",12),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBlue(t,!1))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("value",s.colorService.blue)("min",-100)("max",100)("step",1),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.colorService.blue)}}let zi=(()=>{var c;class v{constructor(i){this.colorService=i,this.onChange=new e.bkB,this.onSlide=new e.bkB}ngOnInit(){this.initialized=!0}emitChange(){this.onChange.emit(!0)}inputBrightness(i){this.changeBrightness(i.newValue,!0)}inputContrast(i){this.changeContrast(i.newValue,!0)}inputExposure(i){this.changeExposure(i.newValue,!0)}inputHue(i){this.changeHue(i.newValue,!0)}inputSaturation(i){this.changeSaturation(i.newValue,!0)}inputRed(i){this.changeRed(i.newValue,!0)}inputGreen(i){this.changeGreen(i.newValue,!0)}inputBlue(i){this.changeBlue(i.newValue,!0)}inputTemperature(i){this.changeTemperature(i.newValue,!0)}inputTint(i){this.changeTint(i.newValue,!0)}inputShadows(i){this.changeShadows(i.newValue,!0)}inputHighlights(i){this.changeHighlights(i.newValue,!0)}changeBrightness(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeBrightness(i,t),this.emitChange())}changeContrast(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeContrast(i,t),this.emitChange())}changeExposure(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeExposure(i,t),this.emitChange())}changeHue(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeHue(i,t),this.emitChange())}changeSaturation(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeSaturation(i,t),this.emitChange())}changeRed(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeRed(i,t),this.emitChange())}changeGreen(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeGreen(i,t),this.emitChange())}changeBlue(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeBlue(i,t),this.emitChange())}changeTemperature(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeTemperature(i,t),this.emitChange())}changeTint(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeTint(i,t),this.emitChange())}changeShadows(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeShadows(i,t),this.emitChange())}changeHighlights(i,t){(i=t?i:i.target.value)<101&&i>-101&&(t||this.onSlide.emit(!0),this.colorService.changeHighlights(i,t),this.emitChange())}onSlideStart(i){this.onSlide.emit(!0)}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(Ii.n))},c.\u0275cmp=e.VBU({type:c,selectors:[["adjustment-change-color"]],outputs:{onChange:"onChange",onSlide:"onSlide"},decls:28,vars:12,consts:[[1,"col-sm-3","p-0"],[1,"card-subtitle","text-semi","m-0"],["class","wp-100 align-items-center mt-10",4,"ngIf"],["class","wp-100 align-items-center mt-9",4,"ngIf"],[1,"mt-10"],[1,"col-sm-8","p-0"],[1,"wp-100","align-items-center","mt-10"],[1,"card-subtitle","m-0"],[1,"d-flex","align-items-center","justify-content-between"],[1,"col-sm-9","p-0"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","slideStart","value","min","max","step"],[1,"col-sm-2","p-0"],["type","text","numberSettings","",1,"form-control","form-input-sm","text-normal","text-black","float-end",3,"change","min","max","ngModel"],[1,"wp-100","align-items-center","mt-9"],[1,"opacity-slider",2,"width","100%",3,"change","slideStart","slideStop","value","min","max","step"]],template:function(i,t){1&i&&(e.j41(0,"div")(1,"div",0)(2,"label",1),e.EFF(3,"Light"),e.k0s()(),e.DNE(4,Wn,9,7,"div",2)(5,Yn,9,7,"div",3)(6,$n,9,7,"div",3)(7,Hn,9,7,"div",3)(8,Kn,9,7,"div",3),e.k0s(),e.j41(9,"div",4)(10,"div",0)(11,"label",1),e.EFF(12,"Color"),e.k0s()(),e.DNE(13,Zn,9,7,"div",2)(14,Qn,9,7,"div",3),e.k0s(),e.j41(15,"div",4)(16,"div",5)(17,"label",1),e.EFF(18,"White Balance"),e.k0s()(),e.DNE(19,Jn,9,7,"div",2)(20,qn,9,7,"div",3),e.k0s(),e.j41(21,"div",4)(22,"div",0)(23,"label",1),e.EFF(24,"Gamma"),e.k0s()(),e.DNE(25,es,9,7,"div",2)(26,ts,9,7,"div",3)(27,is,9,7,"div",3),e.k0s()),2&i&&(e.R7$(4),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(5),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(5),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(5),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized),e.R7$(),e.Y8G("ngIf",t.initialized))},dependencies:[I.bT,we.me,we.BC,we.vS,Mt.I,qe.d1],styles:["label[_ngcontent-%COMP%]{font-size:14px;color:#272b34}"]}),v})();const Wi=c=>({"drawer-active":c});function os(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",8)(1,"div",9)(2,"div",10)(3,"pi",11),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.back())}),e.k0s(),e.j41(4,"span",12),e.EFF(5,"Change Color"),e.k0s()(),e.j41(6,"pi",13),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(7,"div",14)(8,"div",15)(9,"video",16),e.nrm(10,"source",17),e.EFF(11," Your browser does not support the video tag. "),e.k0s()(),e.j41(12,"div",18)(13,"p",19),e.EFF(14,"Select an area over canvas where you want to change the color. "),e.k0s()()()()}2&c&&(e.R7$(9),e.Y8G("muted","muted"))}function ns(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",37)(1,"refine-mask-edit-tools",38),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeTools(t))
1}),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("tabPane",s.tabPane)("activePane",s.selectMaskVal)("showMaskVisible",s.showMaskVisible)}}function ss(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",39)(1,"div",40)(2,"a",41),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.resetAll())}),e.EFF(3,"Reset all"),e.k0s()(),e.j41(4,"adjustment-change-color",42),e.bIt("onChange",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.renderAll())})("onSlide",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onSlideStart(t))}),e.k0s()()}}function rs(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",20)(1,"div",21)(2,"span",22),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.step=1)}),e.EFF(3,"Change Color"),e.k0s(),e.j41(4,"pi",13),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(5,"div",8)(6,"div",23)(7,"div",24,0)(9,"div",25)(10,"div",26)(11,"button",27)(12,"div",28),e.EFF(13,"Selection Tool"),e.k0s()(),e.j41(14,"button",29)(15,"span",30),e.nrm(16,"pi",31),e.k0s(),e.j41(17,"span",32),e.nrm(18,"pi",33),e.k0s()()()(),e.j41(19,"div",34)(20,"div",35),e.DNE(21,ns,2,3,"ng-template"),e.k0s()()(),e.j41(22,"div",36)(23,"div",25)(24,"div",26)(25,"button",27)(26,"div",28),e.EFF(27,"Adjustment"),e.k0s()(),e.j41(28,"button",29)(29,"span",30),e.nrm(30,"pi",31),e.k0s(),e.j41(31,"span",32),e.nrm(32,"pi",33),e.k0s()()()(),e.j41(33,"div",34)(34,"div",35),e.DNE(35,ss,5,0,"ng-template"),e.k0s()()()()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("closeOthers",!0)("destroyOnHide",!0),e.R7$(),e.Y8G("collapsed",!1),e.R7$(15),e.Y8G("disabled",!s.isSelected)}}function as(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",45)(1,"button",46),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.cancel())}),e.EFF(2,"Cancel"),e.k0s(),e.j41(3,"button",47),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.apply())}),e.EFF(4,"Apply"),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("disabled",s.photoEditorService.inProgress),e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress)}}function ls(c,v){if(1&c&&(e.j41(0,"div",43),e.DNE(1,as,5,2,"div",44),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.Y8G("ngIf",s.isApply&&1===s.step)}}let cs=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se){super(r,f,T,N,se),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.changeColorService=q,this.document=ne,this.route=se,this.selectMaskVal=me.Uq,this.isEdit=!1,this.isApply=!0,this.step=0,this.tabPane="splash",this.previewMode=!1,this.f=pe.fabric.Image.filters,this.invertMask=!1,this.showMaskVisible=!1,this.restAndApplyEvent=new e.bkB,this.brushSize=0,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ae=>{ae&&(this.photoEditorService.isLoaded=!1,this.actionController.reset(),this.actionController.delete(),this.photoEditorService.checkProjectName(!0),this.actionController=new Nt,this.actionController&&(this.actionController.undoStepcount=19),this.changeColorService.setActionController(this.actionController),this.photoEditorService.isDirty=!1,this.resetAll(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init()},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(ae=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnChanges(){}ngOnInit(){this.photoEditorService.toolNameForDownload="splash",this.actionController||(this.actionController=new Nt,this.changeColorService.setActionController(this.actionController)),this.updateAdjustmentValues(),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.processResult(),this.step=0,this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.photoEditorService.isExportable=!1})):this.init(),this.onInit(),this.initialized=!0}afterImageLoad(i){this.resolvedModule=i.module,this.actionController.createSplash(this.resolvedModule,i.imageData,i.imageData.width,i.imageData.height),this.initialized=!0,this.setMask(me.Uq),this.processResult()}changeBruceSize(i){this.photoEditorService.brushSizeDisable=i,this.showBrushSizePreview(i)}changeTools(i){"mask"===i.name?(this.selectedOption=i.selectedOption,this.setMask(i.value)):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption),this.actionController.getSplash().selectedOption=i.selectedOption,this.actionController.getSplash().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!!i.value,this.processResult()):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult())}setMask(i){this.selectMaskVal=i,this.actionController.getSplash().setSelectedOption(this.selectMaskVal);let t=this.isPathMode();this.checkAndEnableDrawingMode(t,this.selectMaskVal)}onMouseMove(i){super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResultOnMove())}onMouseUp(i){if(this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}super.onMouseUp(i)}isPathMode(){return this.actionController.getSplash().isPathMode()}drawOutputImage(i,t){this.baseFilter.image=i,this.baseFilter.previewMode=this.previewMode?1:0,this.baseFilter.invertMask=this.invertMask?1:0,super.drawOutputImage(i,t)}onMouseDown(i){this.step=1,this.isSelected=!0,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.isCompareEnable=!0,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult()}addFilter(){null==this.baseFilter&&(this.baseFilter=new this.f.Adjustment({image:null,adjustment:this.actionController.getAdjustedValues(),adztOn:"1.0"})),this.baseFilter.adjustment=this.actionController.getAdjustedValues(),super.addFilter()}renderAll(){this.inputImage&&this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}processResult(){const i=this.actionController.getSplash().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){if(this.shouldRender(this.isPathMode())){const i=this.actionController.getSplash().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}this.index++}processResultOnPreview(){const i=this.actionController.getSplash().getOriginalProcessedMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}gotoPreview(){this.step=2,this.previewMode=!this.previewMode,this.processResult(),setTimeout(()=>{this.photoEditorService.isDirty=!0},100)}editCutout(){this.step=1,this.isEdit=!0,this.previewMode=!this.previewMode,this.processResult()}updateAdjustmentValues(){this.changeColorService.updateAdjustmentValues()}onSlideStart(i){this.actionController.createAdjustmentUndoState(!0)}resetAll(){this.changeColorService.resetAll(()=>{this.renderAll()})}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo n
1ot available!!")}cancel(i=!1){this.isSelected=!1,this.actionController.reset(),this.unconfigureFabricCanvas(),this.resetAll(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.setMask(me.Uq),this.reloadImage(()=>{this.processResult(),this.step=0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=i,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.inProgress=!1,this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()})}applyChanges(i,t=null){this.photoEditorService.imgUrl=i.uri,this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1;let r=i.image;if(this.photoEditorService.originalImage=r,this.cancel(!0),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this.photoEditorService.isCompareEnable=!1,this._saveImage(f,r,i.uri,t)}}gotoVedioPreview(){this.photoEditorService.openVedio(w.b.tutorials.splash)}back(){this.photoEditorService.inProgress||this.restAndApplyEvent.emit()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(Ii.n),e.rXU(I.qQ),e.rXU(z.nX))},c.\u0275cmp=e.VBU({type:c,selectors:[["splash-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Vt3,e.OA$],decls:9,vars:9,consts:[["accItem","ngbAccordionItem"],[1,"drawer-content"],[1,"scroll-content",2,"height","calc(100% - 60px)"],[1,"child-drawer",3,"ngClass"],["class","",4,"ngIf"],["customScrollDir","",1,"drawer-scroll","scroll-container"],["class","ngb-btn common-container p-0 m-0",4,"ngIf"],["class","position-fixed fixed-bottom mb-9 ps-3 pe-3",4,"ngIf"],[1,""],[1,"d-flex","align-items-center","justify-content-between","common-container",2,"min-height","56px"],[1,"d-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8","pointer",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"f-32",2,"cursor","pointer",3,"click"],[1,"common-container"],[1,"d-flex","flex-column","text-center"],["autoplay","","loop","",2,"border-radius","12px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/color_splash.mp4","type","video/mp4"],[1,"simple-text","d-flex","flex-column","mt-2"],[1,"text-14","text-regular","grey-800","mb-0"],[1,"ngb-btn","common-container","p-0","m-0"],[1,"d-flex","align-items-center","justify-content-between","w-100",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125",3,"click"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["ngbAccordionItem","cutout-panel-0",1,"tab-div",3,"collapsed"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100","h-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],["ngbAccordionItem","cutout-panel-1",1,"tab-div",3,"disabled"],[1,"pt-1","ps-3","pe-3"],[3,"changeBruceSize","change","tabPane","activePane","showMaskVisible"],[1,"p-3"],[1,"w-100","d-flex","justify-content-end"],[1,"reset-all",3,"click"],[3,"onChange","onSlide"],[1,"position-fixed","fixed-bottom","mb-9","ps-3","pe-3"],["class","d-flex wp-100 justify-content-between",4,"ngIf"],[1,"d-flex","wp-100","justify-content-between"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"]],template:function(i,t){1&i&&(e.j41(0,"div",1)(1,"div")(2,"div",2)(3,"div",3),e.DNE(4,os,15,1,"div",4),e.k0s(),e.j41(5,"div",3)(6,"div",5),e.DNE(7,rs,36,4,"div",6),e.k0s()()()(),e.DNE(8,ls,2,1,"div",7),e.k0s()),2&i&&(e.R7$(3),e.Y8G("ngClass",e.eq3(5,Wi,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(7,Wi,1==t.step)),e.R7$(2),e.Y8G("ngIf",1==t.step),e.R7$(),e.Y8G("ngIf",1==t.step&&t.isSelected))},dependencies:[I.YU,I.bT,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,z.wQ,Ce.b,zi,Et],styles:[".reset-all[_ng
1content-%COMP%]{float:right;color:#626adf;font-size:12px;cursor:pointer;font-weight:600}.card-subtitle[_ngcontent-%COMP%]{font-size:14px;color:#272b34}.child-drawer[_ngcontent-%COMP%]{position:relative!important;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}"]}),v})();const Mi=c=>({"drawer-active":c}),hs=(c,v)=>({"background-image":c,"background-color":v});function ds(c,v){1&c&&e.nrm(0,"div",6)}function ps(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",6)(1,"div",7)(2,"div",8)(3,"pi",9),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.k0s(),e.j41(4,"span",10),e.EFF(5,"Cutout image"),e.k0s(),e.j41(6,"pi",11),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(7,"div",12)(8,"div",13)(9,"video",14),e.nrm(10,"source",15),e.EFF(11," Your browser does not support the video tag. "),e.k0s()(),e.j41(12,"div",16)(13,"p",17),e.EFF(14,"Select an area over canvas which you want to keep."),e.k0s()()()()()}2&c&&(e.R7$(9),e.Y8G("muted","muted"))}function us(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",23)(1,"span",24),e.EFF(2,"Cutout image"),e.k0s(),e.j41(3,"pi",25),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.gotoVedioPreview())}),e.k0s()()}}function ms(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",26)(2,"pi",9),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.exitRefine(!0))}),e.k0s(),e.j41(3,"span",10),e.EFF(4,"Edit Cutout"),e.k0s()(),e.bVm()}}function gs(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",27)(1,"div",28)(2,"button",29),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",30),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.exitRefine())}),e.EFF(5,"Next"),e.k0s()()()}}function _s(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",18)(2,"div",7),e.DNE(3,us,4,0,"div",19)(4,ms,5,0,"ng-container",4),e.j41(5,"div",20)(6,"refine-mask-edit-tools",21),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTools(t))}),e.k0s()()()(),e.DNE(7,gs,6,0,"div",22),e.bVm()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",!s.isEdit),e.R7$(),e.Y8G("ngIf",s.isEdit),e.R7$(2),e.Y8G("showmask",!0)("tabPane",s.tabPane)("activePane",s.selectMaskVal),e.R7$(),e.Y8G("ngIf",1==s.step&&!s.isEdit)}}function fs(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",51)(1,"div",52)(2,"button",53),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.crop())}),e.EFF(3,"Crop"),e.k0s(),e.j41(4,"div",54),e.nrm(5,"adjust-tool",55),e.k0s()()()}if(2&c){const s=e.XpG(2);e.R7$(5),e.Y8G("activeObject",s.activeObject)("Align",!1)("Scale",!0)("Rotate",!0)("Flip",!0)}}function vs(c,v){1&c&&e.nrm(0,"pi",56)}function bs(c,v){if(1&c&&e.nrm(0,"div",57),2&c){const s=e.XpG(2);e.Y8G("ngStyle",e.l_i(1,hs,s.bg.url?"url("+s.bg.url+")":"none",s.bg.color?s.bg.color:"none"))}}function Cs(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",28)(1,"button",59),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.cancel())}),e.EFF(2,"Cancel"),e.k0s(),e.j41(3,"button",60),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.apply(!1))}),e.EFF(4,"Apply"),e.k0s()()}if(2&c){const s=e.XpG(3);e.R7$(),e.Y8G("disabled",s.photoEditorService.inProgress),e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress)}}function xs(c,v){if(1&c&&(e.j41(0,"div",27),e.DNE(1,Cs,5,2,"div",58),e.k0s()),2&c){const s=e.XpG(2);e.R7$(),e.Y8G("ngIf",!s.bgColorPanelVisible)}}function Ss(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",18)(2,"div",7)(3,"div",31)(4,"div",32)(5,"span",24),e.EFF(6,"Cutout image"),e.k0s(),e.j41(7,"pi",25),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(8,"button",33),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.editCutout())}),e.EFF(9,"Edit Cutout"),e.k0s(),e.j41(10,"div",34)(11,"div",35),e.bIt("shown",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activeAccPanelId="transform-panel-0")})("hidden",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activeAccPanelId="")}),e.j41(12,"div",36)(13,"div",37)(14,"button",38)(15,"div",39),e.EFF(16,"Transform"),e.k0s()(),e.j41(17,"button",40)(18,"span",41),e.nrm(19,"pi",42),e.k0s(),e.j41(20,"span",43),e.nrm(21,"pi",44),e.k0s()()()(),e.j41(22,"div",45)(23,"div",46),e.DNE(24,fs,6,5,"ng-template"),e.k0s()()(),e.j41(25,"div",47),e.bIt("shown",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activeAccPanelId="cutout-panel-1")})("hidden",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.activeAccPanelId="")}),e.j41(26,"div",36)(27,"div",48),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.bgColorPanelVisible=!0)}
1),e.j41(28,"button",38)(29,"h5",39),e.EFF(30,"Background"),e.k0s()(),e.j41(31,"button",40),e.DNE(32,vs,1,0,"pi",49)(33,bs,1,4,"div",50),e.k0s()()()()()()()(),e.DNE(34,xs,2,1,"div",22),e.bVm()}if(2&c){const s=e.XpG();e.R7$(10),e.Y8G("closeOthers",!0)("destroyOnHide",!0),e.R7$(),e.Y8G("collapsed","transform-panel-0"!==s.activeAccPanelId),e.R7$(14),e.Y8G("collapsed","cutout-panel-1"!==s.activeAccPanelId),e.R7$(7),e.Y8G("ngIf",!s.bg),e.R7$(),e.Y8G("ngIf",s.bg),e.R7$(),e.Y8G("ngIf",2==s.step)}}function Es(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",61)(1,"background-drawer",62),e.bIt("bgChanged",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.bgChangedhandler(t))})("backToBackground",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.backToBackground(t))})("changeScale",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeScale(t))}),e.k0s()()}if(2&c){const s=e.XpG();e.R7$(),e.Y8G("bg",s.bg)("activeObject",s.activeObject)}}let ys=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne){super(r,f,T,N,H,"cutout"),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.route=H,this.uploadImageService=q,this.document=ne,this.imgParams={},this.uplodedAssets=[],this.selectMaskVal=me.Uq,this.isEdit=!1,this.isApply=!1,this.isUploadedImageProgress=!1,this.step=0,this.tabPane="cutout",this.bgColorPanelVisible=!1,this.isDataLimit=!1,this.previewMode=!1,this.invertMask=!1,this.f=pe.fabric.Image.filters,this.isVedio=!1,this.VedioPreview=new e.bkB,this.activeAccPanelId="",this.restAndApplyEvent=new e.bkB,this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota),this.authService.usrPropChanged.subscribe(se=>{this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota)}),this.loggedInObserver=this.authService.loggedIn.subscribe(se=>{this.user=this.authService.currentUser()}),this.photoEditorService.isExportable=!1,this.photoEditorService.checkProjectName(),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(se=>{se&&(this.photoEditorService.isLoaded=!1,this.actionController.reset(),this.actionController.delete(),this.photoEditorService.checkProjectName(!0),this.actionController=new it.ZX,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.bgColorPanelVisible=!1,this.stateService.mainCanvas.clear(),this.step=0,this.isEdit=!1,this.bg=null,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.init(null,!0))})}changeScale(i){}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),new Object,this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}accPanelChanged(i){"transform-panel-0"===i.panelId&&(this.activeAccPanelId=i.nextState?i.panelId:"null")}clear(){}bgChangedhandler(i){this.bg=i}ngOnChanges(){}ngOnInit(){this.photoEditorService.toolNameForDownload="cutout",this.actionController||(this.actionController=new it.ZX),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.processResult(),this.step=0,this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1},!0,!0)):(this.bg=null,this.init(null,!0)),this.onInit()}afterImageLoad(i){this.photoEditorService.photoEditorOptions.mask=null,this.resolvedModule=i.module,this.actionController.createCutout(this.resolvedModule,i.imageData,i.imageData.width,i.imageData.height),this.setMask(me.Uq),this.processResult()}changeBruceSize(i){this.photoEditorService.brushSizeDisable=i}changeTools(i){"mask"===i.name?(this.selectedOption=i.selectedOption,this.setMask(i.value)):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption),this.actionController.getCutout().selectedOption=i.selectedOption,this.actionController.getCutout().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!i.value,this.processResult()):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult())}setMask(i){this.selectMaskVal=i,this.actionController.getCutout().setSelectedOption(this.selectMaskVal);let t=this.isPathMode();this.checkAndEnableDrawingMode(t,this.selectMaskVal)}
1backToBackground(i){this.bgColorPanelVisible=i}onMouseMove(i){super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResultOnMove())}onMouseUp(i){if(this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),super.onMouseUp(i)}isPathMode(){return this.actionController.getCutout().isPathMode()}drawOutputImage(i,t){this.baseFilter.image=i,this.baseFilter.previewMode=this.previewMode?1:0,this.baseFilter.invertMask=this.invertMask?1:0,super.drawOutputImage(i,t)}onMouseDown(i){this.step=1,this.photoEditorService.isDirty=!0,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult()}addFilter(){if(null==this.baseFilter){let i=new ft.Y;this.baseFilter=new this.f.CutoutFilter({image:null,adjustment:i.adjustedValues})}super.addFilter()}renderAll(){this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}processResultOnPreview(){const i=this.actionController.getCutout().getOriginalProcessedMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResult(){const i=this.actionController.getCutout().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){if(this.shouldRender(this.isPathMode())){const i=this.actionController.getCutout().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}this.index++}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo not available!!")}gotoVedioPreview(){this.photoEditorService.openVedio(w.b.tutorials.cutout)}closevedio(i){this.isVedio=!1}exitRefine(i=!1){const t=this.actionController.getCutout().getSmoothMaskMat(),r=this.stateService.mainCanvas.getZoom()*this.inputImage.width*this.inputImage.scaleX;this.reloadImage(()=>{const f=this.photoEditorService.originalImage;this.finalMask=this.photoEditorService.upScaleByResizeFilter(f.width,f.height,1,t.image),this.zoomService.set(r/(this.inputImage.width*this.inputImage.scaleX),!1),this.gotoPreview(i)})}gotoPreview(i=!1){if(this.previewMode=!0,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.selectedOption=null,2!=this.step){this.drawOutputImage(this.finalMask,this.stateService.mainCanvasNative),this.unconfigureFabricCanvas();let t=pe.fabric.util.object.clone(this.inputImage),r=pe.fabric.util.object.clone(this.baseFilter);r.previewMode=1,t.filters.push(r),t.applyFilters(),t.lockMovementX=!1,t.lockMovementY=!1,t.hasControls=!0,t.selectable=!0,this.stateService.mainCanvas.selection=!0,this.stateService.mainCanvas.clear();let f=new He(t,this.stateService.mainCanvas,!0);this.photoEditorService.inputImageRefForDownload=t,f.addToCanvas(this.stateService.mainCanvas),this.activeObject=f,this.addBgIfAny(),i&&this.setImgParams(),setTimeout(()=>{this.step=2,this.photoEditorService.isDirty=!0,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.isExportable=!0},100)}}isEditValue(){this.photoEditorService.isDirty=!0}addBgIfAny(){this.bg&&(this.bg.color&&this.photoEditorService.changeBgColor(this.bg.color),this.bg.url&&(this.bg.pattern?this.photoEditorService.addPattern({imgUrl:this.bg.url}).then(()=>{}):this.photoEditorService.addBgImage(this.bg.url,this.activeObject,i=>{})))}getImgParams(){let i={scale:this.activeObject.getScale(),angle:this.activeObject.getAngle(),flipX:this.activeObject.getFlipX(),flipY:this.activeObject.getFlipY(),pos:this.activeObject.getPosition()};this.imgParams=i}setImgParams(){this.activeObject.setScale(this.imgParams.scale,!0),this.activeObject.setAngle(this.imgParams.angle,!0),this.imgParams.flipX&&this.activeObject.xFlip(),this.imgParams.flipY&&this.activeObject.yFlip(),this.activeObject.setPosition(this.imgParams.pos)}reset(i=0){this.actionController.reset(),this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.isEdit=!1,this.photoEditorService.isError||this.setMask(me.Uq),this.photoEditorService.projectName=this.photoEditorService.originalProjectName,this.bg=null,this.reloadImage(()=>{this.processResult(),this.step=i,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1})}cancel(){this.reset(),this.restAndApplyEvent.emit(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}editCutout(){this.getImgParams();const i=this.photoEditorService.getPhotoEditorInputImages().resolutionMax1080;
1this.photoEditorService.photoEditorOptions.mask=this.photoEditorService.upScaleByResizeFilter(i.width,i.height,1,this.finalMask),this.step=1,this.isEdit=!0,this.unconfigureFabricCanvas(),this.previewMode=!1,this.stateService.mainCanvas.clear(),this.bgColorPanelVisible=!1;const t=this.stateService.mainCanvas.getZoom()*this.inputImage.width*this.inputImage.scaleX;this.reloadImage(()=>{this.processResult(),this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.zoomService.set(t/(this.inputImage.width*this.inputImage.scaleX),!1)},!0,!0)}bgDone(){this.bgColorPanelVisible=!1}applyChanges(i,t=null){this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1;let r=i.image;if(this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),this.bg=null,t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(f,r,i.uri,t)}}loadImageAfterApply(i){this.actionController.reset(),this.actionController.delete(),this.actionController=new it.ZX,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.reloadImage(()=>{setTimeout(()=>{this.photoEditorService.inProgress=!1,this.restAndApplyEvent.emit(),this.step=0},1e3),this.photoEditorService.imgUrl=i,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.isDirty=!1},!1)}crop(){this.activeObject.crop(this.stateService.page)}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(z.nX),e.rXU(F.A),e.rXU(I.qQ))},c.\u0275cmp=e.VBU({type:c,selectors:[["cutout-drawer"]],outputs:{VedioPreview:"VedioPreview",restAndApplyEvent:"restAndApplyEvent"},features:[e.Vt3,e.OA$],decls:10,vars:14,consts:[[1,"drawer-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Cutout",1,"d-none"],["class","",4,"ngIf"],[1,"child-drawer",3,"ngClass"],[4,"ngIf"],["class","h-full",4,"ngIf"],[1,""],["customScrollDir","",1,"scroll-container"],[1,"d-flex","align-items-center","common-container","p-0","m-0",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"ms-auto","f-32",2,"cursor","pointer",3,"click"],[1,"common-container","p-0","m-0"],[1,"d-flex","flex-column","text-center"],["autoplay","","loop","",2,"border-radius","12px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/cutout_new.mp4","type","video/mp4"],[1,"simple-text","d-flex","flex-column","mt-2"],[1,"text-14","text-regular","grey-800","mb-0"],[1,"scroll-content",2,"height","calc(100% - 4rem)"],["class","d-flex align-items-center justify-content-between common-container p-0 m-0","style","min-height: 56px;",4,"ngIf"],[1,"",2,"margin-top","-8px"],[3,"changeBruceSize","change","showmask","tabPane","activePane"],["class","position-fixed fixed-bottom mb-9 ps-3 pe-3",4,"ngIf"],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"f-32",2,"cursor","pointer",3,"click"],[1,"d-flex","align-items-center",2,"min-height","56px"],[1,"position-fixed","fixed-bottom","mb-9","ps-3","pe-3"],[1,"d-flex","wp-100","justify-content-between"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"],[1,"ngb-btn","common-container","p-0","m-0"],[1,"d-flex","align-items-center","justify-content-between","p-0","m-0",2,"min-height","56px"],[1,"btn-all","btn-outline-primary","btn-editor-panel","mb-9","w-100","h-40","border-radius-12","text-13",3,"click"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["ngbAccordionItem","transform-panel-0",1,"tab-div",3,"shown","hidden","collapsed"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100","h-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],["ngbAccordionItem","cutout-panel-1",1,"tab-div",3,"shown","hidden","collapsed"],[1,"d-flex","align-items-center","wp-100",3,"click"],["name","lineicon","class","f-40",4,"ngIf"],["class","hw-40 btn-bg-preview",3,"ngStyle",4,"ngIf"],[1,"btn-panel"],[1,"common-container","mt-2"],["type","button",1,"btn-all","btn-outline-primary","btn-editor-panel","w-100","h-40","border-radius-12","text-13",3,"click"],[1,"mt-10"],[3,"activeObject","Align","Scale","Rotate","Flip"],["name","lineicon",1,"f-40"],[1,"hw-40","btn-bg-preview",3,"ngStyle"],["class","d-flex wp-100 justify-content-between",4,"ngIf"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"],[1,"h-full"],[3,"bgChanged","backToBackgroun
1d","changeScale","bg","activeObject"]],template:function(i,t){1&i&&(e.j41(0,"div",0),e.nrm(1,"input",1),e.DNE(2,ds,1,0,"div",2),e.j41(3,"div",3),e.DNE(4,ps,15,1,"div",2),e.k0s(),e.j41(5,"div",3),e.DNE(6,_s,8,6,"ng-container",4),e.k0s(),e.j41(7,"div",3),e.DNE(8,Ss,35,7,"ng-container",4),e.k0s(),e.DNE(9,Es,2,2,"div",5),e.k0s()),2&i&&(e.R7$(2),e.Y8G("ngIf",-1==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(8,Mi,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(10,Mi,1==t.step)),e.R7$(),e.Y8G("ngIf",1==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(12,Mi,2==t.step&&!t.bgColorPanelVisible)),e.R7$(),e.Y8G("ngIf",2==t.step&&!t.bgColorPanelVisible),e.R7$(),e.Y8G("ngIf",t.bgColorPanelVisible))},dependencies:[I.YU,I.bT,I.B3,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,z.wQ,Ei.v,Ce.b,ki,Et],styles:[".child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}.h-full[_ngcontent-%COMP%]{height:100%}"]}),v})();g(99486),g(23585),g(42716);class Yi{constructor(v,s,i,t){this.points=new Array,this.DESIRED_SIZE=100,this.image=s,this.module=v,this.width=i,this.height=t,this.zoomFactor=2,this.brushRadius=50,this.edgeStrength=50,this.selectedOption=0,this.api={setBaseImage:v.cwrap("nativeCutoutSetBaseImage","number",["array","number","number"]),getMaskMat:v.cwrap("nativeCutoutGetMaskMat","number",["number"]),getSmoothMaskMat:v.cwrap("nativeCutoutGetSmoothMaskMat","number",["number"]),getOriginalMaskMat:v.cwrap("nativeCutoutGetOriginalMaskMat","number",["number"]),addErasePoint:v.cwrap("nativeCutoutAddErasePoint","",["number","number","number"]),addBrushPoint:v.cwrap("nativeCutoutAddBrushPoint","",["number","number","number"]),addManualErasePoint:v.cwrap("nativeCutoutAddManualErasePoint","",["number","number","number"]),addManualBrushPoint:v.cwrap("nativeCutoutAddManualBrushPoint","",["number","number","number"]),addSmartSelectionPoint:v.cwrap("nativeCutoutAddSmartSelectionPoint","",["number","number","number"]),addAutoCutoutForegroundPoints:v.cwrap("nativeCutoutAddAutoCutoutForegroundPoints","",["number","number","number"]),setBrushSize:v.cwrap("nativeCutoutSetBrushSize","",["number","number","number"]),setEdgeStrength:v.cwrap("nativeCutoutSetEdgeStrength","",["number","number"]),clearSmartSelectionPoint:v.cwrap("nativeCutoutClearSmartSelectionPoint","",["number"]),applyBackgroundPoints:v.cwrap("nativeCutoutApplyBackgroundPoints","",["number"]),applyForegroundPoints:v.cwrap("nativeCutoutApplyForegroundPoints","",["number"]),applyAutoCutoutForegroundPoints:v.cwrap("nativeCutoutApplyAutoCutoutForegroundPoints","",["number"]),isUndoModeAvailable:v.cwrap("nativeCutoutIsUndoModeAvailable","boolean",["number"]),isRedoModeAvailable:v.cwrap("nativeCutoutIsRedoModeAvailable","boolean",["number"]),undo:v.cwrap("nativeCutoutUndoFilter","",["number"]),redo:v.cwrap("nativeCutoutApplyRedoMode","",["number"]),setBrushPointArray:v.cwrap("nativeCutoutSetBrushPointArray","",["number"]),setErasePointArray:v.cwrap("nativeCutoutSetErasePointArray","",["number"]),enableMagicEraseMode:v.cwrap("nativeCutoutEnableMagicEraseMode","",["number"]),enableMagicBrushMode:v.cwrap("nativeCutoutEnableMagicBrushMode","",["number"]),enableManualMode:v.cwrap("nativeCutoutEnableManualMode","",["number"]),setManualBrushPointArray:v.cwrap("nativeCutoutSetManualBrushPointArray","",["number"]),setManualErasePointArray:v.cwrap("nativeCutoutSetManualErasePointArray","",["number"]),delete:v.cwrap("nativeCutoutDelete","",["number"]),reset:v.cwrap("nativeCutoutReset","",["number"]),invert:v.cwrap("nativeCutoutInvertMaskMat","",["number"]),applyFilterOnMask:v.cwrap("nativeApplyFilterOnMask","",["number"])},this.maskWrapper=this.api.setBaseImage(this.image.data,this.width,this.height),this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor),this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20),this.api.addManualErasePoint(this.maskWrapper,0,0),this.api.setManualErasePointArray(this.maskWrapper)}setBrushSize(v){this.selectedOption==me.MY||this.selectedOption==me.WM?(this.edgeStrength=v,this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20)):(this.brushRadius=v,this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor))}isUndoModeAvailable(){return this.api.isUndoModeAvailable(this.maskWrapper)}isRedoModeAvailable(){return this.api.isRedoModeAvailable(this.maskWrapper)}undo(){return this.api.undo(this.maskWrapper)}redo(){return this.api.redo(this.maskWrapper)}enableMagicEraseMode(){return this.api.enableMagicEraseMode(this.maskWrapper)}enableMagicBrushMode(){return this.api.enableMagicBrushMode(this.maskWrapper)}enableManualMode(){return this.api.enableManualMode(this.maskWrapper)}setBrushPointArray(){this.api.setBrushPointArray(this.maskWrapper)}setErasePointArray(){this.api.setErasePointArray(this.maskWrapper)}setManualErasePointArray(){this.api.setManualErasePointArray(this.maskWrapper)}setManualBrushPointArray(){this.api.setManualBrushPointArray(this.maskWrapper)}setSelectedOption(v){this.selectedOption=v,this.selectedOption==me.MY?this.enableMagicEraseMode():this.selectedOption==me.WM?this.enableMagicBrushMode():(this.selectedOption==me.l4||this.selectedOption==me.lh)&&this.enableManualMode()}onMouseDown(v,s){this.points.length=0,this.api.clearSmartSelectionPoint(this.maskWrapper),this.addPoint(v,s)}onMouseMove(v,s){this.addPoint(v,s)}onMouseUp(){this.selectedOption==me.Uq||this.selectedOption==me.e_?this.interpolateAndAddPoints():this.selectedOption==me.MY?this.setErasePointArray():this.selectedOption==me.WM?this.setBrushPointArray():this.selectedOption==me.l4?this.setManualBrushPointArray():this.selectedOption==me.lh&&this.setManualErasePointArray(),this.api.clearSmartSelectionPoint(this.maskWrapper)}interpolateAndAddPoints(){this.points.length<this.DESIRED_SIZE&&this.interpolate();for(let v=0;v<this.points.length;v++)this.api.addSmartSelectionPoint(this.maskWrapper,this.points[v].x,this.points[v].y);this.selectedOption==me.Uq?this.api.applyForegroundPoints(this.maskWrapper):this.selectedOption==me.e_&&this.api.applyBackgroun
1dPoints(this.maskWrapper),this.points.length=0}interpolate(){let v=this.points.length;if(v>0){let s=Math.floor(this.DESIRED_SIZE/v);for(let i=0;i<this.DESIRED_SIZE;i=+i+s+1)this.points.length>i+1&&this.getMorePoints(this.points[i],this.points[i+1],s,i)}}getMorePoints(v,s,i,t){let r=(s.x-v.x)/i,f=(s.y-v.y)/i,T=new Array;if(0==r&&0==f)return T;for(let N=1;N<=i;N++){let q=v.y+f*N,ne=new Le.b(Math.round(100*(v.x+r*N))/100,Math.round(100*q)/100);this.points.splice(t+N,0,ne)}return T}addPoint(v,s){if(-1==this.maskWrapper)throw new Error("Base mask not set..");switch(this.selectedOption){case me.WM:this.api.addBrushPoint(this.maskWrapper,v,s);break;case me.MY:this.api.addErasePoint(this.maskWrapper,v,s);break;case me.l4:this.api.addManualBrushPoint(this.maskWrapper,v,s);break;case me.lh:this.api.addManualErasePoint(this.maskWrapper,v,s);break;case me.Uq:case me.e_:this.points.push(new Le.b(v,s))}}isPathMode(){return this.selectedOption==me.Uq||this.selectedOption==me.e_}getSelectedOption(){return this.selectedOption}getMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getMaskMat(this.maskWrapper);return Le.A.unpackProcessImageResult(this.module,v)}throw new Error("Base mask not set..")}getSmoothMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getSmoothMaskMat(this.maskWrapper);return Le.A.unpackProcessImageResult(this.module,v)}throw new Error("Base mask not set..")}delete(){var v=this;return(0,n.A)(function*(){-1!=v.maskWrapper&&(yield v.api.delete(v.maskWrapper))})()}reset(){var v=this;return(0,n.A)(function*(){-1!=v.maskWrapper&&(yield v.api.reset(v.maskWrapper))})()}invert(){-1!=this.maskWrapper&&this.api.invert(this.maskWrapper)}getOriginalProcessedMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getOriginalMaskMat(this.maskWrapper);return Le.A.unpackProcessImageResult(this.module,v)}}}class lt{constructor(){this.undoSteps=[],this.redoSteps=[],this.undoStepcount=20}reset(){this.undoSteps.length=0,this.redoSteps.length=0,this.cutout&&this.cutout.reset()}createCutout(v,s,i,t){null==this.cutout&&(this.cutout=new Yi(v,s,i,t))}createRemoveBgCutout(v,s,i,t){this.cutout=new dt(v,s,"",i,t)}isUndoModeAvailable(){return this.undoSteps.length>0}isRedoModeAvailable(){return this.redoSteps.length>0}undo(){if(this.isUndoModeAvailable()){let v=this.undoSteps.pop();v.undoType==me.l3.ERASE&&(this.cutout.undo(),this.redoSteps.length>=this.undoStepcount&&(this.undoSteps=[],this.cutout.undo()),this.redoSteps.push(v))}}redo(){if(this.isRedoModeAvailable()){let v=this.redoSteps.pop();v.undoType==me.l3.ERASE&&(this.cutout.redo(),this.undoSteps.push(v))}}getCutout(){return this.cutout}onMouseUp(){this.cutout.onMouseUp(),this.createUndoState(me.l3.ERASE,null)}createUndoState(v,s){let i=new ws;i.model=s,i.undoType=v,this.undoSteps.push(i),this.redoSteps.length=0}addPoint(v,s){this.cutout.addPoint(v,s)}delete(){this.cutout&&this.cutout.delete()}invert(){this.cutout.invert()}}class ws{}const ji=c=>({"drawer-active":c});function ks(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",9)(1,"div",10)(2,"div",11)(3,"pi",12),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.back())}),e.k0s(),e.j41(4,"span",13),e.EFF(5,"Blur"),e.k0s()(),e.nrm(6,"pi",14),e.k0s(),e.j41(7,"div",15)(8,"div",16)(9,"button",17),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.autoBlur())}),e.j41(10,"div",18),e.nrm(11,"pei",19),e.EFF(12,"Auto"),e.k0s()()(),e.j41(13,"div",16)(14,"button",17),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.manual())}),e.j41(15,"div",18),e.nrm(16,"pei",20),e.EFF(17,"Manual"),e.k0s()()()()()}}function Ts(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",9)(1,"div",10)(2,"span",21),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.step=1)}),e.EFF(3,"Blur"),e.k0s(),e.j41(4,"pi",22),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(5,"div",15)(6,"div",23)(7,"video",24),e.nrm(8,"source",25),e.EFF(9," Your browser does not support the video tag. "),e.k0s()(),e.j41(10,"div",26)(11,"p",27),e.EFF(12,"Select an area over canvas where you want to change the blurness. "),e.k0s()()()()}2&c&&(e.R7$(7),e.Y8G("muted","muted"))}function Ps(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",45)(1,"refine-mask-edit-tools",46),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeTools(t))}),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("tabPane",s.tabPane)("isAuto",s.isAuto)("activePane",s.selectMaskVal)("showMaskVisible",s.showMaskVisible)}}function Is(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",47)(1,"div",48)(2,"span",49),e.EFF(3,"Blur Intensity"),e.k0s()(),e.j41(4,"div",50)(5,"div",51)(6,"mv-slider",52),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.inputBlur(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeBlur(t))}),e.k0s()(),e.j41(7,"div",53)(8,"input",54),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.inputBlur(t))}),e.k0s()()()()}if(2&c){const s=e.XpG(2);e.R7$(6),e.Y8G("value",s.blur)("min",0)("max",100)("step",1),e.R7$(2),e.Y8G("ngModel",s.blur)}}function Ms(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",28)(1,"div",29)(2,"span",30),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.step=1)}),e.EFF(3,"Blur"),e.k0s(),e.j41(4,"pi",22),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(5,"div",9)(6,"div",31)(7,"div",32,0)(9,"div",33)(10,"div",34)(11,"button",35)(12,"div",36),e.EFF(13,"Selection Tool"),e.k0s()(),e.j41(14,"button",37)(15,"span",38),e.nrm(16,"pi",39),e.k0s(),e.j41(17,"span",40),e.nrm(18,"pi",41),e.k0s()()()(),e.j41(19,"div",42)(20,"div",43),e.DNE(21,Ps,2,4,"ng-template"),e.k0s()()()()(),e.j41(22,"div",9)(23,"div",9),e.DNE(24,Is,9,5,"div",44),e.k0s()()()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("destroyOnHide",!0),e.R7$(),e.Y8G("collapsed",!1),e.R7$(17),e.Y8G("ngIf",s.initialized)}}function js(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",57)(1,"button",58),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.cancel())}),e.EFF(2,"Cancel"),e.k0s(),e.j41(3,"button",59),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.apply())}),e.EFF(4,"Apply"),e.k0s()()}if(2&c){const s=e.XpG(2);e.R7$(),e.Y8G("disabled",s.photoEditorService.inProgress),e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress)}}function Os(c,v){if(1&c&&(e.j41(0,"div",55),e.DNE(1,js,5,2,"div",56),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.Y8G("ngIf",s.isApply&&1===s.step)}}let As=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae){super(r,f,T,N,se),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.cdRef=q,this.document=ne,this.route=se,this.removeBgService=ae,this.isSelectedAutoBlur=!1,this.changeBlurEvent=ne
1w e.bkB,this.restAndApplyEvent=new e.bkB,this.selectMaskVal=me.Uq,this.selectAutoMaskVal=me.WM,this.isAuto=!1,this.isEdit=!1,this.isApply=!0,this.step=-1,this.tabPane="blur",this.previewMode=!1,this.f=pe.fabric.Image.filters,this.blurvalue=40,this.blur=this.blurvalue,this.invertMask=!1,this.showMaskVisible=!1,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ce=>{ce&&(this.isSelectedAutoBlur?(this.step=1,this.selectMaskVal=me.MY,this.tabPane="removebg",this.isAuto=!0):(this.step=-1,this.isAuto=!1,this.tabPane="blur"),this.selectMaskVal=null,this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="default",this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init(()=>{this.isSelectedAutoBlur&&(this.selectMaskVal=me.MY,this.step=1,this.tabPane="removebg",this.isAuto=!0,this.autoBlur(),this.changeTools({name:"size",value:50,selectedOption:1}))})},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(ce=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnInit(){this.photoEditorService.toolNameForDownload="blur",this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.step=-1,this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.isSelectedAutoBlur&&(this.step=1,this.tabPane="removebg",this.isAuto=!0,this.autoBlur())})):this.init(),this.initialized=!0,this.onInit()}manual(){this.blur=this.blurvalue,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.isAuto=!1,this.isAuto=!1,this.step=0,this.tabPane="blur",this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=19),this.baseFilter=null,this.addFilter(),this.actionController.createCutout(this.resolvedModule,this.res.imageData,this.res.imageData.width,this.res.imageData.height),this.processResult(),this.reset(()=>{this.setMask(me.Uq)})}afterImageLoad(i){this.res=i,this.resolvedModule=i.module}changeBruceSize(i){this.isAuto&&(i.selectedErase=!i.selectedErase),this.photoEditorService.brushSizeDisable=i}changeTools(i){"mask"===i.name?(this.selectedOption=i.selectedOption,this.setMask(i.value)):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption,this.isAuto),this.actionController.getCutout().selectedOption=i.selectedOption,this.actionController.getCutout().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!!i.value,this.processResult()):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult())}setMask(i){this.selectMaskVal=i,this.actionController.getCutout().setSelectedOption(this.selectMaskVal);let t=this.isPathMode();this.checkAndEnableDrawingMode(t,this.selectMaskVal)}onMouseMove(i){-1!==this.step&&(super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResultOnMove()))}onMouseUp(i){if(-1!==this.step){if(this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}super.onMouseUp(i)}}isPathMode(){return this.actionController.getCutout()instanceof Yi&&this.actionController.getCutout().isPathMode()}drawOutputImage(i,t){this.baseFilter.image=i,super.drawOutputImage(i,t)}onMouseDown(i){-1!==this.step&&(this.step=1,this.isSelected=!0,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult())}addFilter(){null==this.baseFilter&&(this.baseFilter=this.isAuto?new this.f.BlurFilterAuto({image:null,blur:this.blur/100}
1):new this.f.BlurFilter({image:null,blur:this.blur/100})),super.addFilter()}renderAll(){this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}processResult(){const i=this.actionController.getCutout().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){if(this.shouldRender(this.isPathMode())){const i=this.actionController.getCutout().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}this.index++}gotoPreview(){this.step=2,this.previewMode=!this.previewMode,this.processResult(),setTimeout(()=>{this.photoEditorService.isDirty=!0},100)}editCutout(){this.step=1,this.isEdit=!0,this.previewMode=!this.previewMode,this.processResult()}changeBlur(i){this.blur=i,this.baseFilter.blur=i/100,this.renderAll()}resetAll(){this.blur=this.blurvalue,this.resetBlur(this.blur)}resetBlur(i){this.changeBlur(i)}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}get undoable(){return!!this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo not available!!")}reset(i,t=0){this.actionController.reset(),this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.isEdit=!1,this.setMask(me.Uq),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.reloadImage(()=>{this.processResult(),this.step=t,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,i()})}applyChanges(i,t=null){this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.isCompareEnable=!1,this.stateService.mainCanvas.hoverCursor="move",this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1,this.step=-1;let r=i.image;if(this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this.photoEditorService.activeTool==w.b.tool.portrait&&(this.photoEditorService.activeTool=w.b.subTool.blur,this.photoEditorService.activeSubTool=""),this._saveImage(f,r,i.uri,t)}this.isSelectedAutoBlur&&this.changeBlurEvent.emit()}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.isSelected=!1,this.isAuto?(this.isAuto=!1,this.resetAll(),this.selectMaskVal=me.Uq,this.tabPane="blur",this.actionController.reset(),this.actionController.delete(),this.actionController=new lt,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.inProgress=!1})):(this.photoEditorService.isLoaded=!1,this.reset(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.inProgress=!1,this.photoEditorService.isExportable=!0},-1))}cancel(i=-1){this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.isSelected=!1,this.resetAll(),this.unconfigureFabricCanvas(),this.step=i,this.isAuto=!1,this.stateService.mainCanvas.clear(),this.isEdit=!1,this.selectMaskVal=me.Uq,this.tabPane="blur",this.actionController.reset(),this.actionController.delete(),this.actionController=new lt,this.photoEditorService.isLoaded=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.inProgress=!1}),this.isSelectedAutoBlur&&this.changeBlurEvent.emit(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}gotoVedioPreview(){this.photoEditorService.openVedio(w.b.tutorials.blur)}autoBlur(){this.blur=this.blurvalue,this.actionController=new lt,this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.photoEditorService.isCompareEnable=!0,this.photoEditorService.isAuto=!0,this.actionController.createRemoveBgCutout(this.res.module,this.res.imageData,this.res.imageData.width,this.res.imageData.height),this.processResult(),this.removeBgService.resolvedModule?this.processAutoBlurImage():this.removeBgService.resolveModule("lightxSegModule","seglightx.js",i=>{}).then(()=>{this.processAutoBlurImage()})}inputBlur(i){let t;t=i.newValue?i.newValue:i,t>0?t>100?setTimeout(()=>{this.changeBlur(100)},0):setTimeout(()=>{this.changeBlur(t)},0):setTimeout(()=>{this.changeBlur(0)},0)}processAutoBlurImage(){this.photoEditorService.originalImage&&(this.removeBgService.closeProgress(),this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.cdRef.detectChanges(),setTimeout(()=>{this.removeBgService.getAutoBlurMask(this.photoEditorService.originalImage,2).then(i=>{this.processBlurImage(i)}).catch(()=>{this.photoEditorService.clearProcessingProgress()})},1e3))}processBlurImage(i){this.photoEditorService.originalImage&&(this.removeBgService.closeProgress(),this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.removeBgService.getMask(this.photoEditorService.originalImage,i).then(t=>{this.step=1,this.isAuto=!0,this.isSelectedAutoBlur||(this.selectMaskVal=this.selectAutoMaskVal),this.tabPane="removebg",this.baseFilter=null,this.addFilter(),this.actionController.getCutout().applyBgMaskNew(t,r=>{this.actionController.getCutout().renderCallback=()=>{this.processResult(),this.isEdit=!0,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.completeProcessingProgress()}})}).catch(()=>{this.photoEditorService.clearProcessingProgress()}))}back(){this.photoEditorService.inProgress||this.restAndApplyEvent.emit()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(e.gRc),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(vt.r))},c.\u0275cmp=e.VBU({type:c,selectors:[["blur-drawer"]],inputs:{isSelectedAutoBlur:"isSelectedAutoBlur"},outputs:{changeBlurEvent:"changeBlurEvent",restAndApplyEvent:"restAndApplyEvent"},features:[e.Vt3],decls:11,vars:13,consts:[["accItem","ngbAccordionItem"],[1,"drawer-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Blur",1,"d-none"],[1,"scroll-content",2,"height","calc(100% - 60px)"],[1,"child-drawer",3,"ngClass"],["class","",4,"ngIf"],["customScrollDir","",1,"scroll-container"],["class","ngb-btn common-container p-0 m-0",4,"ngIf"],["class","position-fixed bg-white fixed-bottom mb-9 ps-3 pe-3",4,"ngIf"],[1,""],[1,"d-flex","align-items-center","justify-content-between","common-container",2,"min-height","56px"],[1,"d-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32",2,"visibility","hidden"],[1,"common-container"],[1,"accordion-item","mb-2","tab-div","d-flex","align-items-center","wp-100"],["type","button",1,"btn-acc-title","btnBlur","h-48","collapsed",2,"width","100% !important",3,"click"],[1,"m-0","btn","btn-link","card-title","ms-3","h-100"],["name","blurauto",1,"pointer","f-28","me-3"],["name","blurmanual",1,"pointer","f-28","me-3"],[1,"text-lg","text-semi","text-dark","lh-125",3,"click"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"f-32",2,"cursor","pointer",3,"click"],[1,"d-flex","flex-column","text-center"],["autoplay","","loop","",2,"border-radius","12px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/info/blur-info.mp4","type","video/mp4"],[1,"simple-text","d-flex","flex-column","mt-2"],[1,"text-14","text-regular","grey-800","mb-0"],[1,"ngb-btn","common-container","p-0","m-0"],[1,"d-flex","align-items-center","justify-content-between","w-100","p-0","m-0",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2",3,"click"],["ngbAccordion","",3,"destroyOnHide"],["ngbAccordionItem","cutout-panel-0",1,"tab-div",3,"collapsed"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100","h-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],["class","wp-100 align-items-center mt-10",4,"ngIf"],[1,"pt-1","ps-3","pe-3"],[3,"changeBruceSize","change","tabPane","isAuto","activePane","showMaskVisible"],[1,"wp-100","align-items-center","mt-10"],[1,"d-flex","align-items-center","justify-content-between"],[1,"text-normal","text-dark","text-semi","lh-125"],[1,"d-flex","align-items-center","justify-content-between","mt-9"],[1,"col-sm-9","p-0"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"col-sm-2","p-0"],["type","text","mask","000",1,"form-control","form-input-sm","text-normal","text-black","float-end",3,"ngModelChange","ngModel"],[1,"position-fixed","bg-white","fixed-bottom","mb-9","ps-3","pe-3"],["class","d-flex wp-100 justify-content-between pt-2",4,"ngIf"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","btn-h40","text-13",2,"width","130px",3,"click","disabled"]],template:function(i,t){1&i&&(e.j41(0,"div",1),e.nrm(1,"input",2),e.j41(2,"div",3)(3,"div",4),e.DNE(4,ks,18,0,"div",5),e.k0s(),e.j41(5,"div",4),e.DNE(6,Ts,13,1,"div",5),e.k0s(),e.j41(7,"div",4)(8,"div",6),e.DNE(9,Ms,25,3,"div",7),e.k0s()()(),e.DNE(10,Os,2,1,"div",8),e.k0s()),2&i&&(e.R7$(3),e.Y8G("ngClass",e.eq3(7,ji,-1==t.step)),e.R7$(),e.Y8G("ngIf",-1==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(9,ji,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(11,ji,1==t.step)),e.R7$(2),e.Y8G("ngIf",1==t.step),e.R7$(),e.Y8G("ngIf",1==t.step&&(t.isSelected||t.isAuto)))},dependencies:[I.YU,I.bT,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,we.me,we.BC,we.vS,z.wQ,qe.d1,pt.Zr,Ce.b,It.LR,Et],styles:[".btnBlur[_ngcontent-%COMP%]:hover{background:#626adf1a;border-radius:12px}.child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}"]}),v})();var Rs=g(21626);const Bs=["acc"],Ds=["carousel"];function Fs(c,v){1&c&&(e.j41(0,"div",17),e.nrm(1,"img",18),e.k0s(),e.j41(2,"div",19)(3,"h1",20),e.EFF(4,"Add Text on Photo"),e.k0s(),e.j41(5,"p",21),e.EFF(6,"Level up your creativity by adding texts from our extensive library."),e.k0s()())}function Us(c,v){1&c&&(e.j41(0,"div",17),e.nrm(1,"img",22),e.k0s(),e.j41(2,"div",19)(3,"h1",20),e.EFF(4,"Add Sticker on Photo"),e.k0s(),e.j41(5,"p",21),e.EFF(6,"Level up your creativity by adding stickers on your current photo."),e.k0s()())}function Ls(c,v){1&c&&(e.j41(0,"div",17),e.nrm(1,"img",23),e.k0s(),e.j41(2,"div",19)(3,"h1",20),e.EFF(4,"Add Illustration on Photo"),e.k0s(),e.j41(5,"p",21),e.EFF(6,"Insert illustrations in photos and edit their color, opacity, and more."),e.k0s()())}function Ns(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",5)(1,"div",6)(2,"div",7)(3,"pi",8),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.back())}),e.k0s(),e.j41(4,"span",9),e.EFF(5,"Design"),e.k0s()()(),e.j41(6,"div",10)(7,"div",11)(8,"div",12)(9,"ngb-carousel",13,0),e.bIt("slide",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onSlide(t))}),e.DNE(11,Fs,7,0,"ng-template",14)(12,Us,7,0,"ng-template",14)(13,Ls,7,0,"ng-template",14),e.k0s(),e.j41(14,"div",15)(15,"button",16),e.bIt("mouseout",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.interval=1e3)})("mouseover",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.interval=3e3)})("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.confirmMsg(t.activetabId))}),e.EFF(16,"Edit in Design"),e.k0s()()()()()()}if(2&c){const s=e.XpG();e.R7$(9),e.Y8G("interval",s.interval)("activeId",0)("pauseOnHover",s.pauseOnHover)("pauseOnFocus",s.pauseOnFocus),e.R7$(2),e.Y8G("id",0),e.R7$(),e.Y8G("id",1),e.R7$(),e.Y8G("id",2)}}let Gs=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae){super(f,T,N,H,ne),this.http=i,this.authService=t,this.injector=r,this.photoEditorService=f,this.stateService=T,this.zoomService=N,this.uploadService=H,this.uploadImageService=q,this.route=ne,this.router=se,this.modalService=ae,this.restAndApplyEvent=new e.bkB,this.paused=!1,this.unpauseOnArrow=!1,this.pauseOnIndicator=!1,this.pauseOnHover=!0,this.pauseOnFocus=!0,this.isEdit=!1,this.isApply=!0,this.step=0,this.tabPane="design",this.previewMode=!1,this.f=pe.fabric.Image.filters,this.invertMask=!1,this.showMaskVisible=!1,this.activetabId=0,this.interval=100,this.isMove=!1,this.brushSize=0,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ce=>{ce&&(this.photoEditorService.isLoaded=!1,this.actionController.reset(),this.actionController.delete(),this.photoEditorService.checkProjectName(!0),this.actionController=new Nt,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),setTimeout(()=>{this.stateService.mainCanvas.isDrawingMode=!1,this.init()},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(ce=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnChanges(){}ngOnInit(){this.actionController||(this.actionController=new Nt),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.stateService.mainCanvas.isDrawingMode=!1,this.processResult(),this.step=0,this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1})):this.init(),this.initialized=!0}afterImageLoad(i){this.resolvedModule=i.module,this.actionController.createSplash(this.resolvedModule,i.imageData,i.imageData.width,i.imageData.height),this.initialized=!0,this.processResult()}onMouseUp(i){if(this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}super.onMouseUp(i)}isPathMode(){return this.actionController.getSplash().isPathMode()}renderAll(){this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}processResult(){const i=this.actionController.getSplash().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){if(this.shouldRender(this.isPathMode())){const i=this.actionController.getSplash().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}this.index++}processResultOnPreview(){const i=this.actionController.getSplash().getOriginalProcessedMaskMat();this.drawOutputImage(i.image,this.stateServic
1e.mainCanvasNative)}onSlideStart(i){this.actionController.createAdjustmentUndoState(!0)}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo not available!!")}confirmMsg(i){let t="",r="";switch(i){case 2:t=h.sv.ELEMENT,r=h.sv.ILLUSTRATION;break;case 0:t=h.sv.TEXT;break;case 1:t=h.sv.ELEMENT,r=h.sv.STICKERS}this.makeProjectFromScratch(this.photoEditorService,t,r)}b64toBlob(i,t){const r=atob(i),f=new Array(r.length);for(let H=0;H<r.length;H++)f[H]=r.charCodeAt(H);const T=new Uint8Array(f);return new Blob([T],{type:"image/png"})}convertDataUrlToBlob(i){const t=i.split(","),r=t[0].match(/:(.*?);/)[1],f=atob(t[1]);let T=f.length;const N=new Uint8Array(T);for(;T--;)N[T]=f.charCodeAt(T);return new Blob([N],{type:r})}isValidDataUrl(i){return/^data:(.+);base64,(.+)$/.test(i)}makeProjectFromScratch(i,t,r){const f=this.photoEditorService.originalImage;let T=f.src;if(this.isValidDataUrl(T)){T=URL.createObjectURL(this.convertDataUrlToBlob(T));const H=this.router.createUrlTree(["/design-editor/edit"],{queryParams:{from:"",action:"default_project",tab:t,subtab:r,social_platform_id:26,box:T,w:f.width,h:f.height,page_name:"design"}}),q=this.router.serializeUrl(H);window.open(a.c.siteUrl+q,"_blank")}else if(-1==T.search("blob:"))this.http.get(f.src,{responseType:"blob"}).subscribe(N=>{T=URL.createObjectURL(N);const q=this.router.createUrlTree(["/design-editor/edit"],{queryParams:{from:"",action:"default_project",tab:t,subtab:r,social_platform_id:26,box:T,w:f.width,h:f.height,page_name:"design"}}),ne=this.router.serializeUrl(q);window.open(a.c.siteUrl+ne,"_blank")});else{const H=this.router.createUrlTree(["/design-editor/edit"],{queryParams:{from:"",action:"default_project",tab:t,subtab:r,social_platform_id:26,box:T,w:f.width,h:f.height,page_name:"design"}}),q=this.router.serializeUrl(H);window.open(a.c.siteUrl+q,"_blank")}}applyChanges(i,t){throw new Error("Method not implemented.")}onSlide(i){this.isMove||(this.isMove=!0,this.interval=1500),this.activetabId=parseInt(i.current?i.current:"0")}back(){this.photoEditorService.inProgress||this.restAndApplyEvent.emit()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(Rs.Qq),e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(z.nX),e.rXU(z.Ix),e.rXU(Y.Bq))},c.\u0275cmp=e.VBU({type:c,selectors:[["design-drawer"]],viewQuery:function(i,t){if(1&i&&(e.GBs(Bs,5),e.GBs(Ds,7)),2&i){let r;e.mGM(r=e.lsd())&&(t.accordion=r.first),e.mGM(r=e.lsd())&&(t.carousel=r.first)}},outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Vt3,e.OA$],decls:5,vars:1,consts:[["carousel",""],[1,"drawer-content"],[1,"scroll-content"],["customScrollDir","",1,"is-popover-t","scroll-container"],["class","",4,"ngIf"],[1,""],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],[1,"d-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8","pointer",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],[1,"common-container","p-0","m-0","mb-3"],[1,"addStickerToPhoto","carouselDesignTool"],[1,"gray-100",2,"border-radius","16px"],[2,"min-height","194px",3,"slide","interval","activeId","pauseOnHover","pauseOnFocus"],["ngbSlide","",3,"id"],[1,"ps-3","pe-3"],[1,"btn","btn-primary","text-13","w-100","btn-h40","mt-3","mb-3",3,"mouseout","mouseover","click"],[2,"min-height","119px"],["src","https://static.lightxeditor.com/assets/images/addTextToPhotoBanner.jpg",2,"max-width","267px"],[1,"common-container"],[1,"text-lg","lh-inherit","text-dark","mt-9"],[1,"text-sm","lh-inherit","text-dark","mt-2"],["src","https://static.lightxeditor.com/assets/images/addStickerToPhotoBanner.jpg",2,"max-width","267px"],["src","https://static.lightxeditor.com/assets/images/addIllustrationToPhotoBanner.jpg",2,"max-width","267px"]],template:function(i,t){1&i&&(e.j41(0,"div",1)(1,"div")(2,"div",2)(3,"div",3),e.DNE(4,Ns,17,7,"div",4),e.k0s()()()()),2&i&&(e.R7$(4),e.Y8G("ngIf",0==t.step))},dependencies:[I.bT,de.q,Y.Oj,Y.bD,Ce.b],styles:[".addStickerToPhoto[_ngcontent-%COMP%]{border:solid 1px transparent!important;background-image:linear-gradient(90deg,#fc5cff -4%,#2520f6)!important;border-radius:16px;background:#f8f9f9;background-origin:border-box}"]}),v})();var Vs=g(32764);const Xs=["widthInput"],zs=["heightInput"],Ws=(c,v)=>({marginTop:c,marginTopBit:v}),$i=c=>({"cus-error":c}),Hi=c=>({widthHeightTextN:c}),Ys=c=>({iconDivActive:c}),$s=(c,v)=>({width:c,height:v});function Hs(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",28)(2,"buttons-scroll-menu",29),e.bIt("selectLayout",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.layoutSelect(t))}),e.k0s()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(2),e.Y8G("items",s.socialMediaLayout)("type","resizeSocialIcon")}}function Ks(c,v){1&c&&(e.qex(0),e.j41(1,"div",30),e.EFF(2," Drag the handles over canvas to create your desired crop. "),e.k0s(),e.bVm())}function Zs(c,v){if(1&c){const s=e.RV6();e.j41(0,"li")(1,"a",35),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(4);return e.Njj(r.onSizeChange(t))}),e.j41(2,"div",36)(3,"div",37)(4,"div",38),e.nrm(5,"pi",39),e.k0s()(),e.j41(6,"div",32)(7,"div",40),e.EFF(8),e.k0s(),e.j41(9,"div",41),e.EFF(10),e.k0s()()()()()}if(2&c){const s=v.$implicit,i=e.XpG(4);e.R7$(2),e.Y8G("ngClass",e.eq3(6,Ys,i.selectedLayout.id==s.id)),e.R7$(2),e.Y8G("ngStyle",e.l_i(8,$s,s.boxWidth+"px",s.boxHeight+"px")),e.R7$(),e.Y8G("name",s.iconName),e.R7$(3),e.SpI(" ",s.short_name||s.socialPlatform,""),e.R7$(2),e.Lme(" ",s.wratio," : ",s.hratio,"")}}function Qs(c,v){if(1&c&&(e.j41(0,"div")(1,"div")(2,"ul",33),e.DNE(3,Zs,11,11,"li",34),e.k0s()()()),2&c){const s=e.XpG().$implicit;e.R7$(3),e.Y8G("ngForOf",null==s?null:s.socialPlatformFormats)}}function Js(c,v){if(1&c&&(e.j41(0,"div",32),e.DNE(1,Qs,4,1,"div",7),e.k0s()),2&c){const s=v.$implicit;
1e.R7$(),e.Y8G("ngIf",0!==s.id)}}function qs(c,v){if(1&c&&(e.qex(0),e.DNE(1,Js,2,1,"div",31),e.bVm()),2&c){const s=e.XpG();e.R7$(),e.Y8G("ngForOf",s.resizeLayouts)}}function er(c,v){1&c&&(e.j41(0,"div",42),e.EFF(1," All sizes are in pixels. "),e.k0s())}function tr(c,v){if(1&c&&(e.j41(0,"div",43),e.EFF(1),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.SpI(" ",s.errorsmsg," ")}}let ir=(()=>{var c;class v{constructor(i,t,r){this.authService=i,this.photoEditorService=t,this.templateService=r,this.url=a.c.staticAssetsPath+"assets/json/resize.config.json",this.changeCropResize=new e.bkB,this.change=new e.bkB,this.changeLockAspectRatio=new e.bkB,this.width=0,this.height=0,this.lockedAspectRatio=!1,this.inputWidthClicked=!1,this.inputHeightClicked=!1,this.originalWidth=0,this.originalHeight=0,this.templateType=1,this.selectedItem="custom",this.colorsBgPresets=[],this.customsize={width:null,height:null},this.isdisabled=!0,this.errorsmsg="",this.user=this.authService.currentUser(),this.isSubscribed=!!this.user&&this.user.subscribed,this.colorsBgPresets=M.PV.ui.colorBgPresets.items,this.originalWidth=this.photoEditorService?.originalImage?.width,this.originalHeight=this.photoEditorService?.originalImage?.height,this.setOriginalratio()}setOriginalratio(){this.originalWidth>4e3?(this.originalHeight=Math.round(this.photoEditorService.originalImage.height/this.photoEditorService.originalImage.width*4e3),this.originalWidth=4e3):this.originalHeight>4e3&&(this.originalWidth=Math.round(this.photoEditorService.originalImage.width/this.photoEditorService.originalImage.height*4e3),this.originalHeight=4e3)}ngOnInit(){this.templateService.getResizeContent(this.templateType,i=>{i&&(this.CreateFromScratch=JSON.parse(JSON.stringify(i.filter(t=>t.title==E.zu.SocialMedia||t.title==E.zu.Custom||t.title==E.zu.Standard))),this.CreateFromScratch.forEach(t=>{t.socialLabelType="Custom"==t.socialLabelType?"Freeform":t.socialLabelType,t.title===E.zu.SocialMedia&&(this.socialMediaLayout=t.socialMediaLayout)}),this.resizeLayouts=JSON.parse(JSON.stringify(this.CreateFromScratch.filter(t=>t.title==this.selectedItem))),this.selectedLayout=this.selectedLayout??this.resizeLayouts[0].socialPlatformFormats[0],this.lockedWidth=Number(this.width),this.lockedHeight=Number(this.height))})}layoutSelect(i){this.resizeLayouts=JSON.parse(JSON.stringify(this.CreateFromScratch.filter(r=>r.title===E.zu.SocialMedia)));const t=JSON.parse(JSON.stringify(this.resizeLayouts[0].socialPlatformFormats.filter(r=>r.socialPlatform.toLowerCase().startsWith(i.toLowerCase()))));this.resizeLayouts[0].socialPlatformFormats=t,this.selectedLayout&&(this.selectedLayout.id=null)}onCategorySelect(i){this.selectedItem=i.title,this.selectedLayout&&(this.selectedLayout.id=null),this.selectedItem==E.zu.SocialMedia?this.layoutSelect(E.zu.Instagram):this.resizeLayouts=this.CreateFromScratch.filter(t=>t.title==this.selectedItem),this.selectedItem!==E.zu.Custom?(this.lockedAspectRatio=!0,this.changeLockAspectRatio.emit(this.lockedAspectRatio)):this.lockedAspectRatio=!1}onSizeChange(i){this.isdisabled=!0,this.lockedWidth=i.width,this.lockedHeight=i.height,this.selectedLayout=JSON.parse(JSON.stringify(i)),this.selectedLayout.isCustomSize=!1,this.selectedLayout.isValid=!0,this.selectedLayout.isApply=!0,this.changeCropResize.emit(this.selectedLayout),this.errorsmsg=""}changeAspectRatio(){this.lockedAspectRatio||(this.selectedItem=E.zu.Custom),this.lockedWidth=this.width,this.lockedHeight=this.height,this.changeLockAspectRatio.emit(this.lockedAspectRatio)}isValidate(){let i=this.width,t=this.height,r=!1,f="";return this.errorsmsg="",(null!=i&&(i<40||i>4e3)||null!=t&&(t<40||t>4e3))&&(r=!0),i<40||t<40?f="Size cannot be smaller than 40x40":(i>4e3||t>4e3)&&(f="Size cannot be bigger than 4000x4000"),r?(this.isdisabled=!0,this.errorsmsg=f):null!=i&&null!=t&&(this.isdisabled=!1),!r}onFocusOut(){(this.width>this.originalWidth||this.height>this.originalHeight)&&(this.width=this.originalWidth,this.height=this.originalHeight),this.keyEnter()}setCustomValue(i){let t=JSON.parse(JSON.stringify(this.selectedLayout));t.width=Number(this.width),t.height=Number(this.height),t.isCustomSize=!0,t.isApply=i,t.isValid=this.isValidate(),this.changeCropResize.emit(t)}
1keyEnter(){this.inputWidthClicked=!1,this.inputHeightClicked=!1,this.setCustomValue(!0),this.widthInput&&this.heightInput&&(this.widthInput.nativeElement.blur(),this.heightInput.nativeElement.blur())}onKeyWidth(i){this.width=Number(i.target.value),this.lockedAspectRatio?this.calculateAspectRatio(i.target.value,"width"):this.isValidate(),this.setCustomValue(!1)}onKeyHeight(i){this.height=Number(i.target.value),this.lockedAspectRatio?this.calculateAspectRatio(i.target.value,"height"):this.isValidate(),this.setCustomValue(!1)}calculateAspectRatio(i,t){"height"===t?this.width=Math.round(this.lockedWidth/this.lockedHeight*Number(i)):this.height=Math.round(this.lockedHeight/this.lockedWidth*Number(i)),this.isValidate()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(l.p),e.rXU(Vs.I))},c.\u0275cmp=e.VBU({type:c,selectors:[["crop-edit-tools"]],viewQuery:function(i,t){if(1&i&&(e.GBs(Xs,5),e.GBs(zs,5)),2&i){let r;e.mGM(r=e.lsd())&&(t.widthInput=r.first),e.mGM(r=e.lsd())&&(t.heightInput=r.first)}},inputs:{width:"width",height:"height"},outputs:{changeCropResize:"changeCropResize",change:"change",changeLockAspectRatio:"changeLockAspectRatio"},decls:40,vars:28,consts:[["container",""],["widthInput",""],["heightInput",""],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Crop",1,"d-none"],[1,"common-container","d-flex","flex-column","position-fixed","bg-white","resizeCustomTool","p-0","m-0",2,"width","268px","z-index","999"],[1,"text-lg","text-semi","text-dark","lh-125","d-flex","align-items-center","justify-content-start",2,"min-height","56px"],["bindLabel","socialLabelType","bindValue","title",1,"select-menu","resize-popup",3,"change","items","ngModel","searchable","clearable"],[4,"ngIf"],[1,"common-container","h-100","ps-0","pe-0","ms-0","me-0",3,"ngClass"],[1,"create-project"],[1,"w-100","h-100","hometemplate","custom-items","p-0"],[1,"bg-white"],[1,"common-container","position-absolute","bg-white","p-0","m-0",2,"bottom","60px","z-index","2"],[1,"scratch-slider","pt-9"],[1,"d-flex","align-items-center",3,"ngClass"],["type","text","id","width","autocomplete","off","minlength","1","maxlength","4","numbersOnly","",1,"form-control","textBoxText","text-semi","textBoxCustom",3,"ngModelChange","keyup","focusout","keyup.enter","click","ngModel"],[1,"position-absolute","d-flex"],[1,"widthHeightText","text-semi","ml-9","mr-9",3,"ngClass"],[1,"me-4"],["name","dividerCustom"],["name","resizecross",1,"hw-24","align-self-center","ms-2","me-2","grey-600"],["type","text","id","height","autocomplete","off","minlength","1","maxlength","4","numbersOnly","",1,"form-control","textBoxText","text-semi","textBoxCustom",3,"ngModelChange","keyup","focusout","keyup.enter","click","ngModel"],["class","scratch-slider mt-1","style","color: #B0B3BF; line-height: 14.98px;",4,"ngIf"],["class","scratch-slider mt-1","style","color: #F25555; line-height: 14.98px;",4,"ngIf"],[1,"selectAll","d-flex","align-items-center","mt-9"],[1,"checkboxc","d-flex"],["type","checkbox","checked","lockedAspectRatio",1,"marked-check",3,"ngModelChange","change","ngModel"],[1,"ms-2"],[1,"colors-bg","sticker-buttons-scroll","scrollWidth-300"],[1,"mt-9",3,"selectLayout","items","type"],[1,"text-13","grey-300","mt-9"],["class","",4,"ngFor","ngForOf"],[1,""],[1,"list-unstyled","d-flex","flex-row","flex-wrap","mb-4",2,"width","268px"],[4,"ngFor","ngForOf"],["data-toggle","tab",1,"",3,"click"],[1,"row","g-0","align-items-center","justify-content-center","textRatioDiv","text-center",3,"ngClass"],[1,"iconDiv","d-flex","align-items-center","justify-content-center","mt-9"],[1,"imgFormatBg","d-flex","align-items-center","justify-content-center",3,"ngStyle"],[3,"name"],[1,"subtitleText","text-semi","mt-2"],[1,"subtitleRatio","text-semi","mt-2"],[1,"scratch-slider","mt-1",2,"color","#B0B3BF","line-height","14.98px"],[1,"scratch-slider","mt-1",2,"color","#F25555","line-height","14.98px"]],template:function(i,t){if(1&i){const r=e.RV6();e.nrm(0,"input",3),e.j41(1,"div",4)(2,"span",5),e.EFF(3,"Crop"),e.k0s(),e.j41(4,"ng-select",6),e.bIt("change",function(T){return e.eBV(r),e.Njj(t.onCategorySelect(T))}),e.k0s(),e.DNE(5,Hs,3,2,"ng-container",7)(6,Ks,3,0,"ng-container",7),e.k0s(),e.j41(7,"div",8)(8,"div",9,0)(10,"div",10),e.DNE(11,qs,2,1,"ng-container",7),e.k0s()()(),e.qex(12),e.j41(13,"div",11)(14,"div",12)(15,"div",13)(16,"div",14)(17,"input",15,1),e.mxI("ngModelChange",function(T){return e.eBV(r),e.D
1H7(t.width,T)||(t.width=T),e.Njj(T)}),e.bIt("keyup",function(T){return e.eBV(r),e.Njj(t.onKeyWidth(T))})("focusout",function(){return e.eBV(r),e.Njj(t.onFocusOut())})("keyup.enter",function(){return e.eBV(r),e.Njj(t.keyEnter())})("click",function(){return e.eBV(r),e.Njj(t.inputWidthClicked=!0)}),e.k0s(),e.j41(19,"div",16)(20,"span",17),e.EFF(21,"W"),e.k0s(),e.j41(22,"div",18),e.nrm(23,"pi",19),e.k0s()()(),e.nrm(24,"pi",20),e.j41(25,"div",14)(26,"input",21,2),e.mxI("ngModelChange",function(T){return e.eBV(r),e.DH7(t.height,T)||(t.height=T),e.Njj(T)}),e.bIt("keyup",function(T){return e.eBV(r),e.Njj(t.onKeyHeight(T))})("focusout",function(){return e.eBV(r),e.Njj(t.onFocusOut())})("keyup.enter",function(){return e.eBV(r),e.Njj(t.keyEnter())})("click",function(){return e.eBV(r),e.Njj(t.inputHeightClicked=!0)}),e.k0s(),e.j41(28,"div",16)(29,"span",17),e.EFF(30,"H"),e.k0s(),e.j41(31,"div",18),e.nrm(32,"pi",19),e.k0s()()()(),e.DNE(33,er,2,0,"div",22)(34,tr,2,1,"div",23),e.j41(35,"div",24)(36,"div",25)(37,"input",26),e.mxI("ngModelChange",function(T){return e.eBV(r),e.DH7(t.lockedAspectRatio,T)||(t.lockedAspectRatio=T),e.Njj(T)}),e.bIt("change",function(){return e.eBV(r),e.Njj(t.changeAspectRatio())}
1),e.k0s()(),e.j41(38,"span",27),e.EFF(39,"Lock Aspect Ratio"),e.k0s()()()(),e.bVm()}2&i&&(e.R7$(4),e.Y8G("items",t.CreateFromScratch)("ngModel",t.selectedItem)("searchable",!1)("clearable",!1),e.R7$(),e.Y8G("ngIf","socialmedia"===t.selectedItem),e.R7$(),e.Y8G("ngIf","custom"===t.selectedItem),e.R7$(),e.Y8G("ngClass",e.l_i(17,Ws,"socialmedia"===t.selectedItem,"socialmedia"!==t.selectedItem)),e.R7$(4),e.Y8G("ngIf","custom"!==t.selectedItem),e.R7$(5),e.Y8G("ngClass",e.eq3(20,$i,t.width<40||t.width>4e3)),e.R7$(),e.R50("ngModel",t.width),e.R7$(3),e.Y8G("ngClass",e.eq3(22,Hi,1==t.inputWidthClicked)),e.R7$(5),e.Y8G("ngClass",e.eq3(24,$i,t.width<40||t.width>4e3)),e.R7$(),e.R50("ngModel",t.height),e.R7$(3),e.Y8G("ngClass",e.eq3(26,Hi,1==t.inputHeightClicked)),e.R7$(4),e.Y8G("ngIf",""==t.errorsmsg),e.R7$(),e.Y8G("ngIf",""!=t.errorsmsg),e.R7$(3),e.R50("ngModel",t.lockedAspectRatio))},dependencies:[I.YU,I.Sq,I.bT,I.B3,Fe.Z,we.me,we.Zm,we.BC,we.xh,we.tU,we.vS,Lt.vr,Ce.b,Pt.B],styles:[".marginTop[_ngcontent-%COMP%]{margin-top:150px}.marginTopBit[_ngcontent-%COMP%]{margin-top:100px}.scratch-slider[_ngcontent-%COMP%]{display:flex;font-size:12px;color:#e20e33}.scratch-slider[_ngcontent-%COMP%] .textBoxCustom[_ngcontent-%COMP%]{width:114px;height:40px;background-color:#fff;border:1px solid #E2E3E9;border-radius:12px}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]{display:inline;height:38px;padding:0 7px 0 50px;font-size:.875rem;line-height:1.5;color:#000;background-color:#fff;border:1px solid #E2E3E9;border-radius:12px;text-align:center}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:hover{border:1px solid #4A4F5E}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border:1px solid #626ADF}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus .widthHeightText[_ngcontent-%COMP%]{color:#626adf!important}.scratch-slider[_ngcontent-%COMP%] .cus-error[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]{border-color:#f25555!important}.scratch-slider[_ngcontent-%COMP%] .cus-error[_ngcontent-%COMP%] .widthHeightText[_ngcontent-%COMP%]{color:#f25555!important}.scratch-slider[_ngcontent-%COMP%] .widthHeightText[_ngcontent-%COMP%]{font-size:13px;color:#272b34;line-height:17.7px}.scratch-slider[_ngcontent-%COMP%] .widthHeightTextN[_ngcontent-%COMP%]{color:#626adf!important}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{width:78px;cursor:pointer;margin-right:17px}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:nth-child(3n+3){margin-right:0}.iconDiv[_ngcontent-%COMP%]{width:78px;height:78px;background:#626adf0d;border-radius:12px}.iconDiv[_ngcontent-%COMP%] .imgFormatBg[_ngcontent-%COMP%]{background:#e2e3e9;border-radius:8px}.iconDiv[_ngcontent-%COMP%] .subtitleText[_ngcontent-%COMP%], .iconDiv[_ngcontent-%COMP%] .subtitleRatio[_ngcontent-%COMP%]{color:#626adf!important}.textRatioDiv[_ngcontent-%COMP%] .subtitleText[_ngcontent-%COMP%]{font-size:12px;color:#606576;line-height:16.34px}.textRatioDiv[_ngcontent-%COMP%] .subtitleRatio[_ngcontent-%COMP%], .textRatioDiv[_ngcontent-%COMP%]:hover .subtitleText[_ngcontent-%COMP%]{display:none}.textRatioDiv[_ngcontent-%COMP%]:hover .subtitleRatio[_ngcontent-%COMP%]{display:block;font-size:12px;color:#000;line-height:16.34px}.textRatioDiv[_ngcontent-%COMP%]:hover .imgFormatBg[_ngcontent-%COMP%]{background:#626adf1a}.iconDivActive[_ngcontent-%COMP%] .iconDiv[_ngcontent-%COMP%]{background:#626adf0d;border:1px solid #626ADF;border-radius:12px}.iconDivActive[_ngcontent-%COMP%] .imgFormatBg[_ngcontent-%COMP%]{background:#626adf1a}.iconDivActive[_ngcontent-%COMP%] .subtitleText[_ngcontent-%COMP%], .iconDivActive[_ngcontent-%COMP%] .subtitleRatio[_ngcontent-%COMP%]{color:#626adf!important}[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #e2e3e9;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#626adf;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#626adf}.selectAll[_ngcontent-%COMP%]{border-radius:12px}.selectAll[_ngcontent-%COMP%] .checkboxc[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{cursor:pointer;-webkit-appearance:none;appearance:none;background-color:transparent!important;position:relative;width:24px;height:24px;border:0px solid transparent;border-radius:0!important;background:url(https://static.lightxeditor.com/assets/images/checkbox-grey.svg) no-repeat;background-size:cover!important}.selectAll[_ngcontent-%COMP%] .checkboxc[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked{background:url(https://static.lightxeditor.com/assets/images/checkbox-grey-active.svg) no-repeat!important;border:0px!important;background-size:cover!important}"]}),v})();var Qe=g(21092),jt=g(84831);class Ki{constructor(v,s,i,t){this.points=new Array,this.DESIRED_SIZE=100,this.image=s,this.module=v,this.width=i,this.height=t,this.zoomFactor=2,this.brushRadius=50,this.edgeStrength=50,this.selectedOption=0,this.api={updateMaskMat:v.cwrap("nativeEraserUpdateMaskMat","",["number","array","number","number"]),setBaseImage:v.cwrap("nativeCutoutSetBaseImage","number",["array","number","number"]),getMaskMat:v.cwrap("nativeCutoutGetMaskMat","number",["number"]),getSmoothMaskMat:v.cwrap("nativeCutoutGetSmoothMaskMat","number",["number"]),getOriginalMaskMat:v.cwrap("nativeCutoutGetOriginalMaskMat","number",["number"]),addErasePoint:v.cwrap("nativeCutoutAddErasePoint","",["number","number","number"]),addBrushPoint:v.cwrap("nativeCutoutAddBrushPoint","",["number","number","number"]),addManualErasePoint:v.cwrap("nativeCutoutAddManualErasePoint","",["number","number","number"]),addManualBrushPoint:v.cwrap("nativeCutoutAddManualBrushPoint","",["number","number","number"]),addSmartSelectionPoint:v.cwrap("nativeCutoutAddSmartSelectionPoint","",["number","number","number"]),addAutoCutoutForegroundPoints:v.cwrap("nativeCutoutAddAutoCutoutForegroundPoints","",["number","number","number"]),setBrushSize:v.cwrap("nativeCutoutSetBrushSize","",["number","number","number"]),setEdgeStrength:v.cwrap("nativeCutoutSetEdgeStrength","",["number","number"]),clearSmartSelectionPoint:v.cwrap("nativeCutoutClearSmartSelectionPoint","",["number"]),applyBackgroun
1dPoints:v.cwrap("nativeCutoutApplyBackgroundPoints","",["number"]),applyForegroundPoints:v.cwrap("nativeCutoutApplyForegroundPoints","",["number"]),applyAutoCutoutForegroundPoints:v.cwrap("nativeCutoutApplyAutoCutoutForegroundPoints","",["number"]),isUndoModeAvailable:v.cwrap("nativeCutoutIsUndoModeAvailable","boolean",["number"]),isRedoModeAvailable:v.cwrap("nativeCutoutIsRedoModeAvailable","boolean",["number"]),undo:v.cwrap("nativeCutoutUndoFilter","",["number"]),redo:v.cwrap("nativeCutoutApplyRedoMode","",["number"]),setBrushPointArray:v.cwrap("nativeCutoutSetBrushPointArray","",["number"]),setErasePointArray:v.cwrap("nativeCutoutSetErasePointArray","",["number"]),enableMagicEraseMode:v.cwrap("nativeCutoutEnableMagicEraseMode","",["number"]),enableMagicBrushMode:v.cwrap("nativeCutoutEnableMagicBrushMode","",["number"]),enableManualMode:v.cwrap("nativeCutoutEnableManualMode","",["number"]),setManualBrushPointArray:v.cwrap("nativeCutoutSetManualBrushPointArray","",["number"]),setManualErasePointArray:v.cwrap("nativeCutoutSetManualErasePointArray","",["number"]),delete:v.cwrap("nativeCutoutDelete","",["number"]),reset:v.cwrap("nativeCutoutReset","",["number"]),invert:v.cwrap("nativeCutoutInvertMaskMat","",["number"]),applyFilterOnMask:v.cwrap("nativeApplyFilterOnMask","",["number"])},this.maskWrapper=this.api.setBaseImage(this.image,this.width,this.height),this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor),this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20),this.api.addManualErasePoint(this.maskWrapper,0,0),this.api.setManualErasePointArray(this.maskWrapper)}setBrushSize(v){this.selectedOption==Qe.MY||this.selectedOption==Qe.WM?(this.edgeStrength=v,this.api.setEdgeStrength(this.maskWrapper,this.edgeStrength/20)):(this.brushRadius=v,this.api.setBrushSize(this.maskWrapper,this.brushRadius/5,this.zoomFactor))}isUndoModeAvailable(){return this.api.isUndoModeAvailable(this.maskWrapper)}isRedoModeAvailable(){return this.api.isRedoModeAvailable(this.maskWrapper)}undo(){return this.api.undo(this.maskWrapper)}redo(){return this.api.redo(this.maskWrapper)}enableMagicEraseMode(){return this.api.enableMagicEraseMode(this.maskWrapper)}enableMagicBrushMode(){return this.api.enableMagicBrushMode(this.maskWrapper)}enableManualMode(){return this.api.enableManualMode(this.maskWrapper)}setBrushPointArray(){this.api.setBrushPointArray(this.maskWrapper)}setErasePointArray(){this.api.setErasePointArray(this.maskWrapper)}setManualErasePointArray(){this.api.setManualErasePointArray(this.maskWrapper)}setManualBrushPointArray(){this.api.setManualBrushPointArray(this.maskWrapper)}setSelectedOption(v){this.selectedOption=v,this.selectedOption==Qe.MY?this.enableMagicEraseMode():this.selectedOption==Qe.WM?this.enableMagicBrushMode():(this.selectedOption==Qe.l4||this.selectedOption==Qe.lh)&&this.enableManualMode()}onMouseDown(v,s){this.points.length=0,this.api.clearSmartSelectionPoint(this.maskWrapper),this.addPoint(v,s)}onMouseMove(v,s){this.addPoint(v,s)}onMouseUp(){this.selectedOption==Qe.Uq||this.selectedOption==Qe.e_?this.interpolateAndAddPoints():this.selectedOption==Qe.MY?this.setErasePointArray():this.selectedOption==Qe.WM?this.setBrushPointArray():this.selectedOption==Qe.l4?this.setManualBrushPointArray():this.selectedOption==Qe.lh&&this.setManualErasePointArray(),this.api.clearSmartSelectionPoint(this.maskWrapper)}interpolateAndAddPoints(){this.points.length<this.DESIRED_SIZE&&this.interpolate();for(let v=0;v<this.points.length;v++)this.api.addSmartSelectionPoint(this.maskWrapper,this.points[v].x,this.points[v].y);this.selectedOption==Qe.Uq?this.api.applyForegroundPoints(this.maskWrapper):this.selectedOption==Qe.e_&&this.api.applyBackgroundPoints(this.maskWrapper),this.points.length=0}interpolate(){let v=this.points.length;if(v>0){let s=Math.floor(this.DESIRED_SIZE/v);for(let i=0;i<this.DESIRED_SIZE;i=+i+s+1)this.points.length>i+1&&this.getMorePoints(this.points[i],this.points[i+1],s,i)}}getMorePoints(v,s,i,t){let r=(s.x-v.x)/i,f=(s.y-v.y)/i,T=new Array;if(0==r&&0==f)return T;for(let N=1;N<=i;N++){let q=v.y+f*N,ne=new jt.bR(Math.round(100*(v.x+r*N))/100,Math.round(100*q)/100);this.points.splice(t+N,0,ne)}return T}addPoint(v,s){if(-1==this.maskWrapper)throw new Error("Base mask not set..");switch(this.selectedOption){case Qe.WM:this.api.addBrushPoint(this.maskWrapper,v,s);break;case Qe.MY:this.api.addErasePoint(this.maskWrapper,v,s);break;case Qe.l4:this.api.addManualBrushPoint(this.maskWrapper,v,s);break;case Qe.lh:this.api.addManualErasePoint(this.maskWrapper,v,s);break;case Qe.Uq:case Qe.e_:this.points.push(new jt.bR(v,s))}}isPathMode(){return this.selectedOption==Qe.Uq||this.selectedOption==Qe.e_}getSelectedOption(){return this.selectedOption}getMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getMaskMat(this.maskWrapper);return jt.Aq.unpackProcessImageResult(this.module,v)}throw new Error("Base mask not set..")}getSmoothMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getSmoothMaskMat(this.maskWrapper);return jt.Aq.unpackProcessImageResult(this.module,v)}throw new Error("Base mask not set..")}applyBgMaskNew(v,s=null){this.maskData=v,s&&s(),this.updateMaskMat()}updateMaskMat(){if(-1!=this.maskWrapper){const s=new Uint8ClampedArray(this.width*this.height*4);for(let t=0;t<this.maskData.data.length;t+=4)s[t]=this.maskData.data[t],s[t+1]=this.maskData.data[t+1],s[t+2]=this.maskData.data[t+2],s[t+3]=this.maskData.data[t+3];const i=new ImageData(s,this.width,this.height);this.api.updateMaskMat(this.maskWrapper,i.data,this.width,this.height),this.renderCallback()}}applyBgMask(v,s=null){let i=new Image;i.crossOrigin="Anonymous",i.addEventListener("load",()=>{let t=i.width,r=i.height,f=document.createElement("canvas");f.width=t,f.height=r;const T=f.getContext("2d");T.clearRect(0,0,t,r),T.drawImage(i,0,0,t,r),this.resize(T.getImageData(0,0,t,r)),s&&s()},!1),i.src=v}resize(v,s=null){this.resizeImageData(v,this.width,this.height).then(i=>{this.maskData=i,this.updateMaskMat(),s&&s()})}resizeImageData(v,s,i){return(0,n.A)(function*(){const t=0|s,r=0|i,f=yield window.createImageBitmap(v,0,0,v.width,v.height,{resizeWidth:t,resizeHeight:r}),T=document.createElement("canvas");T.width=t,T.height=r;const N=T.getContext("2d");return N.drawImage(f,0,0),N.getImageData(0,0,t,r)})()}delete(){var v=this;return(0,n.A)(function*(){-1!=v.maskWrapper&&(yield v.api.delete(v.maskWrapper))})()}reset(){var v=this;return(0,n.A)(function*(){-1!=v.maskWrapper&&(yield v.api.reset(v.maskWrapper))})()}invert(){-1!=this.maskWrapper&&this.api.invert(this.maskWrapper)}getOriginalProcessedMaskMat(){if(-1!=this.maskWrapper){const v=this.api.getOriginalMaskMat(this.maskWrapper);return jt.Aq.unpackProcessImageResult(this.module,v)}}}g(93988);const Oi=c=>({"drawer-active":c}),or=c=>({disabled:c}),nr=(c,v)=>({"background-image":c,"background-color":v});function sr(c,v){1&c&&e.nrm(0,"pi",33)}function rr(c,v){if(1&c&&e.nrm(0,"div",34),2&c){const s=e.XpG(3);e.Y8G("ngStyle",e.l_i(1,nr,s.bg.url?"url("+s.bg.url+")":"none",s.bg.color?s.bg.color:"none"))}}function ar(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",24)(1,"div",25)(2,"div",26)(3,"div",27),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.changeBg())}
1),e.j41(4,"button",28)(5,"h5",29),e.EFF(6,"Background"),e.k0s()(),e.j41(7,"button",30),e.DNE(8,sr,1,0,"pi",31)(9,rr,1,4,"div",32),e.k0s()()()()()}if(2&c){const s=e.XpG(2);e.R7$(8),e.Y8G("ngIf",!s.bg),e.R7$(),e.Y8G("ngIf",s.bg)}}function lr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",4)(2,"div",5)(3,"span",6),e.EFF(4,"Silhouette"),e.k0s()(),e.j41(5,"div",7)(6,"button",8),e.bIt("click",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.onRefineMaskClick(t))}),e.EFF(7,"Refine Mask "),e.k0s(),e.j41(8,"div",9)(9,"div",10),e.EFF(10,"Exposure"),e.k0s(),e.j41(11,"div",11)(12,"div",12)(13,"mv-slider",13),e.bIt("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputExposure(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputExposure(t))}),e.k0s()(),e.j41(14,"div",14)(15,"input",15),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.inputExposure(t))}),e.k0s()()(),e.j41(16,"div",16)(17,"div",12)(18,"div",10),e.EFF(19,"Original Background"),e.k0s()(),e.j41(20,"div",17)(21,"toggle-switch",18),e.bIt("changeT",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.toggleOriginalBg(t))}),e.k0s()()(),e.DNE(22,ar,10,2,"div",19),e.k0s()()(),e.j41(23,"div",20)(24,"div",21)(25,"button",22),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(26,"Cancel"),e.k0s(),e.j41(27,"button",23),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply(!1))}),e.EFF(28,"Apply"),e.k0s()()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("ngClass",e.eq3(14,or,!s.isLoaded)),e.BMQ("aria-disabled",!s.isLoaded),e.R7$(7),e.Y8G("enabled",s.isLoaded)("value",s.exposure)("min",0)("max",100)("step",1),e.R7$(2),e.Y8G("disabled",!s.isLoaded)("ngModel",s.exposure),e.R7$(6),e.Y8G("disabled",!s.isLoaded)("selected",s.originalBg),e.R7$(),e.Y8G("ngIf",!s.originalBg),e.R7$(3),e.Y8G("disabled",!s.isLoaded),e.R7$(2),e.Y8G("disabled",!s.isLoaded)}}function cr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",35)(2,"div",36)(3,"pi",37),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.exitRefine())}),e.k0s(),e.j41(4,"span",38),e.EFF(5,"Refine Mask"),e.k0s()(),e.j41(6,"div",39)(7,"refine-mask-edit-tools",40),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTools(t))}),e.k0s()()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(7),e.Y8G("tabPane","removebg")("activePane",s.selectMaskVal)}}function hr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"background-drawer",41),e.bIt("bgChanged",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.bgChangedhandler(t))})("backToBackground",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.backToBackground(t))})("changeScale",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeScale(t))}),e.k0s(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(),e.Y8G("bg",s.bg)("activeObject",s.activeObject)("bgLibrary",s.bgLibrary)}}let dr=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae){super(r,f,T,N,se,"silhouette"),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.cdRef=q,this.document=ne,this.route=se,this.removeBgService=ae,this.bgLibrary=!0,this.restAndApplyEvent=new e.bkB,this.selectMaskVal=me.WM,this.isEdit=!1,this.isApply=!0,this.step=0,this.previewMode=!1,this.f=pe.fabric.Image.filters,this.exposure=0,this.invertMask=!1,this.originalBg=!1,this.isLoaded=!1,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ce=>{ce&&(this.step=0,this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init(()=>{this.originalBg=!1,this.bg=null,this.applySilhouette()})},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(ce=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.photoEditorService.ph
1otoEditorOptions.mask=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnInit(){this.photoEditorService.toolNameForDownload="silhouette",this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.step=0,this.originalBg=!1,this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.applySilhouette()},!1)):this.init(()=>{this.originalBg=!1,this.applySilhouette()}),this.onInit()}afterImageLoad(i){this.res=i,this.resolvedModule=i.module,this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=10),this.photoEditorService.photoEditorOptions.mask&&(this.actionController.createRemoveBgCutout(this.res.module,this.res.imageData,this.res.imageData.width,this.res.imageData.height),this.actionController.getCutout().applyBgMaskNew(this.photoEditorService.photoEditorOptions.mask,t=>{this.actionController.getCutout().renderCallback=()=>{this.photoEditorService.photoEditorOptions.mask=null,this.processResult(),this.photoEditorService.inProgress=!1}}),this.photoEditorService.inProgress=!1)}changeBruceSize(i){i.selectedErase=!i.selectedErase,this.photoEditorService.brushSizeDisable=i}changeTools(i){"mask"===i.name?this.setMask(i.value):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption),this.actionController.getCutout().selectedOption=i.selectedOption,this.actionController.getCutout().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!i.value,this.processResult(),this.photoEditorService.isDirty=!0):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult(),this.photoEditorService.isDirty=!0)}setMask(i){this.selectMaskVal=i,this.actionController.getCutout().setSelectedOption(this.selectMaskVal);let t=this.isPathMode();this.checkAndEnableDrawingMode(t,this.selectMaskVal)}onMouseMove(i){1===this.step&&(super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResultOnMove()))}onMouseUp(i){if(1===this.step){if(this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}super.onMouseUp(i)}}isPathMode(){return this.actionController.getCutout()instanceof Ki&&this.actionController.getCutout().isPathMode()}drawOutputImage(i,t){this.baseFilter&&(this.baseFilter.image=i,this.baseFilter.previewMode=this.previewMode?1:0,this.baseFilter.invertMask=this.invertMask?1:0,this.baseFilter.transparentBG=this.originalBg?0:1,super.drawOutputImage(i,t))}onMouseDown(i){1===this.step&&(this.photoEditorService.isDirty=!0,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult())}addFilter(){let i=new ft.Y;this.baseFilter=1===this.step?new pe.fabric.Image.filters.CutoutFilter({image:null,adjustment:i.adjustedValues}):new pe.fabric.Image.filters.SilhouetteFilter({image:null,adjustment:i.adjustedValues}),super.addFilter()}renderAll(){this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}processResult(){const i=this.actionController.getCutout().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){if(this.shouldRender(this.isPathMode())){const i=this.actionController.getCutout().getMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}this.index++}isUndoable(){return 1===this.step&&this.actionController.isUndoModeAvailable()}isRedoable(){return 1===this.step&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo n
1ot available!!")}changeScale(i){this.photoEditorService.isDirty=!0}bgChangedhandler(i){this.photoEditorService.isDirty=!0,this.bg=i,this.changeExposureFilter()}applyChanges(i,t=null){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1,this.step=0,this.photoEditorService.inProgress=!0;let r=i.image;if(this.photoEditorService.inProgress=!1,this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(f,r,i.uri,t)}this.restAndApplyEvent.emit()}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.resetAll(),this.selectMaskVal=me.Uq,this.actionController.reset(),this.actionController.delete(),this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=10),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1},!1)}resetAll(){}cancel(){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.resetAll(),this.unconfigureFabricCanvas(),this.isEdit=!1,this.actionController.reset(),this.actionController.delete(),this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=10),this.photoEditorService.isLoaded=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1},!1),this.restAndApplyEvent.emit(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}backToBackground(i){this.step=0}changeBg(){this.isLoaded&&(this.step=2)}toggleOriginalBg(i){var t=this;return(0,n.A)(function*(){t.exposure=75,i?(t.originalBg=!0,t.stateService.mainCanvas.clear(),yield t.zoomService.init(26,t.inputImage.width,t.inputImage.height),t.inputImage.set({scaleX:1,scaleY:1,left:0,top:0,angle:0,clipTo:null,clipPath:null}),t.drawOutputImage(t.removeBgMask,t.stateService.mainCanvasNative),t.stateService.mainCanvas.add(t.inputImage)):(t.originalBg=!1,t.gotoPreview())})()}onRefineMaskClick(i){this.isLoaded&&this.refineMask()}refineMask(){const i=this.photoEditorService.getPhotoEditorInputImages().resolutionMax1080;this.photoEditorService.photoEditorOptions.mask=this.photoEditorService.upScaleByResizeFilter(i.width,i.height,1,this.removeBgMask),this.step=1,this.isEdit=!0,this.unconfigureFabricCanvas(),this.previewMode=!0,this.photoEditorService.isExportable=!1,this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.processResult()},!0,!0)}applySilhouette(){this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.removeBgService.resolvedModule?this.processAutoMaskImage():this.removeBgService.resolveModule("lightxSegModule","seglightx.js",i=>{}).then(()=>{this.processAutoMaskImage()})}processAutoMaskImage(){this.photoEditorService.originalImage&&(this.removeBgService.closeProgress(),this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.cdRef.detectChanges(),setTimeout(()=>{this.removeBgService.getAutoBlurMask(this.photoEditorService.originalImage,2).then(i=>{this.processImage(i)}).catch(()=>{this.photoEditorService.clearProcessingProgress()})},1e3))}processImage(i){this.photoEditorService.originalImage&&(this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=10),this.removeBgService.getMask(this.photoEditorService.originalImage,i).then(t=>{this.removeBgMask=this.photoEditorService.upScaleByResizeFilter(this.photoEditorService.originalImage.width,this.photoEditorService.originalImage.height,1,t),this.isLoaded=!0,this.exposure=75,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.completeProcessingProgress(),this.photoEditorService.isCompareEnable=!0,this.bg=this.bg||{url:"https://d2v5dzhdg4zhx3.cloudfront.net/hd/bgs/SilhoutteTool/036.jpg",pattern:!0},this.gotoPreview()}))}
1exitRefine(){this.photoEditorService.photoEditorOptions.mask=null;const i=this.actionController.getCutout().getSmoothMaskMat();this.reloadImage(()=>{const t=this.photoEditorService.originalImage;this.removeBgMask=this.photoEditorService.upScaleByResizeFilter(t.width,t.height,1,i.image),this.gotoPreview(!0)},!1)}gotoPreview(i=!1){this.step=0,i&&this.addFilter(),this.drawOutputImage(this.removeBgMask,this.stateService.mainCanvasNative),this.previewMode=!0,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.selectedOption=null,this.unconfigureFabricCanvas(),this.stateService.mainCanvas.selection=!0,this.stateService.mainCanvas.clear();let t=new He(this.inputImage,this.stateService.mainCanvas);this.activeObject=t,this.activeObject.addToCanvas(this.stateService.mainCanvas),this.addBgIfAny(),setTimeout(()=>{this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0},100)}addBgIfAny(){this.bg&&!this.originalBg&&(this.bg.color&&this.photoEditorService.changeBgColor(this.bg.color),this.bg.url&&(this.bg.pattern?this.photoEditorService.addPattern({imgUrl:this.bg.url}).then(i=>{this.bg.fabricBgImage=i,this.changeExposureFilter()}):this.photoEditorService.addBgImage(this.bg.url,this.activeObject,(i,t)=>{this.bg.fabricBgImage=t,this.changeExposureFilter()})))}inputExposure(i){let t;t=i.newValue?i.newValue:i,t>0?t>100?setTimeout(()=>{this.changeExposure(100)},0):setTimeout(()=>{this.changeExposure(t)},0):setTimeout(()=>{this.changeExposure(0)},0)}changeExposure(i){this.exposure=i,this.changeExposureFilter()}changeExposureFilter(){let i;100==this.exposure?(i=!1,this.baseFilter.exposure=0,this.applyFilters(i,0)):this.bg&&this.bg.fabricBgImage&&!this.bg.fabricBgImage.filters[0]?(this.baseFilter.exposure=(this.exposure-100)/100,i=new this.f.Exposure({exposure:(this.exposure-100)/100}),this.applyFilters(i,0)):this.bg&&this.bg.fabricBgImage?(this.baseFilter.exposure=(this.exposure-100)/100,this.applyFilterValue(this.bg.fabricBgImage,0,"exposure",(this.exposure-100)/100)):this.baseFilter.exposure=(this.exposure-100)/100,this.originalBg?this.renderAll():this.stateService.mainCanvas.renderAll()}applyFilters(i,t){this.bg.fabricBgImage.filters[t]=i,this.bg.fabricBgImage.applyFilters()}applyFilterValue(i,t,r,f){i.filters[t]&&(i.filters[t][r]=f,i.applyFilters())}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(e.gRc),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(vt.r))},c.\u0275cmp=e.VBU({type:c,selectors:[["silhouette-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Vt3],decls:8,vars:12,consts:[[1,"scroll-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Silhouette",1,"d-none"],[1,"child-drawer",3,"ngClass"],[4,"ngIf"],["customScrollDir","",1,"scroll-container",2,"height","calc(100% - 60px)"],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125"],[1,"ngb-btn","common-container","p-0","m-0"],["type","button",1,"btn-all","btn-outline-primary","btn-editor-panel","mb-9","w-100","h-40","border-radius-12","text-13",3,"click","ngClass"],[1,"card-body","mt-2"],[1,"text-normal","text-dark","text-semi","lh-125"],[1,"d-flex","align-items-center","mt-8"],[1,"wp-100"],[1,"opacity-slider",3,"change","slideStop","enabled","value","min","max","step"],[1,"ml-9"],["mask","000","type","text",1,"form-control","form-input-sm","text-normal","text-black","brush-input",3,"ngModelChange","disabled","ngModel"],[1,"d-flex","align-items-center","mt-10","mb-10"],[1,"editor-toggle",2,"height","26px"],[1,"d-flex","align-items-center","mb-0",3,"changeT","disabled","selected"],["ngbAccordion","",4,"ngIf"],[1,"position-fixed","fixed-bottom","pt-2","pb-9","ps-3","pe-3","bg-white"],[1,"d-flex","wp-100","justify-content-between"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"],["ngbAccordion",""],["ngbAccordionItem","silhouette-bg",1,"tab-div"],["ngbAccordionHeader",""],[1,"w-100","d-flex","align-items-center",3,"click"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0","ms-auto"],["name","lineicon","class","f-40",4,"ngIf"],["class","hw-40 btn-bg-preview",3,"ngStyle",4,"ngIf"],["name","lineicon",1,"f-40"],[1,"hw-40","btn-bg-preview",3,"ngStyle"],["customScrollDir","",1,"scroll-container"],[1,"d-flex","align-items-center","common-container","p-0","m-0",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],[1,"",2,"margin-top","-8px"],[3,"changeBruceSize","change","tabPane","activePane"],[3,"bgChanged","backToBackgroun
1d","changeScale","bg","activeObject","bgLibrary"]],template:function(i,t){1&i&&(e.j41(0,"div",0),e.nrm(1,"input",1),e.j41(2,"div",2),e.DNE(3,lr,29,16,"ng-container",3),e.k0s(),e.j41(4,"div",2),e.DNE(5,cr,8,2,"ng-container",3),e.k0s(),e.j41(6,"div",2),e.DNE(7,hr,2,3,"ng-container",3),e.k0s()()),2&i&&(e.R7$(2),e.Y8G("ngClass",e.eq3(6,Oi,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(8,Oi,1==t.step)),e.R7$(),e.Y8G("ngIf",1==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(10,Oi,2==t.step)),e.R7$(),e.Y8G("ngIf",2==t.step))},dependencies:[I.YU,I.bT,I.B3,Ut.C,de.q,Y.WP,Y.r6,Y.tW,Y.x7,we.me,we.BC,we.vS,z.wQ,qe.d1,pt.Zr,Ce.b,ki,Et],styles:[".btn[_ngcontent-%COMP%]:first-child:active{border-color:none}.child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}.btn-outline-primary.disabled[_ngcontent-%COMP%]{border:1px solid #E2E3E9!important}"]}),v})();var pr=g(95726);function ur(c,v){if(1&c&&(e.j41(0,"span",10),e.EFF(1),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.Lme("",s.width," x ",s.height," px")}}function mr(c,v){if(1&c&&(e.j41(0,"div",11)(1,"a",12)(2,"i",13),e.nrm(3,"pi",14),e.k0s(),e.j41(4,"span",15),e.EFF(5,"Download HD"),e.k0s()(),e.j41(6,"span",16),e.EFF(7,"4000 x 4000 px"),e.k0s()()),2&c){const s=e.XpG();e.R7$(),e.FS9("href",s.commonService.playStorUrl,e.B4B)}}const Zi=["image/jpg","image/jpeg","image/pjpeg","image/png","image/webp"];let gr=(()=>{var c;class v{constructor(i,t,r,f,T,N,H){this.photoEditorService=i,this.commonService=t,this.uploadImageService=r,this.toastService=f,this.downloadService=T,this.gtmService=N,this.route=H,this.btnText="Customize",this.isHdEnable=!1,this.imgQueryParams={imageUrl:"",tabName:"",from:"",editorType:""},this.fileUploadAccept=Zi.join(",")}ngOnInit(){this.tab=this.route.snapshot.queryParamMap.get("tab"),this.imgUrl=this.route.snapshot.queryParamMap.get("img"),this.from=this.route.snapshot.queryParamMap.get("from")}download(){let i=this.width/this.mainCanvasWidth;this.downloadService.getImageType(this.imgUrl).then(t=>{this.uploadImageService.imgFormat=t,this.gtmService.pushTag({eventName:w.b.gtm.eventname.intermediateDownload,itemName:"photo-resizer",itemValue:"photo-resizer_Mobile"}),this.photoEditorService.download(this.tab,this.uploadImageService.imgFormat,i)})}onFileUploaded(i){if(!i.length)return;const t=i[0];let r=t.name.split(".")[1];if(this.uploadImageService.imgFormat=r,Zi.indexOf(t.type)<0)return void this.toastService.showErrorSingle(w.b.message.validImageMessageForEdit);const f=URL.createObjectURL(t);this.imgQueryParams.imageUrl=f,this.imgQueryParams.from="header",this.imgQueryParams.tabName=this.tab,this.imgQueryParams.editorType=E._Y.Photo,this.uploadImageService.loadInputImage(this.imgQueryParams,()=>{})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(l.p),e.rXU(Ti.h),e.rXU(F.A),e.rXU(Z.f),e.rXU(pr.s),e.rXU(he.y),e.rXU(z.nX))},c.\u0275cmp=e.VBU({type:c,selectors:[["mobile-view-editor"]],inputs:{btnText:"btnText",width:"width",height:"height",mainCanvasWidth:"mainCanvasWidth",isHdEnable:"isHdEnable"},decls:13,vars:5,consts:[["file",""],[1,"row","m-b-btn"],[1,"col-6","col-lg-12","mb-3","pe-1"],["target","_blank",1,"btn","btn-outline-primary","btn-h48","p-0","w-100",3,"href"],[1,"col-6","col-lg-12","mb-3","ps-1"],["id","mo_vi_ed_dw",1,"btn","btn-primary","btn-h48","p-0","w-100",3,"click"],["class","dim-text text-semi d-none",4,"ngIf"],["class","col-6 col-lg-6 pl-2",4,"ngIf"],["for","fileInput",1,"try-ano","text-semi","w-auto","mt-0","mb-0","align-items-center","justify-content-center",2,"height","48px"],["id","fileInput","name","fileInput","type","file",1,"custom-file-input","d-none",3,"change","click","accept"],[1,"dim-text","text-semi","d-none"],[1,"col-6","col-lg-6","pl-2"],["id","go_to_pl_st","target","_blank",1,"btn","btn-primary","btn-h48","p-0","w-100","mb-1",3,"href"],[1,"icon","hw-24","mr-2"],["name","prousernew",1,"f-24"],[1,"d-inline-block"],[1,"dim-text","text-semi"]],template:function(i,t){if(1&i){const r=e.RV6();
1e.j41(0,"div",1)(1,"div",2)(2,"a",3),e.EFF(3),e.k0s()(),e.j41(4,"div",4)(5,"button",5),e.bIt("click",function(){return e.eBV(r),e.Njj(t.download())}),e.EFF(6," Download "),e.k0s(),e.DNE(7,ur,2,2,"span",6),e.k0s(),e.DNE(8,mr,8,1,"div",7),e.j41(9,"label",8),e.EFF(10,"Try another image ?"),e.k0s(),e.j41(11,"input",9,0),e.bIt("change",function(T){return e.eBV(r),e.Njj(t.onFileUploaded(T.srcElement.files))})("click",function(){e.eBV(r);const T=e.sdS(12);return e.Njj(T.value="")}),e.k0s()()}2&i&&(e.R7$(2),e.FS9("href",t.commonService.playStorUrl,e.B4B),e.R7$(),e.SpI(" ",t.btnText," "),e.R7$(4),e.Y8G("ngIf",t.width&&t.height),e.R7$(),e.Y8G("ngIf",t.isHdEnable),e.R7$(3),e.Y8G("accept",t.fileUploadAccept))},dependencies:[I.bT,Ce.b],styles:[".m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%], .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]{font-size:16px;display:flex;align-items:center;justify-content:center}.m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:focus, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:visited, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:hover, .m-b-btn[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]:active{color:#fff;background-color:#626adf;border-color:#626adf}.m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:focus, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:visited, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:hover, .m-b-btn[_ngcontent-%COMP%] .btn-outline-primary[_ngcontent-%COMP%]:active{background:#626adf0d;border:1px solid #626ADF;color:#626adf}.m-b-btn[_ngcontent-%COMP%] button[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{vertical-align:baseline}.m-b-btn[_ngcontent-%COMP%] .dim-text[_ngcontent-%COMP%]{display:block;font-style:normal;font-size:13px;line-height:18px;text-align:center;color:#b0b3bf}.m-b-btn[_ngcontent-%COMP%] .try-ano[_ngcontent-%COMP%]{display:inline-flex;font-style:normal;font-size:13px;line-height:18px;color:#626adf;margin:8px auto 12px;cursor:pointer}.m-b-btn[_ngcontent-%COMP%] .custom-file-input[_ngcontent-%COMP%]{position:absolute;z-index:-99}"]}),v})();const Gt=c=>({"drawer-active":c});function _r(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",7)(2,"div",8)(3,"pi",9),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoPreview(!0))}),e.k0s(),e.j41(4,"span",10),e.EFF(5,"Refine Mask"),e.k0s()(),e.j41(6,"refine-mask-edit-tools",11),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeTools(t))}),e.k0s()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(6),e.Y8G("showmask",!0)("tabPane",s.tabPane)("activePane",s.selectMaskVal)}}function fr(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",13)(1,"div",16)(2,"pi",9),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.step=0)}),e.k0s(),e.j41(3,"span",10),e.EFF(4,"Sticker Maker"),e.k0s(),e.j41(5,"pi",17),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(6,"div",18)(7,"div",19)(8,"video",20),e.nrm(9,"source",21),e.EFF(10," Your browser does not support the video tag. "),e.k0s()(),e.j41(11,"div",22)(12,"p",23),e.EFF(13,"Select an area over canvas which you want to keep."),e.k0s()()()()}2&c&&(e.R7$(8),e.Y8G("muted","muted"))}function vr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",24)(2,"pi",25),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.gotoPreview())}),e.k0s(),e.j41(3,"span",26),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.refineMask(2))}),e.EFF(4,"Edit Cutout"),e.k0s()(),e.j41(5,"refine-mask-edit-tools",11),e.bIt("changeBruceSize",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeBruceSize(t))})("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeTools(t))}),e.k0s(),e.bVm()}if(2&c){const s=e.XpG(2);e.R7$(5),e.Y8G("showmask",!0)("tabPane",s.tabPane)("activePane",s.selectMaskVal)}}function br(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",27)(1,"div",28)(2,"button",29),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",30),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.gotoPreview())}),e.EFF(5,"Next"),e.k0s()()()}}function Cr(c,v){if(1&c&&(e.qex(0),e.j41(1,"div",12)(2,"div",13),e.DNE(3,fr,14,1,"div",14)(4,vr,6,3,"
1ng-container",5),e.nrm(5,"div"),e.k0s(),e.DNE(6,br,6,0,"div",15),e.k0s(),e.bVm()),2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",!s.isEdit),e.R7$(),e.Y8G("ngIf",s.isEdit),e.R7$(2),e.Y8G("ngIf",s.isEdit)}}function xr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",31)(2,"pi",9),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.back())}),e.k0s(),e.j41(3,"span",10),e.EFF(4,"Sticker Maker"),e.k0s(),e.j41(5,"pi",32),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(6,"div",33)(7,"div",34)(8,"button",35),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.autoMask())}),e.j41(9,"div",36),e.nrm(10,"pei",37),e.EFF(11," Auto "),e.k0s()()(),e.j41(12,"div",34)(13,"button",35),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.manual())}),e.j41(14,"div",36),e.nrm(15,"pei",38),e.EFF(16," Manual "),e.k0s()()()(),e.bVm()}}function Sr(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",66)(1,"div",67)(2,"div",68)(3,"div",69)(4,"div",70)(5,"span",71),e.EFF(6,"Color"),e.k0s()(),e.j41(7,"div",72)(8,"div",73)(9,"div",74)(10,"div",75)(11,"button",76),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.outlineColorPanelVisible=!0)}),e.nrm(12,"pi",77),e.k0s()(),e.j41(13,"div",78)(14,"input",79),e.bIt("blur",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.focusOut(t,"outline"))}),e.k0s()()()()()(),e.j41(15,"h5",80),e.EFF(16,"Thickness"),e.k0s(),e.j41(17,"div",81)(18,"div",82)(19,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.outlineThicknessSize(t,35))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.outlineThicknessSize(t,50))}),e.k0s()(),e.j41(20,"div",84)(21,"input",85),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.outlineThicknessSize(t,50))}),e.k0s()()(),e.j41(22,"h5",86),e.EFF(23,"Opacity"),e.k0s(),e.j41(24,"div",81)(25,"div",82)(26,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setOutlineOpacity(t,35))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setOutlineOpacity(t,50))}),e.k0s()(),e.j41(27,"div",84)(28,"input",87),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setOutlineOpacity(t,50))}),e.k0s()()()()()()}if(2&c){const s=e.XpG(3);e.R7$(11),e.xc7("background",s.selectedOutlineColor),e.R7$(3),e.Y8G("value",s.selectedOutlineColor),e.R7$(5),e.Y8G("value",s.outlineThickness)("min",1)("max",20)("step",1),e.R7$(2),e.Y8G("ngModel",s.outlineThickness)("min",1)("max",20)("defaultValue",1),e.R7$(5),e.Y8G("value",s.outlineOpacity)("min",1)("max",100)("step",1),e.R7$(2),e.Y8G("ngModel",s.outlineOpacity)("min",1)("max",100)("defaultValue",1)}}function Er(c,v){if(1&c&&e.DNE(0,Sr,29,19,"div",65),2&c){const s=e.XpG(2);e.Y8G("ngIf",s.toggleOutline)}}function yr(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",89)(1,"div",66)(2,"span",71),e.EFF(3,"Direction"),e.k0s(),e.j41(4,"div",90)(5,"div",91)(6,"buttons-scroll-menu",92),e.bIt("selectLayout",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.selectShadow(t))}),e.k0s()()(),e.j41(7,"div",93)(8,"span",71),e.EFF(9,"X-Direction"),e.k0s(),e.j41(10,"div",94)(11,"div",82)(12,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputXDirection(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputXDirection(t))}),e.k0s()(),e.j41(13,"div",84)(14,"input",95,0),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputXDirection(t))})("keydown.enter",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.focusOutRotate(t))}),e.k0s()()()(),e.j41(16,"div",96)(17,"span",71),e.EFF(18,"Y-Direction"),e.k0s(),e.j41(19,"div",94)(20,"div",82)(21,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputYDirection(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputYDirection(t))}),e.k0s()(),e.j41(22,"div",84)(23,"input",95,1),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputYDirection(t))})("keydown.enter",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.focusOutRotate(t))}),e.k0s()()()(),e.j41(25,"div",97)(26,"div",70)(27,"span",71),e.EFF(28,"Color"),e.k0s()(),e.j41(29,"div",72)(30,"div",73)(31,"div",74)(32,"div",75)(33,"button",76),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.shadowColorPanelVisible=!0)}),e.nrm(34,"pi",77),e.k0s()(),e.j41(35,"div",78)(36,"input",79),e.bIt("blur",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.focusOut(t,"shadow"))}),e.k0s()()()()()(),e.j41(37,"div",98)(38,"div",99)(39,"span",71),e.EFF(40,"Blur"),e.k0s()(),e.j41(41,"div",100)(42,"div",101)(43,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputBlur(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.changeBlur(t))}),e.k0s()(),e.j41(44,"div",102)(45,"input",103),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.inputBlur(t))}),e.k0s()()()(),e.j41(46,"div",104)(47,"div",99)(48,"span",71),e.EFF(49,"Opacity"),e.k0s()(),e.j41(50,"div",100)(51,"div",101)(52,"mv-slider",83),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setShadowOpacity(t))})("slideStop",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setShadowOpacity(t))}),e.k0s()(),e.j41(53,"div",102)(54,"input",105),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.setShadowOpacity(t))}),e.k0s()()()()()()}if(2&c){const s=e.XpG(3);e.R7$(6),e.Y8G("items",s.shadowList)("type","shadowIcon")("categoryId",s.selectedId),e.R7$(6),e.Y8G("value",s.xDirection)("min",-180)("max",180)("step",1),e.R7$(2),e.Y8G("min",-180)("max",180)("ngModel",s.xDirection)("allowNegativeNumbers",!0),e.R7$(7),e.Y8G("value",s.yDirection)("min",-180)("max",180)("step",1),e.R7$(2),e.Y8G("min",-180)("max",180)("ngModel",s.yDirection)("allowNegativeNumbers",!0),e.R7$(10),e.xc7("background",s.selectedShadowColor),e.R7$(3),e.Y8G("value",s.selectedShadowColor),e.R7$(7),e.Y8G("value",s.blur)("min",0)("max",100)("step",1),e.R7$(2),e.Y8G("min",0)("max",100)("ngModel",s.blur),e.R7$(7),e.Y8G("value",s.shadowOpacity)("min",1)("max",100)("step",1),e.R7$(2),e.Y8G("min",1)("max",100)("defaultValue",1)("ngModel",s.shadowOpacity)}}function wr(c,v){if(1&c&&e.DNE(0,yr,55,37,"div",88),2&c){const s=e.XpG(2);e.Y8G("ngIf",s.toggleShadow)}}function kr(c,v){if(1&c&&(e.j41(0,"div",106)(1,"div",66)(2,"div",107),e.nrm(3,"adjust-tool",108),e.k0s()()()),2&c){const s=e.XpG(2);e.R7$(3),e.Y8G("activeObject",s.activeObject)("Align",!1)("Scale",!0)("Rotate",!0)("Flip",!0)}}function Tr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",12)(2,"div",13)(3,"div",39)(4,"div",40)(5,"span",10),e.EFF(6,"Sticker Maker"),e.k0s(),e.j41(7,"pi",41),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.gotoVedioPreview())}),e.k0s()(),e.j41(8,"button",42),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.refineMask(3))}),e.EFF(9,"Edit Cutout"),e.k0s(),e.j41(10,"div",43)(11,"div",44)(12,"div",45)(13,"div",46)(14,"button",47)(15,"div",48),e.
1EFF(16,"Outline"),e.k0s()(),e.j41(17,"div",49)(18,"toggle-switch",50),e.bIt("changeT",function(t){e.eBV(s);const r=e.XpG();return r.toggleOutlineCollaps=!t,e.Njj(r.toggleOutlineChange(t))}),e.k0s()(),e.j41(19,"button",51)(20,"span",52)(21,"pi",53),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.toggleOutlineCollaps=!0)}),e.k0s()(),e.j41(22,"span",54)(23,"pi",55),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return t.toggleOutlineCollaps=!1,t.toggleOutline=!0,e.Njj(t.toggleOutlineChange(t.toggleOutline,!0))}),e.k0s()()()()(),e.j41(24,"div",56)(25,"div",57),e.DNE(26,Er,1,1,"ng-template"),e.k0s()()(),e.j41(27,"div",58)(28,"div",45)(29,"div",46)(30,"button",47)(31,"div",48),e.EFF(32,"Shadow"),e.k0s()(),e.j41(33,"div",49)(34,"toggle-switch",50),e.bIt("changeT",function(t){e.eBV(s);const r=e.XpG();return r.toggleShadowCollaps=!t,e.Njj(r.toggleShadowChange(t))}),e.k0s()(),e.j41(35,"button",51)(36,"span",59),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.toggleShadowCollaps=!0)}),e.nrm(37,"pi",60),e.k0s(),e.j41(38,"span",61),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return t.toggleShadowCollaps=!1,t.toggleShadow=!0,e.Njj(t.toggleShadowChange(t.toggleShadow,!0))}),e.nrm(39,"pi",62),e.k0s()()()(),e.j41(40,"div",56)(41,"div",57),e.DNE(42,wr,1,1,"ng-template"),e.k0s()()(),e.j41(43,"div",63)(44,"div",45)(45,"div",64),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.toggletransformChange(t))}),e.j41(46,"button",47)(47,"div",48),e.EFF(48,"Transform"),e.k0s()(),e.j41(49,"button",51)(50,"span",52),e.nrm(51,"pi",60),e.k0s(),e.j41(52,"span",54),e.nrm(53,"pi",62),e.k0s()()()(),e.j41(54,"div",56)(55,"div",57),e.DNE(56,kr,4,5,"ng-template"),e.k0s()()()()()(),e.j41(57,"div",27)(58,"div",28)(59,"button",29),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(60,"Cancel"),e.k0s(),e.j41(61,"button",30),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply())}),e.EFF(62,"Apply"),e.k0s()()()(),e.bVm()}if(2&c){const s=e.XpG();e.R7$(10),e.Y8G("destroyOnHide",!0),e.R7$(),e.Y8G("collapsed",!1)("disabled",!s.toggleOutline),e.R7$(7),e.Y8G("selected",s.toggleOutline),e.R7$(9),e.Y8G("disabled",!s.toggleShadow),e.R7$(7),e.Y8G("selected",s.toggleShadow)}}function Pr(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",109)(1,"div",110)(2,"div",111)(3,"div",13)(4,"button",112),e.EFF(5,"Custom"),e.k0s(),e.j41(6,"button",113),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.outlineColorPanelVisible=!1)}),e.nrm(7,"pi",114),e.k0s()(),e.j41(8,"app-color-picker-panel",115),e.bIt("changed",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeColor(t))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(8),e.Y8G("selectedColor",s.selectedOutlineColor)}}function Ir(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",109)(1,"div",110)(2,"div",111)(3,"div",13)(4,"button",112),e.EFF(5,"Custom"),e.k0s(),e.j41(6,"button",113),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.shadowColorPanelVisible=!1)}),e.nrm(7,"pi",114),e.k0s()(),e.j41(8,"app-color-picker-panel",115),e.bIt("changed",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeShadowColor(t))}),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(8),e.Y8G("selectedColor",s.selectedShadowColor)}}let Mr=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve){super(f,T,N,H,ae),this.canvasService=i,this.authService=t,this.injector=r,this.photoEditorService=f,this.stateService=T,this.zoomService=N,this.uploadService=H,this.uploadImageService=q,this.cdRef=ne,this.document=se,this.route=ae,this.removeBgService=ce,this.commonService=ve,this.restAndApplyEvent=new e.bkB,this.selectMaskVal=me.Uq,this.isEdit=!1,this.isApply=!0,this.step=0,this.previewMode=!1,this.f=pe.fabric.Image.filters,this.exposure=0,this.invertMask=!1,this.isLoaded=!1,this.tabPane="removebg",this.activeAccPanelId="",this.blur=30,this.xDirection=0,this.yDirection=0,this.colorsBgPresets=[],this.selectedOutlineColor="#F8F8FA",this.selectedShadowColor="#000000",this.outlineOpacity=100,this.shadowOpacity=70,this.bgChanged=new e.bkB,this.changeScale=new e.bkB,this.outlineThickness=5,this.toggleShadow=!0,this.toggleOutline=!0,this.toggleTransform=!1,this.toggleShadowCollaps=!1,this.toggleOutlineCollaps=!1,this.tpp=1,this.DEFAULT_THICKNESS=5,this.outlineColorPanelVisible=!1,this.shadowColorPanelVisible=!1,this.selectedId=0,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.colorsBgPresets=M.PV.ui.colorBgPresets.items,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(Se=>{Se&&(this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),this.stateService.mainCanvas&&this.stateService.mainCanvas.clear(),setTimeout(()=>{this.init(()=>{this.resetValues()})},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(Se=>{this.user=this.authService.currentUser()})}accPanelChanged(i){"transform-panel-0"===i.panelId&&(this.activeAccPanelId=i.nextState?i.panelId:"null")}setMaxThickness(i){let t=this.stateService.mainCanvas.toCanvasElement(1/this.zoomService.currentZoom),f=t.getContext("2d").getImageData(0,0,t.width,t.height),T=this.getTrimmedBound(f,t.width);this.tpp=(T.right-T.left+1)/100/2}changeColor(i){this.selectedOutlineColor=i,this.adjustOutline()}setOutlineOpacity(i,t){let r;r=i.newValue||0===i.newValue?i.newValue:i,this.outlineOpacity=r,this.adjustOutline(t)}setOutlineOpacity1(i,t){let r,f;i.hasOwnProperty("newValue")?(r=i.newValue,f=!1):(r=i,f=!0),r&&!Number.isNaN(r)?r>100?(r=100,this.outlineOpacity=r):this.outlineOpacity=r<0?100:r:this.outlineOpacity=100,this.adjustOutline(t)}changeShadowColor(i){this.selectedShadowColor=i,this.applyShadow()}setShadowOpacity1(i){let t,r;i.hasOwnProperty("newValue")?(t=i.newValue,r=!1):(t=i,r=!0),t&&!Number.isNaN(t)?t>100?(t=100,this.shadowOpacity=t):this.shadowOpacity=t<0?100:t:this.shadowOpacity=100,this.applyShadow()}setShadowOpacity(i){let t;t=i.newValue||0===i.newValue?i.newValue:i,this.shadowOpacity=t,this.applyShadow()}outlineThicknessSize(i,t){let r;r=i.newValue||0===i.newValue?i.newValue:i,this.outlineThickness=r,this.adjustOutline(t)}outlineThicknessSize1(i,t){let r,f;i.hasOwnProperty("newValue")?(r=i.newValue,f=!1):(r=i,f=!0),r&&!Number.isNaN(r)&&(r>20?(r=20,this.outlineThickness=r):this.outlineThickness=r<0?1:r),this.adjustOutline(t)}gotoVedioPreview(){this.photoEditorService.openVedio(w.b.tutorials.cutout)}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy()}getShadowList(){return[{id:1,icon:"shadow1",xDir:-90,yDir:0,tipName:"Left"},{id:2,icon:"shadow2",xDir:-90,yDir:90,tipName:"Bottom Left"},{id:3,icon:"shadow3",xDir:0,yDir:90,tipName:"Bottom"},{id:4,icon:"shadow4",xDir:90,yDir:90,tipName:"Bottom Right"},{id:5,icon:"shadow5",xDir:90,yDir:0,tipName:"Right"},{id:6,icon:"shadow6",xDir:90,yDir:-90,tipName:"Top Right"},{id:7,icon:"shadow7",xDir:0,yDir:-90,tipName:"Top"},{id:8,icon:"shadow8",xDir:-90,yDir:-90,tipName:"Top Left"}]}ngOnInit(){this.shadowList=this.getShadowList(),this.photoEditorService.toolNameForDownload="sticker",this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1})):this.init(()=>{}),this.onInit()}autoMask(){this.photoEditorService.inProgress||(this.toggleShadowCollaps=!1,this.toggleOutlineCollaps=!1,this.processAutoMask())}selectShadow(i){this.selectedId=i.id,this.xDirection=i.xDir,this.yDirection=i.yDir,this.applyShadow()}manual(){this.photoEditorService.inProgress||(this.photoEditorService.inProgress=!0,setTimeout(()=>{this.toggleShadowCollaps=!1,this.toggleOutlineCollaps=!1,this.isEdit=!1,this.step=2,this.tabPane="cutout",this.actionController=new lt,this.actionController&&(this.actionController.undoStepcount=19),this.baseFilter=null,this.addFilter(),this.actionController.createCutout(this.resolvedModule,this.res.imageData,this.res.imageData.width,this.res.imageData.height),this.processResult(),this.reset(()=>{this.photoEditorService.isDirty=!0,this.stateService.mainCanvas.isDrawingMode=!0,this.setMask(me.Uq),this.photoEditorService.inProgress=!1})},0))}reset(i,t=2){this.toggleOutline=!0,this.toggleShadow=!0,this.xDirection=0,this.yDirection=0,this.outlineThickness=5,this.blur=30,this.selectedShadowColor="#000000",this.outlineOpacity=100,this.shadowOpacity=70,this.selectedId=0,this.actionController.reset(),this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.isEdit=!1,this.setMask(me.Uq),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.reloadImage(()=>{this.processResult(),this.step=t,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,i()})}afterImageLoad(i){this.res=i,this.resolvedModule=i.module}changeBruceSize(i){i.selectedErase=!i.selectedErase,this.photoEditorService.brushSizeDisable=i}changeTools(i){"mask"===i.name?(this.selectedOption=i.selectedOption,this.setMask(i.value)):"size"===i.name?(this.setBruceIcon(i.value,i.selectedOption),this.actionController.getCutout().selectedOption=i.selectedOption,this.actionController.getCutout().setBrushSize(i.value)):"showmask"===i.name?(this.previewMode=!i.value,this.processResult(),this.photoEditorService.isDirty=!0):"invert"===i.name&&(this.invertMask=!this.invertMask,this.processResult(),this.photoEditorService.isDirty=!0)}setMask(i){this.selectMaskVal=i,this.actionController.getCutout().setSelectedOption(this.selectMaskVal);let t=this.isPathMode();this.checkAndEnableDrawingMode(t,this.selectMaskVal)}onMouseMove(i){(2==this.step||3==this.step)&&(super.onMouseMove(i),this.mouseDown&&(this.actionController.addPoint(this.currX,this.currY),this.processResultOnMove()))}onMouseUp(i){if(2==this.step||3==this.step){if(this.isPathMode()&&this.stateService.mainCanvas.getObjects().length>1){let t=this.stateService.mainCanvas.getObjects()[1];this.stateService.mainCanvas.remove(t)}this.mouseDown&&(this.actionController.onMouseUp(),this.processResult()),super.onMouseUp(i)}}isPathMode(){return(2==this.step||this.actionController.getCutout()instanceof Ki)&&this.actionController.getCutout().isPathMode()}onMouseDown(i){(2==this.step||3==this.step)&&(this.isEdit=!0,this.photoEditorService.isDirty=!0,super.onMouseDown(i),this.actionController.addPoint(this.currX,this.currY),this.processResult())}drawOutputImage(i,t){this.baseFilter&&(this.baseFilter.image=i,this.baseFilter.previewMode=this.previewMode?1:0,this.baseFilter.invertMask=this.invertMask?1:0,this.baseFilter.transparentBG=1,super.drawOutputImage(i,t))}setactivePanel(i){i&&(this.activeAccPanelId="",this.toggleShadow&&!this.toggleShadowCollaps&&(this.activeAccPanelId=""!=this.activeAccPanelId?this.activeAccPanelId.concat(",shadow-panel-1"):"shadow-panel-1"),this.toggleOutline&&!this.toggleOutlineCollaps&&(this.activeAccPanelId=""!=this.activeAccPanelId?this.activeAccPanelId.concat(",outline-panel-1"):"outline-panel-1"),this.toggleTransform&&(this.activeAccPanelId=""!=this.activeAccPanelId?this.activeAccPanelId.concat(",transform-panel-0"):"transform-panel-0"))}applyShadow(){const i=new pe.fabric.Color(this.selectedShadowColor);i.setAlpha(this.shadowOpacity/100);var t=new pe.fabric.Shadow({blur:this.blur,offsetX:this.xDirection,offsetY:this.yDirection,color:i.toRgba()});this.activeObject._mediaObjects.set({shadow:t}).canvas.renderAll()}toggleShadowChange(i,t=!0){if(this.toggleShadow=i,this.setactivePanel(t),this.toggleShadow){const f=new pe.fabric.Color(this.selectedShadowColor);f.setAlpha(this.shadowOpacity/100);var r=new pe.fabric.Shadow({blur:this.blur,offsetX:this.xDirection,offsetY:this.yDirection,color:f.toRgba()});this.activeObject._mediaObjects.set({shadow:r}).canvas.renderAll()}else this.activeObject._mediaObjects.set({shadow:null}).canvas.renderAll()}toggleOutlineChange(i,t=!0){this.toggleOutline=i,this.setactivePanel(t),i?this.adjustOutline(50):(this.outlineThickness=5,this.removeOutline())}toggletransformChange(i,t=!0){this.toggleTransform="null"!=i.activeAccPanelId,this.setactivePanel(t)}createCanvas(i,t){return Object.assign(document.createElement("canvas"),{width:i,height:t})}removeOutline(){this.AddfreshImage()}addFilter(){let i=new ft.Y;this.baseFilter=null,this.baseFilter=new pe.fabric.Image.filters.CutoutFilter({
1image:null,adjustment:i.adjustedValues}),super.addFilter()}renderAll(){this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}processResult(){const i=this.actionController.getCutout().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}processResultOnMove(){const i=this.actionController.getCutout().getMaskMat();this.maskImageData=i.image,this.drawOutputImage(i.image,this.stateService.mainCanvasNative),this.index++}isUndoable(){return(2===this.step||3===this.step)&&this.actionController.isUndoModeAvailable()}isRedoable(){return(2===this.step||3===this.step)&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult()):alert("Redo not available!!")}apply(){var i=this;let t=this.document.createElement("canvas");this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,t).then(function(){var r=(0,n.A)(function*(f){i.user?i.checkStorage(f.uri,function(){var T=(0,n.A)(function*(N,H){N&&H&&(yield i.photoEditorService.setPhotoEditorInputImages(f.image),i.applyChanges(f,H))});return function(N,H){return T.apply(this,arguments)}}()):(yield i.photoEditorService.setPhotoEditorInputImages(f.image),i.applyChanges(f)),i.zoomService.defaultZoom=!0,i.zoomService.fitToScreen()});return function(f){return r.apply(this,arguments)}}())}applyChanges(i,t=null){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.isApply=!0,this.photoEditorService.isApplyed=!0,this.isEdit=!1,this.step=0,this.photoEditorService.inProgress=!0;let r=i.image;if(this.photoEditorService.inProgress=!1,this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(f,r,i.uri,t)}this.restAndApplyEvent.emit()}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.selectMaskVal=me.Uq,this.actionController.reset(),this.actionController.delete(),this.actionController=new lt,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.previewMode=!1,this.invertMask=!1,this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1})}back(){this.photoEditorService.inProgress||this.restAndApplyEvent.emit()}resetValues(){this.blur=30,this.step=0,this.xDirection=0,this.yDirection=0,this.outlineThickness=this.DEFAULT_THICKNESS,this.selectedOutlineColor="#F8F8FA",this.selectedShadowColor="#000000",this.outlineOpacity=100,this.shadowOpacity=70,this.selectedId=0,this.toggleOutline=!0,this.toggleShadow=!0,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.unconfigureFabricCanvas(),this.isEdit=!1,this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.actionController=new lt}cancel(){this.resetValues(),this.photoEditorService.isLoaded=!1,this.stateService.mainCanvas.clear(),this.croppedImage=null,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1}),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}refineMask(i){this.step=i,3==this.step&&(this.selectMaskVal=me.WM),this.isEdit=!0,this.unconfigureFabricCanvas(),this.previewMode=!1,this.photoEditorService.isExportable=!1,this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.processResult()})}processAutoMask(){this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.removeBgService.resolvedModule?this.processAutoMaskImage():this.removeBgService.resolveModule("lightxSegModule","seglightx.js",i=>{}).then(()=>{this.processAutoMaskImage()})}processAutoMaskImage(){this.photoEditorService.originalImage&&(this.removeBgService.closeProgress(),this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.cdRef.detectChanges(),setTimeout(()=>{this.removeBgService.getAutoBlurMask(this.photoEditorService.originalImage,2).then(i=>{this.processImage(i),this.step=1}).catch(()=>{this.photoEditorService.clearProcessingProgress()})},1e3))}processImage(i){this.photoEditorService.originalImage&&(this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.actionController=new lt,this.actionController.createRemoveBgCutout(this.res.module,this.res.imageData,this.res.imageData.width,this.res.imageData.height),this.removeBgService.getMask(this.photoEditorService.originalImage,i).then(t=>{t=this.removelalala(t),this.maskImageData=t,this.actionController.getCutout().applyBgMaskNew(t,r=>{this.actionController.getCutout().renderCallback=()=>{this.processResult(),this.isLoaded=!0,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.completeProcessingProgress(()=>{this.gotoPreview()})}})}).catch(()=>{this.photoEditorService.clearProcessingProgress()}))}removelalala(i){let t=pe.fabric.util.createCanvasElement();t.width=i.width,t.height=i.height;const r=t.getContext("2d");return r.putImageData(i,0,0),this.removeBgService.trimCanvas(r,t.width,t.height,!0).ctx.getImageData(0,0,t.width,t.height)}resizeInputImage(){return new Promise((i,t)=>{this.canvasService.restoreImageResolution(this.photoEditorService.theOriginalOriginalImage,this.baseFilter.image,(r,f)=>{this.resotedImage=f,i()})})}gotoPreview(i=!1){this.photoEditorService.inProgress=!0,this.resizeInputImage().then(()=>
1{i&&(this.step=1),this.previewMode=!0,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.selectedOption=null,this.processResult(),this.inputHTMLImage=null,this.unconfigureFabricCanvas();let t=pe.fabric.util.object.clone(this.inputImage),r=pe.fabric.util.object.clone(this.baseFilter);r.previewMode=1,t.filters.push(r),t.applyFilters(),t.lockMovementX=!1,t.lockMovementY=!1,t.hasControls=!0,t.selectable=!0,this.setMaxThickness(this.baseFilter.image),this.stateService.mainCanvas.selection=!0,this.stateService.mainCanvas.clear();let f=new He(t,this.stateService.mainCanvas);if(this.inputCroppedObject=new He(t,this.stateService.mainCanvas),f.addToCanvas(this.stateService.mainCanvas),this.activeObject=f,setTimeout(()=>{this.photoEditorService.isDirty=!0,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.isExportable=!0},100),this.stateService.mainCanvas.selection=!0,this.toggleOutline&&this.adjustOutline(),this.toggleShadow){var T=new pe.fabric.Shadow({blur:this.blur,offsetX:this.xDirection,offsetY:this.yDirection});this.activeObject._mediaObjects.set({shadow:T}).canvas.renderAll()}this.photoEditorService.inProgress=!1,this.setactivePanel(!0),this.step=1,setTimeout(()=>{this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0},100)})}processResultOnPreview(){const i=this.actionController.getCutout().getSmoothMaskMat();this.drawOutputImage(i.image,this.stateService.mainCanvasNative)}inputBlur(i){let t;t=i.newValue?i.newValue:i,t>0?t>100?setTimeout(()=>{this.setShadow({blur:100})},0):setTimeout(()=>{this.setShadow({blur:t})},0):setTimeout(()=>{this.setShadow({blur:0})},0)}changeBlur(i){this.setShadow({blur:i})}setShadow(i){i.blur&&(this.blur=i.blur),this.activeObject._mediaObjects.set({shadow:this._getNewShadow(i)}).canvas.renderAll()}inputXDirection(i){let t;this.selectedId=null,t=i.newValue||0===i.newValue?i.newValue:i,this.xDirection=t,this.applyShadow()}_getNewShadow(i){let t=this.activeObject._mediaObjects.shadow;return t={...t,...i},t}inputYDirection(i){let t,r;this.selectedId=null,i.newValue||0===i.newValue?(t=i.newValue,r=!1):(t=i,r=!0),this.yDirection=t,this.applyShadow()}focusOutRotate(i){i.preventDefault()}stickerify(i,t,r=1,f="red",T=50){const N=1+(r*=this.tpp),H=r+1,q=this.createCanvas(i.width+2*N,i.height+2*H),ne=q.getContext("2d");for(let se=0;se<360;se+=360/T)ne.drawImage(i,r*Math.sin(2*Math.PI*se/360)+N,r*Math.cos(2*Math.PI*se/360)+H);return ne.globalCompositeOperation="source-in",ne.fillStyle=f,ne.fillRect(0,0,q.width,q.height),ne.globalCompositeOperation="source-over",ne.drawImage(t,N,H),q}adjustOutline(i=50){if(0==this.outlineThickness)return void this.removeOutline();let t;t=this.resotedImage;let N,H,r=this.getStickerBaseImage(t,this.outlineThickness),f=this.stickerify(r,t,this.outlineThickness,this.selectedOutlineColor,
1i),T=this.activeObject._mediaObjects;N=T.scaleX*(T.width/f.width),H=T.scaleY*(T.height/f.height);var q=new pe.fabric.Image(f,{left:T.left,top:T.top,scaleX:N,scaleY:H,angle:T.angle,flipX:T.flipX,flipY:T.flipY});let ne=this._getNewShadow({});this.activeObject.removeFromCanvas(this.stateService.mainCanvas),this.stateService.mainCanvas.clear();let se=new He(q,this.stateService.mainCanvas);se.addToCanvas(this.stateService.mainCanvas),this.stateService.mainCanvas.renderAll(),this.activeObject=se,ne&&this.activeObject._mediaObjects.set({shadow:ne}).canvas.renderAll()}getStickerBaseImage(i,t=4){let r=this.createCanvas(i.width,i.height),f=r.getContext("2d");f.drawImage(i,0,0),f.globalCompositeOperation="source-in";const T=new pe.fabric.Color(this.selectedOutlineColor);return T.setAlpha(this.outlineOpacity/100),f.fillStyle=T.toRgba(),f.fillRect(0,0,i.width,i.height),f.globalCompositeOperation="source-over",r}AddfreshImage(i=!1){let t;t=pe.fabric.util.object.clone(this.inputImage);let r=this.activeObject._mediaObjects,f=this._getNewShadow({}),T=this.activeObject.getAngle();t.set({left:r.left,top:r.top,scaleX:r.scaleX*(r.width/t.width),scaleY:r.scaleY*(r.height/t.height),angle:r.angle}),this.activeObject.removeFromCanvas(this.stateService.mainCanvas),this.stateService.mainCanvas.clear(),this.activeObject=null;let N=new He(t,this.stateService.mainCanvas);N.addToCanvas(this.stateService.mainCanvas),N.setAngle(T,!1),this.activeObject=N,f&&this.activeObject._mediaObjects.set({shadow:f}).canvas.renderAll()}trim(i){const t=i.getContext("2d"),r=this.createCanvas(i.width,i.height).getContext("2d"),f=t.getImageData(0,0,i.width,i.height);let H={top:null,left:null,right:null,bottom:null};H=this.getTrimmedBound(f,i.width);const q=H.bottom-H.top+1,ne=H.right-H.left+1,se=t.getImageData(H.left,H.top,ne,q);return r.canvas.width=ne,r.canvas.height=q,r.putImageData(se,0,0),r.canvas}getTrimmedBound(i,t){let r,f,T={top:null,left:null,right:null,bottom:null};for(let N=0;N<i.data.length;N+=4)0!==i.data[N+3]&&(r=N/4%t,f=~~(N/4/t),null===T.top&&(T.top=f),(null===T.left||r<T.left)&&(T.left=r),(null===T.right||T.right<r)&&(T.right=r),(null===T.bottom||T.bottom<f)&&(T.bottom=f));return T}cropmask(i){this.step=i,this.clipPath&&this.inputImage.set({clipPath:this.clipPath,scaleX:this.croppedImageOptions.scaleX,scaleY:this.croppedImageOptions.scaleY}),this.AddfreshImage(!0),this.activeObject.crop(this.stateService.page,!1,(t,r)=>{this.clipPath=new pe.fabric.Rect(this.activeObject._mediaObjects.clipPath),this.croppedImageOptions={scaleX:this.activeObject._mediaObjects.scaleX,scaleY:this.activeObject._mediaObjects.scaleY},setTimeout(()=>{this.adjustOutline()},300)})}focusOut(i,t){const r=this.commonService.isValidHexaCode(i.target.value);"shadow"==t?(r?this.selectedShadowColor=r:i.target.value=this.selectedShadowColor,this.applyShadow()):"outline"==t&&(r?this.selectedOutlineColor=r:i.target.value=this.selectedOutlineColor,this.adjustOutline())}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(Ft.W),e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(e.gRc),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(vt.r),e.rXU(Ti.h))},c.\u0275cmp=e.VBU({type:c,selectors:[["sticker-maker-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent",bgChanged:"bgChanged",changeScale:"changeScale"},features:[e.Vt3],decls:12,vars:18,consts:[["xDirInput",""],["yDirInput",""],[1,"scroll-content","stylize"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Sticker Maker",1,"d-none"],[1,"child-drawer",3,"ngClass"],[4,"ngIf"],["class","pane-section","style","position: initial !important;",4,"ngIf"],["customScrollDir","",1,"scroll-container"],[1,"d-flex","align-items-center","common-container","p-0","m-0",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],[3,"changeBruceSize","change","showmask","tabPane","activePane"],["customScrollDir","",1,"scroll-container",2,"height","calc(100% - 4rem)"],[1,""],["class","",4,"ngIf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3","style","z-index: 2;",4,"ngIf"],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32","ms-auto",2,"visibility","hidden",3,"click"],[1,"common-container","p-0","m-0"],[1,"d-flex","flex-column","text-center"],["autoplay","","loop","",2,"border-radius","12px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/cutout_new.mp4","type","video/mp4"],[1,"simple-text","d-flex","flex-column","mt-2"],[1,"text-14","text-regular","grey-800","mb-0"],[1,"d-flex","align-items-center",2,"min-height","56px"],["name","leftarrow",1,"f-24","back-icon","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2",3,"click"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3",2,"z-index","2"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","btn-h40","text-13",2,"width","130px",3,"click"],[1,"d-flex","align-items-center","justify-content-between","common-container",2,"min-height","56px"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-40","ms-auto",2,"visibility","hidden",3,"click"],[1,"common-container"],[1,"accordion-item","mb-2","tab-div","d-flex","align-items-center","wp-100"],["type","button",1,"btn-acc-title","btnBlur","h-48","collapsed",2,"width","100% !important",3,"click"],[1,"m-0","btn","btn-link","card-title","ms-3","h-100"],["name","blurauto",1,"pointer","f-28","me-3"],["name","blurmanual",1,"pointer","f-28","me-3"],[1,"ngb-btn","common-container","p-0","m-0"],[1,"d-flex","align-items-center","position-fixed","bg-white","justify-content-between",2,"width","272px","z-index","999","min-height","56px"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32",2,"visibility","hidden",3,"click"],[1,"btn-all","btn-outline-primary","btn-editor-panel","mb-9","mt-14","w-100","h-40","border-radius-12","text-13",3,"click"],["ngbAccordion","",3,"destroyOnHide"],["ngbAccordionItem","outline-panel-1",1,"tab-div",3,"collapsed","disabled"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],[1,"editor-toggle",2,"height","26px"],[1,"d-flex","align-items-center","mb-0",3,"changeT","selected"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24",3,"click"],[1,"expand-text"],["name","expandAcc",1,"f-24",3,"click"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],["ngbAccordionItem","shadow-panel-1",1,"tab-div",3,"disabled"],[1,"collapse-text","btn-link",3,"click"],["name","collapseAcc",1,"f-24"],[1,"expand-text",3,"click"],["name","expandAcc",1,"f-24"],["ngbAccordionItem","transform-panel-0",1,"tab-div"],[1,"d-flex","align-items-center","wp-100",3,"click"],["class","common-container mt-2",4,"ngIf"],[1,"common-container","mt-2"],[1,"card","drawer-card","mb-3"],[1,"card-body"],[1,"d-flex","w-100","flex-column","mt-2"],[1,"d-flex","align-items-center","justify-content-between","mb-9","w-100"],[1,"text-normal","text-dark","text-semi","lh-125"],[1,"drawer-elements"],[1,"d-flex","w-100","flex-column","bg-color-box"],[1,"row","g-0","m-0","align-items-center"],[1,"col-lg-7","pe-1","h-40"],["placement","top","ngbTooltip","Change Color","tooltipClass","tooltip-custom-all min-82",1,"no-style","color","control","p-0","color-box","w-100",3,"click"],["name","currentcoloricon",1,"f-24"],[1,"col-lg-5","ps-1","h-40"],["type","text","maxlength","7",1,"w-100","text-semi","text-black","bg-transparent",3,"blur","value"],[1,"card-title","m-0","text-semi","mt-10"],[1,"d-flex","mt-2"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ml-9"],["type","text","numberSettings","","maxlength","2","numbersOnly","",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","ngModel","min","max","defaultValue"],[1,"card-title","m-0","text-semi","mt-2"],["type","text","numberSettings","","maxlength","3","numbersOnly","",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","ngModel","min","max","defaultValue"],["class","btn-panel mt-2",4,"ngIf"],[1,"btn-panel","mt-2"],[1,"d-flex","align-items-center","justify-content-center","bg-white","filter-category"],[1,"colors-bg","sticker-buttons-scroll","scrollWidth-300"],[1,"mt-2",3,"selectLayout","items","type","categoryId"],[1,"card-body","mt-10"],[1,"d-flex","mt-1"],["type","text","numberSettings","","maxlength","4","mask","separator.2","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","min","max","ngModel","allowNegativeNumbers"],[1,"card-body","mt-10","mb-3"],[1,"d-flex","w-100","flex-column"],[1,"wp-100","align-items-center","mt-10"],[1,"d-flex","align-items-center","justify-content-between"],[1,"d-flex","align-items-center","justify-content-between","mt-1"],[1,"col-sm-9","p-0"],[1,"col-sm-2","p-0"],["type","text","numberSettings","","maxlength","3","numbersOnly","",1,"form-control","form-input-sm","text-normal","text-black","float-end",3,"ngModelChange","min","max","ngModel"],[1,"wp-100","align-items-center","mt-2","mb-3"],["type","text","numberSettings","","maxlength","3","numbersOnly","",1,"form-control","form-input-sm","text-normal","text-black","float-end",3,"ngModelChange","min","max","defaultValue","ngModel"],[1,"btn-panel"],[1,"mt-10"],[1,"adjust-s-tool",3,"activeObject","Align","Scale","Rotate","Flip"],[1,"pane-section",2,"position","initial !important"],[1,"scroll-content","bg-color-picker","bg-color-picker-active"],[1,"bg-color-panel","pe-3","ps-3","pt-10"],[1,"btn-all","p-0","m-0","btn-left-color","text-normal"],[1,"btn-all","p-0","m-0","btn-right-color","float-end",3,"click"],["name","closecolortool"],[3,"changed","selectedColor"]],template:function(i,t){1&i&&(e.j41(0,"div",2),e.nrm(1,"input",3),e.j41(2,"div",4),e.DNE(3,_r,7,3,"ng-container",5),e.k0s(),e.j41(4,"div",4),e.DNE(
15,Cr,7,3,"ng-container",5),e.k0s(),e.j41(6,"div",4),e.DNE(7,xr,17,0,"ng-container",5),e.k0s(),e.j41(8,"div",4),e.DNE(9,Tr,63,6,"ng-container",5),e.k0s(),e.DNE(10,Pr,9,1,"div",6)(11,Ir,9,1,"div",6),e.k0s()),2&i&&(e.R7$(2),e.Y8G("ngClass",e.eq3(10,Gt,3==t.step)),e.R7$(),e.Y8G("ngIf",3==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(12,Gt,2==t.step)),e.R7$(),e.Y8G("ngIf",2==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(14,Gt,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(16,Gt,1==t.step)),e.R7$(),e.Y8G("ngIf",1==t.step),e.R7$(),e.Y8G("ngIf",t.outlineColorPanelVisible),e.R7$(),e.Y8G("ngIf",t.shadowColorPanelVisible))},dependencies:[I.YU,I.bT,Ut.C,Fe.Z,Mt.I,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,we.me,we.BC,we.tU,we.vS,z.wQ,qe.d1,pt.Zr,Ei.v,Gi.n,Ce.b,Pt.B,It.LR,Et],styles:["#picker[_ngcontent-%COMP%]{border-radius:100%;width:100px;height:100px;background:red}#picker-circle[_ngcontent-%COMP%]{border-radius:50%;width:20px;height:20px;background:#00f}.crop-option[_ngcontent-%COMP%]{background:#626adf0d;border-radius:12px;padding:1rem;flex-direction:column}.child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}.bg-color-picker-active[_ngcontent-%COMP%]{background:#fffc!important;-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.btnBlur[_ngcontent-%COMP%]:hover{background:#626adf1a;border-radius:12px}"]}),v})();const jr=c=>({"ps-0 pe-0 overflow-hidden m-0":c});function Or(c,v){1&c&&(e.j41(0,"div",5),e.nrm(1,"element-placeholder",6),e.k0s()),2&c&&(e.R7$(),e.Y8G("count",3))}function Ar(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",14),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.selectTool(t.toolName))})("mouseenter",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.toggleVideo(t.id))})("mouseleave",function(){const t=e.eBV(s).$implicit,r=e.XpG(3);return e.Njj(r.toggleVideo(t.id))}),e.j41(1,"div",15)(2,"video",16),e.nrm(3,"source",17),e.EFF(4," Your browser does not support the video tag. "),e.k0s()(),e.j41(5,"div",18),e.EFF(6),e.k0s()()}if(2&c){const s=v.$implicit,i=e.XpG(3);e.R7$(2),e.AVh("playing",i.videoPlaying===s.id),e.Y8G("id",s.id),e.R7$(),e.FS9("src",s.url,e.B4B),e.R7$(3),e.JRh(s.name)}}function Rr(c,v){if(1&c&&(e.qex(0),e.j41(1,"div",10)(2,"div",11),e.EFF(3,"Image Tools"),e.k0s(),e.j41(4,"div",12),e.DNE(
15,Ar,7,5,"div",13),e.k0s()(),e.bVm()),2&c){const s=e.XpG(2);e.R7$(5),e.Y8G("ngForOf",s.tools)}}function Br(c,v){if(1&c){const s=e.RV6();e.j41(0,"resize-edit-tools",25),e.bIt("changeSize",function(t){e.eBV(s);const r=e.XpG(4);return e.Njj(r.changeSize(t))})("bgColorChanged",function(t){e.eBV(s);const r=e.XpG(4);return e.Njj(r.bgColorChanged(t))})("changeScale",function(t){e.eBV(s);const r=e.XpG(4);return e.Njj(r.changeScale(t))}),e.k0s()}if(2&c){const s=e.XpG(4);e.Y8G("width",s.cropResizeWidth)("height",s.cropResizeHeight)("toggleDisable",s.toggleDisable)("activeObject",s.activeObject)("name",s.name)}}function Dr(c,v){if(1&c){const s=e.RV6();e.j41(0,"crop-edit-tools",26),e.bIt("changeCropResize",function(t){e.eBV(s);const r=e.XpG(4);return e.Njj(r.changeCropResize(t))})("changeLockAspectRatio",function(t){e.eBV(s);const r=e.XpG(4);return e.Njj(r.changeLockAspectRatio(t))}),e.k0s()}if(2&c){const s=e.XpG(4);e.Y8G("width",s.cropResizeWidth)("height",s.cropResizeHeight)}}function Fr(c,v){if(1&c&&(e.qex(0),e.DNE(1,Br,1,5,"resize-edit-tools",23)(2,Dr,1,2,"crop-edit-tools",24),e.bVm()),2&c){const s=e.XpG(3);e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Resize),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Crop)}}function Ur(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",27)(1,"cutout-drawer",28,0),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()()}}function Lr(c,v){if(1&c){const s=e.RV6();e.j41(0,"sticker-maker-drawer",28),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()}}function Nr(c,v){if(1&c){const s=e.RV6();e.j41(0,"blur-drawer",29,1),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()}}function Gr(c,v){if(1&c){const s=e.RV6();e.j41(0,"silhouette-drawer",29,1),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()}}function Vr(c,v){if(1&c){const s=e.RV6();e.j41(0,"design-drawer",29,1),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()}}function Xr(c,v){if(1&c){const s=e.RV6();e.j41(0,"splash-drawer",29,1),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset())}),e.k0s()}}function zr(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",30)(2,"div",31)(3,"button",32),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.reset(!0))}),e.EFF(4,"Cancel"),e.k0s(),e.j41(5,"button",33),e.bIt("click",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.apply())}),e.EFF(6,"Apply"),e.k0s()()(),e.bVm()}if(2&c){const s=e.XpG(3);e.R7$(5),e.Y8G("disabled",!s.isApply)}}function Wr(c,v){if(1&c&&(e.qex(0),e.j41(1,"div",19)(2,"div"),e.DNE(3,Fr,3,2,"ng-container",4)(4,Ur,3,0,"div",20)(5,Lr,1,0,"sticker-maker-drawer",21)(6,Nr,2,0,"blur-drawer",22)(7,Gr,2,0,"silhouette-drawer",22)(8,Vr,2,0,"design-drawer",22)(9,Xr,2,0,"splash-drawer",22),e.k0s(),e.DNE(10,zr,7,1,"ng-container",4),e.k0s(),e.bVm()),2&c){const s=e.XpG(2);e.R7$(),e.Y8G("ngSwitch",s.toolName),e.R7$(),e.ZvI("w-100 ",s.toolName,""),e.R7$(),e.Y8G("ngIf",s.isLoaded),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Cutout),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.StickerMaker),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Blur),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Silhouette),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.Design),e.R7$(),e.Y8G("ngSwitchCase",s.EditorTool.ChangeColor),e.R7$(),e.Y8G("ngIf",s.isEdit&&(s.toolName==s.EditorTool.Resize||s.toolName==s.EditorTool.Crop))}}function Yr(c,v){if(1&c&&(e.j41(0,"div",7)(1,"div",8)(2,"div",9),e.DNE(3,Rr,6,1,"ng-container",4)(4,Wr,11,12,"ng-container",4),e.k0s()()()),2&c){const s=e.XpG();e.R7$(2),e.Y8G("ngClass",e.eq3(3,jr,s.toolName===s.EditorTool.Silhouette||s.toolName===s.EditorTool.StickerMaker||s.toolName===s.EditorTool.Cutout||s.toolName===s.EditorTool.Blur||s.toolName===s.EditorTool.ChangeColor||s.toolName===s.EditorTool.Design)),e.R7$(),e.Y8G("ngIf",!s.toolName),e.R7$(),e.Y8G("ngIf",s.toolName&&s.isLoaded)}}function $r(c,v){if(1&c&&(e.qex(0),e.nrm(1,"mobile-view-editor",34),e.bVm()),2&c){const s=e.XpG();e.R7$(),e.Y8G("width",s.cropResizeWidth)("height",s.cropResizeHeight)("btnText","Customize")("mainCanvasWidth",s.mainCanvasWidth)}}let Hr=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce){super(r,f,T,N,ne,"tools"),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.document=q,this.route=ne,this.envService=se,this.router=ae,this.editorService=ce,this.changeSubTool=new e.bkB,this.videoPlaying=null,this.isEdit=!1,this.isApply=!0,this.toolName=null,this.toggleDisable=!0,this.isImagePanDone=!1,this.isLoaded=!0,this.name="",this.subTool="",this.tools=[{id:1,toolName:E.z6.Cutout,name:"Cutout",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Cutout-Tools.mp4"},{id:2,toolName:E.z6.ChangeColor,name:"Change Color",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Colorize-Tools.mp4"},{id:3,toolName:E.z6.StickerMaker,name:"Sticker Maker",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Sticker-Maker-Tools.mp4"},{id:4,toolName:E.z6.Blur,name:"Blur",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Blur-Tools.mp4"},{id:5,toolName:E.z6.Silhouette,name:"Silhouette",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Silhouette-Tools.mp4"},{id:7,toolName:E.z6.Resize,name:"Resize",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Resize-Tools.mp4"},{id:8,toolName:E.z6.Crop,name:"Crop",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Crop.mp4"},{id:9,toolName:E.z6.Design,name:"Design",url:"https://static.lightxeditor.com/assets/Photo-Editor-Tools/Design-Tools.mp4"}],this.EditorTool=E.z6,this.initialized=!1,this.resizeByParams=ve=>
1{if(ve==E.z6.Resize){this.name=this.photoEditorService.photoEditorOptions.name;let Se={width:Number(this.photoEditorService.photoEditorOptions._rw),height:Number(this.photoEditorService.photoEditorOptions._rh),socialPlatformId:Number(this.photoEditorService.photoEditorOptions.socialPlatformId),isValid:!0,isApply:!0,fillCanvas:!0};Se.width&&Se.height&&Se.socialPlatformId&&this.changeSize(Se)}},this.photoEditorService.isResizeCropTool=!0,this.user=this.authService.currentUser(),this.authService.usrPropChanged.subscribe(ve=>{this.user=this.authService.currentUser()}),this.loggedInObserver=this.authService.loggedIn.subscribe(ve=>{this.user=this.authService.currentUser()}),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ve=>{ve&&(this.photoEditorService.isDirty=!1,this.photoEditorService.isImagePan=!1,this.isImagePanDone=!1,this.photoEditorService.resizeHeight=0,this.photoEditorService.resizeWidth=0,this.bgColor=null,this.isApply=!0,this.inputImage&&this.inputImage.canvas&&this.inputImage.canvas.backgroundImage&&(this.bgMedia=null,this.inputImage.canvas.backgroundImage=null),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.photoEditorService.changeBgColor(null),this.unconfigureFabricCanvas(),setTimeout(()=>{this.name="",this.init(()=>{this.isLoaded=!1,setTimeout(()=>{this.isLoaded=!0,this.toolName&&this.selectTool(this.toolName)},100)})},100))}),this.activeToolPanelSubscription=this.editorService.activeToolPanel.subscribe(ve=>{ve.subTool&&setTimeout(()=>{this.photoEditorService.photoEditorOptions.subTool=this.subTool=ve.subTool,this.selectTool(ve.subTool)},200)}),this.backBtnClick=this.photoEditorService.BackArrowClick.subscribe(ve=>{ve&&(this.toolName=null)})}ngOnDestroy(){this.photoEditorService.photoEditorOptions.subTool="",this.photoEditorService.activeSubTool="",this.photoEditorService.selectedTool="",this.activeToolPanelSubscription&&this.activeToolPanelSubscription.unsubscribe(),this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.backBtnClick&&this.backBtnClick.unsubscribe(),this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.photoEditorService.isImagePan=!1,this.photoEditorService.resizeHeight=0,this.photoEditorService.resizeWidth=0,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.isResizeCropTool=!1,this.unconfigureFabricCanvas(),this.onDestroy()}ngOnInit(){this.subTool=this.photoEditorService.photoEditorOptions.subTool,this.selectedTool=this.photoEditorService.selectedTool,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.toolName=null,this.unconfigureFabricCanvas(),this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.cropResizeWidth=this.originalWidth,this.cropResizeHeight=this.originalHeight,this.stateService.mainCanvas.hoverCursor="move",this.initialized=!0,this.selectedTool&&this.subTool&&(this.selectTool(this.subTool),this.resizeByParams(this.subTool))})):(this.photoEditorService.initialLoad=!1,this.init(()=>{this.photoEditorService.initialLoad=!0,this.photoEditorService.originalImage&&this.selectedTool&&this.subTool?(this.initialized=!0,this.selectTool(this.subTool),this.resizeByParams(this.subTool)):(this.initialized=!0,this.selectTool(this.subTool))}))}setResizeImage(){this.isEdit=!0,this.cropResizeWidth=this.originalWidth,this.cropResizeHeight=this.originalHeight,this.stateService.mainCanvas.clear();let i=pe.fabric.util.object.clone(this.inputImage);this.activeObject=new He(i,this.stateService.mainCanvas,!1),this.activeObject.addToCanvas(this.stateService.mainCanvas),this.stateService.mainCanvas.hoverCursor="move",this.stateService.mainCanvas.setCursor("move")}selectResize(){this.photoEditorService.selectedTool=this.selectedTool+"_"+this.subTool,this.photoEditorService.activeTool=w.b.tool.tools,this.photoEditorService.activeSubTool=w.b.subTool.resize,this.photoEditorService.originalImage?(this.envService.isMobileView||(this.photoEditorService.resizeWidth=this.originalWidth,this.photoEditorService.resizeHeight=this.originalHeight),this.setResizeImage(),this.configureFabricCanvasMouseDownEvent()):(this.photoEditorService.activeTool=w.b.tool.tools,this.photoEditorService.activeSubTool=w.b.subTool.resize,this.init())}changeLockAspectRatio(i){this.activeObject.controlHandle(i)}selectCrop(){if(this.photoEditorService.originalImage){this.cropResizeWidth=Math.round(this.originalWidth-5*this.originalWidth/100),this.cropResizeHeight=Math.round(this.originalHeight-5*this.originalHeight/100),this.stateService.mainCanvas.clear();let i=pe.fabric.util.object.clone(this.inputImage);
1this.activeObject=new He(i,this.stateService.mainCanvas),this.activeObject.addToCanvas(this.stateService.mainCanvas),this.activeObject.crop(this.stateService.page,!0),this.activeObject.setCropSize(this.cropResizeWidth,this.cropResizeHeight),this.configureFabricCanvasMouseDownEvent(),this.stateService.mainCanvas.hoverCursor="move",this.stateService.mainCanvas.setCursor("move"),this.isEdit=!0,this.photoEditorService.isExportable=!1,this.photoEditorService.selectedTool=this.selectedTool+"_"+this.subTool,this.photoEditorService.activeTool=w.b.tool.tools,this.photoEditorService.activeSubTool=w.b.subTool.crop}else this.photoEditorService.activeTool=w.b.tool.tools,this.photoEditorService.activeSubTool=w.b.subTool.crop,this.init()}changeCropResize(i){if(this.isApply=i.isValid,this.photoEditorService.isExportable=!1,this.isApply&&i.isApply){this.cropResizeWidth=i.width,this.cropResizeHeight=i.height,i.isCustomSize?this.activeObject.setCropSize(this.cropResizeWidth,this.cropResizeHeight):this.activeObject.cropResize(i.width,i.height);const t=this.activeObject.getBoundingBox();this.cropResizeWidth=Math.round(t.width*t.scaleX),this.cropResizeHeight=Math.round(t.height*t.scaleY)}}changeSize(i){var t=this;return(0,n.A)(function*(){t.mainCanvasWidth=t.stateService.mainCanvas.width,t.isApply=i.isValid,t.isApply&&i.isApply&&(t.toggleDisable=!1,t.photoEditorService.isImagePan=i.fillCanvas&&!t.isImagePanDone,t.envService.isMobileView||(t.photoEditorService.resizeWidth=i.width,t.photoEditorService.resizeHeight=i.height),t.isEdit=!0,t.unconfigureFabricCanvas(),t.cropResizeWidth=i.width,t.cropResizeHeight=i.height,t.bgMedia&&t.bgMedia.formatAssets(i.width,i.height),yield t.resizeImage(i),setTimeout(()=>{t.photoEditorService.isDirty=!t.envService.isMobileView,t.photoEditorService.isExportable=!0},100))})()}resizeImage(i){var t=this;return(0,n.A)(function*(){if(t.zoomService.defaultZoom=!0,yield t.zoomService.setLayout(i.socialPlatformId,i.width,i.height),i.width<=100&&i.height<=100){let r=0;r=i.width<i.height?100/i.width:100/i.height,t.zoomService.set(r,!0)}t.activeObject.resizeCanvas(i.width,i.height,i.fillCanvas),t.bgColor&&50!=t.bgColor&&100!=t.bgColor&&!i.fillCanvas?t.photoEditorService.changeBgColor(t.bgColor):"Custom"===i.title&&!i.fillCanvas&&!t.bgColor&&t.photoEditorService.changeBgColor(null),i.fillCanvas&&t.configureFabricCanvasMouseDownEvent()})()}afterImageLoad(i){i.imageData&&(this.originalWidth=this.photoEditorService.originalImage.width,this.originalHeight=this.photoEditorService.originalImage.height)}onMouseMove(i){this.toolName===E.z6.Resize&&this.mouseDown&&this.activeObject.mouseMove(i)}onMouseUp(i){if(this.toolName===E.z6.Resize)this.mouseDown=!1,this.photoEditorService.isImagePan=!1,this.isImagePanDone=!0,this.activeObject.mouseUp(i),this.stateService.mainCanvas.off("mouse:up"),this.stateService.mainCanvas.off("mouse:move");else if(this.toolName===E.z6.Crop){const t=this.activeObject.getBoundingBox();this.cropResizeWidth=Math.round(t.width*t.scaleX),this.cropResizeHeight=Math.round(t.height*t.scaleY),this.stateService.mainCanvas.off("mouse:up"),this.stateService.mainCanvas.off("mouse:move")}}onMouseDown(i){this.toolName===E.z6.Resize?(this.mouseDown=!0,this.activeObject.mouseDown(i),this.configureFabricCanvasMouseMoveAndUpEvent()):this.toolName===E.z6.Crop&&(this.mouseDown=!0,this.configureFabricCanvasMouseMoveAndUpEvent())}renderAll(){this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}isUndoable(){}isRedoable(){}undoClicked(){}redoClicked(){}bgColorChanged(i){if(this.photoEditorService.isDirty=!0,this.isEdit=i.isEdit,i.color)if(this.bgColor=i.color,this.bgColor&&50===this.bgColor||100===this.bgColor){const t=this.stateService.mainCanvas;let r,f;t.clipPath?(r=t.clipPath.width,f=t.clipPath.height):(r=t.width/t.viewportTransform[0],f=t.height/t.viewportTransform[3]);const T=new Ui.b(null,r,f,1);T.updateOImg(this.inputImage),T.addToCanvas(this.stateService.mainCanvas),this.bgMedia=T;let N=this.inputImage.canvas.backgroundImage,H=new pe.fabric.Image.filters.Blur({blur:this.bgColor/100});N.filters.find(ne=>ne&&ne.blur)?this.inputImage.canvas.backgroundImage.filters[0]=H:this.inputImage.canvas.backgroundImage.filters.push(H),this.inputImage.canvas.backgroundImage.applyFilters(),this.inputImage.canvas.renderAll(),this.renderAll()}else this.bgMedia=null,this.inputImage.canvas?.backgroundImage&&(this.inputImage.canvas.backgroundImage=null),this.photoEditorService.changeBgColor(this.bgColor);else this.bgMedia=null,this.inputImage.canvas?.backgroundImage&&(this.bgMedia=null,this.inputImage.canvas.backgroundImage=null),this.bgColor=null,this.photoEditorService.changeBgColor(this.bgColor)}reset(i=!1){if(this.name="",this.photoEditorService.selectedTool=this.selectedTool,this.toggleDisable=!0,this.isEdit=!1,i&&(this.photoEditorService.isExportable=!1),this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.photoEditorService.isError)return this.photoEditorService.inProgress=!1,this.zoomService.defaultZoom=!0,void(this.toolName=null);this.reloadImage(()=>{this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.toolName=null,this.photoEditorService.isDirty=!1,this.photoEditorService.isImagePan=!1,this.photoEditorService.resizeWidth=0,this.photoEditorService.resizeHeight=0,this.photoEditorService.inProgress=!1,this.bgColor=null,this.isImagePanDone=!1,this.unconfigureFabricCanvas(),this.inputImage.canvas.backgroundImage&&(this.bgMedia=null,this.inputImage.canvas.backgroundImage=null),this.photoEditorService.changeBgColor(null)})}
1apply(){if(this.toolName===E.z6.Resize){let i=this.document.createElement("canvas");this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,i).then(t=>{this.user?this.checkStorage(t.uri,(r,f)=>{r&&f&&this.applyChanges(t,f)}):this.applyChanges(t)})}else if(this.toolName===E.z6.Crop){let i=this.exportCrop();this.photoEditorService.getImageFromCanvasCrop(i).then(t=>{this.user?this.checkStorage(t.uri,(r,f)=>{r&&f&&this.applyChanges(t,f)}):this.applyChanges(t)})}}applyChanges(i,t=null){if(this.toolName===E.z6.Resize){this.photoEditorService.isApplyed=!0,this.isEdit=!1,this.toggleDisable=!0,this.photoEditorService.inProgress=!0,this.photoEditorService.isImagePan=!1;let r=i.image;if(this.photoEditorService.inProgress=!1,this.photoEditorService.originalImage=r,this.originalWidth=r.width,this.originalHeight=r.height,this.photoEditorService.resizeWidth=0,this.photoEditorService.resizeHeight=0,this.photoEditorService.imgUrl=i.uri,this.loadImageAfterApply(i.uri,r),t){const f=this.document.createElement("canvas");this._saveImage(f,r,i.uri,t),this.reset(),this.photoEditorService.isExportable=!0}}else if(this.toolName===E.z6.Crop){let r=i.image;if(this.photoEditorService.isApplyed=!0,this.photoEditorService.inProgress=!1,this.photoEditorService.originalImage=r,this.originalWidth=r.width,this.originalHeight=r.height,this.photoEditorService.imgUrl=i.uri,this.loadImageAfterApply(i.uri,r),t){const f=this.document.createElement("canvas");this._saveImage(f,r,i.uri,t),this.reset(),this.photoEditorService.isExportable=!0}}}exportCrop(){const i=this.activeObject.getBoundingBox(),t=-i.left,r=-i.top,f=i.width*i.scaleX,T=i.height*i.scaleY;let N=pe.fabric.util.object.clone(this.inputImage);N.set({left:t,top:r});let H=this.document.createElement("canvas"),q=new pe.fabric.StaticCanvas(H);return q.width=f,q.height=T,q.add(N),q.renderAll(),q}loadImageAfterApply(i,t){var r=this;return(0,n.A)(function*(){yield r.photoEditorService.setPhotoEditorInputImages(t),r.photoEditorService.isDirty=!1,r.photoEditorService.isExportable=!0,r.stateService.mainCanvas.clear(),r.reloadImage(()=>{r.zoomService.defaultZoom=!0,r.zoomService.fitToScreen(),r.photoEditorService.isDirty=!1,r.photoEditorService.isImagePan=!1,r.photoEditorService.resizeWidth=0,r.photoEditorService.resizeHeight=0,r.photoEditorService.inProgress=!1,r.bgColor=null,r.isImagePanDone=!1,r.unconfigureFabricCanvas(),r.toolName=null})})()}changeScale(i){this.photoEditorService.isExportable=!0,this.photoEditorService.isDirty=!0,this.activeObject.setRe
1sizeScale(i.scale,i.final)}selectTool(i){this.photoEditorService.isCompareEnable=!1,this.toolName=i;const t=this.tools.find(r=>r.toolName===i)?.name;this.changeSubTool.emit({toolName:E.z6.Tools,subTool:i,title:t}),i==E.z6.Resize?this.selectResize():i===E.z6.Crop&&this.selectCrop()}updateRouteParams(){this.photoEditorService.photoEditorOptions?.subTool&&this.router.navigate([],{relativeTo:this.route,queryParams:{subTool:this.photoEditorService.photoEditorOptions.subTool},queryParamsHandling:"merge"})}resetScroll(){}toggleVideo(i){const t=document.getElementById(i);t&&(this.videoPlaying!==i?(this.videoPlaying=i,t.play()):(this.videoPlaying=null,t.pause(),setTimeout(()=>{t.currentTime=0},200)))}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(Q.L),e.rXU(z.Ix),e.rXU(o.x))},c.\u0275cmp=e.VBU({type:c,selectors:[["tools-drawer"]],outputs:{changeSubTool:"changeSubTool"},features:[e.Vt3],decls:3,vars:3,consts:[["cutoutdrawer",""],["tooldrawer",""],["class","blank-preview",4,"ngIf"],["class","drawer-content",4,"ngIf"],[4,"ngIf"],[1,"blank-preview"],[3,"count"],[1,"drawer-content"],[1,"scroll-content"],["customScrollDir","",1,"scroll-container",3,"ngClass"],[1,"common-container","p-0","m-0"],[1,"text-lg","text-semi","text-dark","d-flex","align-items-center",2,"height","56px"],[1,"ai-video-list","d-flex","align-items-start",2,"column-gap","8px"],["class","ai-video-thumbs d-flex align-items-center mb-3 position-relative",3,"click","mouseenter","mouseleave",4,"ngFor","ngForOf"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-3","position-relative",3,"click","mouseenter","mouseleave"],[1,"videoThumb"],["loop","","muted","",2,"border-radius","8px","width","100%",3,"id"],["type","video/mp4",3,"src"],[1,"tool-name","text-medium","mt-1"],[1,"d-flex","align-items-center-start",3,"ngSwitch"],["class","child-drawer drawer-active",4,"ngSwitchCase"],["class","w-100",3,"restAndApplyEvent",4,"ngSwitchCase"],[3,"restAndApplyEvent",4,"ngSwitchCase"],["class","w-100",3,"width","height","toggleDisable","activeObject","name","changeSize","bgColorChanged","changeScale",4,"ngSwitchCase"],[3,"width","height","changeCropResize","changeLockAspectRatio",4,"ngSwitchCase"],[1,"w-100",3,"changeSize","bgColorChanged","changeScale","width","height","toggleDisable","activeObject","name"],[3,"changeCropResize","changeLockAspectRatio","width","height"],[1,"child-drawer","drawer-active"],[1,"w-100",3,"restAndApplyEvent"],[3,"restAndApplyEvent"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3",2,"z-index","2"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"],[3,"width","height","btnText","mainCanvasWidth"]],template:function(i,t){1&i&&e.DNE(0,Or,2,1,"div",2)(1,Yr,5,5,"div",3)(2,$r,2,4,"ng-container",4),2&i&&(e.Y8G("ngIf",!t.envService.isMobileView&&!t.photoEditorService.initialLoad),e.R7$(),e.Y8G("ngIf",!t.envService.isMobileView&&t.photoEditorService.initialLoad),e.R7$(),e.Y8G("ngIf",t.envService.isMobileView))},dependencies:[I.YU,I.Sq,I.bT,I.ux,I.e1,Ni.n,de.q,z.wQ,Xn.Z,cs,ys,As,Gs,ir,dr,gr,Mr],styles:[".child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}.ai-video-list[_ngcontent-%COMP%]{flex-flow:wrap}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]{width:84px;flex-direction:column;border-radius:8px;justify-content:flex-end;cursor:pointer}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]:hover .tool-name[_ngcontent-%COMP%]{color:#000;transition:color .3s ease-in-out}.videoThumb[_ngcontent-%COMP%]{width:84px;height:84px;overflow:hidden;display:flex;align-items:center;justify-content:center;border-radius:8px;transition:opacity .3s ease-in,visibility .3s ease-in!important}.videoThumb[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{transform:scale(1.1);transition:transform .2s ease-in}.videoThumb[_ngcontent-%COMP%]:hover video[_ngcontent-%COMP%]{transform:scale(1);transition:transform .2s ease-in}
1.tool-name[_ngcontent-%COMP%]{width:100%;position:relative;font-size:12px;color:#4a4f5e;text-align:center;padding:0;line-height:140%}.new_item[_ngcontent-%COMP%], .new_badge[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;padding-right:0;z-index:1}.new_item[_ngcontent-%COMP%]:after, .new_badge[_ngcontent-%COMP%]:after{content:url(https://static.lightxeditor.com/assets/icons/newbadge.svg);position:relative;top:0}"]}),v})();var Vt=g(6762),Qi=g(21413),Kr=g(70152);const Zr=(c,v)=>({activeBadgeTemp:c,"shift-item":v}),Ai=c=>({yellowRectangleEdit:c}),Ji=c=>({activeBadgeTemp:c}),Qr=(c,v)=>({"scroll-content":c,"scroll-content pb-14":v}),qi=c=>({"tab-child-active":c}),Jr=(c,v)=>({"tab-child-active":c,mid:v});function qr(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",26),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function ea(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",27)(1,"adjustment-change-color",28),e.bIt("onChange",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.renderAll())})("onSlide",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onSlideStart(t))}),e.k0s()()}}function ta(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",17)(2,"div",18),e.DNE(3,qr,1,0,"div",19),e.j41(4,"div",20)(5,"div",21)(6,"div",22)(7,"div",23)(8,"button",24),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.resetAll())}),e.EFF(9,"Reset all"),e.k0s()(),e.DNE(10,ea,2,0,"div",25),e.k0s()()()()(),e.bVm()}if(2&c){const s=e.XpG(2);e.R7$(3),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(5),e.Y8G("disabled",!s.isAllEdit),e.R7$(2),e.Y8G("ngIf",s.isSliderReady)}}function ia(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",26),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function oa(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",30)(1,"adjustment-change-color",28),e.bIt("onChange",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.renderAll())})("onSlide",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onSlideStart(t))}),e.k0s()()}}function na(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",17)(2,"div",18),e.DNE(3,ia,1,0,"div",19),e.j41(4,"div",20)(5,"div",21)(6,"div",22)(7,"div",23)(8,"button",24),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.resetAll())}),e.EFF(9,"Reset all"),e.k0s()(),e.DNE(10,oa,2,0,"div",29),e.k0s()()()()(),e.bVm()}if(2&c){const s=e.XpG(2);e.R7$(3),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(5),e.Y8G("disabled",!s.isFgEdit),e.R7$(2),e.Y8G("ngIf",s.isSliderReady)}}function sa(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",26),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function ra(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",30)(1,"adjustment-change-color",28),e.bIt("onChange",function(){e.eBV(s);const t=e.XpG(3);return e.Njj(t.renderAll())})("onSlide",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onSlideStart(t))}),e.k0s()()}}function aa(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",17)(2,"div",18),e.DNE(3,sa,1,0,"div",19),e.j41(4,"div",20)(5,"div",21)(6,"div",22)(7,"div",23)(8,"button",24),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.resetAll())}),e.EFF(9,"Reset all"),e.k0s()(),e.DNE(10,ra,2,0,"div",29),e.k0s()()()()(),e.bVm()}if(2&c){const s=e.XpG(2);e.R7$(3),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(5),e.Y8G("disabled",!s.isBgEdit),e.R7$(2),e.Y8G("ngIf",s.isSliderReady)}}function la(c,v){if(1&c&&(e.j41(0,"div",12)(1,"div",13),e.DNE(2,ta,11,3,"ng-container",14),e.k0s(),e.j41(3,"div",15),e.DNE(4,na,11,3,"ng-container",14),e.k0s(),e.j41(5,"div",16),e.DNE(6,aa,11,3,"ng-container",14),e.k0s()()),2&c){const s=e.XpG();e.Y8G("ngClass",e.l_i(7,Qr,!s.isEdit,s.isEdit)),e.R7$(),e.Y8G("ngClass",e.eq3(10,qi,0==s.step)),e.R7$(),e.Y8G("ngIf",0==s.step),e.R7$(),e.Y8G("ngClass",e.l_i(12,Jr,1==s.step,2==s.step)),e.R7$(),e.Y8G("ngIf",1==s.step),e.R7$(),e.Y8G("ngClass",e.eq3(15,qi,2==s.step)),e.R7$(),e.Y8G("ngIf",2==s.step)}}function ca(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",31)(1,"div",32)(2,"button",33),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",34),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply(!1))}),e.EFF(5,"Apply"),e.k0s()()()}if(2&c){const s=e.XpG();e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress),e.R7$(2),e.Y8G("disabled",s.photoEditorService.inProgress)}}let ha=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce){super(r,f,T,N,ae,"adjustment"),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.cdRef=q,this.changeColorService=ne,this.document=se,this.route=ae,this.removeBgService=ce,this.onDrawerClickEvent=new e.bkB,this.subTool="all",this.isSliderReady=!1,this.sliderRetryCount=0,this.sliderRetryLimit=50,this.step=0,this.baseFilter=[],this.isEdit=!1,this.f=pe.fabric.Image.filters,this.isUploadedNewImage=!1,this.isAllEdit=!1,this.isFgEdit=!1,this.isBgEdit=!1,this.isLoaded=!1,this.onChange$=new Qi.B,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ve=>{ve&&(this.isLoaded=!0,this.step="foreground"==this.subTool?1:"background"==this.subTool?2:0,this.isAllEdit=!1,this.isFgEdit=!1,this.isBgEdit=!1,this.isEdit=!1,this.isUploadedNewImage=!0,this.photoEditorService.isLoaded=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.isDirty=!1,this.photoEditorService.checkProjectName(!0),this.actionController.reset(),this.actionController.delete(),this.actionController=new Vt.Z,this.changeColorService.setActionController(this.actionController),this.changeColorService.updateAdjustmentValues(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init(()=>{this.isLoaded=!1,this.autoMask()})}
1,0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(ve=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.actionController&&(this.actionController.reset(),this.actionController.delete()),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.onDestroy(),this.onChangeSub&&this.onChangeSub.unsubscribe(),this.sliderRetryTimer&&clearTimeout(this.sliderRetryTimer),this.photoEditorService.activeSubTool=""}ngOnInit(){this.photoEditorService.toolNameForDownload="adjustment",this.onChangeSub=this.onChange$.pipe((0,Kr.B)(50)).subscribe(()=>this.renderAll()),this.waitForSliderInit(),this.actionController||(this.actionController=new Vt.Z,this.changeColorService.setActionController(this.actionController),this.changeColorService.updateAdjustmentValues()),this.photoEditorService.originalImage?this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.autoMask()}):this.init(()=>{this.autoMask()}),this.onInit()}waitForSliderInit(){this.document?.defaultView?.Slider?this.isSliderReady=!0:this.sliderRetryCount>=this.sliderRetryLimit||(this.sliderRetryCount+=1,this.sliderRetryTimer=setTimeout(()=>this.waitForSliderInit(),50))}afterImageLoad(i){}drawOutputImage(i,t){this.baseFilter&&(this.baseFilter.forEach(r=>{r.image=i}),super.drawOutputImage(i,t))}resetAll(){this.changeColorService.resetAll(()=>{this.renderAll(),0==this.step?this.isAllEdit=!1:1==this.step?this.isFgEdit=!1:2==this.step&&(this.isBgEdit=!1)})}onSlideStart(i){this.actionController.createAdjustmentUndoState(!0),this.isEdit=!0,this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.isCompareEnable=!0,0==this.step?this.isAllEdit=!0:1==this.step?this.isFgEdit=!0:2==this.step&&(this.isBgEdit=!0)}tabChange(i){this.step=i,this.actionController.setSelectedAjustment(i),this.changeColorService.updateAdjustmentValues()}addFilter(){if(0===this.baseFilter.length){for(let i=0;i<3;i++){let t=1==i?"1.0":2==i?"2.0":i;this.actionController.setSelectedAjustment(i),this.baseFilter[i]=new this.f.Adjustment({image:null,adjustment:this.actionController.getAdjustedValues(),adztOn:t})}this.actionController.setSelectedAjustment(0)}super.addFilter()}onChange(){this.onChange$.next(null)}renderAll(){try{this.inputImage.applyFilters(),this.stateService.mainCanvas.requestRenderAll()}catch(i){console.error("Rendering failed",i)}}processResult(){this.drawOutputImage(this.removeBgMask,this.stateService.mainCanvasNative)}isUndoable(){return this.actionController&&this.actionController.isUndoModeAvailable()}isRedoable(){return this.actionController&&this.actionController.isRedoModeAvailable()}undoClicked(){this.actionController.isUndoModeAvailable()?(this.actionController.undo(),this.processResult(),this.changeColorService.updateAdjustmentValues()):alert("Undo not available!!")}redoClicked(){this.actionController.isRedoModeAvailable()?(this.actionController.redo(),this.processResult(),this.changeColorService.updateAdjustmentValues()):alert("Redo not available!!")}applyChanges(i,t=null){this.photoEditorService.isApplyed=!0;let r=i.image;if(this.photoEditorService.originalImage=r,this.loadImageAfterApply(i.uri),t){const f=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(f,r,i.uri,t)}}loadImageAfterApply(i){this.resetAll(),this.photoEditorService.imgUrl=i,this.actionController.reset(),this.actionController.delete(),this.actionController=new Vt.Z,this.changeColorService.setActionController(this.actionController),this.changeColorService.updateAdjustmentValues(),this.photoEditorService.isDirty=!1,this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.step=0,this.isAllEdit=!1,this.isFgEdit=!1,this.isBgEdit=!1,this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1,this.isEdit=!1,this.baseFilter=[],this.addFilter(),this.processResult(),this.photoEditorService.inProgress=!1})}cancel(){this.photoEditorService.inProgress=!0,this.resetAll(),this.actionController.reset(),this.actionController.delete(),this.photoEditorService.isLoaded=!1,this.actionController=new Vt.Z,this.changeColorService.setActionController(this.actionController),this.changeColorService.updateAdjustmentValues(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.reloadImage(()=>{this.step=0,this.isAllEdit=!1,this.isFgEdit=!1,this.isBgEdit=!1,this.isEdit=!1,this.photoEditorService.isLoaded=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.baseFilter=[],this.addFilter(),this.processResult(),this.photoEditorService.inProgress=!1}),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}autoMask(){this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.removeBgService.resolvedModule?this.processAutoMaskImage():this.removeBgService.resolveModule("lightxSegModule","seglightx.js",i=>{}).then(()=>{this.processAutoMaskImage()}).catch(()=>{this.photoEditorService.clearProcessingProgress()})}processAutoMaskImage(){this.photoEditorService.originalImage&&(this.removeBgService.closeProgress(),this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.cdRef.detectChanges(),this.removeBgService.getAutoBlurMask(this.photoEditorService.originalImage,2).then(i=>{this.processMaskImage(i)}).catch(()=>{this.photoEditorService.clearProcessingProgress()}))}processMaskImage(i){this.photoEditorService.originalImage&&(this.photoEditorService.processingProgress.isActive?this.photoEditorService.inProgress=!0:this.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),this.removeBgService.getMask(this.photoEditorService.originalImage,i).then(t=>{this.removeBgMask=this.photoEditorService.upScaleByResizeFilter(this.photoEditorService.originalImage.width,this.photoEditorService.originalImage.height,1,t),this.processResult(),this.photoEditorService.completeProcessingProgress(),this.isEdit=!1,this.isUploadedNewImage&&(this.isUploadedNewImage=!1,this.baseFilter=[],this.addFilter(),this.processResult())}).catch(()=>{this.photoEditorService.clearProcessingProgress()}))}gotoVedioPreview(){this.photoEditorService.openVedio(w.b.tutorials.splash)}onDrawerClick(i){}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(e.gRc),e.rXU(Ii.n),e.rXU(I.qQ),e.rXU(z.nX),e.rXU(vt.r))},c.\u0275cmp=e.VBU({type:c,selectors:[["adjustment-drawer"]],inputs:{subTool:"subTool"},outputs:{onDrawerClickEvent:"onDrawerClickEvent"},features:[e.Vt3],decls:21,vars:21,consts:[[1,"drawer-content"],[1,"position-absolute","bg-white",2,"overflow","hidden","width","300px","z-index","1"],[1,"d-flex","align-items-center","justify-content-between","common-container","pt-8","mb-8",2,"z-index","1"],[1,"text-lg","text-semi","text-dark","lh-125"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32",2,"visibility","hidden"],[1,"d-flex","position-relative","mt-7","pb-2","ps-3","adjust-nav"],[1,"text-center","adjust-item",3,"click","ngClass"],[1,"badge-temp","me-2"],["name","yellowrectangle",1,"yellowRectangle",3,"ngClass"],[1,"badge-temp"],["style","height: calc(100% - 0px);",3,"ngClass",4,"ngIf"],["class","position-fixed fixed-bottom pb-9 pe-3 ps-3 bg-white pt-2",4,"ngIf"],[2,"height","calc(100% - 0px)",3,"ngClass"],[1,"tab-child-item","one",3,"ngClass"],[4,"ngIf"],[1,"tab-child-item","two",3,"ngClass"],[1,"tab-child-item","three",3,"ngClass"],["customScrollDir","",1,"scroll-container","pb-2"],[1,"position-relative"],["class","drawer-click-overlay",3,"click",4,"ngIf"],[1,"ngb-btn","common-container","p-0","m-0"],[1,"mt-3","pt-5"],[1,"optionDiv","p-3",2,"margin-top","53px !important"],[1,"w-100","d-flex","justify-content-end",2,"margin-bottom","-5px"],[1,"btn-all","reset-all","text-semi",2,"margin-top","-8px",3,"click","disabled"],["style","margin-top: -22px;",4,"ngIf"],[1,"drawer-click-overlay",3,"click"],[2,"margin-top","-22px"],[3,"onChange","onSlide"],["style","margin-top: -16px;",4,"ngIf"],[2,"margin-top","-16px"],[1,"position-fixed","fixed-bottom","pb-9","pe-3","ps-3","bg-white","pt-2"],[1,"d-flex","wp-100","justify-content-between"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click","disabled"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click","disabled"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"div",1)(2,"div",2)(3,"span",3),e.
1EFF(4,"Adjustment"),e.k0s(),e.nrm(5,"pi",4),e.k0s(),e.j41(6,"div",5)(7,"div",6),e.bIt("click",function(){return t.tabChange(0)}),e.j41(8,"div",7),e.EFF(9,"All"),e.k0s(),e.nrm(10,"pei",8),e.k0s(),e.j41(11,"div",6),e.bIt("click",function(){return t.tabChange(1)}),e.j41(12,"div",7),e.EFF(13,"Foreground"),e.k0s(),e.nrm(14,"pei",8),e.k0s(),e.j41(15,"div",6),e.bIt("click",function(){return t.tabChange(2)}),e.j41(16,"div",9),e.EFF(17,"Background"),e.k0s(),e.nrm(18,"pei",8),e.k0s()()(),e.DNE(19,la,7,17,"div",10)(20,ca,6,2,"div",11),e.k0s()),2&i&&(e.R7$(7),e.Y8G("ngClass",e.l_i(8,Zr,0==t.step,2==t.step)),e.R7$(3),e.Y8G("ngClass",e.eq3(11,Ai,t.isAllEdit)),e.R7$(),e.Y8G("ngClass",e.eq3(13,Ji,1==t.step)),e.R7$(3),e.Y8G("ngClass",e.eq3(15,Ai,t.isFgEdit)),e.R7$(),e.Y8G("ngClass",e.eq3(17,Ji,2==t.step)),e.R7$(3),e.Y8G("ngClass",e.eq3(19,Ai,t.isBgEdit)),e.R7$(),e.Y8G("ngIf",!t.isLoaded),e.R7$(),e.Y8G("ngIf",t.isEdit))},dependencies:[I.YU,I.bT,de.q,Y.md,z.wQ,Ce.b,zi,It.LR],styles:[".optionDiv[_ngcontent-%COMP%]{background:#626adf0d;border-radius:12px}.reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:.5rem}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#626adf}.badge-temp[_ngcontent-%COMP%]{height:36px;font-size:13px;background:transparent;padding:0 20px}.badge-temp[_ngcontent-%COMP%]:hover{color:#000;border:1px solid #626ADF;background:#626adf0d}.yellowRectangle[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;margin-top:4px;margin-left:-6px}.adjust-nav[_ngcontent-%COMP%] .adjust-item[_ngcontent-%COMP%]{transition:all .4s ease}.adjust-nav[_ngcontent-%COMP%] .shift-item[_ngcontent-%COMP%]{margin-left:-34px;transition:all .4s ease}.adjust-nav[_ngcontent-%COMP%] .yellowRectangle[_ngcontent-%COMP%]{visibility:hidden}.adjust-nav[_ngcontent-%COMP%] .yellowRectangleEdit[_ngcontent-%COMP%]{visibility:visible!important}.activeBadgeTemp[_ngcontent-%COMP%] .badge-temp[_ngcontent-%COMP%]{background:#626adf;border:1px solid #626adf;color:#fff}.activeBadgeTemp[_ngcontent-%COMP%] .badge-temp[_ngcontent-%COMP%]:hover{border:1px solid #626adf}.one[_ngcontent-%COMP%]{transform:translate(-20px)}.two[_ngcontent-%COMP%], .three[_ngcontent-%COMP%]{transform:translate(20px)}.mid[_ngcontent-%COMP%]{transform:translate(-20px)!important}.tab-child-item[_ngcontent-%COMP%]{overflow:hidden;width:100%;height:0px;opacity:0;transition-duration:.35s;transition-property:opacity,transform;transition-timing-function:ease-in-out}.tab-child-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translate(0)}.drawer-click-overlay[_ngcontent-%COMP%]{position:absolute;top:0;right:0;left:0;z-index:5;bottom:0}"]}),v})();g(57942),g(65485);var eo=g(28068);function da(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",27)(1,"div",28)(2,"span",29),e.EFF(3,"Intensity"),e.k0s(),e.j41(4,"div",30)(5,"div",31)(6,"mv-slider",32),e.bIt("slideStop",function(t){e.eBV(s);const r=e.XpG().$implicit,f=e.XpG();return e.Njj(f.stopIntensity(t,r))})("change",function(t){e.eBV(s);const r=e.XpG().$implicit,f=e.XpG();return e.Njj(f.changeIntensity(t,r))}),e.k0s()(),e.j41(7,"div",33),e.nrm(8,"input",34),e.k0s()()()()}if(2&c){const s=e.XpG().$implicit;e.R7$(6),e.Y8G("min",s.min)("max",s.max)("step",1)("value",s.val),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",s.val)("allowNegativeNumbers",!0)}}function pa(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",15),e.bIt("show",function(){const t=e.eBV(s).$implicit,r=e.XpG();return e.Njj(r.onPanelToggle(t.name,!0))})("hide",function(){const t=e.eBV(s).$implicit,r=e.XpG();return e.Njj(r.onPanelToggle(t.name,!1))}),e.j41(1,"div",16)(2,"div",17)(3,"button",18)(4,"div",19),e.EFF(5),e.k0s()(),e.j41(6,"button",20)(7,"span",21),e.nrm(8,"pi",22),e.k0s(),e.j41(9,"span",23),e.nrm(10,"pi",24),e.k0s()()()(),e.j41(11,"div",25)(12,"div",26),e.DNE(13,da,9,8,"ng-template"),e.k0s()()()}if(2&c){const s=v.$implicit,i=e.XpG();e.FS9("ngbAccordionItem",s.name),e.Y8G("collapsed",i.activePanels!==s.name),e.R7$(5),e.JRh(s.name)}}function ua(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",35)(1,"div",36)(2,"button",37),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",38),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply())}),e.EFF(5,"Apply"),e.k0s()()()}}let ma=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se){super(t,r,f,T,q,"bodyRetouch"),this.injector=i,this.photoEditorService=t,this.stateService=r,this.zoomService=f,this.uploadService=T,this.document=N,this.route=q,this.aiPhotoService=ne,this.editorService=se,this.bodyReshapeService=ae,this.uploadImageService=ce,this.authService=ve,this.undoRedoProcessService=Se,this.restAndApplyEvent=new e.bkB,this.array=[{name:"Tall",val:0,min:-100,max:100,type:y.J.Tall},{name:"Slim",val:0,min:-100,max:100,type:y.J.Slim},{name:"Head",val:0,min:-100,max:100,type:y.J.Head},{name:"Breast",val:0,min:-100,max:100,type:y.J.Breast},{name:"Belly",val:0,min:-100,max:100,type:y.J.Belly},{name:"Waist",val:0,min:0,max:100,type:y.J.Waist}],this.toolToggleMap=new Map(this.array.map(xe=>[xe,!1])),this.originalWidth=0,this.originalHeight=0,this.stateHistory=[],this.currentStateIndex=-1,this.expandWidth=0,this.expandHeight=0,this.activePanels="panel1",this.imageScaleFactor=.85,H.closeOthers=!0,this.user=this.authService.currentUser(),this.loggedInObserver=this.authService.loggedIn.subscribe(xe=>{this.user=this.authService.currentUser()}),this.editorService.setOnChange({name:"toolChanged",value:"BODY_RETOUCH",subtool:""}),this.onChangeObserv=this.bodyReshapeService.onChange.subscribe(xe=>
1{(xe&&"startResize"===xe.name||xe&&"startDrag"===xe.name)&&(this.resetValues(),this.applyImage())}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(xe=>{xe&&(this.bodyReshapeService.imageEdited(!1,this.photoEditorService),this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.bodyReshapeService.setOnChange("bodyPartType",{type:-1}),this.activePanels="",this.resetUndoRedo(),this.resetValues(),setTimeout(()=>{this.init(()=>{this.recordState(this.inputImage.getElement().src)})},0))})}ngOnInit(){this.photoEditorService.touchpadCanvasGestureEventHandler?.disable(),this.photoEditorService.toolNameForDownload="aireshape",this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.bodyReshapeService.imageEdited(!1,this.photoEditorService),this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.recordState(this.inputImage.getElement().src)})):this.init(()=>{this.bodyReshapeService.imageEdited(!1,this.photoEditorService),this.recordState(this.inputImage.getElement().src)})}resetValues(){for(let i=0;i<this.array.length;i++)this.array[i].val=0}resetUndoRedo(){this.stateHistory=[],this.currentStateIndex=-1}afterImageLoad(i){}onPanelToggle(i,t){var r=this;return(0,n.A)(function*(){r.activePanels=t?i:"";let f=-1;switch(yield r.applyImage(),r.activePanels){case"Tall":f=y.J.Tall,r.zoomService.fitToScreenByPercent(15);break;case"Slim":f=y.J.Slim,r.zoomService.fitToScreenByPercent(15);break;case"Head":f=y.J.Head,r.makeFit();break;case"Breast":f=y.J.Breast,r.makeFit();break;case"Belly":f=y.J.Belly,r.makeFit();break;case"Waist":f=y.J.Waist,r.makeFit();break;default:f=y.J.None,r.makeFit()}r.controlType=f,r.editorService.setOnChange({name:"toolChanged",value:"BODY_RETOUCH",subtool:f}),setTimeout(()=>{r.bodyReshapeService.setOnChange("bodyPartType",{type:f})}),r.resetValues()})()}makeFit(){this.setOriginalImageWH(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(!1)}changeZoom(){}inputIntensity(i,t){let r=i;r=i/100,r=-r/10,"Slim"===t.name?this.refreshSlim(i/400*((1-this.imageScaleFactor)*this.originalWidth)):"Tall"===t.name?(!this.originalHeight&&this.inputImage&&(this.originalHeight=this.inputImage.height,this.originalWidth=this.inputImage.width),this.refreshTall(i/400*((1-this.imageScaleFactor)*this.originalHeight))):(this.inputImage.filters&&this.inputImage.filters.length>0?"Waist"===t.name?this.inputImage.filters[0].radiusInput&&(this.inputImage.filters=[],this.addShader(t)):this.inputImage.filters[0].warpScale&&(this.inputImage.filters=[],this.addShader(t)):this.addShader(t),this.refreshShader(t,r))}addShader(i){i.type===y.J.Head?this.addHeadShader():i.type===y.J.Breast?this.addHeadShader(!0):i.type===y.J.Belly?this.addHeadShader():i.type===y.J.Waist&&this.addWaistShader()}refreshShader(i,t){i.type===y.J.Head?this.refreshHeadShader(t):i.type===y.J.Breast?this.refreshHeadShader(t,!0):i.type===y.J.Belly?this.refreshHeadShader(t):i.type===y.J.Waist&&this.refreshWaistShader(t)}apply(){this.photoEditorService.inProgress=!0,setTimeout(()=>{let i=this.document.createElement("canvas");this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,i).then(t=>{this.user?this.checkStorage(t.uri,(r,f)=>{r&&f&&this.applyChanges(t,f)}):this.applyChanges(t)})},0)}applyChanges(i){var t=this;return(0,n.A)(function*(r,f=null){t.photoEditorService.isApplyed=!0;let T=r.image;if(t.photoEditorService.originalImage=T,yield t.photoEditorService.setPhotoEditorInputImages(T),t.loadImageAfterApply(r.uri),f){const N=t.document.createElement("canvas");t.zoomService.fitToScreen(),t._saveImage(N,T,r.uri,f)}t.restAndApplyEvent.emit()}).apply(this,arguments)}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.resetAll(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.inProgress=!1})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.editorService.setOnChange({name:"toolChanged",value:""}),this.onChangeObserv&&this.onChangeObserv.unsubscribe(),this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.touchpadCanvasGestureEventHandler?.enable()}isUndoable(){return this.currentStateIndex>0}isRedoable(){return this.currentStateIndex<this.stateHistory.length-1}addAndRemoveImage(i,t=null){pe.fabric.Image.fromURL(i,r=>{let f=r.height,T=r.width,N=this.stateService.mainCanvas;
1N.setHeight(f*N.getZoom()),N.setWidth(T*N.getZoom());let H=this.inputImage;N.clear(),N.remove(H),r.set({selectable:!1,evented:!1}),N.add(r),this.inputImage=r,N.renderAll(),this.setOriginalImageWH(T,f),this.zoomService.defaultZoom=!0,this.controlType===y.J.Slim||this.controlType===y.J.Tall?this.zoomService.fitToScreenByPercent(15):this.zoomService.fitToScreen(!1),this.bodyReshapeService.setOnChange("setPos",{}),this.resetValues()},{crossOrigin:"anonymous"})}undoClicked(){this.undoRedoProcessService.executeSyncWithProtection(()=>(this.currentStateIndex>0&&(this.currentStateIndex--,this.addAndRemoveImage(this.stateHistory[this.currentStateIndex]),this.slimOrTallImage=null,this.bodyReshapeService.setOnUndoRedo(),0==this.currentStateIndex&&this.bodyReshapeService.imageEdited(!1,this.photoEditorService)),!0))}redoClicked(){this.undoRedoProcessService.executeSyncWithProtection(()=>(this.currentStateIndex<this.stateHistory.length-1&&(this.currentStateIndex++,this.addAndRemoveImage(this.stateHistory[this.currentStateIndex]),this.slimOrTallImage=null,this.bodyReshapeService.setOnUndoRedo(),this.currentStateIndex>0&&this.bodyReshapeService.imageEdited(!0,this.photoEditorService)),!0))}cancel(){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.resetAll(),this.unconfigureFabricCanvas(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1}),this.restAndApplyEvent.emit()}resetAll(){}bakeFiltersAndReplaceImage(){if(this.controlType===y.J.Slim||this.controlType===y.J.Tall){const i=this.stateService.mainCanvas;let t=i.getZoom();const f=1*i.height/t;1*i.width/t>me.lL?t=i.width/me.lL:f>me.iB&&(t=i.height/me.iB);const T=i.toDataURL({multiplier:1/t});this.recordState(T)}else{const i=this.stateService.mainCanvas,t=i.toDataURL({multiplier:1/i.getZoom()});this.recordState(t),pe.fabric.Image.fromURL(t,r=>{this.slimOrTallImage=r})}}recordState(i){i&&(this.currentStateIndex<this.stateHistory.length-1&&(this.stateHistory=this.stateHistory.slice(0,this.currentStateIndex+1)),this.currentStateIndex++,this.stateHistory.push(i))}stopIntensity(i,t){("Slim"===t.name||"Tall"===t.name)&&this.bodyReshapeService.setOnChange("visibility",{type:this.controlType}),this.bakeFiltersAndReplaceImage(),this.bodyReshapeService.imageEdited(!0,this.photoEditorService)}applyImage(){var i=this;return(0,n.A)(function*(){if(i.slimOrTallImage){const t=i.slimOrTallImage.getElement();(t.width>me.lL||t.height>me.iB)&&(i.photoEditorService.inProgress=!0,i.slimOrTallImage=yield new Promise((f,T)=>{Bt.k.checkAndResizeImage(t,q=>{f(new pe.fabric.Image(q))},me.lL,me.iB)}),i.photoEditorService.inProgress=!1);let r=i.stateService.mainCanvas.width/i.slimOrTallImage.width;r=i.slimOrTallImage.width>i.slimOrTallImage.height?i.stateService.mainCanvas.width/i.slimOrTallImage.width:i.stateService.mainCanvas.height/i.slimOrTallImage.height,i.stateService.mainCanvas.setZoom(r),i.stateService.mainCanvas.remove(i.inputImage),i.inputImage=i.slimOrTallImage,i.slimOrTallImage=null,i.setOriginalImageWH(),i.inputImage.set({selectable:!1,evented:!1}),i.stateService.mainCanvas.add(i.inputImage),i.stateService.mainCanvas.requestRenderAll()}})()}setOriginalImageWH(i=this.inputImage.width,t=this.inputImage.height){this.stateService.original.width=i,this.stateService.original.height=t}changeIntensity(i,t){let T,N;("Slim"===t.name||"Tall"===t.name)&&this.bodyReshapeService.setOnChange("visibility",{type:-1}),i.hasOwnProperty("newValue")?(T=i.newValue,N=!1):(T=i,N=!0),""!==T&&!Number.isNaN(Number(T))&&(T>100?setTimeout(()=>{t.val=100,this.inputIntensity(t.val,t)},0):T<-100?setTimeout(()=>{t.val=-100,this.inputIntensity(t.val,t)},0):(t.val=T,this.inputIntensity(t.val,t)))}addHeadShader(i=!1){var t=new pe.fabric.Image.filters.FaceReshape({radiusInput:.3,centreX:.5,centreY:.5,radiusInput2:.3,centreX2:.7,centreY2:.5,width:this.inputImage.width,height:this.inputImage.height,alphaVal:0,brightness:0,breastMode:0});this.inputImage.filters.push(t),this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}addWaistShader(){var i=new pe.fabric.Image.filters.WaistReshape({originx:0,originy:0,rectWidth:1,rectHeight:1,warpScale:-200});this.inputImage.filters.push(i),this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}refreshWaistShader(i){let t=this.bodyReshapeService.clientRectangle,r=(t.left-32/this.stateService.mainCanvas.getZoom())/this.inputImage.width,f=t.top/this.inputImage.height,T=(t.right-t.left+64/this.stateService.mainCanvas.getZoom())/this.inputImage.width,N=(t.bottom-t.top)/this.inputImage.height;this.inputImage.filters[0].warpScale=.2*i,this.inputImage.filters[0].originx=r,this.inputImage.filters[0].originy=f,this.inputImage.filters[0].rectWidth=T,this.inputImage.filters[0].rectHeight=N,this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}refreshHeadShader(i,t=!1){let r=this.bodyReshapeService.clientRectangle,f=r.centerX/this.inputImage.width,T=r.centerY/this.inputImage.height,N=Math.max(this.inputImage.width,this.inputImage.height),H=r.radius/N;if(this.inputImage.filters[0].alphaVal=i,this.inputImage.filters[0].centreX=f,this.inputImage.filters[0].centreY=T,this.inputImage.filters[0].radiusInput
1=H,t){let q=r.centerX2/this.inputImage.width,ne=r.centerY2/this.inputImage.height,se=Math.max(this.inputImage.width,this.inputImage.height),ae=r.radius2/se;this.inputImage.filters[0].centreX2=q,this.inputImage.filters[0].centreY2=ne,this.inputImage.filters[0].radiusInput2=ae,this.inputImage.filters[0].breastMode=1}else this.inputImage.filters[0].breastMode=0;this.inputImage.applyFilters(),this.inputImage.canvas.renderAll()}refreshSlim(i){this.originalHeight=this.inputImage.height,this.originalWidth=this.inputImage.width;let t=this.stateService.mainCanvas;t.setWidth((this.originalWidth+i)*t.getZoom()),t.remove(this.inputImage),t.clear();const f=this.getSlimImage(i);this.slimOrTallImage=f,f&&(t.add(f),t.renderAll())}refreshTall(i){this.originalHeight=this.inputImage.height,this.originalWidth=this.inputImage.width;let t=this.stateService.mainCanvas;t.setHeight((this.originalHeight+i)*t.getZoom()),t.remove(this.inputImage),t.clear();const f=this.getTallImage(i);this.slimOrTallImage=f,f&&(t.add(f),t.renderAll())}getSlimImage(i){let t=this.bodyReshapeService.clientRectangle,r=t.left,f=t.right,T=this.originalWidth,N=this.originalHeight,H=this.inputImage;if(!this.inputImage)return;const q=T+i,ne=this.document.createElement("canvas");ne.width=q,ne.height=N;const se=ne.getContext("2d");se.drawImage(H.getElement(),0,0,r,N,0,0,r,N);const ae=f+1-r,ce=ae+i;return se.drawImage(H.getElement(),r,0,ae,N,r,0,ce,N),se.drawImage(H.getElement(),f,0,T-f,N,f+i,0,T-f,N),new pe.fabric.Image(ne,{left:0,top:0,selectable:!1})}getTallImage(i){if(!this.inputImage)return;const t=this.originalHeight+i;let r=this.bodyReshapeService.clientRectangle;const f=document.createElement("canvas");f.width=this.originalWidth,f.height=t;const T=f.getContext("2d");let N=this.inputImage,H=this.originalWidth,q=this.originalHeight,ne=r.top,se=r.bottom;T.drawImage(N.getElement(),0,0,H,ne,0,0,H,ne);const ae=se+1-ne,ce=ae+i;return T.drawImage(N.getElement(),0,ne,H,ae,0,ne,H,ce),T.drawImage(N.getElement(),0,se,H,q-se,0,se+i,H,q-se),new pe.fabric.Image(f,{left:0,top:0,selectable:!1})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(I.qQ),e.rXU(Y.iM),e.rXU(z.nX),e.rXU(L.s),e.rXU(o.x),e.rXU(y.E),e.rXU(F.A),e.rXU($.u),e.rXU(eo.V))},c.\u0275cmp=e.VBU({type:c,selectors:[["bodyReshape-drawer"]],viewQuery:function(i,t){if(1&i&&e.GBs(B.y,5),2&i){let r;e.mGM(r=e.lsd())&&(t.appBodyExpanderComponent=r.first)}},outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Jv_([Y.iM,L.s,eo.V]),e.Vt3],decls:17,vars:3,consts:[[1,"scroll-content"],[1,""],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Body Reshape",1,"d-none"],[1,"child-drawer","drawer-active"],["customScrollDir","",1,"scroll-container"],[1,"common-container","p-0","m-0"],[1,"d-flex","align-items-center","w-100","justify-content-between",2,"min-height","56px"],[1,"d-inline-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32","invisible"],[1,"ngb-btn","common-container","p-0","m-0"],["ngbAccordion","",3,"destroyOnHide"],[3,"ngbAccordionItem","collapsed","show","hide",4,"ngFor","ngForOf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3",4,"ngIf"],[3,"show","hide","ngbAccordionItem","collapsed"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],[1,"common-container"],[1,"card-body","pt-2"],[1,"text-13","grey-800","text-semi"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"slideStop","change","min","max","step","value"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","disabled","","mask","separator.2","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",2,"pointer-events","none",3,"min","max","ngModel","allowNegativeNumbers"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"div",1),e.nrm(2,"input",2),e.j41(3,"div",3),e.qex(4),e.j41(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"pi",8),e.bIt("click",function(){return t.cancel()}),e.k0s(),e.j41(10,"span",9),e.EFF(11,"Body Reshape "),e.k0s()(),e.nrm(12,"pi",10),e.k0s()(),e.j41(13,"div",11)(14,"div",12),e.DNE(15,pa,14,3,"div",13),e.k0s()()(),e.bVm(),e.k0s()(),e.DNE(16,ua,6,0,"div",14),e.k0s()),2&i&&(e.R7$(14),e.Y8G("destroyOnHide",!1),e.R7$(),e.Y8G("ngForOf",t.array),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isDirty))},dependencies:[I.Sq,I.bT,Mt.I,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,we.me,we.BC,we.tU,we.vS,z.wQ,qe.d1,pt.Zr,Ce.b]}),v})();g(17314),g(49868),g(31611),g(16447),g(86535);var to=g(39762),ga=g(89334),_a=g(58426),fa=g(60655),va=g(95854);const ba=c=>({minusindex:c});function Ca(c,v){if(1&c&&e.nrm(0,"skin-tool",33),2&c){const s=e.XpG(2).$implicit,i=e.XpG();e.Y8G("active",i.toolToggleMap.get(s))("inputImage",i.inputImage)("originalImage",i.photoEditorService.originalImage)}}function xa(c,v){if(1&c&&e.nrm(0,"shade-tool-lips",34),2&c){const s=e.XpG(2).$implicit,i=e.XpG();e.Y8G("active",i.toolToggleMap.get(s))("inputImage",i.inputImage)("uploadImageService",i.uploadImageService)}}function Sa(c,v){if(1&c&&e.nrm(0,"shade-tool-hair",35),2&c){const s=e.XpG(2).$implicit,i=e.XpG();e.Y8G("active",i.toolToggleMap.get(s))("inputImage",i.inputImage)}}function Ea(c,v){if(1&c&&e.nrm(0,"single-tool",36),2&c){const s=e.XpG(2).$implicit,i=e.XpG();e.Y8G("toolName",s)("active",i.toolToggleMap.get(s))("inputImage",i.inputImage)("uploadImageService",i.uploadImageService)}}function ya(c,v){if(1&c&&e.DNE(0,Ca,1,3,"skin-tool",29)(1,xa,1,3,"shade-tool-lips",30)(2,Sa,1,2,"shade-tool-hair",31)(3,Ea,1,4,"single-tool",32),2&c){const s=e.XpG().$implicit;e.Y8G("ngIf","Skin"==s),e.R7$(),e.Y8G("ngIf","Lips"==s),e.R7$(),e.Y8G("ngIf","Hair"==s),e.R7$(),e.Y8G("ngIf","Eyes"==s||"Eyebrows"==s||"Teeth"==s)}}function wa(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",15),e.bIt("shown",function(){const t=e.eBV(s).$implicit,r=e.XpG();return e.Njj(r.addRemove(!0,t))}),e.j41(1,"div",16)(2,"div",17)(3,"button",18)(4,"div",19),e.EFF(5),e.k0s()(),e.j41(6,"div",20)(7,"toggle-switch",21),e.bIt("changeT",function(t){const r=e.eBV(s).$implicit,f=e.XpG();return e.Njj(f.addRemove(t,r))}),e.k0s()(),e.j41(8,"button",22)(9,"span",23),e.nrm(10,"pi",24),e.k0s(),e.j41(11,"span",25),e.nrm(12,"pi",26),e.k0s()()()(),e.j41(13,"div",27)(14,"div",28),e.DNE(15,ya,4,4,"ng-template"),e.k0s()()()}if(2&c){const s=v.$implicit,i=e.XpG();e.Y8G("ngbAccordionItem","face-retouch-"+s)("collapsed",!i.toolToggleMap.get(s)),e.R7$(5),e.JRh(s),e.R7$(2),e.Y8G("selected",i.toolToggleMap.get(s))}}function ka(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",37)(1,"div",38)(2,"button",39),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",40),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply())}),e.EFF(5,"Apply"),e.k0s()()()}if(2&c){const s=e.XpG();e.Y8G("ngClass",e.eq3(1,ba,s.faceRetouchService.colorWheel))}}let Ta=(()=>{var c;class v extends $e.O{addRemove(i,t){this.toolToggleMap.set(t,i);let r=!1;for(let f of this.toolToggleMap.entries())f[1]&&(r=!0);this.faceRetouchService.imageEdited(r,this.photoEditorService)}afterImageLoad(i){}addFilter(){this.baseFilter=[],super.addFilter()}constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se,xe,ke){super(r,f,T,N,ce,"faceRetouch"),this.authService=i,this.injector=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.uploadImageService=H,this.removeBgService=q,this.aiUploadImageService=ne,this.document=se,this.route=ce,this.toastService=ve,this.aiPhotoService=Se,this.faceRetouchService=xe,this.createPopupService=ke,this.restAndApplyEvent=new e.bkB,this.array=["Skin","Hair","Lips","Eyes","Eyebrows","Teeth"],this.toolToggleMap=new Map(this.array.map(Te=>[Te,!1])),ae.closeOthers=!0,this.user=this.authService.currentUser(),this.photoEditorService.checkProjectName(),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(Te=>{Te&&(this.faceRetouchService.reset(this.photoEditorService),this.photoEditorService.checkProjectName(!0),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.toolToggleMap=new Map(this.array.map(We=>[We,!1])),setTimeout(()=>{this.faceRetouchService.reset(this.photoEditorService)},0),setTimeout(()=>{this.init(()=>{this.getMaskFromRemote()})},0))}),this.loggedInObserver=this.authService.loggedIn.subscribe(Te=>{this.user=this.authService.currentUser()})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.photoEditorService.isDirty=!1,this.onDestroy()}ngOnInit(){this.photoEditorService.toolNameForDownload="faceRetouch",this.faceRetouchService.reset(this.photoEditorService),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.getMaskFromRemote()})):this.init(()=>{this.getMaskFromRemote()})}getMaskFromRemote(){this.photoEditorService.startProcessingProgress({featureType:"airetouch",indeterminate:!0}),this.removeBgService.prepareInputImageRemoteBg(this.photoEditorService.originalImage).then(i=>{this.aiUploadImageService.uploadImage(i,{tab:"airetouch",fileName:"untitled.jpeg"},t=>{t&&"FAIL"!==t.status?this.generate(t.contentUrl):(this.photoEditorService.clearProcessingProgress(),this.toastService.showError(w.b.message.somethingWrong))})})}generate(i){var t=this;const r={imageUrl:i,featureType:"airetouch"};this.photoEditorService.startProcessingProgress({featureType:"airetouch",indeterminate:!0}),this.aiPhotoService.generateImage(r,f=>{f&&f.assetId?(f.featureType="airetouch",this.aiPhotoService.checkStatus(f,0,function(){var N=(0,n.A)(function*(H){H&&H.urls&&H.urls.length>0?(t.user&&(t.user.remainingCoins=H.remainingCalls),t.aiPhotoService.aiImages=[],yield t.loadApiResultImage(H),t.photoEditorService.completeProcessingProgress()):t.photoEditorService.clearProcessingProgress()});return function(H){return N.apply(this,arguments)}}(),N=>{this.displayErrorMsg(N)})):this.displayErrorMsg(f)},f=>{this.displayErrorMsg(f)})}loadApiResultImage(i){var t=this;return(0,n.A)(function*(){const r=t.photoEditorService.originalImage,f=r.width,T=r.height,N=new Promise((ne,se)=>{pe.fabric.Image.fromURL(i.urls[0],ce=>{t.faceRetouchService.setAllmaskFabricImage(ce),t.removeBgService.processOutputImageRemote(f,T,ce).then(ve=>{let Se=ve.scaledImageData;const xe=pe.fabric.util.createCanvasElement();
1xe.width=Se.width,xe.height=Se.height,xe.getContext("2d").putImageData(Se,0,0);const ke=new pe.fabric.Image(xe);t.faceRetouchService.setAllmaskFabricImage(ke),ne()})},{crossOrigin:"Anonymous"})}),H=new Promise((ne,se)=>{pe.fabric.Image.fromURL(i.maskUrl,ae=>{const ce=new pe.fabric.Image.filters.Blur({blur:.2});ae.filters.push(ce),ae.applyFilters(),t.removeBgService.processOutputImageRemote(f,T,ae).then(ve=>{t.faceRetouchService.setHairMaskImageData(ve.scaledImageData),ne()})},{crossOrigin:"Anonymous"})}),q=new Promise((ne,se)=>{i.maskSkinUrl?pe.fabric.Image.fromURL(i.maskSkinUrl,ae=>{const ce=new pe.fabric.Image.filters.Blur({blur:.2});ae.filters.push(ce),ae.applyFilters(),t.removeBgService.processOutputImageRemote(f,T,ae).then(ve=>{t.faceRetouchService.setSkinMaskImageData(ve.scaledImageData),ne()})},{crossOrigin:"Anonymous"}):ne()});return Promise.all([N,H,q])})()}displayErrorMsg(i=null){let t=i?.description;this.photoEditorService.clearProcessingProgress(),this.createPopupService.openWarningDialog("Error",t).then(f=>{this.restAndApplyEvent.emit(0)})}drawOutputImage(i,t){this.baseFilter&&(this.baseFilter.image=i,super.drawOutputImage(i,t))}renderAll(){this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}isUndoable(){return!1}isRedoable(){return!1}undoClicked(){}redoClicked(){}apply(){let i=this.document.createElement("canvas");this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,i).then(t=>{this.user?this.checkStorage(t.uri,(r,f)=>{r&&f&&this.applyChanges(t,f)}):this.applyChanges(t)})}applyChanges(i){var t=this;return(0,n.A)(function*(r,f=null){t.photoEditorService.isApplyed=!0,t.photoEditorService.inProgress=!0;let T=r.image;if(t.photoEditorService.inProgress=!1,t.photoEditorService.originalImage=T,yield t.photoEditorService.setPhotoEditorInputImages(T),t.loadImageAfterApply(r.uri),f){const N=t.document.createElement("canvas");t.zoomService.fitToScreen(),t._saveImage(N,T,r.uri,f)}t.restAndApplyEvent.emit()}).apply(this,arguments)}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.resetAll(),this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1})}resetAll(){}cancel(){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.resetAll(),this.unconfigureFabricCanvas(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()}),this.restAndApplyEvent.emit()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(e.zZn),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(vt.r),e.rXU(St.M),e.rXU(I.qQ),e.rXU(Y.iM),e.rXU(z.nX),e.rXU(Z.f),e.rXU(L.s),e.rXU(to.V),e.rXU(rt.A))},c.\u0275cmp=e.VBU({type:c,selectors:[["faceRetouch-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Jv_([Y.iM,to.V]),e.Vt3],decls:17,vars:3,consts:[[1,"scroll-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Face Retouch",1,"d-none"],[1,"child-drawer","drawer-active"],["customScrollDir","",1,"scroll-container",2,"height","calc(100% - 4rem)"],[1,"common-container","p-0","m-0"],[1,"d-flex","align-items-center","w-100","justify-content-between",2,"min-height","56px"],[1,"d-inline-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","helpicon","placement","right","popoverClass","pop-for-tooltip","ngbPopover","Improves facial appearance by smoothing skin and reducing imperfections.","triggers","mouseenter:mouseleave","popoverTitle","Retouch","container","body",1,"ms-1","hw-24","help-icon"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32","invisible"],[1,"ngb-btn","common-container","p-0","m-0"],["ngbAccordion","",3,"destroyOnHide"],[3,"ngbAccordionItem","collapsed","shown",4,"ngFor","ngForOf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3",3,"ngClass",4,"ngIf"],[3,"shown","ngbAccordionItem","collapsed"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],[1,"editor-toggle",2,"height","26px"],[1,"d-flex","align-items-center","mb-0",3,"changeT","selected"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],[3,"active","inputImage","originalImage",4,"ngIf"],[3,"active","inputImage","uploadImageService",4,"ngIf"],[3,"active","inputImage",4,"ngIf"],[3,"toolName","active","inputImage","uploadImageService",4,"ngIf"],[3,"active","inputImage","originalImage"],[3,"active","inputImage","uploadImageService"],[3,"active","inputImage"],[3,"toolName","active","inputImage","uploadImageService"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3",3,"ngClass"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"]],template:function(i,t){1&i&&(e.j41(0,"div",0),e.nrm(1,"input",1),e.j41(2,"div",2),e.qex(3),e.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"pi",7),e.bIt("click",function(){return t.cancel()}),e.k0s(),e.j41(9,"span",8),e.EFF(10,"Face Retouch"),e.nrm(11,"pi",9),e.k0s()(),e.nrm(12,"pi",10),e.k0s()(),e.j41(13,"div",11)(14,"div",12),e.DNE(15,wa,16,4,"div",13),e.k0s()()(),e.bVm(),e.k0s(),e.DNE(16,ka,6,3,"div",14),e.k0s()),2&i&&(e.R7$(14),e.Y8G("destroyOnHide",!1),e.R7$(),e.Y8G("ngForOf",t.array),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isDirty))},dependencies:[I.YU,I.Sq,I.bT,Ut.C,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.ZM,Y.md,z.wQ,Ce.b,ga.R,_a.O,fa.J,va.H],styles:[".btn[_ngcontent-%COMP%]:first-child:active{border-color:none}#picker[_ngcontent-%COMP%]{border-radius:100%;width:100px;height:100px;background:red}
1#picker-circle[_ngcontent-%COMP%]{border-radius:50%;width:20px;height:20px;background:#00f}.crop-option[_ngcontent-%COMP%]{background:#626adf0d;border-radius:12px;padding:1rem;flex-direction:column}.child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}.bg-color-picker-active[_ngcontent-%COMP%]{background:#fffc!important;-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important}.minusindex[_ngcontent-%COMP%]{z-index:-1}"]}),v})();var Ri=g(19282),Bi=g(12658),io=g(18770);const Pa=c=>({"pe-none":c}),Ia=c=>({"pb-14":c});function Ma(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",17)(1,"div",18)(2,"buttons-scroll-menu",19),e.bIt("selectMenu",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.selectFaceImg(t))}),e.k0s()()()}if(2&c){const s=e.XpG();e.R7$(2),e.Y8G("type","faceExpression")("categoryId",null==s.selectedFace?null:s.selectedFace.id)("items",s.faceDataList)}}function ja(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",34)(1,"span",35),e.EFF(2),e.nrm(3,"pei",36),e.k0s(),e.j41(4,"div",37)(5,"div",38)(6,"mv-slider",39),e.bIt("slideStop",function(t){const r=e.eBV(s).$implicit,f=e.XpG(3);return e.Njj(f.stopIntensity(t,r))})("slideStart",function(t){const r=e.eBV(s).$implicit,f=e.XpG(3);return e.Njj(f.slideStart(t,r))})("change",function(t){const r=e.eBV(s).$implicit,f=e.XpG(3);return e.Njj(f.changeIntensity(t,r))}),e.k0s()(),e.j41(7,"div",40),e.nrm(8,"input",41),e.k0s()()()}if(2&c){const s=v.$implicit,i=e.XpG(3);e.R7$(2),e.JRh(s.toolName),e.R7$(),e.FS9("name",s.icon),e.R7$(3),e.Y8G("min",s.min)("max",s.max)("step",1)("value",null==i.selectedFace?null:i.selectedFace.toolValues.get(s.subToolId)),e.R7$(2),e.Y8G("min",s.min)("max",s.max)("ngModel",null==i.selectedFace?null:i.selectedFace.toolValues.get(s.subToolId))("allowNegativeNumbers",!0)}}function Oa(c,v){if(1&c&&(e.j41(0,"div",32),e.DNE(1,ja,9,10,"div",33),e.k0s()),2&c){const s=e.XpG().$implicit;e.R7$(),e.Y8G("ngForOf",s.subToolArray)}}function Aa(c,v){if(1&c&&(e.j41(0,"div",20)(1,"div",21)(2,"div",22)(3,"button",23)(4,"div",24),e.EFF(5),e.k0s()(),e.j41(6,"button",25)(7,"span",26),e.nrm(8,"pi",27),e.k0s(),e.j41(9,"span",28),e.nrm(10,"pi",29),e.k0s()()()(),e.j41(11,"div",30)(12,"div",31),e.DNE(13,Oa,2,1,"ng-template"),e.k0s()()()),2&c){const s=v.$implicit;e.Y8G("ngbAccordionItem",s.toolId),e.R7$(5),e.JRh(s.toolName)}}function Ra(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",42)(1,"div",43)(2,"button",44),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",45),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply())}),e.EFF(5,"Apply"),e.k0s()()()}}let Ba=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se){super(t,r,f,T,ae,"faceExpression"),this.authService=i,this.photoEditorService=t,this.stateService=r,this.zoomService=f,this.uploadService=T,this.aiUploadImageService=N,this.toastService=H,this.aiPhotoService=q,this.createPopupService=ne,this.dialogService=se,this.route=ae,this.uploadImageService=ce,this.faceExpressionService=ve,this.document=Se,this.containerId="canvas-mask-wrapper",this.restAndApplyEvent=new e.bkB,this.uploadImageScaleFactor=2.2,this.toolkeys=Ri.JJ,this.faceExpressionTools=Ri.zp,this.faceExpressionSubToolMap=new Map,this.faceDataList=[],this.selectedFace=null,this.updateCounter=0,this.oldValue=null,this.detectionsResult=null,this.subToolId=null,this.subToolValue=null,this.ismodel=!1,this.isSliderstart=!1,this.isEdit=!1,this.faceExpressionService.setServices(f),this.user=this.authService.currentUser();let xe=sessionStorage.getItem("ImgsubComponentdate");const ke=xe?new Date(xe):new Date,Te=new Date(ke.setMinutes(ke.getMinutes()+10));xe&&Te<new Date&&(!this.user||this.user&&!this.user.subscribed)&&(this.updateCounter=5),this.loggedInObserver=this.authService.loggedIn.subscribe(Me=>{if(this.user=this.authService.currentUser(),Me&&this.user&&!this.user.subscribed&&this.subToolId){const Ae=this.selectedFace.toolpreviousValues.get(this.subToolId);this.subToolValue=this.selectedFace.toolValues.get(this.subToolId),this.selectedFace.toolValues.set(this.subToolId,Ae)}}),this.usrPropChangedObserver=this.authService.usrPropChanged.subscribe(Me=>{this.user=this.authService.currentUser(),Me&&this.user&&this.user.subscribed&&this.subToolId&&this.subToolValue&&this.selectedFace.toolValues.set(this.subToolId,this.subToolValue)}),this.updateBehaviorUserAiConis=this.authService.updateBehaviorUserAiConis.subscribe(Me=>{Me&&(this.user=this.authService.currentUser())}
1),this.faceExpressionTools.forEach(Me=>{Me.subToolArray.forEach(Ae=>{this.faceExpressionSubToolMap.set(Ae.subToolId,Ae)})}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(Me=>{Me&&(this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),t.isDirty=!1,t.isExportable=!1,t.isCompareEnable=!1,setTimeout(()=>{this.init(()=>{this.detectFaces()})},0))})}ngOnDestroy(){this.photoEditorService.toolNameForDownload=null,this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.updateBehaviorUserAiConis&&this.updateBehaviorUserAiConis.unsubscribe(),this.usrPropChangedObserver&&this.usrPropChangedObserver.unsubscribe(),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.faceBoundingBoxVisibilitySub?.unsubscribe(),this.photoEditorService.isDirty=!1,this.onDestroy(),this.aiPhotoService.cleanup()}loadMediaPipeScripts(){var i=this;return(0,n.A)(function*(){if(!(window.FilesetResolver&&window.FaceLandmarker&&window.FaceDetector))return new Promise((t,r)=>{const f=i.document.createElement("script");f.type="module",f.textContent="\n import { FilesetResolver, FaceLandmarker, FaceDetector } from 'https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]';\n window.FilesetResolver = FilesetResolver;\n window.FaceLandmarker = FaceLandmarker;\n window.FaceDetector = FaceDetector;\n window.dispatchEvent(new CustomEvent('mediapipe-loaded'));\n ",f.onload=()=>{console.log("MediaPipe scripts loaded successfully"),t()},f.onerror=N=>{console.error("Failed to load MediaPipe scripts:",N),r(N)};const T=()=>{window.removeEventListener("mediapipe-loaded",T),t()};window.addEventListener("mediapipe-loaded",T),i.document.head.appendChild(f)});console.log("MediaPipe scripts already loaded")})()}ngAfterViewInit(){var i=this;return(0,n.A)(function*(){i.photoEditorService.inProgress=!0;try{yield i.loadMediaPipeScripts(),yield i.faceExpressionService.loadModels()}catch(t){i.showError("Failed to initialize FaceLandmarker: "+t.message)}i.photoEditorService.inProgress=!1})()}ngOnInit(){this.faceDataList=[],this.photoEditorService.toolNameForDownload="faceExpression",this.imageEdited(!1,this.photoEditorService),this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.detectFaces()})):this.init(()=>{this.detectFaces()}),this.faceBoundingBoxVisibilitySub=this.photoEditorService.visibility$.subscribe(i=>{"hide"===i&&this.faceExpressionService.hideFaceBoundingBox(),"show"===i&&this.faceExpressionService.showFaceBoundingBox()})}detectFaces(){var i=this;return(0,n.A)(function*(t=!0){yield function(){var f=(0,n.A)(function*(){try{let T=i.photoEditorService.originalImage;yield i.faceExpressionService.loadModels(),i.resultD=yield i.faceExpressionService.detectFacesFaceApi(T);let N=i.resultD.detections;i.detectionsResult=N;const H=yield i.faceExpressionService.checkAndResizeInpuImage(N,T,i.uploadImageScaleFactor);H&&(i.photoEditorService.originalImage=H,i.photoEditorService.compareImageUrl=H.src,yield i.initFabricCanvas(H)),t&&(i.faceDataList=[],i.faceDataList=yield i.faceExpressionService.createFaceList(N,i.photoEditorService.originalImage,i.uploadImageScaleFactor));const q=i.stateService.calcWrapperSize();i.faceDataList.length>0?(i.faceExpressionService.mainCanvas=i.stateService.mainCanvas,yield i.faceExpressionService.getBiggestFace(i.resultD,i.containerId,q),i.selectedFace=i.faceExpressionService.selectedFace,i.isNewSelection=!0):i.displayErrorMsg()}catch(T){i.showError("Face detection failed: "+T.message)}});return function(){return f.apply(this,arguments)}}()()}).apply(this,arguments)}imageEdited(i,t=null){i&&t?(t.isDirty=!0,t.isExportable=!0,t.isCompareEnable=!0):t&&(t.isDirty=!1,t.isExportable=!1,t.isCompareEnable=!1)}afterImageLoad(i){}inputIntensity(i,t){var r=this;return(0,n.A)(function*(){r.isEdit=!0,r.selectedFace.toolValues.set(t.subToolId,i),r.faceBoundingBox&&r.stateService.mainCanvas.remove(r.faceBoundingBox);try{yield r.uploadAndGenrate(t),r.faceBoundingBox&&r.stateService.mainCanvas.remove(r.faceBoundingBox),r.faceDataList.length>1&&r.isNewSelection&&(r.isNewSelection=!1,yield r.faceExpressionService.cutlatestfaces()),yield r.faceExpressionService.putImageOnCanvas(),r.resetValueAcordingToSli
1derVAlues(),r.faceDataList.length>1&&r.faceExpressionService.putlatestfacesoncanvas(),r.stateService.mainCanvas.renderAll(),r.faceExpressionService.checkandupdateFaceBoundingBox(),r.photoEditorService.completeProcessingProgress()}catch{r.photoEditorService.clearProcessingProgress()}})()}slideStart(i,t){this.oldValue=this.selectedFace.toolValues.get(t.subToolId)}changeIntensity(i,t){if(i.hasOwnProperty("oldValue")&&!this.isSliderstart){let H=i.oldValue;this.isSliderstart=!0,this.selectedFace.toolpreviousValues.set(t.subToolId,H)}let T,N;i.hasOwnProperty("newValue")?(T=i.newValue,N=!1):(T=i,N=!0),""!==T&&!Number.isNaN(Number(T))&&(T>100?T=100:T<-100&&(T=-100),this.selectedFace.toolValues.set(t.subToolId,T))}stopIntensity(i,t){let T,N;if(i.hasOwnProperty("newValue")?(T=i.newValue,N=!1):(T=i,N=!0),this.oldValue!==T){if(this.oldValue=null,this.isSliderstart=!1,!this.user||this.user&&!this.user.subscribed){let H=sessionStorage.getItem("ImgsubComponenttime");const q=H?new Date(H):new Date,ne=new Date(q.setHours(q.getHours()+24));(!H||H&&ne<new Date)&&(this.updateCounter=0,sessionStorage.setItem("ImgsubComponenttime",(new Date).toString()),localStorage.removeItem("ImgsubComponent"));const ae=localStorage.getItem("ImgsubComponent");if(null!==ae&&ae||this.updateCounter>=5)return localStorage.setItem("ImgsubComponent","true"),this.openSubscriptionPopup(i,t),void setTimeout(()=>{this.ismodel=!1},200)}""!==T&&!Number.isNaN(Number(T))&&(T>100?T=100:T<-100&&(T=-100),setTimeout(()=>{this.inputIntensity(T,t)},0),this.user?this.user&&!this.user.subscribed&&this.updateCounter++:this.updateCounter++)}else this.oldValue=null}isUndoable(){return!1}isRedoable(){return!1}undoClicked(){}redoClicked(){}apply(){this.faceExpressionService.hideFaceBoundingBox();let i=pe.fabric.util.createCanvasElement();this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,i).then(t=>{this.user?this.checkStorage(t.uri,(r,f)=>{r&&f&&this.applyChanges(t,f)}):this.applyChanges(t)})}applyChanges(i){var t=this;return(0,n.A)(function*(r,f=null){t.photoEditorService.isApplyed=!0,t.photoEditorService.inProgress=!0;let T=r.image;if(t.photoEditorService.inProgress=!1,t.photoEditorService.originalImage=T,yield t.photoEditorService.setPhotoEditorInputImages(T),t.loadImageAfterApply(r.uri),f){const N=pe.fabric.util.createCanvasElement();t.zoomService.fitToScreen(),t._saveImage(N,T,r.uri,f)}t.restAndApplyEvent.emit()}).apply(this,arguments)}loadImageAfterApply(i){this.photoEditorService.imgUrl=i,this.photoEditorService.isDirty=!1,this.unconfigureFabricCanvas(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.stateService.mainCanvas.clear(),this.photoEditorService.isLoaded=!1,this.reloadImage(()=>{this.photoEditorService.isLoaded=!0,this.photoEditorService.isCompareEnable=!1})}resetCanvas(i=null){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="move",this.unconfigureFabricCanvas(),this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.stateService.mainCanvas.clear(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),i&&i()})}cancel(){this.resetCanvas(),this.restAndApplyEvent.emit()}selectFaceImg(i,t=!1){let r;if(r=i.hasOwnProperty("product")?i.product:i,this.isNewSelection=!0,this.selectedFace=r,this.faceExpressionService.selectedFace=this.selectedFace,this.faceExpressionService.checkandupdateFaceBoundingBox(),this.faceBoundingBox=this.faceExpressionService.faceBoundingBox,!t){const f=this.stateService.calcWrapperSize();this.faceExpressionService.focusOnSelectedFace(this.containerId,f)}}uploadAndGenrate(i=null){var t=this;return new Promise(function(){var r=(0,n.A)(function*(f,T){if(t.selectedFace.uploadedFileUrl)try{yield t.generate(i),f()}catch(N){t.photoEditorService.clearProcessingProgress(),T(N)}else t.photoEditorService.startProcessingProgress({featureType:"expression",indeterminate:!0}),t.aiUploadImageService.uploadImage(t.selectedFace.uploadBlob,{tab:"expression",fileName:"untitled.jpeg"},function(){var N=(0,n.A)(function*(H){if(H&&"FAIL"!==H.status){t.selectedFace.uploadedFileUrl=H.contentUrl;
1try{yield t.generate(i),f()}catch(q){t.photoEditorService.clearProcessingProgress(),T(q)}}else t.photoEditorService.clearProcessingProgress(),t.toastService.showError(w.b.message.somethingWrong),T(H)});return function(H){return N.apply(this,arguments)}}())});return function(f,T){return r.apply(this,arguments)}}())}generate(){var i=this;return(0,n.A)(function*(t=null){return new Promise((r,f)=>{const T=i.selectedFace;let N="",H=0;for(const ne of i.toolkeys){const se=i.faceExpressionSubToolMap.get(ne),ce=i.faceExpressionService.mapValue(T.toolValues.get(ne)/100,se.min/100,se.max/100,se.minValue,se.maxValue).toFixed(4);H>0&&H<i.toolkeys.length&&(N+="|"),N+=ce,H++}const q={imageUrl:T.uploadedFileUrl,featureType:"expression",expression:N};i.photoEditorService.startProcessingProgress({featureType:"expression",indeterminate:!0}),i.aiPhotoService.generateImage(q,ne=>{ne&&ne.assetId?(ne.featureType="airetouch",i.aiPhotoService.checkStatus(ne,0,function(){var ae=(0,n.A)(function*(ce){if(ce&&ce.urls&&ce.urls.length>0)i.user&&(i.user.remainingCoins=ce.remainingCalls),T.resultFace=ce.urls[0],r();else{if(t){const ve=i.selectedFace.toolpreviousValues.get(t.subToolId);i.selectedFace.toolValues.set(t.subToolId,ve)}f(),i.photoEditorService.inProgress=!1}});return function(ce){return ae.apply(this,arguments)}}(),ae=>{i.displayErrorMsg(ae),f()})):(i.displayErrorMsg(ne),f())},ne=>{i.displayErrorMsg(ne),f()})})}).apply(this,arguments)}displayErrorMsg(i=null){let t=i?.description||w.b.message.faceNotFound;this.photoEditorService.clearProcessingProgress(),this.createPopupService.openWarningDialog("Error",t).then(f=>{this.restAndApplyEvent.emit(0)})}openSubscriptionPopup(i,t){this.ismodel||(this.subToolId=null,this.subToolValue=null,!this.user||this.user&&!this.user.subscribed?(this.ismodel=!0,this.subToolId=t.subToolId,this.subToolValue=t.value,this.faceExpressionService.showSubscriptionModal().result.then(f=>{if(this.ismodel=!1,"sucess"===f)setTimeout(()=>{this.inputIntensity(i,t)},0);else{const T=this.selectedFace.toolpreviousValues.get(t.subToolId);this.selectedFace.toolValues.set(t.subToolId,T)}})):this.user&&this.user.subscribed&&(this.updateCounter=0,localStorage.removeItem("ImgsubComponent")))}resetValueAcordingToSliderVAlues(){const i=this.faceExpressionService.getFacesWithNonZeroToolValues();Array.from(i.keys()).length>0?(this.photoEditorService.isDirty=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.isCompareEnable=!0):(this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1)}showError(i){const t=document.getElementById("error");t&&(t.textContent=i,console.error(i))}resetAll(){const i=()=>{this.isEdit=!1,this.resetValueAcordingToSliderVAlues(),this.faceDataList.length>0&&this.faceDataList.forEach(r=>{r.isEdited=!1,this.faceExpressionTools.forEach(f=>{f.subToolArray.forEach(T=>{r.toolValues.set(T.subToolId,0),r.toolpreviousValues.set(T.subToolId,0)})})}),this.resetCanvas(()=>{this.detectFaces(!1)})};this.dialogService.confirmDialog({title:w.b.message.resetAllMessage,okButtonText:"Reset All",cancelButtonText:"Cancel"}).result.then(r=>{"ok"==r&&i()})}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(St.M),e.rXU(Z.f),e.rXU(L.s),e.rXU(rt.A),e.rXU(K.g),e.rXU(z.nX),e.rXU(F.A),e.rXU(io.z),e.rXU(I.qQ))},c.\u0275cmp=e.VBU({type:c,selectors:[["faceExpression-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Jv_([Bi.g,io.z]),e.Vt3],decls:20,vars:12,consts:[[1,"scroll-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Body Reshape",1,"d-none"],[1,"child-drawer","drawer-active"],[1,"scroll-content","h-100"],["customScrollDir","",1,"scroll-container"],[1,"common-container","p-0","m-0"],[1,"d-flex","align-items-center","w-100","justify-content-between",2,"min-height","56px"],[1,"d-inline-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32","d-none"],[1,"btn-all","reset-all","text-semi",3,"click","disabled","ngClass"],["class","bg-white filter-category mt-1 mb-2 faceExpression-face",4,"ngIf"],[1,"ngb-btn","common-container","p-0","m-0",3,"ngClass"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["class","tab-div",3,"ngbAccordionItem",4,"ngFor","ngForOf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3",4,"ngIf"],[1,"bg-white","filter-category","mt-1","mb-2","faceExpression-face"],[1,"sticker-buttons-scroll","scrollWidth-300"],[3,"selectMenu","type","categoryId","items"],[1,"tab-div",3,"ngbAccordionItem"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],[1,"common-container","mb-3"],["class","card-body pt-2",4,"ngFor","ngForOf"],[1,"card-body","pt-2"],[1,"text-13","grey-800","text-semi"],[1,"ms-1",3,"name"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"slideStop","slideStart","change","min","max","step","value"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","disabled","","mask","separator.2","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",2,"pointer-events","none",3,"min","max","ngModel","allowNegativeNumbers"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"]],template:function(i,t){1&i&&(e.j41(0,"div",0),e.nrm(1,"input",1),e.j41(2,"div",2),e.qex(3),e.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"pi",8),e.bIt("click",function(){return t.cancel()}),e.k0s(),e.j41(10,"span",9),e.EFF(11,"Face Expression"),e.k0s()(),e.nrm(12,"pi",10),e.j41(13,"button",11),e.bIt("click",function(){return t.resetAll()}),e.EFF(14,"Reset all"),e.k0s()(),e.DNE(15,Ma,3,3,"div",12),e.k0s(),e.j41(16,"div",13)(17,"div",14),e.DNE(18,Aa,14,2,"div",15),e.k0s()()()(),e.bVm(),e.k0s(),e.DNE(19,Ra,6,0,"div",16),e.k0s()),2&i&&(e.R7$(13),e.Y8G("disabled",!t.isEdit)("ngClass",e.eq3(8,Pa,!t.isEdit)),e.R7$(2),e.Y8G("ngIf",(null==t.faceDataList?null:t.faceDataList.length)>1),e.R7$(),e.Y8G("ngClass",e.eq3(10,Ia,t.photoEditorService.isDirty)),e.R7$(),e.Y8G("closeOthers",!0)("destroyOnHide",!1),e.R7$(),e.Y8G("ngForOf",t.faceExpressionTools),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isDirty))},dependencies:[I.YU,I.Sq,I.bT,Mt.I,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,we.me,we.BC,we.tU,we.vS,z.wQ,qe.d1,pt.Zr,Ce.b,Pt.B,It.LR],styles:[".faceExpression-face[_ngcontent-%COMP%]{min-height:52px}
1.reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:0 7px;height:32px}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d}.defualt-scroll[_ngcontent-%COMP%]{overflow-y:auto;height:100%}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px;height:4px}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#e8e8e8;border-radius:12px;opacity:.6;-webkit-transition:width .2s linear,opacity .2s linear,background-color .2s linear;transition:width .2s linear,opacity .2s linear,background-color .2s linear}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#aaa;border-radius:6px}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#999}.defualt-scroll.drawer-scroll-margin[_ngcontent-%COMP%]::-webkit-scrollbar-track{margin-bottom:2px}"]}),v})();var oo=g(98081),ut=g(40580),Di=g(41783),Da=g(83316),Fa=g(16966),Ua=g(96710),La=(g(74972),g(37535),g(62922)),De=g(10235),mt=g(7259),Na=g(87502),Ga=g(96408),Va=g(57160),Xa=g(25693);const za=c=>({"pe-none":c}),Wa=c=>({"pb-14":c});function Ya(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",17)(1,"div",18)(2,"buttons-scroll-menu",19),e.bIt("selectMenu",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.selectDetectedFaceImg(t))}),e.k0s()()()}if(2&c){const s=e.XpG();e.R7$(2),e.Y8G("type","faceExpression")("user",s.user)("categoryId",s.selectedFaceId)("items",s.faceList)}}function $a(c,v){1&c&&(e.j41(0,"span",50),e.nrm(1,"pi",51),e.k0s())}function Ha(c,v){if(1&c&&(e.j41(0,"div",47)(1,"span",48),e.EFF(2),e.k0s(),e.DNE(3,$a,2,0,"span",49),e.k0s()),2&c){const s=v.item,i=e.XpG(4);e.R7$(2),e.JRh(s.value),e.R7$(),e.Y8G("ngIf",s.pro&&!(null!=i.user&&i.user.subscribed))}}function Ka(c,v){if(1&c){const s=e.RV6();e.j41(0,"ng-select",45),e.mxI("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.DH7(r.selectedSideOption,t)||(r.selectedSideOption=t),e.Njj(t)}),e.bIt("ngModelChange",function(t){e.eBV(s);const r=e.XpG(3);return e.Njj(r.onSideOptionSelect(t))}),e.DNE(1,Ha,4,2,"ng-template",46),e.k0s()}if(2&c){const s=e.XpG(3);e.Y8G("items",s.sideOptionList),e.R50("ngModel",s.selectedSideOption),e.Y8G("searchable",!1)("clearable",!1)}}function Za(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",32)(1,"div",33)(2,"div",34)(3,"span",35),e.EFF(4,"Shape"),e.k0s(),e.DNE(5,Ka,2,4,"ng-select",36),e.k0s(),e.j41(6,"div",37)(7,"buttons-scroll-menu",38),e.bIt("selectMenu",function(t){e.eBV(s);const r=e.XpG().$implicit,f=e.XpG();return e.Njj(f.onSelectSubtoolMenu(r,t))}),e.k0s()()(),e.j41(8,"div",33)(9,"span",39),e.EFF(10,"Scale"),e.k0s(),e.j41(11,"div",40)(12,"div",41)(13,"mv-slider",42),e.bIt("change",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onScaleChange(t))}),e.k0s()(),e.j41(14,"div",43),e.nrm(15,"input",44),e.k0s()()()()}if(2&c){const s=e.XpG().$implicit,i=e.XpG();e.R7$(5),e.Y8G("ngIf",(null==s?null:s.type)==i.FaceReshapeTool.EYEBROWS||(null==s?null:s.type)==i.FaceReshapeTool.EYES),e.R7$(2),e.Y8G("type","faceReshapeSubtools")("user",i.user)("categoryId",null==i.selectedSubTool?null:i.selectedSubTool.type)("sideKey",(null==i.selectedSideOption||null==i.selectedSideOption.toLowerCase?null:i.selectedSideOption.toLowerCase())||"both")("items",s.subtools),e.R7$(6),e.Y8G("min",-100)("max",100)("step",1)("value",null==i.selectedSubTool||null==i.selectedSubTool.values[(null==i.selectedSideOption||null==i.selectedSideOption.toLowerCase?null:i.selectedSideOption.toLowerCase())||"both"]?null:i.selectedSubTool.values[(null==i.selectedSideOption||null==i.selectedSideOption.toLowerCase?null:i.selectedSideOption.toLowerCase())||"both"].current),e.R7$(2),e.Y8G("min",-100)("max",100)("ngModel",null==i.selectedSubTool||null==i.selectedSubTool.values[(null==i.selectedSideOption||null==i.selectedSideOption.toLowerCase?null:i.selectedSideOption.toLowerCase())||"both"]?null:i.selectedSubTool.values[(null==i.selectedSideOption||null==i.selectedSideOption.toLowerCase?null:i.selectedSideOption.toLowerCase())||"both"].current)("allowNegativeNumbers",!0)}}function Qa(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",20)(1,"div",21)(2,"div",22),e.bIt("click",function(){const t=e.eBV(s).$implicit,r=e.XpG();return e.Njj(r.selectTool(t))}),e.j41(3,"button",23)(4,"div",24),e.EFF(5),e.k0s()(),e.j41(6,"button",25)(7,"span",26),e.nrm(8,"pi",27),e.k0s(),e.j41(9,"span",28),e.nrm(10,"pi",29),e.k0s()()()(),e.j41(11,"div",30)(12,"div",31),e.DNE(13,Za,16,14,"ng-template"),e.k0s()()()}if(2&c){const s=v.$implicit;e.Y8G("ngbAccordionItem",s.name),e.R7$(5),e.JRh(s.name)}}function Ja(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",52)(1,"div",53)(2,"button",54),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.cancel())}),e.EFF(3,"Cancel"),e.k0s(),e.j41(4,"button",55),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.apply())}),e.EFF(5,"Apply"),e.k0s()()()}}let qa=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se){var xe;super(t,r,f,T,q,"faceReshape"),xe=this,this.authService=i,this.photoEditorService=t,this.stateService=r,this.zoomService=f,this.uploadService=T,this.uploadImageService=N,this.toastService=H,this.route=q,this.faceDetectionService=ne,this.faceApiMultiFaceService=se,this.subsService=ae,this.env=ce,this.createPopupService=ve,this.document=Se,this.restAndApplyEvent=new e.bkB,this.faceReshapeTools=[],this.selectedTool=null,this.FaceRe
1shapeTool=mt.IX,this.scaleValue=0,this.selectedSubTool=null,this.faceDataModel=null,this.subtooledited=!1,this.detectionsResult=null,this.faceList=[],this.selectedFaceId=null,this.uploadImageScaleFactor=1.3,this.faceBoundingBox=null,this.perFaceTools={},this.baseToolsTemplate=JSON.parse(JSON.stringify(mt.Jy)),this.selectedSideOption="Both",this.previousSideOption="Both",this.sideOptionList=[{key:"Both",value:"Both Sides",pro:!1},{key:"Left",value:"Left Side",pro:!0},{key:"Right",value:"Right Side",pro:!0}],this.selectedSideOptionoption=this.sideOptionList[0],this.onWebglContextLost=()=>{try{this.toastService&&this.toastService.showError&&this.toastService.showError("Graphics context was lost. Reloading...")}catch{}setTimeout(()=>{try{window.location.reload()}catch{try{this.restAndApplyEvent.emit()}catch{}}},250)},this.user=this.authService.currentUser(),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ke=>{if(ke){this.photoEditorService.isLoaded=!1;try{this.photoEditorService.checkProjectName(!0)}catch{}this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.faceList=[],this.resetAll(!0),setTimeout(()=>{this.init((0,n.A)(function*(){yield xe.detectFacesAndPrepare()}))},0)}})}updateEditedFlagForFace(i){if(!i)return;const t=this.perFaceTools?.[i];let r=!1;if(t&&t.length)e:for(const T of t)if(T?.subtools)for(const N of T.subtools)if(0!==(N?.values?.both?.current||0)||0!==(N?.values?.left?.current||0)||0!==(N?.values?.right?.current||0)){r=!0;break e}const f=(this.faceList||[]).find(T=>T?.id===i);f&&(f.isEdited=r)}updateCompareEnableState(){this.photoEditorService.isCompareEnable=(()=>{const t=r=>{if(!r||!r.length)return!1;for(const f of r)if(f?.subtools)for(const T of f.subtools)if(0!==(T?.values?.both?.current||0)||0!==(T?.values?.left?.current||0)||0!==(T?.values?.right?.current||0))return!0;return!1};if(this.perFaceTools&&Object.keys(this.perFaceTools).length){for(const r of Object.keys(this.perFaceTools))if(t(this.perFaceTools[r]))return!0;return!1}return t(this.faceReshapeTools)})()}ngOnDestroy(){this.uploadImageServiceAfterImageLoadSub?.unsubscribe(),this.faceBoundingBoxVisibilitySub?.unsubscribe();try{const i=pe.fabric.filterBackend,t=i&&i.canvas;t&&this.glContextLostHandlerRef&&(t.removeEventListener("webglcontextlost",this.glContextLostHandlerRef),this.glContextLostHandlerRef=null)}catch{}}afterImageLoad(i){}loadMediaPipeScripts(){var i=this;return(0,n.A)(function*(){if(!(window.FilesetResolver&&window.FaceLandmarker&&window.FaceDetector))return new Promise((t,r)=>{const f=i.document.createElement("script");f.type="module",f.textContent="\n import { FilesetResolver, FaceLandmarker, FaceDetector } from 'https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]';\n window.FilesetResolver = FilesetResolver;\n window.FaceLandmarker = FaceLandmarker;\n window.FaceDetector = FaceDetector;\n window.dispatchEvent(new CustomEvent('mediapipe-loaded'));\n ",f.onload=()=>{console.log("MediaPipe scripts loaded successfully"),t()},f.onerror=N=>{console.error("Failed to load MediaPipe scripts:",N),r(N)};const T=()=>{window.removeEventListener("mediapipe-loaded",T),t()};window.addEventListener("mediapipe-loaded",T),i.document.head.appendChild(f)});console.log("MediaPipe scripts already loaded")})()}ngOnInit(){var i=this;return(0,n.A)(function*(){i.faceReshapeTools=JSON.parse(JSON.stringify(mt.Jy)),i.photoEditorService.toolNameForDownload="faceReshape",i.imageEdited(!1,i.photoEditorService);try{i.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),yield i.loadMediaPipeScripts(),yield i.faceDetectionService.initialize();try{const t=pe.fabric.filterBackend||pe.fabric.initFilterBackend?.(),r=t&&t.canvas;r&&(i.glContextLostHandlerRef=f=>{try{f&&f.preventDefault&&f.preventDefault()}catch{}i.onWebglContextLost()},r.addEventListener("webglcontextlost",i.glContextLostHandlerRef,!1))}catch{i.photoEditorService.clearProcessingProgress()}}catch(t){console.log(t),i.photoEditorService.clearProcessingProgress()}i.photoEditorService.originalImage?(i.photoEditorService.processingProgress.isActive?i.photoEditorService.inProgress=!0:i.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage}),i.stateService.mainCanvas.clear(),i.zoomService.defaultZoom=!0,i.zoomService.fitToScreen(),i.reloadImage((0,n.A)(function*(){i.photoEditorService.isDirty=!1,yield i.detectFacesAndPrepare()}))):(i.init((0,n.A)(function*(){yield i.detectFacesAndPrepare()})),setTimeout(()=>{i.photoEditorService.clearProcessingProgress()},200)),i.faceBoundingBoxVisibilitySub=i.photoEditorService.visibility$.subscribe(t=>{"hide"===t?i.removeFaceBoundingBoxOverlay():"show"===t&&i.checkandupdateFaceBoundingBox()})})()}removeFaceBoundingBoxOverlay(){try{this.faceBoundingBox&&this.stateService?.mainCanvas&&(this.stateService.mainCanvas.remove(this.faceBoundingBox),this.faceBoundingBox=null,this.stateService.mainCanvas.renderAll())}catch{}}
1detectLandmarks(){var i=this;return(0,n.A)(function*(t=!1){i.photoEditorService.inProgress=!0;try{const r=i.photoEditorService.originalImage;if(r){let f=yield i.faceDetectionService.getLandmarks(r);if(!f||!f.length||!f[0])return void i.displayErrorMsg();const T=f[0],N=ut.k.calculateDistanceA(T[152],T[10])*r.height,H=ut.k.calculateAngle(T[152],T[10]),q=ut.k.calculateAngle(T[234],T[454]);i.faceDataModel=new Di.t(T,r.width,r.height,null,q,H,N),t||i.setupTriangleMaskWarpFilter()}else i.toastService.showError("No image found for landmark detection.")}catch(r){i.toastService.showError("Failed to detect face landmarks: "+(r?.message||r))}}).apply(this,arguments)}detectFacesAndPrepare(){var i=this;return(0,n.A)(function*(){i.photoEditorService.processingProgress.isActive?i.photoEditorService.inProgress=!0:i.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage});try{const t=i.photoEditorService.originalImage;if(!t)return;yield i.faceApiMultiFaceService.loadModels("https://static.lightxeditor.com/assets/models/ssd_mobilenetv1");const{detections:r}=yield i.faceApiMultiFaceService.detectFacesFaceApi(t);i.detectionsResult=r,r?.detections?.length?(i.faceList=yield i.faceApiMultiFaceService.createFaceList(r,t,i.uploadImageScaleFactor),i.selectedFaceId=i.faceList[0]?.id||null,(i.faceList||[]).forEach(f=>{f?.id&&!i.perFaceTools[f.id]&&(i.perFaceTools[f.id]=JSON.parse(JSON.stringify(i.baseToolsTemplate)))}),i.selectedFaceId&&i.perFaceTools[i.selectedFaceId]&&(i.faceReshapeTools=i.perFaceTools[i.selectedFaceId],i.syncSelectedToolToFaceTools()),yield i.detectLandmarksForSelectedFace(!1),i.checkandupdateFaceBoundingBox()):i.displayErrorMsg()}catch(t){console.warn("Multi-face detection failed; falling back to single-face landmarks",t),yield i.detectLandmarks(!1)}finally{i.photoEditorService.processingProgress.isActive?i.photoEditorService.completeProcessingProgress():i.photoEditorService.inProgress=!1}})()}displayErrorMsg(i=null){let t=i?.description||w.b.message.faceNotFound;this.photoEditorService.clearProcessingProgress(),this.createPopupService.openWarningDialog("Error",t).then(f=>{this.restAndApplyEvent.emit(0)})}focusOnSelectedFace(i,t){const r=(this.faceList||[]).find(Se=>Se?.id===this.selectedFaceId),f=this.stateService?.mainCanvas;if(!r||!f)return;const T=t?.width||f.getWidth(),N=t?.height||f.getHeight(),ne=Math.min(.4*T/(r.width||1),.4*N/(r.height||1),2);if(this.zoomService&&this.zoomService.set)try{this.zoomService.set(ne),this.zoomService.zoomValue$&&this.zoomService.zoomValue$.next()}catch{f.setZoom(ne)}else try{f.setZoom(ne)}catch{}const se=document.getElementById(i),ae=f.getZoom?f.getZoom():ne,ve=(r.originY+r.height/2)*ae;if(se&&"function"==typeof se.scrollTo){const Se=Math.max(0,(r.originX+r.width/2)*ae-se.clientWidth/2),xe=Math.max(0,ve-se.clientHeight/2);setTimeout(()=>{se.scrollTo({left:Se,top:xe,behavior:"smooth"})})}}onSelectDetectedFace(i){var t=this;return(0,n.A)(function*(){t.selectedFaceId=i,t.perFaceTools[i]||(t.perFaceTools[i]=JSON.parse(JSON.stringify(t.baseToolsTemplate))),t.faceReshapeTools=t.perFaceTools[i],t.selectedTool=null,t.selectedSubTool=null,t.scaleValue=0,yield t.detectLandmarksForSelectedFace();try{const r=t.stateService.calcWrapperSize?t.stateService.calcWrapperSize():{width:t.stateService.mainCanvas.getWidth(),height:t.stateService.mainCanvas.getHeight()};t.focusOnSelectedFace("canvas-mask-wrapper",r)}catch{}})()}selectDetectedFaceImg(i){const t=i?.product?.id||i?.id||i;t&&(this.onSelectDetectedFace(t),this.checkandupdateFaceBoundingBox())}syncSelectedToolToFaceTools(){try{if(!this.faceReshapeTools||0===this.faceReshapeTools.length)return;if(this.selectedTool){const i=this.faceReshapeTools.find(t=>t.type===this.selectedTool.type)||this.faceReshapeTools[0];this.selectedTool=i}else this.selectedTool=this.faceReshapeTools[0];if(this.selectedTool){const i=this.selectedSubTool?.type,t=this.selectedTool.subtools.find(r=>r.type===i)||this.selectedTool.subtools[0];this.selectedSubTool=t}}catch{}}checkandupdateFaceBoundingBox(){try{if(!this.stateService?.mainCanvas)return;if(!this.faceList||this.faceList.length<=1)return void(this.faceBoundingBox&&
1(this.stateService.mainCanvas.remove(this.faceBoundingBox),this.faceBoundingBox=null,this.stateService.mainCanvas.renderAll()));this.faceBoundingBox&&(this.stateService.mainCanvas.remove(this.faceBoundingBox),this.faceBoundingBox=null);const i=(this.faceList||[]).find(q=>q?.id===this.selectedFaceId);if(!i)return void this.stateService.mainCanvas.renderAll();const t=i,r=Math.max(0,Math.floor(t.originX||t.x||0)),f=Math.max(0,Math.floor(t.originY||t.y||0)),T=Math.floor(t.width||0),N=Math.floor(t.height||0),H=new Ri.jj({left:r,top:f,width:T,height:N,objectCaching:!1});this.faceBoundingBox=H,this.stateService.mainCanvas.add(H),this.stateService.mainCanvas.bringToFront(H),this.stateService.mainCanvas.renderAll()}catch{}}detectLandmarksForSelectedFace(){var i=this;return(0,n.A)(function*(t=!1){if(!i.selectedFaceId)return void(yield i.detectLandmarks(t));const r=(i.faceList||[]).find(f=>f?.id===i.selectedFaceId);if(r)try{const T=URL.createObjectURL(r.uploadBlob),N=yield new Promise((Re,Ge)=>{const je=new Image;je.onload=()=>Re(je),je.onerror=Ge,je.src=T}),H=yield i.faceDetectionService.getLandmarks(N);if(!H||!H.length||!H[0])return void i.displayErrorMsg();const q=r.cropParam||{boundedMinX:0,boundedMinY:0,boundedMaxX:0,boundedMaxY:0},ne=q.boundedMinX||0,se=q.boundedMinY||0,ae=(q.boundedMaxX||0)-ne,ce=(q.boundedMaxY||0)-se,ve=i.photoEditorService.originalImage,Se=ve.width,xe=ve.height,Te=H[0].map(Re=>({x:(ne+Re.x*ae)/Se,y:(se+Re.y*ce)/xe,z:Re.z})),We=ut.k.calculateDistanceA(Te[152],Te[10])*xe,Me=ut.k.calculateAngle(Te[152],Te[10]),Ae=ut.k.calculateAngle(Te[234],Te[454]);i.faceDataModel=new Di.t(Te,Se,xe,null,Ae,Me,We),t||i.setupTriangleMaskWarpFilter()}catch(f){console.warn("Failed landmarking selected face; falling back to single-face",f),yield i.detectLandmarks(t)}else yield i.detectLandmarks(t)}).apply(this,arguments)}imageEdited(i,t=null){i&&t?(t.isDirty=!0,t.isExportable=!0,t.isCompareEnable=!0):t&&(t.isDirty=!1,t.isExportable=!1,t.isCompareEnable=!1)}resetAll(i=!1){var t=this;try{if(this.faceBoundingBox&&this.stateService?.mainCanvas){try{this.stateService.mainCanvas.remove(this.faceBoundingBox),this.stateService.mainCanvas.renderAll()}catch{}this.faceBoundingBox=null}this.selectedTool=null,this.selectedSubTool=null,this.scaleValue=0,this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.perFaceTools&&Object.keys(this.perFaceTools).forEach(r=>{this.perFaceTools[r]?.forEach(T=>T.subtools?.forEach(N=>{N?.values&&(N.values.both.current=0,N.values.both.previous=0,N.values.left.current=0,N.values.left.previous=0,N.values.right.current=0,N.values.right.previous=0)}))}),(this.faceList||[]).forEach(r=>{r.isEdited=!1}),this.perFaceTools={},i||(this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage((0,n.A)(function*(){yield t.detectFacesAndPrepare()})))}catch{}}apply(){if(this.faceBoundingBox&&this.stateService?.mainCanvas)try{this.stateService.mainCanvas.remove(this.faceBoundingBox),this.stateService.mainCanvas.renderAll()}catch{}let t=pe.fabric.util.createCanvasElement();this.photoEditorService.getImageFromCanvas(this.stateService.original.width,this.stateService.original.height,this.zoomService.currentZoom,t).then(r=>{this.user?this.checkStorage(r.uri,(f,T)=>{f&&T&&this.applyChanges(r,T)}):this.applyChanges(r)})}applyChanges(i){var t=this;return(0,n.A)(function*(r,f=null){let T;t.photoEditorService.inProgress=!0;try{T=r.image,t.photoEditorService.originalImage=T,t.photoEditorService.setPhotoEditorInputImages&&(yield t.photoEditorService.setPhotoEditorInputImages(T))}finally{if(t.photoEditorService.isDirty=!1,t.photoEditorService.isCompareEnable=!1,t.zoomService.defaultZoom=!0,t.zoomService.fitToScreen(),t.photoEditorService.isApplyed=!0,f){const N=t.document.createElement("canvas");t.zoomService.fitToScreen(),t._saveImage(N,T,r.uri,f)}t.restAndApplyEvent.emit(),t.photoEditorService.inProgress=!1}}).apply(this,arguments)}cancel(){if(this.faceBoundingBox&&this.stateService?.mainCanvas){try{this.stateService.mainCanvas.remove(this.faceBoundingBox),this.stateService.mainCanvas.renderAll()}catch{}this.faceBoundingBox=null}this.photoEditorService.isDirty=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.restAndApplyEvent.emit()}isUndoable(){return!1}isRedoable(){return!1}selectTool(i){this.selectedSideOption="Both",this.previousSideOption=this.selectedSideOption,this.selectedTool=i,this.selectSubTool(i.subtools[0])}onSideOptionSelect(i){const t=i||this.selectedSideOptionoption.key,f=!!(this.sideOptionList||[]).find(T=>T.key===t)?.pro;if(this.user=this.authService.currentUser(),!f||this.user&&(!this.user||this.user.subscribed))this.previousSideOption=t,this.selectSubTool(this.selectedSubTool);else{const T=this.previousSideOption||"Both";this.subsService.loginWithUpgrade(()=>{const N=this.authService.currentUser();N&&N.subscribed?(this.selectedSideOption=t,this.selectSubTool(this.selectedSubTool),setTimeout(()=>{this.user=N},0)):setTimeout(()=>{this.selectedSideOption=T;const H=(this.sideOptionList||[]).find(q=>q.key===T);
1this.selectedSideOptionoption=H},0)},{coinSectionHide:this.env.isMobileView},!0)}}selectSubTool(i){var t=this;return(0,n.A)(function*(){if(t.subtooledited){t.subtooledited=!1,t.photoEditorService.startProcessingProgress({indeterminate:!0,message:w.b.label.processingImage});const H=new Promise(q=>setTimeout(q,1e3));try{yield Promise.all([H,t.captureCanvasAsOriginalAndRedetect()]),t.photoEditorService.completeProcessingProgress()}catch{t.photoEditorService.clearProcessingProgress()}}if(t.selectedSubTool){const H=t.selectedSideOption?.toLowerCase?.()||"both";t.selectedSubTool.values[H].previous=t.selectedSubTool.values[H].current}t.selectedSubTool=i;let r=0;"Left"==t.selectedSideOption?r=1:"Right"==t.selectedSideOption&&(r=2);let f={staticPointArray:null,startPointArray:null,endPointArray:null};switch(t.selectedTool.type){case mt.IX.SHAPE:f=(new Da.y).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type);break;case mt.IX.RATIO:f=(new Fa.g).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type);break;case mt.IX.EYEBROWS:f=(new Na.i).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type,r);break;case mt.IX.EYES:f=(new Ga.o).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type,r);break;case mt.IX.NOSE:f=(new Va.g).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type);break;case mt.IX.LIPS:f=(new Xa.b).updatePointsForSelection(t.faceDataModel,t.selectedSubTool.type)}const T=new Ua.o;t.algo=T,T.setFrameLength(80);const N=t.photoEditorService.originalImage;T.setImageSize({width:N.width,height:N.height}),T.addStaticPointArray(f.staticPointArray),T.addDynamicPointArray(f.startPointArray,f.endPointArray),T.applyDelaunayForFrame(0)})()}onSelectSubtoolMenu(i,t){const r=t?.type??t?.product?.type;if(null==r)return;const f=i?.subtools?.find(N=>N.type===r);if(!f||this.selectedSubTool&&this.selectedSubTool.type===f.type)return;const T=()=>{this.selectSubTool(f)};this.user=this.authService.currentUser(),Number(f.pro)&&(!this.user||this.user&&!this.user.subscribed)?this.subsService.loginWithUpgrade(()=>{this.user=this.authService.currentUser(),this.user&&this.user.subscribed&&T()},{coinSectionHide:this.env.isMobileView}):T()}captureCanvasAsOriginalAndRedetect(){var i=this;return(0,n.A)(function*(){try{const t=!!i.faceBoundingBox;if(t&&i.stateService?.mainCanvas)try{i.stateService.mainCanvas.remove(i.faceBoundingBox),i.stateService.mainCanvas.renderAll()}catch{}const r=pe.fabric.util.createCanvasElement(),f=i.stateService.original.width,T=i.stateService.original.height,N=i.zoomService.currentZoom,H=yield i.photoEditorService.getImageFromCanvasBlob(f,T,N,r);i.photoEditorService.originalImage=H.image,i.inputImage=new pe.fabric.Image(i.photoEditorService.originalImage,{selectable:!1,evented:!1}),i.stateService.mainCanvas.clear(),i.stateService.mainCanvas.add(i.inputImage),i.stateService.mainCanvas.renderAll(),yield i.detectLandmarksForSelectedFaceFromCurrentCanvas(!1),t&&i.checkandupdateFaceBoundingBox()}catch(t){console.warn("Failed to capture canvas and re-detect landmarks",t)}})()}detectLandmarksForSelectedFaceFromCurrentCanvas(){var i=this;return(0,n.A)(function*(t=!1){if(!i.selectedFaceId||!i.faceList?.length)return void(yield i.detectLandmarks(t));const r=i.faceList.find(f=>f?.id===i.selectedFaceId);if(r)try{const f=r.cropParam||{boundedMinX:0,boundedMinY:0,boundedMaxX:0,boundedMaxY:0},T=Math.max(0,Math.floor(f.boundedMinX||0)),N=Math.max(0,Math.floor(f.boundedMinY||0)),H=Math.max(T+1,Math.floor(f.boundedMaxX||0)),q=Math.max(N+1,Math.floor(f.boundedMaxY||0)),ne=H-T,se=q-N,ae=i.photoEditorService.originalImage,ce=document.createElement("canvas");ce.width=ne,ce.height=se,ce.getContext("2d").drawImage(ae,T,N,ne,se,0,0,ne,se);const Se=yield new Promise((je,Xe)=>{ce.toBlob(Ke=>{if(!Ke)return void Xe(new Error("Failed to create blob for cropped face"));const Ye=URL.createObjectURL(Ke),Je=new Image;Je.onload=()=>je(Je),Je.onerror=Xe,Je.src=Ye},"image/png",.9)}),xe=yield i.faceDetectionService.getLandmarks(Se);if(!xe||!xe.length)throw new Error("No landmarks returned for cropped face");const ke=ae.width,Te=ae.height,Me=xe[0].map(je=>({x:(T+je.x*ne)/ke,y:(N+je.y*se)/Te,z:je.z})),Ae=ut.k.calculateDistanceA(Me[152],Me[10])*Te,Re=ut.k.calculateAngle(Me[152],Me[10]),Ge=ut.k.calculateAngle(Me[234],Me[454]);i.faceDataModel=new Di.t(Me,ke,Te,null,Ge,Re,Ae),t||i.setupTriangleMaskWarpFilter(),i.checkandupdateFaceBoundingBox()}catch(f){console.warn("Failed re-landmarking selected face from current canvas; falling back",f),yield i.detectLandmarks(t)}else yield i.detectLandmarks(t)}).apply(this,arguments)}onScaleChange(i){let t,r;i.hasOwnProperty("newValue")?(t=i.newValue,r=!1):(t=i,r=!0),this.selectedSubTool&&this.algo?null!=t&&!Number.isNaN(Number(t))&&(t>100?t=100:t<-100&&(t=-100),this.scaleValue=t,this.applyScaleTransformation(t)):this.scaleValue=null==t||Number.isNaN(Number(t))?0:t}applyScaleTransformation(i){if(!this.selectedSubTool||!this.algo)return;const t=this.selectedSideOption?.toLowerCase?.()||"both";this.selectedSubTool.values[t].current=i;const r=this.getProgressFactor(i),f=Math.round(80*r/4),T=this.algo;if(!T)return;T.applyDelaunayForFrame(f);const N=T.getDynamicTriangles(),H=T.buildTriangleMaskCanvas(this.inputImage),q=this.buildTriangleLUTArrayCV(N);this.updateTriangleMaskWarpFilterWithArray(H,q,N.length),this.imageEdited(!0,this.photoEditorService),this.subtooledited=!0,this.updateEditedFlagForFace(this.selectedFaceId),this.updateCompareEnableState()}back(){this.cancel()}setupTriangleMaskWarpFilter(){const i=this.inputImage;if(!i)return;const t=pe.fabric.Image.filters.TriangleMaskWarp;t?(this.maskWarpFilter=new t({maskImage:null,triLUTImage:null,triCount:0}),i.filters=i.filters||[],i.filters.push(this.maskWarpFilter),i.applyFilters(),this.stateService.mainCanvas.renderAll()):console.warn("TriangleMaskWarp not found")}buildTriangleLUTCanvas(i){const t=this.inputImage;if(!t)return null;
1const r=t.getElement(),f=r&&(r.naturalWidth||r.videoWidth)||t.width,T=r&&(r.naturalHeight||r.videoHeight)||t.height,N=i.length,H=Math.max(1,2*N);this.triangleLUTCanvas||(this.triangleLUTCanvas=document.createElement("canvas"));const q=this.triangleLUTCanvas;q.width=H,q.height=1;const ne=q.getContext("2d"),se=ne.createImageData(H,1);for(let ae=0;ae<N;ae++){const ce=i[ae],ve=ce[0],Se=ce[1],xe=ce[2],ke=ce[3]||ce[0],Te=ce[4]||ce[1],We=ce[5]||ce[2],Me=bt=>bt/f,Ae=bt=>bt/T,Re=bt=>Math.max(0,Math.min(255,Math.round(255*(.5*bt+.5)))),Ge=(bt,Ac,Rc,Bc,Dc)=>{const zt=4*bt;se.data[zt]=Ac,se.data[zt+1]=Rc,se.data[zt+2]=Bc,se.data[zt+3]=Dc},je=Me(ke.x),Xe=Ae(ke.y),Ke=Me(Te.x),Ye=Ae(Te.y),Je=Me(We.x),st=Ae(We.y),tt=Me(ve.x),at=Ae(ve.y),wt=Me(Se.x),_t=Ae(Se.y),ro=Me(xe.x),ao=Ae(xe.y),lo=Ke-je,co=Ye-Xe,ho=Je-je,po=st-Xe,Xt=lo*po-co*ho||1e-8,uo=po/Xt,mo=-co/Xt,go=-ho/Xt,_o=lo/Xt,fo=Ke-je,vo=Ye-Xe,bo=Je-je,Co=st-Xe,xo=uo*fo+mo*vo,So=go*fo+_o*vo,Eo=uo*bo+mo*Co,yo=go*bo+_o*Co,wo=(wt-tt)*xo+(ro-tt)*Eo,ko=(wt-tt)*So+(ro-tt)*yo,jc=tt-(wo*je+ko*Xe),To=(_t-at)*xo+(ao-at)*Eo,Po=(_t-at)*So+(ao-at)*yo,Oc=at-(To*je+Po*Xe),Io=2*ae;
1Ge(Io+0,Re(wo),Re(ko),Re(jc),255),Ge(Io+1,Re(To),Re(Po),Re(Oc),255)}return ne.putImageData(se,0,0),q}buildTriangleLUTCanvasCV(i){const t=this.inputImage;if(!t)return null;const r=window.cv;if(!r||"function"!=typeof r.getAffineTransform)return console.warn("OpenCV not available; falling back to non-OpenCV LUT builder"),this.buildTriangleLUTCanvas(i);const f=t.getElement(),T=f&&(f.naturalWidth||f.videoWidth)||t.width,N=f&&(f.naturalHeight||f.videoHeight)||t.height,H=i.length||0,q=Math.max(1,2*H);this.triangleLUTCanvas||(this.triangleLUTCanvas=document.createElement("canvas"));const ne=this.triangleLUTCanvas;ne.width=q,ne.height=1;const se=ne.getContext("2d"),ae=se.createImageData(q,1),ce=Se=>{const xe=Math.max(-1,Math.min(1,Se));return Math.max(0,Math.min(255,Math.round(255*(.5*xe+.5))))},ve=(Se,xe,ke,Te,We)=>{const Me=4*Se;ae.data[Me]=xe,ae.data[Me+1]=ke,ae.data[Me+2]=Te,ae.data[Me+3]=We};for(let Se=0;Se<H;Se++){const xe=i[Se];if(!xe)continue;const ke=xe[0],Te=xe[1],We=xe[2],Me=xe[3]||xe[0],Ae=xe[4]||xe[1],Re=xe[5]||xe[2];let Ge,je,Xe;try{Ge=r.matFromArray(3,2,r.CV_32F,[Me.x,Me.y,Ae.x,Ae.y,Re.x,Re.y]),je=r.matFromArray(3,2,r.CV_32F,[ke.x,ke.y,Te.x,Te.y,We.x,We.y]),Xe=r.getAffineTransform(Ge,je);const Ke=Xe.data64F||Xe.data32F;let Je=Ke[1],st=Ke[2],tt=Ke[3],at=Ke[4],wt=Ke[5];const _t=2*Se;ve(_t+0,ce(Ke[0]),ce(Je),ce(st/Math.max(1,T)),255),ve(_t+1,ce(tt),ce(at),ce(wt/Math.max(1,N)),255)}catch(Ke){console.warn("Failed to compute affine transform for triangle",Se,Ke);const Ye=2*Se;ve(Ye+0,ce(1),ce(0),ce(0),255),ve(Ye+1,ce(0),ce(1),ce(0),255)}finally{try{Ge&&Ge.delete&&Ge.delete()}catch{}try{je&&je.delete&&je.delete()}catch{}try{Xe&&Xe.delete&&Xe.delete()}catch{}}}return se.putImageData(ae,0,0),ne}buildTriangleLUTArrayCV(i){const t=i?.length||0,r=new Float32Array(6*t);for(let f=0;f<t;f++){const T=i[f];if(!T)continue;const N=T[0],H=T[1],q=T[2],ne=T[3]||T[0],se=T[4]||T[1],ae=T[5]||T[2];let ce,ve,Se;try{const xe=La.s.computeAffineFromTriangles(N,H,q,ne,se,ae),Te=xe[1],We=xe[2],Me=xe[3],Ae=xe[4],Re=xe[5],Ge=6*f;r[Ge+0]=xe[0],r[Ge+1]=Te,r[Ge+2]=We,r[Ge+3]=Me,r[Ge+4]=Ae,r[Ge+5]=Re}catch{const ke=6*f;r[ke+0]=1,r[ke+1]=0,r[ke+2]=0,r[ke+3]=0,r[ke+4]=1,r[ke+5]=0}finally{try{ce&&ce.delete&&ce.delete()}catch{}try{ve&&ve.delete&&ve.delete()}catch{}try{Se&&Se.delete&&Se.delete()}catch{}}}return r}updateTriangleMaskWarpFilter(i,t,r){if(!this.maskWarpFilter||!this.inputImage)return;this.maskWarpFilter.maskImage=i,this.maskWarpFilter.triLUTImage=t,this.maskWarpFilter.triCount=r;const f=this.inputImage.getElement();this.maskWarpFilter.imageWidth=f&&(f.naturalWidth||f.videoWidth)||this.inputImage.width,this.maskWarpFilter.imageHeight=f&&(f.naturalHeight||f.videoHeight)||this.inputImage.height,this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}updateTriangleMaskWarpFilterWithArray(i,t,r){if(!this.maskWarpFilter||!this.inputImage)return;this.maskWarpFilter.maskImage=i,this.maskWarpFilter.triLUTImage=null,this.maskWarpFilter.triLUTArray=t,this.maskWarpFilter.triCount=r;const f=this.inputImage.getElement();this.maskWarpFilter.imageWidth=f&&(f.naturalWidth||f.videoWidth)||this.inputImage.width,this.maskWarpFilter.imageHeight=f&&(f.naturalHeight||f.videoHeight)||this.inputImage.height,this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}interpolateValue(i,t,r,f,T){return r===t?f:f+(i-t)/(r-t)*(T-f)}getLastProgress(){const i=this.selectedSideOption?.toLowerCase?.()||"both";return this.selectedSubTool.values[i]?.previous||0}getProgressFactor(i){let t=2*(i/100+1),r=t,f=2*(this.getLastProgress()/100+1);switch(this.selectedSubTool.type){case De.I.EYEBROW_LIFT:t=4-t,f=4-f;case De.I.EYE_LIFT:case De.I.EYE_DISTANCE:r=this.interpolateValue(t,0,4,1.5,2.5),f=this.interpolateValue(f,0,4,1.5,2.5);break;case De.I.EYE_HEIGHT:case De.I.NOSE_WIDTH:case De.I.NOSE_TIP:r=this.interpolateValue(t,0,4,1.75,2.25),f=this.interpolateValue(f,0,4,1.75,2.25);break;case De.I.EYE_SIZE:t=4-t,f=4-f,r=this.interpolateValue(t,0,4,1.85,2.15),f=this.interpolateValue(f,0,4,1.85,2.15);break;case De.I.EYEBROW_PEAK:r=this.interpolateValue(t,0,4,1.5,2.5),f=this.interpolateValue(f,0,4,1.5,2.5);break;case De.I.EYEBROW_TILT:case De.I.EYE_TILT:r=this.interpolateValue(t,0,4,1.85,2.15),f=this.interpolateValue(f,0,4,1.85,2.15);break;case De.I.NOSE_WING:case De.I.RATIO_MIDDLE:r=this.interpolateValue(t,0,4,1.6,2.4),f=this.interpolateValue(f,0,4,1.6,2.4);break;case De.I.NOSE_BRIDGE:r=this.interpolateValue(t,0,4,1,3),f=this.interpolateValue(f,0,4,1,3);break;case De.I.NOSE_LIFT:t=4-t,f=4-f,r=this.interpolateValue(t,0,4,1.75,2.25),f=this.interpolateValue(f,0,4,1.75,2.25);break;case De.I.NOSE_SIZE:r=this.interpolateValue(t,0,4,1.5,2.5),f=this.interpolateValue(f,0,4,1.5,2.5);break;case De.I.RATIO_TOP:t=4-t,f=4-f,r=this.interpolateValue(t,0,4,1.85,2.15),f=this.interpolateValue(f,0,4,1.85,2.15);break;case De.I.RATIO_UPPER:r=this.interpolateValue(t,0,4,1.6,2.4),f=this.interpolateValue(f,0,4,1.6,2.4);break;case De.I.RATIO_LOWER:case De.I.SHAPE_CHIN:case De.I.SHAPE_VSHAPE:case De.I.SHAPE_SLIM:r=this.interpolateValue(t,0,4,1.8,2.2),f=this.interpolateValue(f,0,4,1.8,2.2);break;case De.I.EYEBROW_LENGTH:case De.I.EYEBROW_DISTANCE:r=this.interpolateValue(t,0,4,1.25,2.75),f=this.interpolateValue(f,0,4,1.25,2.75);break;case De.I.EYE_WIDTH:r=this.interpolateValue(t,0,4,1.5,2.5),f=this.interpolateValue(f,0,4,1.5,2.5);break;case De.I.EYEBROW_THICKNESS:t=4-t,f=4-f,r=this.interpolateValue(t,0,4,1.6,2.4),f=this.interpolateValue(f,0,4,1.6,2.4);break;case De.I.LIP_SMILE:case De.I.SHAPE_JAW:case De.I.SHAPE_FOREHEAD:case De.I.SHAPE_CHEEKBONE:r=this.interpolateValue(t,0,4,1.75,2.25),f=this.interpolateValue(f,0,4,1.75,2.25);break;case De.I.LIP_UPPER:case De.I.LIP_LOWER:case De.I.LIP_SIZE:r=this.interpolateValue(t,0,4,1.5,2.5),f=this.interpolateValue(f,0,4,1.5,2.5);break;case De.I.SHAPE_WIDTH:case De.I.SHAPE_TEMPLES:r=this.interpolateValue(t,0,4,1.75,2.25),f=this.interpolateValue(f,0,4,1.75,2.25);break;default:r=this.interpolateValue(t,0,4,1,3),f=this.interpolateValue(f,0,4,1,3)}return f>2?this.interpolateValue(r,0,f,0,2):this.interpolateValue(r,f,4,2,4)}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU($.u),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(Z.f),e.rXU(z.nX),e.rXU(oo.x),e.rXU(Bi.g),e.rXU(U.n),e.rXU(Q.L),e.rXU(rt.A),e.rXU(I.qQ))},c.\u0275cmp=e.VBU({type:c,selectors:[["faceReshape-drawer"]],outputs:{restAndApplyEvent:"restAndApplyEvent"},features:[e.Jv_([oo.x,Bi.g]),e.Vt3],decls:20,vars:12,consts:[[1,"scroll-content"],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Body Reshape",1,"d-none"],[1,"child-drawer","drawer-active"],[1,"scroll-content","h-100"],["customScrollDir","",1,"scroll-container"],[1,"common-container","p-0","m-0"],[1,"d-flex","align-items-center","w-100","justify-content-between",2,"min-height","56px"],[1,"d-inline-flex","align-items-center"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32","d-none"],[1,"btn-all","reset-all","text-semi",3,"click","disabled","ngClass"],["class","bg-white filter-category mt-1 mb-2 faceExpression-face",4,"ngIf"],[1,"ngb-btn","common-container","m-0","ps-0","pe-0","pb-10",3,"ngClass"],["ngbAccordion","",3,"closeOthers","destroyOnHide"],["class","tab-div",3,"ngbAccordionItem",4,"ngFor","ngForOf"],["class","position-fixed bg-white fixed-bottom pb-9 ps-3 pe-3",4,"ngIf"],[1,"bg-white","filter-category","mt-1","mb-2","faceExpression-face"],[1,"sticker-buttons-scroll","scrollWidth-300"],[3,"selectMenu","type","user","categoryId","items"],[1,"tab-div",3,"ngbAccordionItem"],["ngbAccordionHeader",""],[1,"d-flex","align-items-center","wp-100",3,"click"],["type","button","ngbAccordionButton","",1,"btn-acc-title"],[1,"m-0","btn","btn-link","card-title","ms-3"],["type","button","ngbAccordionButton","",1,"btn-collapse","p-0"],[1,"collapse-text","btn-link"],["name","collapseAcc",1,"f-24"],[1,"expand-text"],["name","expandAcc",1,"f-24"],["ngbAccordionCollapse",""],["ngbAccordionBody",""],[1,"common-container","mb-3"],[1,"card-body"],[1,"d-flex","align-items-center","justify-content-between","w-100","mt-2"],[1,"text-13","grey-800","text-semi","d-inline-flex","w-100"],["bindLabel","value","bindValue","key","class","select-menu resize-popup both-sides",3,"items","ngModel","searchable","clearable","ngModelChange",4,"ngIf"],[1,"colors-bg","sticker-buttons-scroll","scrollWidth-268","text-highlight-style","prompt-menu","mb-0"],[3,"selectMenu","type","user","categoryId","sideKey","items"],[1,"text-13","grey-800","text-semi","mb-1","d-inline-flex","w-100"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","min","max","step","value"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","disabled","","mask","separator.2","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",2,"pointer-events","none",3,"min","max","ngModel","allowNegativeNumbers"],["bindLabel","value","bindValue","key",1,"select-menu","resize-popup","both-sides",3,"ngModelChange","items","ngModel","searchable","clearable"],["ng-option-tmp",""],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"d-inline-flex","f-12","text-semi","grey-800","align-items-center"],["class","d-inline-flex",4,"ngIf"],[1,"d-inline-flex"],["name","proicon",2,"line-height","normal"],[1,"position-fixed","bg-white","fixed-bottom","pb-9","ps-3","pe-3"],[1,"d-flex","wp-100","justify-content-between","pt-2"],["routerLinkActive","router-link-active",1,"btn","btn-editor-primary","text-13",3,"click"],["routerLinkActive","router-link-active",1,"btn","btn-primary","text-13","btn-h40",2,"width","130px",3,"click"]],template:function(i,t){1&i&&(e.j41(0,"div",0),e.nrm(1,"input",1),e.j41(2,"div",2),e.qex(3),e.j41(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"pi",8),e.bIt("click",function(){return t.cancel()}),e.k0s(),e.j41(10,"span",9),e.EFF(11,"Face Reshape"),e.k0s()(),e.nrm(12,"pi",10),e.j41(13,"button",11),e.bIt("click",function(){return t.resetAll()}),e.EFF(14,"Reset all"),e.k0s()(),e.DNE(15,Ya,3,4,"div",12),e.k0s(),e.j41(16,"div",13)(17,"div",14),e.DNE(18,Qa,14,2,"div",15),e.k0s()()()(),e.bVm(),e.k0s(),e.DNE(19,Ja,6,0,"div",16),e.k0s()),2&i&&(e.R7$(13),e.Y8G("disabled",!t.photoEditorService.isDirty)("ngClass",e.eq3(8,za,!t.photoEditorService.isDirty)),e.R7$(2),e.Y8G("ngIf",(null==t.faceList?null:t.faceList.length)>1),e.R7$(),e.Y8G("ngClass",e.eq3(10,Wa,t.photoEditorService.isDirty)),e.R7$(),e.Y8G("closeOthers",!0)("destroyOnHide",!1),e.R7$(),e.Y8G("ngForOf",t.faceReshapeTools),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isDirty))},dependencies:[I.YU,I.Sq,I.bT,Mt.I,de.q,Y.WP,Y.r6,Y.tW,Y.x7,Y.UA,Y.$R,Y.md,we.me,we.BC,we.tU,we.vS,z.wQ,Lt.vr,Lt.Uq,qe.d1,pt.Zr,Ce.b,Pt.B],styles:[".drawer-container[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%;background:#fff;border-radius:8px;box-shadow:0 2px 10px #0000001a;overflow:hidden}
1.drawer-header[_ngcontent-%COMP%]{padding:20px;background:linear-gradient(135deg,#667eea,#764ba2);color:#fff}.drawer-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 8px;font-size:18px;font-weight:600}.drawer-header[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0;font-size:14px;opacity:.9}.drawer-content[_ngcontent-%COMP%]{flex:1;padding:20px;overflow-y:auto}.face-selection-section[_ngcontent-%COMP%]{margin-bottom:30px}.face-selection-section[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 15px;font-size:16px;font-weight:600;color:#333}.face-list[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px}.face-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:10px;border:2px solid #e0e0e0;border-radius:8px;cursor:pointer;transition:all .3s ease;min-width:80px}.face-item[_ngcontent-%COMP%]:hover{border-color:#667eea;transform:translateY(-2px)}.face-item.selected[_ngcontent-%COMP%]{border-color:#667eea;background:#667eea1a}.face-preview[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:50%;background:linear-gradient(135deg,#667eea,#764ba2);display:flex;align-items:center;justify-content:center;margin-bottom:8px;position:relative}.face-preview[_ngcontent-%COMP%] .face-number[_ngcontent-%COMP%]{color:#fff;font-weight:600;font-size:16px}.face-preview[_ngcontent-%COMP%] .landmark-indicator[_ngcontent-%COMP%]{position:absolute;bottom:-5px;left:50%;transform:translate(-50%);background:#28a745;color:#fff;padding:2px 6px;border-radius:10px;font-size:10px;white-space:nowrap}.face-preview[_ngcontent-%COMP%] .landmark-indicator[_ngcontent-%COMP%] .landmark-count[_ngcontent-%COMP%]{font-weight:500}.face-label[_ngcontent-%COMP%]{font-size:12px;color:#666;text-align:center}.reshape-tools-section[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 20px;font-size:16px;font-weight:600;color:#333}.tool-group[_ngcontent-%COMP%]{margin-bottom:25px}.tool-group[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 15px;font-size:14px;font-weight:600;color:#555;text-transform:uppercase;letter-spacing:.5px}.slider-container[_ngcontent-%COMP%]{margin-bottom:15px;position:relative}.slider-container[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;font-size:13px;font-weight:500;color:#666}.slider-container[_ngcontent-%COMP%] input[type=range][_ngcontent-%COMP%]{width:100%;height:6px;border-radius:3px;background:#e0e0e0;outline:none;-webkit-appearance:none}.slider-container[_ngcontent-%COMP%] input[type=range][_ngcontent-%COMP%]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:linear-gradient(135deg,#667eea,#764ba2);cursor:pointer;box-shadow:0 2px 4px #0003}.slider-container[_ngcontent-%COMP%] input[type=range][_ngcontent-%COMP%]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:linear-gradient(135deg,#667eea,#764ba2);cursor:pointer;border:none;box-shadow:0 2px 4px #0003}.slider-container[_ngcontent-%COMP%] input[type=range][_ngcontent-%COMP%]:focus{outline:none}.slider-container[_ngcontent-%COMP%] .value-display[_ngcontent-%COMP%]{position:absolute;right:0;top:0;font-size:12px;font-weight:600;color:#667eea;background:#667eea1a;padding:2px 6px;border-radius:4px}.landmark-info[_ngcontent-%COMP%]{margin-top:20px;padding:15px;background:#f8f9fa;border-radius:8px;border-left:4px solid #667eea}.landmark-info[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 10px;font-size:14px;font-weight:600;color:#333}.landmark-info[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:13px;color:#666}.landmark-info[_ngcontent-%COMP%] .landmark-features[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px}.landmark-info[_ngcontent-%COMP%] .landmark-features[_ngcontent-%COMP%] .feature-tag[_ngcontent-%COMP%]{background:#667eea;color:#fff;padding:4px 8px;border-radius:12px;font-size:11px;font-weight:500}.no-faces-message[_ngcontent-%COMP%]{text-align:center;padding:40px 20px;color:#666}.no-faces-message[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0 0 10px;font-size:14px}.no-faces-message[_ngcontent-%COMP%] p[_ngcontent-%COMP%]:last-of-type{margin-bottom:20px;font-size:12px;opacity:.8}.no-faces-message[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{margin-top:15px}
1.drawer-footer[_ngcontent-%COMP%]{padding:20px;border-top:1px solid #e0e0e0;background:#f8f9fa}.action-buttons[_ngcontent-%COMP%]{display:flex;gap:10px}.action-buttons[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{flex:1;padding:12px 20px;border:none;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;transition:all .3s ease}.action-buttons[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]:disabled{opacity:.6;cursor:not-allowed}.action-buttons[_ngcontent-%COMP%] .btn.btn-secondary[_ngcontent-%COMP%]{background:#e0e0e0;color:#666}.action-buttons[_ngcontent-%COMP%] .btn.btn-secondary[_ngcontent-%COMP%]:hover:not(:disabled){background:#d0d0d0}.action-buttons[_ngcontent-%COMP%] .btn.btn-primary[_ngcontent-%COMP%]{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff}.action-buttons[_ngcontent-%COMP%] .btn.btn-primary[_ngcontent-%COMP%]:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 8px #667eea4d}@media (max-width: 768px){.drawer-container[_ngcontent-%COMP%]{border-radius:0}.drawer-header[_ngcontent-%COMP%]{padding:15px}.drawer-header[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{font-size:16px}.drawer-content[_ngcontent-%COMP%]{padding:15px}.face-list[_ngcontent-%COMP%]{gap:8px}.face-item[_ngcontent-%COMP%]{min-width:70px;padding:8px}.face-preview[_ngcontent-%COMP%]{width:40px;height:40px}.face-preview[_ngcontent-%COMP%] .face-number[_ngcontent-%COMP%]{font-size:14px}.face-preview[_ngcontent-%COMP%] .landmark-indicator[_ngcontent-%COMP%]{font-size:9px;padding:1px 4px}.action-buttons[_ngcontent-%COMP%]{flex-direction:column}.action-buttons[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{padding:10px 16px}.slider-container[_ngcontent-%COMP%] .value-display[_ngcontent-%COMP%]{position:static;display:block;margin-top:5px;text-align:center}}.reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:0 7px;height:32px}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d}.defualt-scroll[_ngcontent-%COMP%]{overflow-y:auto;height:100%}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px;height:4px}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#e8e8e8;border-radius:12px;opacity:.6;-webkit-transition:width .2s linear,opacity .2s linear,background-color .2s linear;transition:width .2s linear,opacity .2s linear,background-color .2s linear}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#aaa;border-radius:6px}.defualt-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#999}.defualt-scroll.drawer-scroll-margin[_ngcontent-%COMP%]::-webkit-scrollbar-track{margin-bottom:2px}"]}),v})();const el=["tooldrawer"],Ot=c=>({"drawer-active":c});function tl(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"div",5)(2,"div",6)(3,"span",7),e.EFF(4,"Choose a Portrait Tool"),e.k0s(),e.nrm(5,"pi",8),e.k0s(),e.j41(6,"div",9)(7,"div",10)(8,"div",11),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.selectFaceRetouch())}),e.nrm(9,"img",12),e.j41(10,"div",13),e.EFF(11," Face Retouch"),e.k0s()(),e.j41(12,"div",14),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.selectFaceReshape())}),e.nrm(13,"div",15)(14,"img",16),e.j41(15,"div",13),e.EFF(16," Face Reshape"),e.k0s()(),e.j41(17,"div",14),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.selectBodyReshape())}),e.nrm(18,"img",17),e.j41(19,"div",13),e.EFF(20," Body Reshape"),e.k0s()(),e.j41(21,"div",14),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.selectFaceExpression())}),e.nrm(22,"img",18),e.j41(23,"div",13),e.EFF(24," Face Expression"),e.k0s()()()()(),e.bVm()}}function il(c,v){1&c&&e.nrm(0,"div",21)}function ol(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"faceRetouch-drawer",19,0),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.reset())}),e.k0s(),e.DNE(3,il,1,0,"div",20),e.bVm()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",s.photoEditorService.inProgress)}}function nl(c,v){1&c&&e.nrm(0,"div",21)}function sl(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"bodyReshape-drawer",19,0),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.reset())}),e.k0s(),e.DNE(3,nl,1,0,"div",20),e.bVm()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",s.photoEditorService.inProgress)}}function rl(c,v){1&c&&e.nrm(0,"div",21)}function al(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"faceExpression-drawer",19,0),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.reset())}),e.k0s(),e.DNE(3,rl,1,0,"div",20),e.bVm()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",s.photoEditorService.inProgress)}}function ll(c,v){1&c&&e.nrm(0,"div",21)}function cl(c,v){if(1&c){const s=e.RV6();e.qex(0),e.j41(1,"faceReshape-drawer",19,0),e.bIt("restAndApplyEvent",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.reset())}),e.k0s(),e.DNE(3,ll,1,0,"div",20),e.bVm()}if(2&c){const s=e.XpG();e.R7$(3),e.Y8G("ngIf",s.photoEditorService.inProgress)}}let hl=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H){super(i,t,r,f,N,"portait"),this.photoEditorService=i,this.stateService=t,this.zoomService=r,this.uploadService=f,this.uploadImageService=T,this.route=N,this.editorService=H,this.subTool="",this.step=0,this.isSelectedAutoBlur=!0,this.eventsSubject=ne
1w Qi.B,this.afterImageLoadSub=q=>{q&&(this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init(()=>{})},0))},this.photoEditorService.checkProjectName(),this.photoEditorService.isExportable=!1,this.backBtnClick=this.photoEditorService.BackArrowClick.subscribe(q=>{q&&(this.step=0)}),this.OpenNewTabClick=this.photoEditorService.OpenNewTabClick.subscribe(q=>{q&&q.loadValue&&(this.photoEditorService.isLoaded=!1,this.photoEditorService.checkProjectName(!0),this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.photoEditorService.originalProjectName&&(this.photoEditorService.projectName=this.photoEditorService.originalProjectName),this.unconfigureFabricCanvas(),setTimeout(()=>{this.init(()=>{})},0))}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(this.afterImageLoadSub),this.activeToolPanelSubscription=this.editorService.activeToolPanel.subscribe(q=>{q.subTool&&(this.subTool="",q.subTool&&!this.photoEditorService.photoEditorOptions.subTool?this.photoEditorService.photoEditorOptions.subTool=q.subTool:this.photoEditorService.photoEditorOptions.subTool&&!q.subTool&&(q.subTool=this.photoEditorService.photoEditorOptions.subTool),this.photoEditorService.photoEditorOptions.subTool=q.subTool,this.subTool=q.subTool,this.selectedTool=this.photoEditorService.selectedTool,this.photoEditorService.photoEditorOptions&&3!=this.step&&q.subTool==w.b.subTool.faceRetouch?(this.step=3,setTimeout(()=>{this.selectFaceRetouch()},200)):this.photoEditorService.photoEditorOptions&&4!=this.step&&q.subTool==w.b.subTool.bodyReshape?(this.step=4,setTimeout(()=>{this.selectBodyReshape()},200)):this.photoEditorService.photoEditorOptions&&5!=this.step&&q.subTool==w.b.subTool.faceExpression?(this.step=5,setTimeout(()=>{this.selectFaceExpression()},200)):this.photoEditorService.photoEditorOptions&&6!=this.step&&q.subTool==w.b.subTool.faceReshape&&(this.step=6,setTimeout(()=>{this.selectFaceReshape()},200)))})}ngOnInit(){this.subTool=this.photoEditorService.photoEditorOptions.subTool,this.selectedTool=this.photoEditorService.selectedTool,this.photoEditorService.originalImage?(this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.step=0})):(this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1,this.subTool==w.b.subTool.faceRetouch?this.selectFaceRetouch():this.subTool==w.b.subTool.bodyReshape?this.selectBodyReshape():this.subTool==w.b.subTool.faceExpression?this.selectFaceExpression():this.subTool==w.b.subTool.faceReshape?this.selectFaceReshape():(this.step=0,this.init()))}afterImageLoad(i){i.imageData&&(this.checkImageUrl()&&this.subTool==w.b.subTool.faceRetouch&&!this.photoEditorService.isApplyed?(this.step=3,setTimeout(()=>{this.selectFaceRetouch()},200)):this.checkImageUrl()&&this.subTool==w.b.subTool.bodyReshape&&!this.photoEditorService.isApplyed?(this.step=4,setTimeout(()=>{this.selectBodyReshape()},200)):this.checkImageUrl()&&this.subTool==w.b.subTool.faceExpression&&!this.photoEditorService.isApplyed?(this.step=5,setTimeout(()=>{this.selectFaceExpression()},200)):this.checkImageUrl()&&this.subTool==w.b.subTool.faceReshape&&!this.photoEditorService.isApplyed&&(this.step=6,setTimeout(()=>{this.selectFaceReshape()},200)))}selectFaceReshape(){this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.step=6,this.photoEditorService.activeTool=w.b.tool.portrait,this.photoEditorService.activeSubTool=w.b.subTool.faceReshape,this.photoEditorService.title="Face Reshape"}selectBodyReshape(){this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.step=4,this.photoEditorService.activeTool=w.b.tool.portrait,this.photoEditorService.activeSubTool=w.b.subTool.bodyReshape,this.photoEditorService.title="Body Reshape"}selectFaceExpression(){this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.step=5,this.photoEditorService.activeTool=w.b.tool.portrait,this.photoEditorService.activeSubTool=w.b.subTool.faceExpression,this.photoEditorService.selectedTool="faceExpression",this.photoEditorService.title="Face Expression"}selectFaceRetouch(){this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.photoEditorService.activeTool=w.b.tool.portrait,this.photoEditorService.activeSubTool=w.b.subTool.faceRetouch,this.photoEditorService.selectedTool=this.selectedTool+"_"+this.subTool,this.photoEditorService.title="Face Retouch",this.step=3}reset(){this.photoEditorService.selectedTool=this.selectedTool,this.step=0,this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(this.afterImageLoadSub),this.reloadImage(()=>{},!1)}isUndoable(){let i,t=!1;
1return this.tools&&(i=this.tools.first,i&&i.isUndoable()&&(t=!0)),t}isRedoable(){let i,t=!1;return this.tools&&(i=this.tools.first,i&&i.isRedoable()&&(t=!0)),t}undoClicked(){this.tools.first.undoClicked()}redoClicked(){this.tools.first.redoClicked()}applyChanges(i,t){throw new Error("Method not implemented.")}ngOnDestroy(){this.photoEditorService.selectedTool="",this.photoEditorService.photoEditorOptions.subTool=null,this.OpenNewTabClick&&this.OpenNewTabClick.unsubscribe(),this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.activeToolPanelSubscription&&this.activeToolPanelSubscription.unsubscribe(),this.backBtnClick&&this.backBtnClick.unsubscribe()}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(F.A),e.rXU(z.nX),e.rXU(o.x))},c.\u0275cmp=e.VBU({type:c,selectors:[["portrait-drawer"]],viewQuery:function(i,t){if(1&i&&e.GBs(el,5),2&i){let r;e.mGM(r=e.lsd())&&(t.tools=r)}},features:[e.Vt3],decls:12,vars:20,consts:[["tooldrawer",""],[1,"drawer-content"],[1,"scroll-content"],[1,"child-drawer",3,"ngClass"],[4,"ngIf"],["customScrollDir","",1,"scroll-container"],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32",2,"visibility","hidden"],[1,"common-container","pb-8","ps-0","pe-0","m-0"],[1,"mb-8"],[1,"resizeImgPanel","d-flex","align-items-center","justify-content-center","pointer","position-relative",3,"click"],["src","https://static.lightxeditor.com/assets/images/Face-Retouch.webp",2,"width","268px"],[1,"panelImgText","w-100","text-center","d-flex","align-items-center","justify-content-center","position-absolute","text-bold"],[1,"resizeImgPanel","d-flex","align-items-center","justify-content-center","pointer","position-relative","mt-9",3,"click"],[1,"new_item"],["src","https://static.lightxeditor.com/assets/images/Face-Reshape.jpg",2,"width","268px"],["src","https://static.lightxeditor.com/assets/images/Body-Reshape.webp",2,"width","268px"],["src","https://static.lightxeditor.com/assets/images/Face-Expression.webp",2,"width","268px"],[1,"w-100",3,"restAndApplyEvent"],["class","h-100 w-100 position-absolute","style","cursor: not-allowed; top: 0;",4,"ngIf"],[1,"h-100","w-100","position-absolute",2,"cursor","not-allowed","top","0"]],template:function(i,t){1&i&&(e.j41(0,"div",1)(1,"div",2)(2,"div",3),e.DNE(3,tl,25,0,"ng-container",4),e.k0s(),e.j41(4,"div",3),e.DNE(5,ol,4,1,"ng-container",4),e.k0s(),e.j41(6,"div",3),e.DNE(7,sl,4,1,"ng-container",4),e.k0s(),e.j41(8,"div",3),e.DNE(9,al,4,1,"ng-container",4),e.k0s(),e.j41(10,"div",3),e.DNE(11,cl,4,1,"ng-container",4),e.k0s()()()),2&i&&(e.R7$(2),e.Y8G("ngClass",e.eq3(10,Ot,0==t.step)),e.R7$(),e.Y8G("ngIf",0==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(12,Ot,3==t.step)),e.R7$(),e.Y8G("ngIf",3==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(14,Ot,4==t.step)),e.R7$(),e.Y8G("ngIf",4==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(16,Ot,5==t.step)),e.R7$(),e.Y8G("ngIf",5==t.step),e.R7$(),e.Y8G("ngClass",e.eq3(18,Ot,6==t.step)),e.R7$(),e.Y8G("ngIf",6==t.step))},dependencies:[I.YU,I.bT,de.q,Y.md,Ce.b,ma,Ta,Ba,qa],styles:[".panelImgText[_ngcontent-%COMP%]{font-size:14px;color:#fff;line-height:19.6px;background:#00000047;border-radius:12px}.resizeImgPanel[_ngcontent-%COMP%]{overflow:hidden;border-radius:12px}.resizeImgPanel[_ngcontent-%COMP%] .panelImgText[_ngcontent-%COMP%]{height:100%;bottom:0;transition:height .2s ease-out}.resizeImgPanel[_ngcontent-%COMP%] .new_item[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;padding-right:0;z-index:1}.resizeImgPanel[_ngcontent-%COMP%]:hover .panelImgText[_ngcontent-%COMP%]{border-radius:0 0 12px 12px;background:#0006;height:34px;bottom:0;transition:height .2s ease-out}.child-drawer[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:0px;opacity:0;transform:translateY(-20px);transition:transform .5s ease-in-out,opacity .5s ease-in-out}.drawer-active[_ngcontent-%COMP%]{height:100%;opacity:1;transform:translateY(0)}"]}),v})();var dl=g(32660);const pl=()=>["/batch-editor/edit"],ul=()=>({from:"photo-editor"});let ml=(()=>{var c;class v extends $e.O{constructor(i,t,r,f,T,N,H){super(r,f,T,N,H,"tools"),this.env=i,this.uploadImageService=t,this.photoEditorService=r,this.stateService=f,this.zoomService=T,this.uploadService=N,this.route=H,this.isLoaded=!0}ngOnInit(){this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(i=>{i&&setTimeout(()=>{this.init(()=>{})},100)}),this.photoEditorService.originalImage||(this.photoEditorService.isLoaded=!1,this.photoEditorService.isError=!0)}afterImageLoad(){}applyChanges(){}isUndoable(){return!1}isRedoable(){return!1}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(Q.L),e.rXU(F.A),e.rXU(l.p),e.rXU(G.X),e.rXU(A.n),e.rXU(nt.B),e.rXU(z.nX))},c.\u0275cmp=e.VBU({type:c,selectors:[["batch-drawer"]],features:[e.Vt3],decls:18,vars:5,consts:[[1,"drawer-content"],[1,"scroll-content"],["customScrollDir","",1,"is-popover-t","scroll-container"],[1,"common-container","p-0","m-0","mb-3"],[1,"mt-10","addStickerToPhoto","carouselDesignTool"],[1,"gray-100","border-radius-lg","p-2"],[1,"d-flex","flex-column","text-center"],["autoplay","","loop","",2,"border-radius","10px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/batch-common-video.mp4","type","video/mp4"],[1,"ps-2","pe-2","d-flex","flex-column","align-items-center","justify-content-start","w-100"],[1,"d-inline-flex","w-100","text-semi","text-14","grey-800","lh-160","mt-10"],[1,"d-inline-flex","w-100","text-12","grey-800","lh-140","mt-2"],["target","_blank",1,"btn","btn-primary","text-13","w-100","btn-h40","mt-3","mb-2","d-flex","align-items-center","justify-content-center","is-new-tab","batch-editor",3,"routerLink","queryParams"]],template:function(i,t){1&i&&(e.j41(0,"div",0)(1,"div")(2,"div",1)(3,"div",2)(4,"div",3)(5,"div",4)(6,"div",5)(7,"div",6)(8,"video",7),e.nrm(9,"source",8),e.
1EFF(10," Your browser does not support the video tag. "),e.k0s()(),e.j41(11,"div",9)(12,"span",10),e.EFF(13,"Batch Editor"),e.k0s(),e.j41(14,"span",11),e.EFF(15,"Level up your creativity by adding stickers on your current photo."),e.k0s(),e.j41(16,"a",12),e.EFF(17,"Edit in Batch"),e.k0s()()()()()()()()()),2&i&&(e.R7$(8),e.Y8G("muted","muted"),e.R7$(8),e.Y8G("routerLink",e.lJ4(3,pl))("queryParams",e.lJ4(4,ul)))},dependencies:[de.q,z.Wk],styles:[".addStickerToPhoto[_ngcontent-%COMP%]{border:solid 1px transparent!important;background-image:linear-gradient(90deg,#fc5cff -4%,#2520f6)!important;border-radius:16px;background:#f8f9f9;background-origin:border-box}"]}),v})();const gl=["canvasWrapper"],_l=["canvasMaskWrapperLoaded"],fl=["canvasMaskWrapper"],vl=["mainCanvas"],bl=["canvasBackground"],Cl=["canvasPreview"],xl=["page"],Sl=["inputFile"],El=["outputCanvas"],yl=["zoomselect"],wl=["editNavInner"],kl=["editNavUpper"],Tl=["tooldrawer"],Pl=(c,v,s)=>({"m-resize":c,visibleads:v,"hideads-col":s}),Il=c=>({"h-100":c}),Ml=c=>({"layers-on":c}),jl=(c,v)=>({widthAdded:c,"border-radius-lg":v}),Ol=(c,v)=>({"d-none":c,"in-progress":v}),Al=c=>({"ai-body-touch-area":c}),Rl=(c,v,s,i)=>[c,v,s,i],no=c=>({"d-none":c}),yt=c=>({"drawer-active":c}),Bl=(c,v)=>({"mb-9":c,"d-none":v}),At=c=>({"btn-bottom-active":c}),Rt=c=>({"disable-btn pe-none":c}),Dl=c=>({"disabled-P":c}),so=()=>["/batch-editor/edit"],Fl=()=>({tab:"resize",from:"photo-editor"}),Ul=()=>({tab:"crop",from:"photo-editor"});function Ll(c,v){1&c&&e.nrm(0,"app-top-strip",58)}function Nl(c,v){if(1&c&&e.nrm(0,"editor-header",59),2&c){const s=e.XpG();e.Y8G("projectName",s.photoEditorService.projectName)("selectedUpscale",s.selectedUpscale)("expandImageUrl",s.expandImageUrl)("activeTool",s.activeToolPanel)}}function Gl(c,v){1&c&&e.nrm(0,"div",63)}function Vl(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",60)(1,"toolbar-navigation",61),e.bIt("toggleSliderEvent",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.toggleSliderOpen(t))}),e.k0s(),e.DNE(2,Gl,1,0,"div",62),e.k0s()}if(2&c){const s=e.XpG();e.R7$(),e.Y8G("activeTool",s.activeToolPanel)("sldBtn",s.sldBtn),e.R7$(),e.Y8G("ngIf",s.photoEditorService.inProgress)}}function Xl(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",71),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function zl(c,v){if(1&c&&e.nrm(0,"adjustment-drawer",72,11),2&c){const s=e.XpG(2);e.Y8G("subTool",s.photoEditorService.activeSubTool)}}function Wl(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",71),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function Yl(c,v){if(1&c&&e.nrm(0,"remove-bg-drawer",73,11),2&c){const s=e.XpG(2);e.Y8G("isMobileView",s.envService.isMobileView)}}function $l(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",71),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function Hl(c,v){1&c&&e.nrm(0,"portrait-drawer",null,11)}function Kl(c,v){1&c&&e.nrm(0,"batch-drawer",null,11)}function Zl(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",71),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function Ql(c,v){if(1&c){const s=e.RV6();e.j41(0,"tools-drawer",74,11),e.bIt("changeSubTool",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeSubTool(t))}),e.k0s()}}function Jl(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",71),e.bIt("click",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.onDrawerClick(t))}),e.k0s()}}function ql(c,v){if(1&c){const s=e.RV6();e.j41(0,"ai-tools-drawer",74,11),e.bIt("changeSubTool",function(t){e.eBV(s);const r=e.XpG(2);return e.Njj(r.changeSubTool(t))}),e.k0s()}}function ec(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",64),e.bIt("click",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.editToolsWrapperClick(t))}),e.j41(1,"div",65),e.DNE(2,Xl,1,0,"div",66)(3,zl,2,1,"adjustment-drawer",67),e.k0s(),e.j41(4,"div",65),e.DNE(5,Wl,1,0,"div",66)(6,Yl,2,1,"remove-bg-drawer",68),e.k0s(),e.j41(7,"div",65),e.DNE(8,$l,1,0,"div",66)(9,Hl,2,0,"portrait-drawer",69),e.k0s(),e.j41(10,"div",65),e.DNE(11,Kl,2,0,"batch-drawer",69),e.k0s(),e.j41(12,"div",65),e.DNE(13,Zl,1,0,"div",66)(14,Ql,2,0,"tools-drawer",70),e.k0s(),e.j41(15,"div",65),e.DNE(16,Jl,1,0,"div",66)(17,ql,2,0,"ai-tools-drawer",70),e.k0s()()}if(2&c){const s=e.XpG();e.Y8G("ngSwitch",s.activeToolPanel),e.R7$(),e.HbH(s.drawerClassArray.adjustment),e.Y8G("ngClass",e.eq3(30,yt,"adjustment"==s.activeToolPanel)),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(),e.Y8G("ngSwitchCase","adjustment"),e.R7$(),e.HbH(s.drawerClassArray.remove_bg),e.Y8G("ngClass",e.eq3(32,yt,"remove_bg"==s.activeToolPanel)),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(),e.Y8G("ngSwitchCase","remove_bg"),e.R7$(),e.HbH(s.drawerClassArray.portrait),e.Y8G("ngClass",e.eq3(34,yt,"portrait"==s.activeToolPanel)),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(),e.Y8G("ngSwitchCase","portrait"),e.R7$(),e.HbH(s.drawerClassArray.batch),e.Y8G("ngClass",e.eq3(36,yt,"batch"==s.activeToolPanel)),e.R7$(),e.Y8G("ngSwitchCase","batch"),e.R7$(),e.HbH(s.drawerClassArray.tools),e.Y8G("ngClass",e.eq3(38,yt,"tools"==s.activeToolPanel)),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(),e.Y8G("ngSwitchCase","tools"),e.R7$(),e.HbH(s.drawerClassArray.aitools),e.Y8G("ngClass",e.eq3(40,yt,"aitools"==s.activeToolPanel)),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isError||!s.photoEditorService.originalImage),e.R7$(),e.Y8G("ngSwitchCase","aitools")}}function tc(c,v){1&c&&(e.j41(0,"div",75,12),e.nrm(2,"div",76,13),e.k0s())}function ic(c,v){if(1&c&&(e.j41(0,"div",77)(1,"div",78)(2,"span"),e.EFF(3),e.k0s(),e.EFF(4,"\xa0 x \xa0"),e.j41(5,"span"),e.EFF(6),e.k0s()()()),2&c){const s=e.XpG();e.R7$(3),e.SpI("W:",s.photoEditorService.resizeWidth,""),e.R7$(3),e.SpI("H:",s.photoEditorService.resizeHeight,"")}}function oc(c,v){if(1&c&&e.nrm(0,"div",79),2&c){const s=e.XpG();e.xc7("background-image",null!=s.photoEditorService&&s.photoEditorService.AiToolcompareImageUrl?"url("+s.photoEditorService.AiToolcompareImageUrl+")":"url("+s.photoEditorService.compareImageUrl+")"),e.Y8G("ngClass",s.iscompare?"displayblock":"displaynone")}}function nc(c,v){if(1&c&&e.nrm(0,"div",80),2&c){const s=e.XpG();e.xc7("background-image","url("+(null==s.photoEditorService?null:s.photoEditorService.compareImageUrl)+")"),e.Y8G("ngClass",s.iscompare?"displayblock":"displaynone")}}function sc(c,v){if(1&c&&e.nrm(0,"app-body-expander",83),2&c){const s=e.XpG(2);e.Y8G("mainCanvas",null==s.stateService?null:s.stateService.mainCanvas)("mainCanvasNative",null==s.stateService?null:s.stateService.mainCanvasNative)("hidden",s.iscompare)}}function rc(c,v){if(1&c&&e.nrm(0,"app-body-expander",84),2&c){const s=e.XpG(2);e.Y8G("mainCanvas",null==s.stateService?null:s.stateService.mainCanvas)("mainCanvasNative",null==s.stateService?null:s.stateService.mainCanvasNative)("hidden",s.iscompare)("isRoundInstance2",!0)}}function ac(c,v){if(1&c&&(e.qex(0),e.DNE(1,sc,1,3,"app-body-expander",81)(2,rc,1,4,"app-body-expander",82),e.bVm()),2&c){const s=e.XpG();e.R7$(),e.Y8G("ngIf","BODY_RETOUCH"===s.selectedToolName),e.R7$(),e.Y8G("ngIf","BODY_RETOUCH"===s.selectedToolName&&s.shapeControl==s.ShapeControlType.Breast)}}function lc(c,v){if(1&c&&(e.j41(0,"div",85)(1,"div",86)(2,"img-comparison-slider",87)(3,"picture",88),e.nrm(4,"img",89),e.j41(5,"div",90),e.EFF(6,"Before"),e.k0s()(),e.j41(7,"picture",91),e.nrm(8,"img",89),e.j41(9,"div",92),e.EFF(10,"After"),e.k0s(),e.j41(11,"div",93)(12,"span",94),e.EFF(13),e.k0s(),e.j41(14,"span",95),e.EFF(15),e.k0s()()(),e.qSk(),e.j41(16,"svg",96),e.nrm(17,"circle",97)(18,"path",98)(19,"path",99),e.k0s()()()()),2&c){const s=e.XpG();e.R7$(4),e.Y8G("src",null==s.selectedUpscale?null:s.selectedUpscale.inputSrc,e.B4B),e.R7$(4),e.Y8G("src",null==s.selectedUpscale?null:s.selectedUpscale.outputSrc,e.B4B),e.R7$(5),e.SpI("",null==s.selectedUpscale?null:s.selectedUpscale.id," ."),e.R7$(2),e.Lme(" ",null==s.selectedUpscale?null:s.selectedUpscale.width,"x",null==s.selectedUpscale?null:s.selectedUpscale.height,"")}}function cc(c,v){if(1&c&&(e.j41(0,"div",100),e.nrm(1,"img",101),e.k0s()),2&c){const s=e.XpG();e.R7$(),e.Y8G("src",s.expandImageUrl,e.B4B)}}function hc(c,v){1&c&&(e.j41(0,"div",102)(1,"div",103),e.nrm(2,"pi",104),e.EFF(3,"Drag Image to pan "),e.k0s()())}function dc(c,v){if(1&c&&(e.j41(0,"div",105)(1,"div",106),e.nrm(2,"app-ai-processing-bar",107),e.k0s(),e.j41(3,"div",108)(4,"div",109),e.nrm(5,"div",110)(6,"div",111)(7,"div",112),e.k0s()()()),2&c){const s=e.XpG();e.R7$(2),e.Y8G("progress",s.processingProgress.progressPercent)("message",s.processingProgress.isActive?s.processingProgress.progressMessage:s.GlobalConstants.label.processingImage)("indeterminate",!s.processingProgress.isActive||s.processingProgress.indeterminate)}}function pc(c,v){1&c&&(e.j41(0,"div",113),e.nrm(1,"div",114)(2,"div",115),e.k0s())}function uc(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",125),e.bIt("mouseup",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mouseout",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mousedown",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!0)}),e.nrm(1,"pi",126),e.k0s()}if(2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,At,s.iscompare))}}function mc(c,v){if(1&c&&(e.j41(0,"button",127),e.nrm(1,"pi",128),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,Rt,!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&!s.undoable)))}}function gc(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",125),e.bIt("mouseup",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mouseout",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mousedown",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!0)}),e.nrm(1,"pi",126),e.k0s()}if(2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,At,s.iscompare))}}function _c(c,v){if(1&c&&(e.j41(0,"button",127),e.nrm(1,"pi",128),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,Rt,!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&!s.undoable)))}}function fc(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",129),e.bIt("mouseup",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mouseout",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!1)})("mousedown",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.iscompare=!0)}),e.nrm(1,"pi",126),e.k0s()}if(2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,At,s.iscompare))}}function vc(c,v){if(1&c&&(e.j41(0,"button",127),e.nrm(1,"pi",128),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,Rt,!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&!s.undoable)))}}function bc(c,v){if(1&c&&(e.j41(0,"button",127),e.nrm(1,"pi",130),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,Rt,!s.undoable))}}function Cc(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",131),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.undo())})("mousedown",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.isButtonFocusedundo=!0)})("mouseup",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.mouseupundo())}),e.nrm(1,"pi",132),e.k0s()}if(2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,At,s.isButtonFocusedundo))}}function xc(c,v){if(1&c&&(e.j41(0,"button",127),e.nrm(1,"pi",133),e.k0s()),2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,Rt,!s.redoable))}}function Sc(c,v){if(1&c){const s=e.RV6();e.j41(0,"button",134),e.bIt("click",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.redo())})("mousedown",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.isButtonFocusedredo=!0)})("mouseup",function(){e.eBV(s);const t=e.XpG(2);return e.Njj(t.mouseupredo())}),e.nrm(1,"pi",135),e.k0s()}if(2&c){const s=e.XpG(2);e.Y8G("ngClass",e.eq3(1,At,s.isButtonFocusedredo))}}function Ec(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",116)(1,"div",117),e.DNE(2,uc,2,3,"button",118)(3,mc,2,3,"button",119)(4,gc,2,3,"button",118)(
15,_c,2,3,"button",119)(6,fc,2,3,"button",120)(7,vc,2,3,"button",119),e.nrm(8,"pi",121),e.DNE(9,bc,2,3,"button",119)(10,Cc,2,3,"button",122)(11,xc,2,3,"button",119)(12,Sc,2,3,"button",123),e.nrm(13,"pi",121),e.j41(14,"zoom-select",124,14),e.bIt("changeZoom",function(t){e.eBV(s);const r=e.XpG();return e.Njj(r.changeZoom(t))}),e.k0s()()()}if(2&c){const s=e.XpG();e.Y8G("ngClass",e.l_i(13,Bl,s.isDialog,s.expandImageUrl)),e.R7$(2),e.Y8G("ngIf",s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&"splash"!=s.activeToolPanel&&"adjustment"!=s.activeToolPanel&&"blur"!=s.activeToolPanel),e.R7$(),e.Y8G("ngIf",!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable)&&"splash"!=s.activeToolPanel&&"adjustment"!=s.activeToolPanel&&"blur"!=s.activeToolPanel),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&s.undoable&&("splash"==s.activeToolPanel||"adjustment"==s.activeToolPanel||"blur"==s.activeToolPanel&&!s.photoEditorService.isAuto)),e.R7$(),e.Y8G("ngIf",!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&s.undoable||"splash"!=s.activeToolPanel&&"adjustment"!=s.activeToolPanel&&("blur"!=s.activeToolPanel||s.photoEditorService.isAuto))),e.R7$(),e.Y8G("ngIf",s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable&&"blur"==s.activeToolPanel&&s.photoEditorService.isAuto),e.R7$(),e.Y8G("ngIf",!(s.photoEditorService.isCompareEnable&&s.photoEditorService.isExportable)&&"blur"==s.activeToolPanel&&s.photoEditorService.isAuto),e.R7$(2),e.Y8G("ngIf",!s.undoable),e.R7$(),e.Y8G("ngIf",s.undoable),e.R7$(),e.Y8G("ngIf",!s.redoable),e.R7$(),e.Y8G("ngIf",s.redoable),e.R7$(2),e.Y8G("_photoEditorType",s._photoEditorType)("selectedToolName",s.selectedToolName)}}function yc(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",53)(1,"div",136)(2,"div",137),e.nrm(3,"img",138),e.j41(4,"button",139),e.bIt("click",function(){e.eBV(s);const t=e.XpG(),r=e.sdS(58);return t.resetInput(),e.Njj(null==r?null:r.click())}),e.EFF(5," Upload Image "),e.k0s(),e.j41(6,"p",140),e.EFF(7,"or drag & drop an image"),e.k0s()()()()}if(2&c){const s=e.XpG();e.R7$(4),e.Y8G("disabled","batch"==s.activeToolPanel),e.R7$(2),e.Y8G("ngClass",e.eq3(2,Dl,"batch"==s.activeToolPanel))}}function wc(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",141)(1,"div",142),e.nrm(2,"ins",143),e.k0s(),e.j41(3,"div",144)(4,"button",145),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.removeAds())}),e.nrm(5,"pi",146),e.j41(6,"span",147),e.EFF(7,"Remove ads"),e.k0s()()()()}}function kc(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",148)(1,"div",149)(2,"video",150),e.nrm(3,"source",151),e.EFF(4," Your browser does not support the video tag. "),e.k0s()(),e.j41(5,"div",152)(6,"span",153),e.EFF(7," Resize multiple photos instantly at once. "),e.k0s(),e.j41(8,"a",154),e.EFF(9,"Batch Edit Now"),e.k0s(),e.j41(10,"div",155),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.closePromotion())}),e.nrm(11,"pi",156),e.k0s()()()}2&c&&(e.R7$(2),e.Y8G("muted","muted"),e.R7$(6),e.Y8G("routerLink",e.lJ4(3,so))("queryParams",e.lJ4(4,Fl)))}function Tc(c,v){if(1&c){const s=e.RV6();e.j41(0,"div",148)(1,"div",149)(2,"video",150),e.nrm(3,"source",157),e.EFF(4," Your browser does not support the video tag. "),e.k0s()(),e.j41(5,"div",152)(6,"span",153),e.EFF(7," Crop multiple photos instantly at once. "),e.k0s(),e.j41(8,"a",154),e.EFF(9,"Batch Edit Now"),e.k0s(),e.j41(10,"div",155),e.bIt("click",function(){e.eBV(s);const t=e.XpG();return e.Njj(t.closePromotion())}),e.nrm(11,"pi",156),e.k0s()()()}2&c&&(e.R7$(2),e.Y8G("muted","muted"),e.R7$(6),e.Y8G("routerLink",e.lJ4(3,so))("queryParams",e.lJ4(4,Ul)))}function Pc(c,v){1&c&&(e.j41(0,"div",158)(1,"div",159)(2,"span",160),e.EFF(3,"Drop images anywhere to upload"),e.k0s(),e.j41(4,"span",161),e.EFF(5," Upload upto one image at a time "),e.k0s()()())}function Ic(c,v){if(1&c&&e.nrm(0,"opacity-tool",162),2&c){const s=e.XpG();e.Y8G("activeObject",s.activeObject)("verticalOrientation",!0)}}let Mc=(()=>{var c;class v extends x{constructor(i,t,r,f,T,N,H,q,ne,se,ae,ce,ve,Se,xe,ke,Te,We,Me,Ae,Re,Ge,je,Xe,Ke){super("lightxOpenCVModule","cvlightx.js",ae,N),this.toolhistoryservice=i,this.aiphotoServies=t,this.subsService=r,this.editorService=f,this.zoomService=T,this.stateService=N,this.route=H,this.router=q,this.toastService=ne,this.authService=se,this.photoEditorService=ae,this.ngZone=ce,this.activeModal=ve,this.cdRef=Se,this.modalService=xe,this.envService=ke,this.dialogService=Te,this.zoomGenericService=We,this.loginService=Me,this.config=Ae,this.document=Re,this.renderer=Ge,this.touchpadCanvasGestureService=je,this.uploadImageService=Xe,this.processingProgress=Ke,this.GlobalConstants=w.b,this.activeEditSubPane="edit",this.elementactiveSubPane=h.sv.BACKGROUND_EDIT,this.opacityPane="opacity",this.Showopacity=!1,this.Showblur=!1,this.gridLines=[],this.inProgress=!1,this.selectedSceneIndex=0,this.editorVolume=!0,this.sldBtn=!0,this.editNavs=[],this.inBackgroun
1dAdjustMode=!1,this.inMediaAdjustMode=!1,this.BackgroundEdittools=!1,this.lastSelectedEditSubPane="",this.showBgEditTools=!1,this.isLayersVisible=!1,this.createScratch=!1,this.readyModule=!1,this.maskedImageUrl="",this.isVedio=!1,this.vediourl="https://www.youtube.com/embed/sMtaFJeTF8A",this.isDialog=!1,this.iscompare=!1,this.toolName="",this.editorType=E._Y.Photo,this.isButtonFocusedundo=!1,this.isButtonFocusedredo=!1,this.showAds=!1,this.enableAds=0,this._photoEditorType="NORMAL",this.drawerClassArray=[],this.expandImageUrl="",this.expandInputImageUrl="",this.callConfig=!1,this.callAiCoins=!1,this.isAuto=!1,this.selectedToolName="",this.shapeControl=y.J.None,this.ShapeControlType=y.J,this.showPromotion=!1,this.isResizeClicked=!1,this.isCropClicked=!1,this.errorUploadDragOver=!1,this.isShown=!1,this.clickedElementRef=null,this.stateService.editorType=this.editorType,this.moduleDecorator=Ye=>{Ye.canvas=this.mainCanvas?.nativeElement||null,Ye.printErr=Je=>{Je.startsWith("WARNING")||this.ngZone.run(()=>this.error=Je)}},this.toastService.removeAll(),this.loggedInObserver=this.authService.loggedIn.subscribe(Ye=>{this.user=this.authService.currentUser()}),this.updateBehaviorUserAiConis=this.authService.updateBehaviorUserAiConis.subscribe(Ye=>{this.user=this.authService.currentUser()}),this.UpdateAdsObserver=this.config.updateAds.subscribe(Ye=>{this.callConfig=!0,this.showAds=Ye&&this.config.settingAds?.adsEnableWeb}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(Ye=>{Ye&&this.clickedElementRef?(this.photoEditorService.OpenNewTabClick.next({loadValue:!0}),(this.photoEditorService.selectedTool="aitools")?setTimeout(()=>{this.aiphotoServies.elementClick=!0,this.clickedElementRef?.click(),this.clickedElementRef=null},1e3):setTimeout(()=>{this.aiphotoServies.elementClick=!0,this.clickedElementRef?.click(),this.clickedElementRef=null},600)):Ye&&"load_image"==Ye&&(this.photoEditorService.isError=!1)}),this.user=this.authService.currentUser(),this.user&&this.authService.updateUserAiConis()}afterExpandFreeformResized(i){}afterExpandFreeformDragged(i){}ngAfterViewInit(){this.resolveModule(t=>{}).then(()=>{this.__loadProject(),this.readyModule=!0,this.cdRef.detectChanges()}),this.showAds&&setTimeout(()=>{try{(window.adsbygoogle=window.adsbygoogle||[]).push({})}catch{}},1e3);const i=this.document.querySelector(".drawer-contentupload");i&&i.addEventListener("click",t=>this.handleOverlayClickCapture(t),!0)}ngOnInit(){var i=this;if(this.aiphotoServies.quickEditTools.length<=0&&this.aiphotoServies.getQuickToolLists(),this.inProgress=!0,this.photoEditorService.isLoaded=!1,this.photoEditorService.isFreeTool=!1,this.photoEditorService.downloadImgUrl="",this.editorService.sceneChanged.subscribe(r=>{this.selectedSceneIndex=r}),this.isDialog)this.photoEditorOptions.activeModal=this.activeModal;else{if(this.photoEditorOptions={project_id:this.route.snapshot.queryParamMap.get("project_id"),afterlogin:this.route.snapshot.queryParamMap.get("afterlogin"),action:this.route.snapshot.queryParamMap.get("action"),tab:this.route.snapshot.queryParamMap.get("tab"),w:this.route.snapshot.queryParamMap.get("w"),h:this.route.snapshot.queryParamMap.get("h"),img:this.route.snapshot.queryParamMap.get("img"),isDialog:!1,from:this.route.snapshot.queryParamMap.get("from"),_rw:this.route.snapshot.queryParamMap.get("_rw"),_rh:this.route.snapshot.queryParamMap.get("_rh"),socialPlatformId:this.route.snapshot.queryParamMap.get("social_platform_id"),name:this.route.snapshot.queryParamMap.get("name"),subTool:this.route.snapshot.queryParamMap.get("subTool"),maskUrl:this.route.snapshot.queryParamMap.get("maskUrl"),productId:Number(this.route.snapshot.queryParamMap.get("productId"))},this.photoEditorOptions.tab&&"aitools"!=this.photoEditorOptions.tab&&"tools"!=this.photoEditorOptions.tab){const r=M.Ed.toolbar.nav.items.find(f=>f.name===this.photoEditorOptions.tab)?.title;this.photoEditorService.title=r}this.photoEditorService.selectedTool=this.photoEditorOptions.tab}"eraser"==this.photoEditorOptions.subTool&&"aitools"==this.photoEditorOptions.tab&&(this.photoEditorService.inProgress=!0),"quickedit"==this.photoEditorOptions.subTool&&"aitools"==this.photoEditorOptions.tab&&(this.photoEditorService.inProgress=!0,this.photoEditorService.isExportable=!0,this.photoEditorService.downloadImgUrl=this.photoEditorOptions.img),this.photoEditorService.ph
1otoEditorOptions=this.photoEditorOptions,this.activeToolPanelSubscription=this.editorService.activeToolPanel.subscribe(r=>this.openDrawers(r)),this.route.snapshot.queryParamMap.get("isApiKey")||this.subsService.openPromotionPopup(),this.editorService.onChange.subscribe(r=>{r&&"photoEditorType"===r.name?(this._photoEditorType=r.value,this.zoomselect.setZoomService(this._photoEditorType)):r&&"showExpandPreview"===r.name?this.expandImageUrl=r.value:r&&"hideExpandPreview"===r.name?this.expandImageUrl="":r&&"changeOnEditor"===r.name&&this.appcropframe&&this.appcropframe.change(r),r&&"toolChanged"===r.name&&(this.selectedToolName=r.value,this.shapeControl=r.subtool)}),document.body.classList.add("overflow-hidden"),this.photoEditorService.generateImageFn=function(){var r=(0,n.A)(function*(f,T){i.selectedUpscale=f,i.zoomselect?.resetZoomSelect()});return function(f,T){return r.apply(this,arguments)}}();const t=navigator.userAgent;t.includes("Mac")&&(t.includes("Safari")||t.includes("Chrome"))&&this.renderer.addClass(document.body,"for-mac-safari-chrome"),t.includes("Mac")&&t.includes("Firefox")&&this.renderer.addClass(document.body,"for-mac-firefox"),this.canvasWrapper?.nativeElement&&(this.detachGesture=this.touchpadCanvasGestureService.attachPinchPanHandlers(this.canvasWrapper.nativeElement,this.zoomService),this.photoEditorService.touchpadCanvasGestureEventHandler=this.detachGesture)}getOutputCanvas(){return this.outputCanvas}getInputCanvas(){return this.stateService.mainCanvasNative}__loadProject(){const i=this.photoEditorOptions.tab;this.editorService.setActiveToolPanel(i?{panel:i,from:"default"}:{panel:h.sv.BACKGROUND_EDIT,from:"default"}),this.stateService.init(this.canvasWrapper,this.canvasMaskWrapper,this.mainCanvas,this.canvasPreview,this.outputCanvas,!1,null,null,this.canvasMaskWrapperLoaded),this.stateService.page=this.page.nativeElement,this.canvasPreview=this.stateService.outputCanvas,this.user=this.authService.currentUser(),this.inProgress=!1,this.stateService.disableCanvasRightClick(),this.iscompare=!1}ngOnDestroy(){this.photoEditorService.downloadImgUrl="",this.activeToolPanelSubscription&&this.activeToolPanelSubscription.unsubscribe(),this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.zoomService.defaultZoom=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.originalImage=null,this.photoEditorService.projectName="",this.photoEditorService.originalProjectName="",this.modalService.hasOpenModals()&&this.modalService.dismissAll(""),this.zoomGenericService.mainCanvas&&(this.zoomGenericService.mainCanvas=null),this.loggedInObserver&&this.loggedInObserver.unsubscribe(),document.body.classList.remove("overflow-hidden"),this.resetGlobalFileDropVisual(),this.detachGesture?.destroy(),this.autoCloseTimer&&clearTimeout(this.autoCloseTimer);const i=this.document.querySelector(".drawer-contentupload");i&&i.removeEventListener("click",this.handleOverlayClickCapture,!0)}get undoable(){let i,t=!1;return this.tools&&(i=this.tools.first,i&&i.isUndoable()&&(t=!0)),t}get redoable(){let i,t=!1;return this.tools&&(i=this.tools.first,i&&i.isRedoable()&&(t=!0)),t}undo(){this.tools.first.undoClicked()}redo(){this.tools.first.redoClicked()}compare(){this.canvasMaskWrapper=this.getInputCanvas()}openDrawers(i){let t=!1,r="";for(const f of M.Ed.toolbar.nav.items)f.name===i.panel?(this.drawerClassArray[f.name]="",r=f.title?f.title:"",t=!0):this.drawerClassArray[f.name]=t?"up-state":"down-state";this.activeToolPanel=i.panel,this.lastSelectedToolPanel=i.panel,this.photoEditorService.selectedTool=this.activeToolPanel,"nav"===i.from&&(this.sldBtn=!0),(!i||"canvas"!==i.from)&&(this.BackgroundEdittools=!1,this.showBgEditTools=!1,this.changeSubTool())}unloadNotification(i){this.canDeactivate()||(i.returnValue=!0)}onvisibilitychange(i){this.document.hidden||this.stateService&&this.stateService.mainCanvas&&this.stateService.mainCanvas.renderAll()}canDeactivate(){return!this.photoEditorService.isDirty}toggleSliderOpen(i){this.sldBtn=i,this.setActiveEditSubPane(this.lastSelectedEditSubPane),100==this.zoomService.viewZoom&&setTimeout(()=>{this.zoomService.fitToScreen()},500)}toggleSliderClose(i){this.sldBtn=i,this.setActiveEditSubPane(null),100==this.zoomService.viewZoom&&setTimeout(()=>{this.zoomService.fitToScreen()},500)}setActiveEditSubPane(i){this.activeEditSubPane=i,i&&(this.lastSelectedEditSubPane=i),this.editorService.setActiveEditToolSubPanel(i)}changeZoom(i=100){"NORMAL"===this._photoEditorType?(0===i?(this.inProgress=!0,this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()):-1===i||(this.zoomService.defaultZoom=!1,this.zoomService.set(i,!0)),this.zoomService._canvasScale.next(i),this.stateService.mainCanvas.freeDrawingBrush.width=3/this.zoomService.currentZoom):(0===i?(this.inProgress=!0,this.zoomGenericService.defaultZoom=!0,this.zoomGenericService.fitToScreen()):-1===i||(this.zoomGenericService.defaultZoom=!1,this.zoomGenericService.set(i,!0)),this.zoomGenericService._canvasScale.next(i))}selectObject(i){i.activeThisOnCanvas(),this.stateService.mainCanvas.renderAll()}stopAnimate(){}editToolsWrapperClick(i){this.Showopacity=!1}cancelProcess(){this.envService.isMobileView&&this.router.navigate(["/photo-editing/"+this.photoEditorOptions.from])}getEditorType(){return this.editorType}mouseupundo(){setTimeout(()=>{this.isButtonFocusedundo=!1})}mouseupredo(){setTimeout(()=>{this.isButtonFocusedredo=!1})}removeAds(){this.user?this.subsService.upgradePlanCheckout("","","Remove_Ads_"+this.activeToolPanel,i=>{this.user=this.authService.currentUser()}):this.openLoginDialogWithSubscription()}openLoginDialogWithSubscription(i=null,t=null){this.loginService.openLoginDialog(r=>{this.user=this.authService.currentUser(),this.user&&!this.user.subscribed?this.removeAds():i&&(this.showAds=!1,i())},!0,t)}changeSubTool(i=null){i?.toolName&&(this.photoEditorService.title=i?.title,this.photoEditorService.activeTool=i?.toolName),i&&(this.photoEditorService.activeSubTool=i?.subTool||""),i?.subTool!=E.z6.Resize||this.isResizeClicked?i?.subTool!=E.z6.Crop||this.isCropClicked?this.showPromotion=!1:(this.isCropClicked=!0,this.showPromotion=!0,this.autoCloseTimer=setTimeout(()=>{this.closePromotion()},8e3)):(this.isResizeClicked=!0,this.showPromotion=!0,this.autoCloseTimer=setTimeout(()=>{this.closePromotion()},8e3))}closePromotion(){this.showPromotion=!1,this.autoCloseTimer&&clearTimeout(this.autoCloseTimer)}onDrawerClick(i){}handleOverlayClickCapture(i){if(!this.photoEditorService.isError&&this.photoEditorService.originalImage)return;const r=this.document.elementFromPoint(i.clientX,i.clientY);this.clickedElementRef=r?.closest("a,.pointer,button,.ai-video-thumbs,quick-edits,a");const f=r?.closest(".is-new-tab"),T=r?.closest(".isgenerate"),N=!!f,H=this.photoEditorService.onDrawerClick(i,this.document);return H&&(i.preventDefault(),i.stopImmediatePropagation()),T?(this.clickedElementRef=T,void this.inputFile.nativeElement.click()):H&&!N?("adjustment"==this.activeToolPanel&&(r.innerText.includes("Foreground")||r.innerText.includes("Backgroun
1d"))&&(this.photoEditorService.activeSubTool=r.innerText.includes("Foreground")?"foreground":"background"),void this.inputFile.nativeElement.click()):void(N&&f&&setTimeout(()=>{const q=r?.closest(".batch-editor");if(q)return void setTimeout(()=>{q.click(),this.clickedElementRef=null},0);let ne={slug:f?.innerText.trim(),type:f?.parentElement?.innerText.trim()};this.clickedElementRef=null,this.photoEditorService.OpenNewTabClick.next(ne)},100))}onFileUploaded(i,t=null){if("batch"==this.activeToolPanel)return;const r=t??(i instanceof File?i:i?.item?.(0)??i?.[0]);if(!r)return;if(["image/jpg","image/jpeg","image/pjpeg","image/png","image/webp"].indexOf(r.type)<0)return void this.toastService.showErrorSingle(w.b.message.validImageMessageForEdit);const T=URL.createObjectURL(r);this.photoEditorService.isError=!1,this.uploadImageService.loadInputImage({imageUrl:T,tabName:this.activeToolPanel,from:"header"},()=>{})}isGlobalFileDrag(i){const t=i.dataTransfer?.types;return!!t&&Array.from(t).includes("Files")}allowGlobalPageDrop(){return this.editorType!==E._Y.BatchEditor}resetGlobalFileDropVisual(){this.isShown=!1,document.documentElement.style.overflow=""}resetInput(){this.clickedElementRef=null}onDocumentDragOver(i){!this.allowGlobalPageDrop()||!this.isGlobalFileDrag(i)||(i.preventDefault(),i.dataTransfer.dropEffect="copy",this.isShown||this.ngZone.run(()=>{this.isShown=!0,document.documentElement.style.overflow="hidden"}))}onDocumentDragLeave(i){if(!this.allowGlobalPageDrop()||!this.isGlobalFileDrag(i))return;const t=i.relatedTarget;t&&document.body.contains(t)||this.ngZone.run(()=>this.resetGlobalFileDropVisual())}onDocumentDrop(i){if(!this.allowGlobalPageDrop()||!this.isGlobalFileDrag(i))return;i.preventDefault(),i.stopPropagation();const t=i.dataTransfer?.files;this.ngZone.run(()=>{this.resetGlobalFileDropVisual(),t?.length&&this.droppedFile(t[0])})}droppedFile(i){this.onFileUploaded(null,i)}}return(c=v).\u0275fac=function(i){return new(i||c)(e.rXU(j.k),e.rXU(L.s),e.rXU(U.n),e.rXU(o.x),e.rXU(A.n),e.rXU(G.X),e.rXU(z.nX),e.rXU(z.Ix),e.rXU(Z.f),e.rXU($.u),e.rXU(l.p),e.rXU(e.SKi),e.rXU(Y.Lw),e.rXU(e.gRc),e.rXU(Y.Bq),e.rXU(Q.L),e.rXU(K.g),e.rXU(k.u),e.rXU(W.H),e.rXU(X.w),e.rXU(I.qQ),e.rXU(e.sFG),e.rXU(O.J),e.rXU(F.A),e.rXU(V.M))},c.\u0275cmp=e.VBU({type:c,selectors:[["app-photo-editor-ui"]],viewQuery:function(i,t){if(1&i&&(e.GBs(gl,7),e.GBs(_l,7),e.GBs(fl,7),e.GBs(vl,7),e.GBs(bl,7),e.GBs(Cl,7),e.GBs(xl,7),e.GBs(Sl,7),e.GBs(El,7),e.GBs(yl,5),e.GBs(b,5),e.GBs(B.y,5),e.GBs(wl,5),e.GBs(kl,5),e.GBs(Tl,5)),2&i){let r;e.mGM(r=e.lsd())&&(t.canvasWrapper=r.first),e.mGM(r=e.lsd())&&(t.canvasMaskWrapperLoaded=r.first),e.mGM(r=e.lsd())&&(t.canvasMaskWrapper=r.first),e.mGM(r=e.lsd())&&(t.mainCanvas=r.first),e.mGM(r=e.lsd())&&(t.canvasBackground=r.first),e.mGM(r=e.lsd())&&(t.canvasPreview=r.first),e.mGM(r=e.lsd())&&(t.page=r.first),e.mGM(r=e.lsd())&&(t.inputFile=r.first),e.mGM(r=e.lsd())&&(t.outputCanvas=r.first),e.mGM(r=e.lsd())&&(t.zoomselect=r.first),e.mGM(r=e.lsd())&&(t.appcropframe=r.first),e.mGM(r=e.lsd())&&(t.appBodyExpanderComponent=r.first),e.mGM(r=e.lsd())&&(t.editNavInner=r),e.mGM(r=e.lsd())&&(t.editNavUpper=r),e.mGM(r=e.lsd())&&(t.tools=r)}},hostBindings:function(i,t){1&i&&e.bIt("beforeunload",function(f){return t.unloadNotification(f)},!1,e.tSv)("visibilitychange",function(f){return t.onvisibilitychange(f)},!1,e.EBC)("dragover",function(f){return t.onDocumentDragOver(f)},!1,e.EBC)("dragleave",function(f){return t.onDocumentDragLeave(f)},!1,e.EBC)("drop",function(f){return t.onDocumentDrop(f)},!1,e.EBC)},inputs:{activeToolPanel:"activeToolPanel",isDialog:"isDialog",photoEditorOptions:"photoEditorOptions"},features:[e.Jv_([R.U,o.x,l.p,{provide:A.n,useClass:P.C},G.X,k.u,D.F,O.J]),e.Vt3],decls:59,vars:64,consts:[["page",""],["canvasWrapper",""],["canvasMaskWrapperLoaded",""],["canvasMaskWrapper",""],["mainCanvas",""],["canvasPreview",""],["appcropframe",""],["expandCanvas",""],["canvasBackground",""],["popOpacity",""],["inputFile",""],["tooldrawer",""],["editNavUpper",""],["editNavInner",""],["zoomselect",""],[1,"page","editor-tool-panel","m-remove-bg",3,"ngClass"],["class","position-relative",4,"ngIf"],[3,"projectName","selectedUpscale","expandImageUrl","activeTool",4,"ngIf"],[1,"editor-view","p-editor",3,"ngClass"],[1,"row","m-0","h-100","g-0","position-relative",3,"ngClass"],["type","hidden","id","gtm-photo-editor-active-tool",1,"d-none",3,"value"],[1,"col-i","left-panel",3,"ngClass"],[1,"row","m-0","h-100","g-0"],["class","col-i navs h-100",4,"ngIf"],[1,"col-i","navs-drawer","h-100","overflow-hidden","drawer-contentupload",3,"hidden"],["class","drawer-container h-100 col-animate",3,"ngSwitch","click",4,"ngIf"],[1,"col-i","wrapper-for-timeline","ps-1","pr-9","position-relative",3,"ngClass"],["style","position:absolute;z-index:99;width:126px;height:calc(100% - 4rem)","class","d-flex flex-column text-center justify-content-center",4,"ngIf"],[1,"row","no-margin","main-content","g-0",2,"display","inline-flex","width","100%"],["id","canvas-wrapper",1,"canvas-wrapper","position-relative"],["class","position-absolute w-100","style","top: 12px;z-index:999;",4,"ngIf"],["id","canvas-mask-wrapper",1,"canvas-mask-wrapper","not-loaded",3,"hidden","ngClass"],[1,"canvas-child-area"],[1,"position-relative",3,"ngClass"],["
1id","vmx-canvas",3,"ngClass","hidden"],["class","image-compare","style","background-size: contain;\n background-position: center;",3,"background-image","ngClass",4,"ngIf"],["class","image-compare","style","background-position: center;",3,"background-image","ngClass",4,"ngIf"],[4,"ngIf"],[1,"canvas-loader",3,"click","hidden"],[2,"z-index","999","position","absolute","top","0"],["class","canvas-mask-wrapper ai-expand-area justify-content-center upscale-image-slide",4,"ngIf"],[1,"canvas-mask-wrapper","ai-expand-area","justify-content-center",3,"hidden","ngClass"],["id","expand-container",1,"expand-container","d-flex",2,"width","100%","align-items","center","justify-content","center"],["alt","Picture","id","ai-expand-image",2,"height","50%",3,"hidden","src"],[3,"afterExpandFreeformResized","afterExpandFreeformDragged"],[1,"canvas-mask-wrapper",3,"hidden","ngClass"],["id","expand-layout-container",1,"show-transbg"],["id","expand-canvas"],["class","expandImageUrl justify-content-center d-flex align-items-center","style","width: 100%; height: 100%;",4,"ngIf"],["class","position-absolute w-100 drag-con","style","bottom: 12px;",4,"ngIf"],["class","canvas-progress circle-animation photo-bg-animation","style","opacity: 1;",4,"ngIf"],["class","loader",4,"ngIf"],["style","z-index: 99;position: absolute;bottom:3px;width: 90%;","class","canvas-action-bottom",3,"ngClass",4,"ngIf"],[1,"col-i","wrapper-for-timeline","position-relative","p-13"],["class","d-flex align-items-center display-ads-section position-absolute w-100",4,"ngIf"],["class","position-absolute d-flex align-items-center justify-content-start p-2 notify-promotion border-radius-lg bg-white",4,"ngIf"],["class","photo-editor-page-drop-overlay","aria-hidden","true",4,"ngIf"],["id","inputFile","name","inputFile","type","file","accept","image/*",1,"custom-file-input","d-none",3,"change","click"],[1,"position-relative"],[3,"projectName","selectedUpscale","expandImageUrl","activeTool"],[1,"col-i","navs","h-100"],[3,"toggleSliderEvent","activeTool","sldBtn"],["class","h-100 w-100 position-absolute","style","cursor: not-allowed; top: 0;",4,"ngIf"],[1,"h-100","w-100","position-absolute",2,"cursor","not-allowed","top","0"],[1,"drawer-container","h-100","col-animate",3,"click","ngSwitch"],[1,"child-drawer",3,"ngClass"],["class","drawer-click-overlay",3,"click",4,"ngIf"],[3,"subTool",4,"ngSwitchCase"],[3,"isMobileView",4,"ngSwitchCase"],[4,"ngSwitchCase"],[3,"changeSubTool",4,"ngSwitchCase"],[1,"drawer-click-overlay",3,"click"],[3,"subTool"],[3,"isMobileView"],[3,"changeSubTool"],[1,"d-flex","flex-column","text-center","justify-content-center",2,"position","absolute","z-index","99","width","126px","height","calc(100% - 4rem)"],[1,"d-flex","flex-column","text-center","justify-content-center",2,"align-self","start","position","relative","width","100%"],[1,"position-absolute","w-100",2,"top","12px","z-index","999"],[1,"whShowBox","d-flex","align-items-center","btn-h40","mx-auto"],[1,"image-compare",2,"background-size","contain","background-position","center",3,"ngClass"],[1,"image-compare",2,"background-position","center",3,"ngClass"],[3,"mainCanvas","mainCanvasNative","hidden",4,"ngIf"],[3,"mainCanvas","mainCanvasNative","hidden","isRoundInstance2",4,"ngIf"],[3,"mainCanvas","mainCanvasNative","hidden"],[3,"mainCanvas","mainCanvasNative","hidden","isRoundInstance2"],[1,"canvas-mask-wrapper","ai-expand-area","justify-content-center","upscale-image-slide"],[1,"expand-container",2,"width","100%","align-items","center","justify-content","center","height","100%"],[1,"slider-with-animated-handle","w-100","overflow-hidden",2,"overflow","hidden"],["slot","first"],["width","","height","",1,"responsive",3,"src"],[1,"position-absolute","beforeText","text-white","text-11","text-semi"],["slot","second"],[1,"position-absolute","afterText","text-white","text-11","text-semi"],[1,"position-absolute","outputText","text-11"],[1,"text-semi","text-white","text-uppercase"],[1,"grey-100"],["slot","handle","width","52","height","52","viewBox","0 0 52 52","fill","none","xmlns","http://www.w3.org/2000/svg",1,"handle-round"],["cx","26","cy","26","r","26","fill","white"],["d","M39.3147 26.0715L34.3647 21.1215C34.1825 20.9329 34.0817 20.6803 34.084 20.4181C34.0863 20.1559 34.1915 19.9051 34.3769 19.7197C34.5623 19.5342 34.8131 19.4291 35.0753 19.4268C35.3375 19.4245 35.5901 19.5253 35.7787 19.7075L41.4357 25.3645C41.6232 25.552 41.7285 25.8063 41.7285 26.0715C41.7285 26.3366 41.6232 26.5909 41.4357 26.7785L35.7787 32.4355C35.5901 32.6176 35.3375 32.7184 35.0753 32.7161C34.8131 32.7139 34.5623 32.6087 34.3769 32.4233C34.1915 32.2379 34.0863 31.9871 34.084 31.7249C34.0817 31.4627 34.1825 31.2101 34.3647 31.0215L39.3147 26.0715Z","fill","var(--handle-color)"],["d","M12.7536 26.0002L17.7036 30.9502C17.7991 31.0424 17.8753 31.1528 17.9277 31.2748C17.9801 31.3968 18.0077 31.528 18.0089 31.6608C18.01 31.7936 17.9847 31.9252 17.9345 32.0481C17.8842 32.171 17.8099 32.2827 17.716 32.3766C17.6221 32.4705 17.5105 32.5447 17.3876 32.595C17.2647 32.6453 17.133 32.6706 17.0002 32.6694C16.8674 32.6683 16.7362 32.6407 16.6142 32.5883C16.4922 32.5359 16.3819 32.4597 16.2896 32.3642L10.6326 26.7072C10.4452 26.5197 10.3398 26.2653 10.3398 26.0002C10.3398 25.735 10.4452 25.4807 10.6326 25.2932L16.2896 19.6362C16.4782 19.454 16.7308 19.3532 16.993 19.3555C17.2552 19.3578 17.506 19.463 17.6914 19.6484C17.8769 19.8338 17.982 20.0846 17.9843 20.3468C17.9866 20.609 17.8858 20.8616 17.7036 21.0502L12.7536 26.0002Z","fill","var(--handle-color)"],[1,"expandImageUrl","justify-content-center","d-flex","align-items-center",2,"width","100%","height","100%"],[2,"margin","auto","object-fit","contain","height","-webkit-fill-available",3,"src"],[1,"position-absolute","w-100","drag-con",2,"bottom","12px"],[1,"btn","btn-primary","btn-h40","align-items-center","text-13",2,"border-radius","20px","padding","0.35rem 1rem","display","inline-flex"],["name","dragImageOpen",1,"f-28","me-1"],[1,"canvas-progress","circle-animation","photo-bg-animation",2,"opacity","1"],[1,"inner"],["size","lg",3,"progress","message","indeterminate"],[1,"canvas"],[1,"aurora-bg"],[1,"blob","blob-1"],[1,"blob","blob-2"],[1,"blob","blob-3"],[1,"loader"],[1,"cdk-overlay-backdrop","cdk-overlay-dark-backdrop","cdk-overlay-backdrop-showing"],[1,"loader-inner"],[1,"canvas-action-bottom",2,"z-index","99","position","absolute","bottom","3px","width","90%",3,"ngClass"],[1,"canvas-action-btn-bottom"],["class","btn-all btn-bottom mr-8","color","primary","placement","top","ngbTooltip","Compare","tooltipClass","tooltip-custom-all","triggers","mouseenter:mouseleave",3,"ngClass","mouseup","mouseout","mousedown",4,"ngIf"],["class","btn-all btn-bottom mr-8","color","primary","placement","bottom",3,"ngClass",4,"ngIf"],["class","btn-all btn-bottom mr-8","color","primary","placement","top","ngbTooltip","Compare","tooltipClass","tooltip-custom-all",3,"ngClass","mouseup","mouseout","mousedown",4,"ngIf"],["name","divider",1,"mr-8",2,"align-self","center"],["class","btn-all btn-bottom mr-8","color","primary","placement","top","ngbTooltip","Undo","tooltipClass","tooltip-custom-all",3,"ngClass","click","mousedown","mouseup",4,"ngIf"],["class","btn-all btn-bottom mr-8","color","primary","placement","top","ngbTooltip","Redo","tooltipClass","tooltip-custom-all",3,"ngClass","click","mousedown","mouseup",4,"ngIf"],[3,"changeZoom","_photoEditorType","selectedToolName"],["color","primary","placement","top","ngbTooltip","Compare","tooltipClass","tooltip-custom-all","triggers","mouseenter:mouseleave",1,"btn-all","btn-bottom","mr-8",3,"mouseup","mouseout","mousedown","ngClass"],["name","compareactive",1,"f-24"],["color","primary","placement","bottom",1,"btn-all","btn-bottom","mr-8",3,"ngClass"],["name","compare",1,"f-24"],["color","primary","placement","top","ngbTooltip","Compare","tooltipClass","tooltip-custom-all",1,"btn-all","btn-bottom","mr-8",3,"mouseup","mouseout","mousedown","ngClass"],["name","undo",1,"f-24",2,"color","#B0B3BF","opacity","0.3"],["color","primary","placement","top","ngbTooltip","Undo","tooltipClass","tooltip-custom-all",1,"btn-all","btn-bottom","mr-8",3,"click","mousedown","mouseup","ngClass"],["name","undoactive",1,"f-24"],["name","redo",1,"f-24",2,"color","#B0B3BF","opacity","0.3"],["color","primary","placement","top","ngbTooltip","Redo","tooltipClass","tooltip-custom-all",1,"btn-all","btn-bottom","mr-8",3,"click","mousedown","mouseup","ngClass"],["name","redoactive",1,"f-24"],[1,"p-3","border-radius-lg","bg-white","d-flex","align-items-center","justify-content-center","w-100","h-100","position-relative"],[1,"w-100","h-100","d-flex","align-items-center","justify-content-center","bg-white","border-radius-12","flex-column",2,"border","1p
1x solid #959AA7","min-height","250px"],["src","https://static.lightxeditor.com/assets/svg/viastockactive.svg","height","80px","width","80px"],["type","button",1,"btn","btn-primary","btn-h48","text-lg","mt-10","ps-4","pe-4","mt-4",3,"click","disabled"],[1,"text-14","grey-800","m-0","mt-2","lh-160",3,"ngClass"],[1,"d-flex","align-items-center","display-ads-section","position-absolute","w-100"],[1,"d-flex","align-items-center","justify-content-center","leaderboard-area"],["data-ad-client","ca-pub-4500187821001787","data-ad-slot","6146054956","data-ad-format","horizontal","data-full-width-responsive","true",1,"adsbygoogle","ad_responsive_1",2,"display","block","height","90px","width","730px"],[1,"button-col","d-flex","align-items-center","justify-content-center"],[1,"btn-all","btn-outline-primary","border-btn-gradiant","text-13","btn-h32","border-0","border-radius-12","text-semi","ps-2","pe-2",3,"click"],["name","prousernew",1,"f-16"],[1,"text-black"],[1,"position-absolute","d-flex","align-items-center","justify-content-start","p-2","notify-promotion","border-radius-lg","bg-white"],[1,"d-inline-flex","align-items-center","justify-content-center","video-col"],["autoplay","","loop","",2,"border-radius","10px","width","100%",3,"muted"],["src","https://static.lightxeditor.com/assets/tutorials/promotion-resize.mp4","type","video/mp4"],[1,"d-inline-flex","align-items-start","justify-content-start","content-col","flex-column","position-relative","ms-2"],[1,"grey-800","text-14","lh-160","d-inline-flex","w-100","mt-2","mb-2","pe-4"],["target","_blank",1,"btn","btn-outline-primary","btn-h40","text-13","d-inline-flex","align-items-center","justify-content-center","ps-4","pe-4",3,"routerLink","queryParams"],[1,"position-absolute","close-promotion","d-flex","align-items-center","justify-content-center","pointer",3,"click"],["name","resizecross",1,"grey-800"],["src","https://static.lightxeditor.com/assets/tutorials/promotion-crop.mp4","type","video/mp4"],["aria-hidden","true",1,"photo-editor-page-drop-overlay"],[1,"photo-editor-page-drop-overlay__inner","drag-drop-text","d-flex","align-items-center","justify-content-center","flex-column"],[1,"text-center","text-32","text-bold","grey-800","lh-125"],[1,"photo-editor-page-drop-overlay__sub","secondary-text","text-semi","mt-10","text-xxl","grey-800"],[3,"activeObject","verticalOrientation"]],template:function(i,t){if(1&i){const r=e.RV6();e.j41(0,"div",15,0),e.DNE(2,Ll,1,0,"app-top-strip",16)(3,Nl,1,4,"editor-header",17),e.j41(4,"div",18)(5,"div",19),e.nrm(6,"input",20),e.j41(7,"aside",21)(8,"div",22),e.DNE(9,Vl,3,3,"div",23),e.j41(10,"div",24),e.DNE(11,ec,18,42,"div",25),e.k0s()()(),e.j41(12,"div",26),e.DNE(13,tc,4,0,"div",27),e.j41(14,"div",28)(15,"div",29,1),e.DNE(17,ic,7,2,"div",30),e.j41(18,"div",31,2)(20,"div",32,3)(22,"div",33)(23,"canvas",34,4),e.EFF(25," Your browser does not support the HTML5 canvas tag. "),e.k0s(),e.DNE(26,oc,1,3,"div",35)(27,nc,1,3,"div",36)(28,ac,3,2,"ng-container",37),e.k0s(),e.j41(29,"div",38),e.bIt("click",function(){return e.eBV(r),e.Njj(t.stopAnimate())}),e.nrm(30,"div",39,5),e.k0s(),e.DNE(32,lc,20,5,"div",40),e.k0s()(),e.j41(33,"div",41)(34,"div",42),e.nrm(35,"img",43),e.k0s(),e.j41(36,"app-crop-frame",44,6),e.bIt("afterExpandFreeformResized",function(T){return e.eBV(r),e.Njj(t.afterExpandFreeformResized(T))})("afterExpandFreeformDragged",function(T){return e.eBV(r),e.Njj(t.afterExpandFreeformDragged(T))}),e.k0s()(),e.j41(38,"div",45)(39,"div",32)(40,"div",46),e.nrm(41,"canvas",47,7),e.k0s()()(),e.DNE(43,cc,2,1,"div",48)(44,hc,4,0,"div",49)(45,dc,8,3,"div",50)(46,pc,3,0,"div",51),e.nrm(47,"div",39,8),e.k0s()(),e.DNE(49,Ec,16,16,"div",52),e.k0s(),e.DNE(50,yc,8,4,"div",53),e.k0s()(),e.DNE(51,wc,8,0,"div",54)(52,kc,12,5,"div",55)(53,Tc,12,5,"div",55)(54,Pc,6,0,"div",56),e.k0s(),e.DNE(55,Ic,1,2,"ng-template",null,9,e.C5r),e.j41(57,"input",57,10),e.bIt("change",function(T){return e.eBV(r),e.Njj(t.onFileUploaded(T.srcElement.files))})("click",function(){e.eBV(r);const T=e.sdS(58);return e.Njj(T.value="")}),e.k0s()}2&i&&(e.Y8G("ngClass",e.sMw(39,Pl,t.photoEditorOptions&&t.photoEditorOptions._rw,!t.user||!t.user.subscribed,!t.showAds)),e.R7$(2),e.Y8G("ngIf",!t.isDialog),e.R7$(),e.Y8G("ngIf",!t.isDialog),e.R7$(),e.Y8G("ngClass",e.eq3(43,Il,t.isDialog)),e.R7$(),e.Y8G("ngClass",e.eq3(45,Ml,t.isLayersVisible)),e.R7$(),e.FS9("value",t.activeToolPanel),e.R7$(),e.Y8G("ngClass",e.l_i(47,jl,!t.sldBtn,t.isDialog)),e.R7$(2),e.Y8G("ngIf",!t.isDialog&&!t.envService.isMobileView),e.R7$(),e.Y8G("hidden",!t.sldBtn),e.R7$(),e.Y8G("ngIf",t.readyModule&&t.activeToolPanel),e.R7$(),e.Y8G("ngClass",e.l_i(50,Ol,t.photoEditorService.isError,t.photoEditorService.inProgress)),e.R7$(),e.Y8G("ngIf",t.editNavs.length),e.R7$(4),e.Y8G("ngIf",t.photoEditorService.isLoaded&&t.photoEditorService.resizeWidth&&t.photoEditorService.resizeHeight),e.R7$(),e.Y8G("hidden",!("NORMAL"===t._photoEditorType||"EXPAND"===t._photoEditorType&&!(t.expandInputImageUrl||null!=t.photoEditorService&&null!=t.photoEditorService.originalImage&&t.photoEditorService.originalImage.src)))("ngClass",e.eq3(53,Al,"BODY_RETOUCH"===t.selectedToolName)),e.R7$(4),e.Y8G("ngClass",e.ziG(55,Rl,!t.photoEditorService.isLoaded||t.iscompare&&"aitools"!=t.activeToolPanel?"bg-none":"show-transbg",t.photoEditorService.isLoaded?"loaded":"","aitools"==t.activeToolPanel&&null!=t.selectedUpscale&&t.selectedUpscale.gen?"bg-none":"",t.iscompare?"compare":"")),e.R7$(),e.Y8G("ngClass",t.iscompare?"displaynone":"displayblock")("hidden","NORMAL"===t._photoEditorType&&(null==t.selectedUpscale?null:t.selectedUpscale.gen)),e.R7$(3),e.Y8G("ngIf","aitools"==t.activeToolPanel||"tools"==t.activeToolPanel&&"silhouette"==t.photoEditorService.activeSubTool),e.R7$(),e.Y8G("ngIf","aitools"!=t.activeToolPanel&&!("tools"==t.activeToolPanel&&"silhouette"==t.photoEditorService.activeSubTool)),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isLoaded),e.R7$(),e.Y8G("hidden",!0),e.R7$(3),e.Y8G("ngIf","aitools"==t.activeToolPanel&&(null==t.selectedUpscale?null:t.selectedUpscale.gen)),e.R7$(),e.Y8G("hidden","EXPAND"!==t._photoEditorType||!(t.expandInputImageUrl||null!=t.photoEditorService&&null!=t.photoEditorService.originalImage&&t.photoEditorService.originalImage.src))("ngClass",e.eq3(60,no,t.expandImageUrl||(null==t.selectedUpscale?null:t.selectedUpscale.gen))),e.R7$(2),e.Y8G("hidden",!(t.expandInputImageUrl||null!=t.photoEditorService&&null!=t.photoEditorService.originalImage&&t.photoEditorService.originalImage.src))("src",t.expandInputImageUrl||(null==t.photoEditorService||null==t.photoEditorService.originalImage?null:t.photoEditorService.originalImage.src),e.B4B),e.R7$(3),e.Y8G("hidden","EXPANDLAYOUT"!==t._photoEditorType)("ngClass",e.eq3(62,
1no,t.expandImageUrl||(null==t.selectedUpscale?null:t.selectedUpscale.gen))),e.R7$(5),e.Y8G("ngIf",t.expandImageUrl),e.R7$(),e.Y8G("ngIf",t.photoEditorService.isLoaded&&t.photoEditorService.isImagePan),e.R7$(),e.Y8G("ngIf",t.photoEditorService.inProgress),e.R7$(),e.Y8G("ngIf",t.inProgress),e.R7$(3),e.Y8G("ngIf",!t.envService.isMobileView),e.R7$(),e.vxM(t.photoEditorService.isError?50:-1),e.R7$(),e.Y8G("ngIf",t.showAds),e.R7$(),e.Y8G("ngIf",t.showPromotion&&"tools"==t.activeToolPanel&&"resize"==(null==t.photoEditorService?null:t.photoEditorService.activeSubTool)&&!t.envService.isMobileView),e.R7$(),e.Y8G("ngIf",t.showPromotion&&"tools"==t.activeToolPanel&&"crop"==(null==t.photoEditorService?null:t.photoEditorService.activeSubTool)&&!t.envService.isMobileView),e.R7$(),e.Y8G("ngIf",t.isShown&&"batch"!=t.activeToolPanel))},dependencies:[I.YU,I.bT,I.ux,I.e1,le.g,Y.md,z.Wk,fe.V,Ce.b,Ne.Z,B.y,ot,ht,Nn,Vn,Hr,ha,hl,dl.Y,b,ml],styles:['@charset "UTF-8";.loaded[_ngcontent-%COMP%]{box-shadow:0 0 12px #0000001a}.editor-view[_ngcontent-%COMP%]{min-width:920px}.canvas-child-area[_ngcontent-%COMP%]{width:fit-content;margin:auto;position:relative;max-height:100%}.layer-text[_ngcontent-%COMP%]{position:absolute;margin-top:57px}.canvas-loader[_ngcontent-%COMP%], .scene-preview-back[_ngcontent-%COMP%]{position:fixed;width:100%;height:100%;top:0;left:0;background:#000c;z-index:10000}.bottom-panel-wrapper[_ngcontent-%COMP%]{background:#fff;border-radius:12px 12px 0 0;box-shadow:0 0 12px #0000001a}.collapse-header[_ngcontent-%COMP%]{padding:1rem;border-bottom:solid 2px #e2e2e6}.timeline-canvas-wrapper[_ngcontent-%COMP%]{width:calc(100% - 51px);height:200px;overflow-x:auto}.timeline[_ngcontent-%COMP%]{width:100%}.bottom-panel[_ngcontent-%COMP%]{width:100%;display:block;background:#fff;overflow:hidden}.canvas-mask-wrapper[_ngcontent-%COMP%]{display:inline-flex;overflow:auto}.time-duration-container[_ngcontent-%COMP%]{border-radius:6px;width:118px;height:40px;background-color:#fff;border:solid 2px #475ae7}.time-duration-container[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{padding:0rem .5rem}.time-duration-container[_ngcontent-%COMP%] .btn.textblue[_ngcontent-%COMP%]{color:#475ae7}.canvas-progress[_ngcontent-%COMP%]{z-index:999;position:absolute;top:0;height:100%;width:100%;background:#fff;opacity:.8;display:grid}.canvas-progress[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%]{color:#898b8a;position:absolute;top:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%}.canvas-progress[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .spinner-border[_ngcontent-%COMP%]{color:#626adf}.canvas-progress[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .spinner-border[_ngcontent-%COMP%]{width:60px;height:60px;min-width:60px;min-height:60px;border:6px solid #626ADF;border-right-color:transparent}.canvas-progress[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .spinner-text[_ngcontent-%COMP%]{font-style:normal;font-size:32px;line-height:44px;text-align:center;color:#000}.canvas-progress[_ngcontent-%COMP%] .inner[_ngcontent-%COMP%] .spinner-text-secondary[_ngcontent-%COMP%]{font-size:20px;color:#272b34;line-height:36px}.widthAdded[_ngcontent-%COMP%]{width:7rem}.widthRemoved[_ngcontent-%COMP%]{width:calc(100% - 8rem)}.layers-on[_ngcontent-%COMP%] .widthRemoved[_ngcontent-%COMP%]{width:calc(100% - 14.5rem)}.active[_ngcontent-%COMP%]{background:#626adf!important;border-radius:16px!important;color:#fff!important}.opacityactive[_ngcontent-%COMP%]{background:#626adf1a!important;color:#626adf!important;border-radius:16px!important}.opacitytext[_ngcontent-%COMP%], .nav-title-text[_ngcontent-%COMP%]{color:#626adf!important}.displaynone[_ngcontent-%COMP%]{visibility:hidden}.displayblock[_ngcontent-%COMP%]{visibility:visible}.image-compare[_ngcontent-%COMP%]{position:absolute;max-height:100%;top:0%;left:0%;height:100%!important;width:100%!important;background-repeat:no-repeat;background-size:100% 100%}.whShowBox[_ngcontent-%COMP%]{background:#272b34cc;color:#fff;border-radius:20px;width:fit-content;font-size:12px;line-height:14.6px}@media only screen and (min-width: 320px) and (max-width: 920px){.m-remove-bg[_ngcontent-%COMP%] .editor-view[_ngcontent-%COMP%]{min-width:100%}.m-remove-bg[_ngcontent-%COMP%] aside.left-panel[_ngcontent-%COMP%]{width:100%;height:auto;position:fixed;bottom:0;z-index:99}.m-remove-bg[_ngcontent-%COMP%] aside.left-panel[_ngcontent-%COMP%] .h-100[_ngcontent-%COMP%]{height:auto!important}.m-remove-bg[_ngcontent-%COMP%] aside.left-panel[_ngcontent-%COMP%] .navs-drawer[_ngcontent-%COMP%]{background:#fff;width:100%;padding:0 16px;height:auto!important;border-radius:0}.m-remove-bg[_ngcontent-%COMP%] .main-content[_ngcontent-%COMP%]{height:calc(100% - 16rem);margin-top:15px}.m-remove-bg[_ngcontent-%COMP%] .wrapper-for-timeline[_ngcontent-%COMP%]{width:100%;padding:0 16px!important}.m-remove-bg[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%]{height:calc(100% + 60px)}.m-remove-bg[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .canvas-progress[_ngcontent-%COMP%]{position:fixed;top:0;bottom:-60px;z-index:9999;height:calc(100% + 60px);min-height:-webkit-fill-available;max-height:-webkit-fill-available;background:#f9f9f9b3;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px);opacity:1}.m-resize[_ngcontent-%COMP%]{background-color:#fff}.m-resize[_ngcontent-%COMP%] .editor-view[_ngcontent-%COMP%]{height:calc(100% - 6.57rem - var(--sales-height))}.m-resize[_ngcontent-%COMP%] aside.left-panel[_ngcontent-%COMP%] .navs-drawer[_ngcontent-%COMP%]{background-color:#fff}.m-resize[_ngcontent-%COMP%] .main-content[_ngcontent-%COMP%]{height:calc(100% - 8rem)}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%]{height:calc(100% + 50px - var(--sales-height));align-items:center;justify-content:center;overflow:hidden}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .show-transbg[_ngcontent-%COMP%], .m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .lower-canvas[_ngcontent-%COMP%]{border-radius:24px;box-shadow:none}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .drag-con[_ngcontent-%COMP%]{bottom:auto!important}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .drag-con[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .drag-con[_ngcontent-%COMP%] .btn-primary[_ngcontent-%COMP%] pi[_ngcontent-%COMP%]{margin-right:.25rem}.m-resize[_ngcontent-%COMP%] .canvas-wrapper[_ngcontent-%COMP%] .canvas-progress[_ngcontent-%COMP%]{height:calc(100% + 50px - var(--sales-height))}}.col-animate[_ngcontent-%COMP%] .up-state[_ngcontent-%COMP%]{transform:translateY(30px)!important}.disable-btn[_ngcontent-%COMP%]{cursor:text}.disable-btn[_ngcontent-%COMP%]:hover, .disable-btn[_ngcontent-%COMP%]:focus{background:transparent!important}.btn-bottom-active[_ngcontent-%COMP%]{background:#626adf1a!important}.display-ads-section[_ngcontent-%COMP%]{border-top:1px solid #EEEDF3;background:#fff;padding-top:5px;justify-content:space-evenly}.display-ads-section[_ngcontent-%COMP%] .leaderboard-area[_ngcontent-%COMP%]{width:730px;height:90px;background:#d9d9d9;margin-left:16.5%}.display-ads-section[_ngcontent-%COMP%] .button-col[_ngcontent-%COMP%] .btn-h32[_ngcontent-%COMP%]{height:32px;background:transparent!important}.display-ads-section[_ngcontent-%COMP%] .button-col[_ngcontent-%COMP%] .btn-h32[_ngcontent-%COMP%]:hover{background:#626adf0d!important}.upscale-image-slide[_ngcontent-%COMP%]{position:absolute;
1left:0;top:0}.beforeText[_ngcontent-%COMP%]{border-radius:24px;background:#60657666;left:12px;top:12px!important;padding:9px 16px}.afterText[_ngcontent-%COMP%]{border-radius:24px;background:#60657666;right:12px;top:12px!important;padding:16px 20px}.outputText[_ngcontent-%COMP%]{bottom:12px;border-radius:24px;background:#60657666;right:12px;padding:14px 16px}.dot[_ngcontent-%COMP%]{color:#fff;width:4px;height:4px;background:#fff;border-radius:50%}.ai-body-touch-area[_ngcontent-%COMP%]{width:100%;overflow:hidden}.drawer-click-overlay[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10;pointer-events:none}.photo-editor-page-drop-overlay[_ngcontent-%COMP%]{position:fixed;top:0;right:0;bottom:0;left:0;z-index:10050;display:flex;align-items:center;justify-content:center;width:100%;height:100%;box-sizing:border-box;pointer-events:none;background:#f8f9f9cc;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}.photo-editor-page-drop-overlay__inner[_ngcontent-%COMP%]{pointer-events:none;max-width:90%}.photo-editor-page-drop-overlay__sub[_ngcontent-%COMP%]{position:relative;z-index:1}.disabled-P[_ngcontent-%COMP%]{color:#e2e3e9!important}.wrapper-for-timeline.in-progress[_ngcontent-%COMP%]{padding-left:0!important}']}),v})()},41067:(_e,ie,g)=>{"use strict";g.d(ie,{EO:()=>a,LR:()=>h});var n=g(54438);const o=["*"],P={AAAsound:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.13372 9.06712C8.64922 9.06712 9.06712 8.64922 9.06712 8.13372C9.06712 7.61821 8.64922 7.20031 8.13372 7.20031C7.61821 7.20031 7.20031 7.61821 7.20031 8.13372C7.20031 8.64922 7.61821 9.06712 8.13372 9.06712Z" fill="#606576"/><path d="M12.8007 8.13372C12.8007 8.64922 12.3828 9.06712 11.8673 9.06712C11.3518 9.06712 10.9339 8.64922 10.9339 8.13372C10.9339 7.61821 11.3518 7.20031 11.8673 7.20031C12.3828 7.20031 12.8007 7.61821 12.8007 8.13372Z" fill="#606576"/><path d="M10 3C7.71144 3 5.94628 3.77201 4.75639 5.06411C3.5723 6.34991 3 8.10467 3 10C3 11.8953 3.5723 13.6501 4.75639 14.9359C5.94628 16.228 7.71144 17 10 17C12.2886 17 14.0537 16.228 15.2436 14.9359C16.4277 13.6501 17 11.8953 17 10C17 8.10467 16.4277 6.34991 15.2436 5.06411C14.0537 3.77201 12.2886 3 10 3ZM3.9334 10C3.9334 8.28709 4.44955 6.7752 5.44301 5.69641C6.43067 4.62392 7.93216 3.9334 10 3.9334C12.0678 3.9334 13.5693 4.62392 14.557 5.69641C15.5504 6.7752 16.0666 8.28709 16.0666 10C16.0666 11.7129 15.5504 13.2248 14.557 14.3036C13.5693 15.3761 12.0678 16.0666 10 16.0666C7.93216 16.0666 6.43067 15.3761 5.44301 14.3036C4.44955 13.2248 3.9334 11.7129 3.9334 10Z" fill="#606576"/><path d="M8.13372 9.06712C8.64922 9.06712 9.06712 8.64922 9.06712 8.13372C9.06712 7.61821 8.64922 7.20031 8.13372 7.20031C7.61821 7.20031 7.20031 7.61821 7.20031 8.13372C7.20031 8.64922 7.61821 9.06712 8.13372 9.06712Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.8007 8.13372C12.8007 8.64922 12.3828 9.06712 11.8673 9.06712C11.3518 9.06712 10.9339 8.64922 10.9339 8.13372C10.9339 7.61821 11.3518 7.20031 11.8673 7.20031C12.3828 7.20031 12.8007 7.61821 12.8007 8.13372Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 3C7.71144 3 5.94628 3.77201 4.75639 5.06411C3.5723 6.34991 3 8.10467 3 10C3 11.8953 3.5723 13.6501 4.75639 14.9359C5.94628 16.228 7.71144 17 10 17C12.2886 17 14.0537 16.228 15.2436 14.9359C16.4277 13.6501 17 11.8953 17 10C17 8.10467 16.4277 6.34991 15.2436 5.06411C14.0537 3.77201 12.2886 3 10 3ZM3.9334 10C3.9334 8.28709 4.44955 6.7752 5.44301 5.69641C6.43067 4.62392 7.93216 3.9334 10 3.9334C12.0678 3.9334 13.5693 4.62392 14.557 5.69641C15.5504 6.7752 16.0666 8.28709 16.0666 10C16.0666 11.7129 15.5504 13.2248 14.557 14.3036C13.5693 15.3761 12.0678 16.0666 10 16.0666C7.93216 16.0666 6.43067 15.3761 5.44301 14.3036C4.44955 13.2248 3.9334 11.7129 3.9334 10Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.98105 14.2367C6.54203 14.2367 7.33033 11.0703 7.33033 11.0703H12.6799C12.6799 11.0703 13.4201 14.2367 9.98105 14.2367Z" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/></svg>',EEEsound:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"><path fill="#606576" d="M8.134 9.067a.933.933 0 1 0 0-1.867.933.933 0 0 0 0 1.867M12.801 8.134a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0"/><path fill="#606576" d="M10 3c-2.288 0-4.053.772-5.243 2.064C3.573 6.35 3 8.104 3 10s.573 3.65 1.757 4.936C5.947 16.228 7.712 17 10 17s4.054-.772 5.244-2.064C16.428 13.65 17 11.896 17 10s-.572-3.65-1.756-4.936C14.054 3.772 12.289 3 10 3m-6.066 7c0-1.713.516-3.225 1.51-4.304C6.43 4.624 7.931 3.933 10 3.933s3.57.69 4.557 1.763c.994 1.08 1.51 2.591 1.51 4.304s-.516 3.225-1.51 4.304c-.987 1.072-2.489 1.763-4.557 1.763s-3.57-.69-4.557-1.763c-.993-1.08-1.51-2.591-1.51-4.304"/><path stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M8.134 9.067a.933.933 0 1 0 0-1.867.933.933 0 0 0 0 1.867M12.801 8.134a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0"/><path stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M10 3c-2.288 0-4.053.772-5.243 2.064C3.573 6.35 3 8.104 3 10s.573 3.65 1.757 4.936C5.947 16.228 7.712 17 10 17s4.054-.772 5.244-2.064C16.428 13.65 17 11.896 17 10s-.572-3.65-1.756-4.936C14.054 3.772 12.289 3 10 3m-6.066 7c0-1.713.516-3.225 1.51-4.304C6.43 4.624 7.931 3.933 10 3.933s3.57.69 4.557 1.763c.994 1.08 1.51 2.591 1.51 4.304s-.516 3.225-1.51 4.304c-.987 1.072-2.489 1.763-4.557 1.763s-3.57-.69-4.557-1.763c-.993-1.08-1.51-2.591-1.51-4.304"/><path fill="#606576" stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M6.856 13.447q.098.177.227.32c.248.271.575.436.934.436h3.967c.358 0 .685-.165.933-.436a1.7 1.7 0 0 0 .204-.278 1.95 1.95 0 0 0 .263-1c0-.4-.112-.768-.299-1.06-.256-.399-.654-.656-1.101-.656H8.017c-.423 0-.802.23-1.059.593-.212.3-.341.693-.341 1.122 0 .356.088.686.239.96m1.16-2.102h3.968c.366 0 .683.259.836.635a.44.44 0 0 1-.37.223h-4.9a.44.44 0 0 1-.37-.223c.153-.376.47-.635.837-.635m4.804 1.652c-.153.376-.47.635-.836.635H8.017c-.367 0-.684-.259-.836-.635a.44.44 0 0 1 .37-.223h4.9c.15 0 .284.087.37.223"/></svg>',WOOsound:'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"><path fill="#606576" d="M8.134 9.067a.933.933 0 1 0 0-1.867.933.933 0 0 0 0 1.867M12.801 8.134a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0"/><path fill="#606576" d="M10 3c-2.288 0-4.053.772-5.243 2.064C3.573 6.35 3 8.104 3 10s.573 3.65 1.757 4.936C5.947 16.228 7.712 17 10 17s4.054-.772 5.244-2.064C16.428 13.65 17 11.896 17 10s-.572-3.65-1.756-4.936C14.054 3.772 12.289 3 10 3m-6.066 7c0-1.713.516-3.225 1.51-4.304C6.43 4.624 7.931 3.933 10 3.933s3.57.69 4.557 1.763c.994 1.08 1.51 2.591 1.51 4.304s-.516 3.225-1.51 4.304c-.987 1.072-2.489 1.763-4.557 1.763s-3.57-.69-4.557-1.763c-.993-1.08-1.51-2.591-1.51-4.304"/><path stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M8.134 9.067a.933.933 0 1 0 0-1.867.933.933 0 0 0 0 1.867M12.801 8.134a.933.933 0 1 1-1.867 0 .933.933 0 0 1 1.867 0"/><path stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M10 3c-2.288 0-4.053.772-5.243 2.064C3.573 6.35 3 8.104 3 10s.573 3.65 1.757 4.936C5.947 16.228 7.712 17 10 17s4.054-.772 5.244-2.064C16.428 13.65 17 11.896 17 10s-.572-3.65-1.756-4.936C14.054 3.772 12.289 3 10 3m-6.066 7c0-1.713.516-3.225 1.51-4.304C6.43 4.624 7.931 3.933 10 3.933s3.57.69 4.557 1.763c.994 1.08 1.51 2.591 1.51 4.304s-.516 3.225-1.51 4.304c-.987 1.072-2.489 1.763-4.557 1.763s-3.57-.69-4.557-1.763c-.993-1.08-1.51-2.591-1.51-4.304"/><path fill="#606576" stroke="#606576" stroke-linecap="round" stroke-linejoin="round" stroke-width=".3" d="M9.766 10.936c0-.258.21-.467.467-.467.65 0 1.41.526 1.41 1.176 0 .266-.354.532-.503.729.15.197.503.423.503.69 0 .65-.76 1.176-1.41 1.176a.467.467 0 1 1 0-.934c.134 0 .477-.108.477-.242a.24.24 0 0 0-.243-.243.467.467 0 0 1 0-.934.24.24 0 0 0 .243-.242c0-.134-.343-.243-.477-.243a.467.467 0 0 1-.467-.466"/></svg>',smile:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.13372 9.06712C8.64922 9.06712 9.06712 8.64922 9.06712 8.13372C9.06712 7.61821 8.64922 7.20031 8.13372 7.20031C7.61821 7.20031 7.20031 7.61821 7.20031 8.13372C7.20031 8.64922 7.61821 9.06712 8.13372 9.06712Z" fill="#606576"/><path d="M12.8007 8.13372C12.8007 8.64922 12.3828 9.06712 11.8673 9.06712C11.3518 9.06712 10.9339 8.64922 10.9339 8.13372C10.9339 7.61821 11.3518 7.20031 11.8673 7.20031C12.3828 7.20031 12.8007 7.61821 12.8007 8.13372Z" fill="#606576"/><path d="M10 3C7.71144 3 5.94628 3.77201 4.75639 5.06411C3.5723 6.34991 3 8.10467 3 10C3 11.8953 3.5723 13.6501 4.75639 14.9359C5.94628 16.228 7.71144 17 10 17C12.2886 17 14.0537 16.228 15.2436 14.9359C16.4277 13.6501 17 11.8953 17 10C17 8.10467 16.4277 6.34991 15.2436 5.06411C14.0537 3.77201 12.2886 3 10 3ZM3.9334 10C3.9334 8.28709 4.44955 6.7752 5.44301 5.69641C6.43067 4.62392 7.93216 3.9334 10 3.9334C12.0678 3.9334 13.5693 4.62392 14.557 5.69641C15.5504 6.7752 16.0666 8.28709 16.0666 10C16.0666 11.7129 15.5504 13.2248 14.557 14.3036C13.5693 15.3761 12.0678 16.0666 10 16.0666C7.93216 16.0666 6.4306
17 15.3761 5.44301 14.3036C4.44955 13.2248 3.9334 11.7129 3.9334 10Z" fill="#606576"/><path d="M8.13372 9.06712C8.64922 9.06712 9.06712 8.64922 9.06712 8.13372C9.06712 7.61821 8.64922 7.20031 8.13372 7.20031C7.61821 7.20031 7.20031 7.61821 7.20031 8.13372C7.20031 8.64922 7.61821 9.06712 8.13372 9.06712Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.8007 8.13372C12.8007 8.64922 12.3828 9.06712 11.8673 9.06712C11.3518 9.06712 10.9339 8.64922 10.9339 8.13372C10.9339 7.61821 11.3518 7.20031 11.8673 7.20031C12.3828 7.20031 12.8007 7.61821 12.8007 8.13372Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 3C7.71144 3 5.94628 3.77201 4.75639 5.06411C3.5723 6.34991 3 8.10467 3 10C3 11.8953 3.5723 13.6501 4.75639 14.9359C5.94628 16.228 7.71144 17 10 17C12.2886 17 14.0537 16.228 15.2436 14.9359C16.4277 13.6501 17 11.8953 17 10C17 8.10467 16.4277 6.34991 15.2436 5.06411C14.0537 3.77201 12.2886 3 10 3ZM3.9334 10C3.9334 8.28709 4.44955 6.7752 5.44301 5.69641C6.43067 4.62392 7.93216 3.9334 10 3.9334C12.0678 3.9334 13.5693 4.62392 14.557 5.69641C15.5504 6.7752 16.0666 8.28709 16.0666 10C16.0666 11.7129 15.5504 13.2248 14.557 14.3036C13.5693 15.3761 12.0678 16.0666 10 16.0666C7.93216 16.0666 6.43067 15.3761 5.44301 14.3036C4.44955 13.2248 3.9334 11.7129 3.9334 10Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.1934 11.5148C12.0341 11.7273 11.4021 12.5174 9.93759 12.5174C8.77633 12.5174 7.95078 11.9407 7.8064 11.7482C7.65175 11.542 7.35922 11.5002 7.15302 11.6548C6.94682 11.8095 6.90503 12.102 7.05968 12.3082C7.382 12.738 8.48532 13.4278 9.93759 13.4278C11.74 13.4278 12.6328 12.4847 12.9401 12.0749C13.0948 11.8687 13.053 11.5761 12.8468 11.4215C12.6406 11.2668 12.348 11.3086 12.1934 11.5148Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',headtilt:'<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_34403_147987)"><path d="M15.0289 10.1648C15.0289 13.3259 13.012 17.1604 10.524 17.1604C8.03597 17.1604 6.01904 13.3259 6.01904 10.1648C6.01904 7.00369 8.03597 5.28906 10.524 5.28906C13.012 5.28906 15.0289 7.00369 15.0289 10.1648Z" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M18.1896 14.2762C18.1899 15.7294 17.7003 16.7145 16.6313 17.7546" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M19.7809 14.8082L18.4997 12.9744C18.466 12.9262 18.4011 12.9164 18.3547 12.9526L16.5906 14.3282" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.81036 6.30188C2.8101 4.84873 3.29965 3.86363 4.36871 2.82357" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M1.2191 5.76989L2.50032 7.60369C2.53401 7.65192 2.59894 7.66168 2.64533 7.62551L4.40942 6.24989" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/></g><defs><clipPath id="clip0_34403_147987"><rect width="20" height="20" fill="white" transform="translate(0.5 0.289062)"/></clipPath></defs></svg>',headupdown:'<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.7689 9.7976C11.7689 12.9587 9.75196 16.7932 7.26396 16.7932C4.77596 16.7932 2.75903 12.9587 2.75903 9.7976C2.75903 6.6365 4.77596 4.92188 7.26396 4.92188C9.75196 4.92188 11.7689 6.6365 11.7689 9.7976Z" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.974 7.30939C12.7139 7.0623 12.7037 6.65078 12.9506 6.39045L14.4897 4.76838C14.7865 4.45557 15.2827 4.45557 15.5795 4.76838L17.1196 6.39045L17.1996 6.49494C17.3596 6.7515 17.323 7.09315 17.0951 7.30939C16.8348 7.55637 16.4233 7.54622 16.1762 7.28595L15.685 6.7674L15.685 14.9383L16.1762 14.4197C16.4233 14.1594 16.8348 14.1492 17.0951 14.3963C17.3555 14.6434 17.3666 15.0549 17.1196 15.3153L15.5795 16.9373C15.2827 17.25 14.7865 17.2501 14.4897 16.9373L12.9506 15.3153C12.7036 15.055 12.714 14.6434 12.974 14.3963C13.2344 14.1493 13.6459 14.1596 13.893 14.4197L14.3842 14.9383L14.3842 6.7674L13.893 7.28595C13.6459 7.54601 13.2343 7.55637 12.974 7.30939Z" fill="#606576"/></svg>',headleftright:'<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_34403_147989)"><path d="M14.6517 7.76635C14.6517 10.9275 12.6348 14.762 10.1468 14.762C7.65877 14.762 5.64185 10.9275 5.64185 7.76635C5.64185 4.60525 7.65877 2.89062 10.1468 2.89062C12.6348 2.89062 14.6517 4.60525 14.6517 7.76635Z" stroke="#606576" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"/>
1<path d="M13.6898 15.9599C13.9369 15.6998 14.3484 15.6895 14.6087 15.9365L16.2308 17.4755C16.5436 17.7723 16.5436 18.2686 16.2308 18.5654L14.6087 20.1054L14.5042 20.1855C14.2477 20.3453 13.9059 20.3087 13.6898 20.081C13.4428 19.8207 13.4531 19.4092 13.7132 19.162L14.2318 18.6708H6.06086L6.57942 19.162C6.83973 19.4092 6.84992 19.8206 6.60286 20.081C6.35573 20.3411 5.94422 20.3524 5.68391 20.1054L4.06184 18.5654C3.74919 18.2686 3.7493 17.7723 4.06184 17.4755L5.68391 15.9365C5.94421 15.6895 6.35573 15.6998 6.60286 15.9599C6.84987 16.2202 6.83957 16.6317 6.57942 16.8788L6.06086 17.3701H14.2318L13.7132 16.8788C13.4532 16.6318 13.443 16.2202 13.6898 15.9599Z" fill="#606576"/></g><defs><clipPath id="clip0_34403_147989"><rect width="20" height="20" fill="white" transform="translate(0.146484 0.289062)"/></clipPath></defs></svg>',eyeblink:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.25639 5.06411C6.44628 3.77201 8.21144 3 10.5 3C12.7886 3 14.5537 3.77201 15.7436 5.06411C16.9277 6.34991 17.5 8.10467 17.5 10C17.5 11.8953 16.9277 13.6501 15.7436 14.9359C14.5537 16.228 12.7886 17 10.5 17C8.21144 17 6.44628 16.228 5.25639 14.9359C4.0723 13.6501 3.5 11.8953 3.5 10C3.5 8.10467 4.0723 6.34991 5.25639 5.06411ZM5.94301 5.69641C4.94955 6.7752 4.4334 8.28709 4.4334 10C4.4334 11.7129 4.94955 13.2248 5.94301 14.3036C6.93067 15.3761 8.43215 16.0666 10.5 16.0666C12.5678 16.0666 14.0693 15.3761 15.057 14.3036C16.0504 13.2248 16.5666 11.7129 16.5666 10C16.5666 8.28709 16.0504 6.7752 15.057 5.69641C14.0693 4.62392 12.5678 3.9334 10.5 3.9334C8.43215 3.9334 6.93067 4.62392 5.94301 5.69641Z" fill="#606576" stroke="#606576" stroke-width="0.295452" stroke-linecap="round" stroke-linejoin="round"/><path d="M13.541 8.34375L12.5 8.79222L11.8211 9.86234L12.8194 9.56755L13.7995 9.89521" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.48271 8.34375L8.52364 8.79222L9.20256 9.86234L8.20432 9.56755L7.22421 9.89521" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.6936 12.4836C12.5343 12.696 11.9023 13.4861 10.4378 13.4861C9.27658 13.4861 8.45103 12.9094 8.30664 12.7169C8.15199 12.5107 7.85946 12.4689 7.65326 12.6236C7.44706 12.7782 7.40527 13.0708 7.55992 13.277C7.88224 13.7067 8.98556 14.3965 10.4378 14.3965C12.2402 14.3965 13.133 13.4534 13.4404 13.0436C13.595 12.8374 13.5532 12.5449 13.347 12.3902C13.1408 12.2356 12.8483 12.2774 12.6936 12.4836Z" fill="#606576" stroke="#606576" stroke-width="0.295452" stroke-linecap="round" stroke-linejoin="round"/></svg>',eyewink:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.78447 5.06411C5.97436 3.77201 7.73952 3 10.0281 3C12.3166 3 14.0818 3.77201 15.2717 5.06411C16.4558 6.34991 17.0281 8.10467 17.0281 10C17.0281 11.8953 16.4558 13.6501 15.2717 14.9359C14.0818 16.228 12.3166 17 10.0281 17C7.73952 17 5.97436 16.228 4.78447 14.9359C3.60038 13.6501 3.02808 11.8953 3.02808 10C3.02808 8.10467 3.60038 6.34991 4.78447 5.06411ZM5.47108 5.69641C4.47763 6.7752 3.96148 8.28709 3.96148 10C3.96148 11.7129 4.47763 13.2248 5.47108 14.3036C6.45874 15.3761 7.96023 16.0666 10.0281 16.0666C12.0959 16.0666 13.5974 15.3761 14.5851 14.3036C15.5785 13.2248 16.0947 11.7129 16.0947 10C16.0947 8.28709 15.5785 6.7752 14.5851 5.69641C13.5974 4.62392 12.0959 3.9334 10.0281 3.9334C7.96023 3.9334 6.45874 4.62392 5.47108 5.69641Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M7.6958 7.96875C8.56155 7.96911 9.26318 8.67128 9.26318 9.53711C9.26302 9.9489 9.10397 10.3239 8.84424 10.6035C8.79742 10.6539 8.72474 10.6703 8.66064 10.6455C8.45305 10.5642 8.21583 10.4908 7.95947 10.4473C8.17823 10.3432 8.33057 10.1226 8.33057 9.86426C8.33055 9.50634 8.04005 9.21582 7.68213 9.21582C7.3244 9.21606 7.03468 9.50648 7.03467 9.86426C7.03467 10.0932 7.15423 10.2929 7.3335 10.4082C7.15284 10.4164 6.97812 10.4412 6.81299 10.4775L6.61377 10.5283C6.54657 10.5473 6.47371 10.5219 6.43213 10.4658C6.24075 10.2059 6.12758 9.88433 6.12744 9.53711C6.12744 8.67106 6.82975 7.96875 7.6958 7.96875Z" fill="#606576"/>
1<path d="M13.0695 8.3125L12.6502 8.49318C12.2452 8.66765 11.9022 8.96013 11.666 9.33246L11.5238 9.55669C11.4634 9.65184 11.5533 9.77097 11.6613 9.73905L11.7963 9.6992C12.1554 9.59316 12.5383 9.59995 12.8934 9.71866L13.328 9.86396" stroke="#606576" stroke-linecap="round"/><path d="M13.7371 12.2266C13.8202 11.9826 13.6897 11.7174 13.4457 11.6344C13.2017 11.5513 12.9366 11.6818 12.8535 11.9258C12.4094 13.2306 10.9907 13.9265 9.68529 13.4783C9.44151 13.3946 9.17603 13.5243 9.09232 13.7681C9.00861 14.0119 9.13838 14.2774 9.38216 14.3611C11.1756 14.9769 13.1265 14.0207 13.7371 12.2266Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',eyebrow:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.96602 8.82721C2.09562 8.39248 2.47676 7.7997 2.83784 7.39049C3.19893 6.98128 3.63303 6.79998 4.23389 6.69474C4.77197 6.6005 5.20698 6.61275 5.65028 6.66972C6.09134 6.72636 6.52794 6.8203 6.95899 6.92811C7.35338 7.02657 7.74769 7.13723 8.12745 7.28123C8.50662 7.42604 9.04415 7.67128 8.8786 8.16713C8.80978 8.37394 8.65593 8.51637 8.39116 8.5203C8.26165 8.52222 7.7326 8.40867 7.6002 8.37744C7.06893 8.2514 6.54742 8.08497 6.01129 7.97696C5.45483 7.86535 4.94089 7.71206 4.37119 7.81185C3.75411 7.91993 2.68635 8.30006 2.14843 8.93989C2.05244 9.05408 1.90895 8.95535 1.96602 8.82721Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><path d="M18.3277 8.82721C18.1981 8.39248 17.8169 7.7997 17.4559 7.39049C17.0948 6.98128 16.6607 6.79998 16.0598 6.69474C15.5217 6.6005 15.0867 6.61275 14.6434 6.66972C14.2024 6.72636 13.7658 6.8203 13.3347 6.92811C12.9403 7.02657 12.546 7.13723 12.1663 7.28123C11.7871 7.42604 11.2495 7.67128 11.4151 8.16713C11.4839 8.37394 11.6378 8.51637 11.9025 8.5203C12.0321 8.52222 12.5611 8.40867 12.6935 8.37744C13.2248 8.2514 13.7463 8.08497 14.2824 7.97696C14.8389 7.86535 15.3528 7.71206 15.9225 7.81185C16.5396 7.91993 17.6074 8.30006 18.1453 8.93989C18.2413 9.05408 18.3848 8.95535 18.3277 8.82721Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><circle cx="5.38005" cy="12.1349" r="1.92399" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><circle cx="6.53253" cy="12.137" r="1.15265" fill="#606576"/><circle cx="14.9333" cy="12.1349" r="1.92399" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><circle cx="16.086" cy="12.137" r="1.15265" fill="#606576"/></svg>',eyeverticle:'<svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.81597 4.25231C5.79203 4.25911 5.7682 4.26618 5.7445 4.27353C4.46074 4.67146 3.52832 5.86825 3.52832 7.28281C3.52832 9.02251 4.93862 10.4328 6.67832 10.4328C8.41802 10.4328 9.82832 9.02251 9.82832 7.28281C9.82832 6.1859 9.26765 5.21994 8.41725 4.65588C7.91892 4.32534 7.3211 4.13281 6.67832 4.13281C6.37931 4.13281 6.09003 4.17447 5.81597 4.25231ZM9.12832 7.28281C9.12832 8.63591 8.03142 9.73281 6.67832 9.73281C5.32522 9.73281 4.22832 8.63591 4.22832 7.28281C4.22832 6.29827 4.80905 5.44937 5.64666 5.05997C5.75519 5.72514 6.33247 6.23281 7.02832 6.23281C7.58462 6.23281 8.06514 5.90835 8.29095 5.43834C8.80418 5.88742 9.12832 6.54727 9.12832 7.28281Z" fill="#606576"/><path d="M11.2283 7.28281C11.2283 6.1859 11.789 5.21994 12.6394 4.65588C12.6741 4.63286 12.7093 4.61051 12.7449 4.58885C13.2212 4.29946 13.7803 4.13281 14.3783 4.13281C14.7035 4.13281 15.0171 4.18207 15.3121 4.27353C16.5959 4.67146 17.5283 5.86825 17.5283 7.28281C17.5283 9.02251 16.118 10.4328 14.3783 10.4328C12.6386 10.4328 11.2283 9.02251 11.2283 7.28281ZM16.8283 7.28281C16.8283 6.29827 16.2476 5.44937 15.41 5.05997C15.3015 5.72514 14.7242 6.23281 14.0283 6.23281C13.472 6.23281 12.9915 5.90835 12.7657 5.43834C12.2525 5.88742 11.9283 6.54727 11.9283 7.28281C11.9283 8.63591 13.0252 9.73281 14.3783 9.73281C15.7314 9.73281 16.8283 8.63591 16.8283 7.28281Z" fill="#606576"/><path d="M5.81597 4.25231C5.79203 4.25911 5.7682 4.26618 5.7445 4.27353C4.46074 4.67146 3.52832 5.86825 3.52832 7.28281C3.52832 9.02251 4.93862 10.4328 6.67832 10.4328C8.41802 10.4328 9.82832 9.02251 9.82832 7.28281C9.82832 6.1859 9.26765 5.21994 8.41725 4.65588C7.91892 4.32534 7.3211 4.13281 6.67832 4.13281C6.37931 4.13281 6.09003 4.17447 5.81597 4.25231ZM9.12832 7.28281C9.12832 8.63591 8.03142 9.73281 6.67832 9.73281C5.32522 9.73281 4.22832 8.63591 4.22832 7.28281C4.22832 6.29827 4.80905 5.44937 5.64666 5.05997C5.75519 5.72514 6.33247 6.23281 7.02832 6.23281C7.58462 6.23281 8.06514 5.90835 8.29095 5.43834C8.80418 5.88742 9.12832 6.54727 9.12832 7.28281Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round"/>
1<path d="M11.2283 7.28281C11.2283 6.1859 11.789 5.21994 12.6394 4.65588C12.6741 4.63286 12.7093 4.61051 12.7449 4.58885C13.2212 4.29946 13.7803 4.13281 14.3783 4.13281C14.7035 4.13281 15.0171 4.18207 15.3121 4.27353C16.5959 4.67146 17.5283 5.86825 17.5283 7.28281C17.5283 9.02251 16.118 10.4328 14.3783 10.4328C12.6386 10.4328 11.2283 9.02251 11.2283 7.28281ZM16.8283 7.28281C16.8283 6.29827 16.2476 5.44937 15.41 5.05997C15.3015 5.72514 14.7242 6.23281 14.0283 6.23281C13.472 6.23281 12.9915 5.90835 12.7657 5.43834C12.2525 5.88742 11.9283 6.54727 11.9283 7.28281C11.9283 8.63591 13.0252 9.73281 14.3783 9.73281C15.7314 9.73281 16.8283 8.63591 16.8283 7.28281Z" stroke="#606576" stroke-width="0.3" stroke-linecap="round"/><circle cx="6.91599" cy="5.76267" r="1.52048" fill="#606576"/><circle cx="14.2512" cy="5.76267" r="1.52048" fill="#606576"/><path d="M12.7217 13.9445C12.5624 14.157 11.9304 14.9471 10.4659 14.9471C9.30465 14.9471 8.4791 14.3704 8.33472 14.1779C8.18007 13.9717 7.88754 13.9299 7.68134 14.0845C7.47514 14.2392 7.43335 14.5317 7.588 14.7379C7.91032 15.1677 9.01364 15.8574 10.4659 15.8574C12.2683 15.8574 13.1611 14.9144 13.4684 14.5046C13.6231 14.2984 13.5813 14.0058 13.3751 13.8512C13.1689 13.6965 12.8764 13.7383 12.7217 13.9445Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/></svg>',eyehorizontal:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="5.64663" cy="6.64565" r="2.65347" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.0886 14.0428C11.9254 14.2604 11.2781 15.0697 9.77805 15.0697C8.58859 15.0697 7.743 14.479 7.59511 14.2818C7.4367 14.0706 7.13707 14.0278 6.92586 14.1862C6.71465 14.3446 6.67185 14.6443 6.83025 14.8555C7.1604 15.2957 8.29051 16.0022 9.77805 16.0022C11.6242 16.0022 12.5387 15.0362 12.8535 14.6164C13.0119 14.4052 12.9691 14.1056 12.7579 13.9472C12.5467 13.7888 12.247 13.8316 12.0886 14.0428Z" fill="#606576" stroke="#606576" stroke-width="0.3" stroke-linecap="round" stroke-linejoin="round"/><circle cx="7.08865" cy="6.64334" r="1.5574" fill="#606576"/><circle cx="14.037" cy="6.64565" r="2.65347" stroke="#606576" stroke-linecap="round" stroke-linejoin="round"/><circle cx="15.4358" cy="6.64334" r="1.5574" fill="#606576"/></svg>',blurauto:'<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="none" xmlns:v="https://vecta.io/nano"><use xlink:href="assets/svg/lightx-icons.svg#01-blurauto"></use></svg>',blurmanual:'<svg width="1em" height="1em" viewBox="0 0 28 28" fill="none"><use xlink:href="assets/svg/lightx-icons.svg#01-blurmanual"></use></svg>',yellowrectangle:'<svg width="7" height="6" viewBox="0 0 7 6" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect x="0.5" width="6" height="6" rx="3" fill="#FFB21A"/> </svg> ',eyesinncorner:'<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M22.5 12.0288C22.5 12.0288 20.4161 16.8288 14.5 16.8288C8.58386 16.8288 6.5 12.0288 6.5 12.0288" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M22.5 12.0288C22.5 12.0288 20.4161 7.22879 14.5 7.22879C8.58386 7.22879 6.5 12.0288 6.5 12.0288" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="14.5" cy="12" r="2" fill="#272B34" style="fill:#272B34;fill:color(display-p3 0.1529 0.1686 0.2039);fill-opacity:1;"/><path d="M10.1631 17.1978C8.34107 17.1978 6.85471 16.7774 5.66046 16.1757C2.65555 14.6617 1.5 12 1.5 12C1.5 12 2.65555 9.33826 5.66046 7.82426C6.85471 7.22255 8.34107 6.80212 10.1631 6.80212" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="2.73 2.73"/></svg>',eyeslowerlid:'<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 10.4962C17.5 10.4962 15.4161 15.2962 9.5 15.2962C3.58386 15.2962 1.5 10.4962 1.5 10.4962" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
1<path d="M17.5 10.4962C17.5 10.4962 15.4161 5.69617 9.5 5.69617C3.58386 5.69617 1.5 10.4962 1.5 10.4962" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9.5" cy="10.4962" r="2" fill="#272B34" style="fill:#272B34;fill:color(display-p3 0.1529 0.1686 0.2039);fill-opacity:1;"/><path d="M10.6164 16.1207C11.9933 16.4925 14.3569 16.5725 15.7139 16.0945C18.5942 15.08 19.917 13.8007 19.917 13.8007" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="3 3"/></svg>',eyesoutcorner:'<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 12.0288C17.5 12.0288 15.4161 16.8288 9.5 16.8288C3.58386 16.8288 1.5 12.0288 1.5 12.0288" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M17.5 12.0288C17.5 12.0288 15.4161 7.22879 9.5 7.22879C3.58386 7.22879 1.5 12.0288 1.5 12.0288" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9.5" cy="12.0288" r="2" fill="#272B34" style="fill:#272B34;fill:color(display-p3 0.1529 0.1686 0.2039);fill-opacity:1;"/><path d="M13.8369 17.1978C15.6589 17.1978 17.1453 16.7774 18.3395 16.1757C21.3444 14.6617 22.5 12 22.5 12C22.5 12 21.3444 9.33826 18.3395 7.82426C17.1453 7.22255 15.6589 6.80212 13.8369 6.80212" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="2.73 2.73"/></svg>',eyespupil:'<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12.0002" cy="12" r="6.97778" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2"/><circle cx="12.0011" cy="12" r="3.18467" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-miterlimit="8.2289" stroke-linecap="round" stroke-dasharray="2.89 2.89 2.89 2.89"/></svg>',eyestail:'<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M17.5 13.169C17.5 13.169 15.4161 17.969 9.5 17.969C3.58386 17.969 1.5 13.169 1.5 13.169" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M17.5 13.169C17.5 13.169 15.4161 8.36902 9.5 8.36902C3.58386 8.36902 1.5 13.169 1.5 13.169" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle cx="9.5" cy="13.169" r="2" fill="#272B34" style="fill:#272B34;fill:color(display-p3 0.1529 0.1686 0.2039);fill-opacity:1;"/><path d="M13.6741 9.1604C14.3163 10.0715 16.6784 9.65153 18.5605 8.99103C20.4425 8.33052 21.4274 7.6555 22.1573 6.84126C23.034 10.3532 22.4525 16.0522 16 17.1481" stroke="#272B34" style="stroke:#272B34;stroke:color(display-p3 0.1529 0.1686 0.2039);stroke-opacity:1;" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="1.89 1.89"/></svg>'};let h=(()=>{var d;class e{set name(_){this.element.nativeElement.innerHTML=P[_]}constructor(_){this.element=_}ngOnInit(){}}return(d=e).\u0275fac=function(_){return new(_||d)(n.rXU(n.aKT))},d.\u0275cmp=n.VBU({type:d,selectors:[["pei"]],inputs:{name:"name"},ngContentSelectors:o,decls:1,vars:0,template:function(_,C){1&_&&(n.NAR(),n.SdG(0))},encapsulation:2}),e})(),a=(()=>{var d;class e{}return(d=e).\u0275fac=function(_){return new(_||d)},d.\u0275mod=n.$C({type:d}),d.\u0275inj=n.G2t({}),e})()},79829:(_e,ie,g)=>{"use strict";g.d(ie,{p:()=>y});var n=g(10467),o=g(54438),G=g(84412),P=g(21413),h=g(75270),a=g(99404),d=g(16478),e=g(51789),l=g(57110),_=g(26494),C=g(88650),S=g(75243),x=g(93552),M=g(43695),R=g(16471),I=g(3781),D=g(74983),p=g(55349),u=g(33391),m=g(74710),b=g(28567),k=g(68287),A=g(41300),B=g(65356);let y=(()=>{var w;
1class j{hide(){this.visibilitySubject.next("hide")}show(){this.visibilitySubject.next("show")}constructor(U,z,Z,$,Y,Q,K,W,X,F){this.stateService=U,this.toast=z,this.editorUiService=Z,this.modalService=$,this.route=Y,this.router=Q,this.zoomService=K,this.envService=W,this.confirmDialogService=X,this.processingProgress=F,this.isApplyed=!1,this.isResizeCropTool=!1,this.brushSizeDisable={value:!1,selectedErase:!1},this.afterConfigureFabricCanvas=new o.bkB,this.afterImageLoad=new G.t(null),this.imageUpload=new G.t(!1),this.BackArrowClick=new G.t(!1),this.OpenNewTabClick=new G.t(null),this.isDirty=!1,this.isLoaded=!1,this.initialLoad=!0,this.imgUrl="",this.bgmaskImgUrl="",this.isRemoveObj=!1,this.projectName="",this.originalProjectName="",this.inProgress=!1,this.activeTool="",this.activeSubTool="",this.isError=!1,this.isExportable=!1,this.slidersize=0,this.isImagePan=!1,this.isCompareEnable=!0,this.compareImageUrl="",this.AiToolcompareImageUrl="",this.switchValue="png",this.isDisabled=!1,this.tab="",this.maxResolutionSupported=4096,this.PreviousdownloadHight=1080,this.previousdownloadWidth=1080,this.downloadswitchValue="png",this.downloadresulationSliderValue=0,this.aiReplaceProduct=[],this.aiGenerateImgCount=0,this.isAuto=!1,this.isFreeTool=!1,this.upscaleImages=[{id:"2x",inputSrc:"",outputSrc:"",quality:2,gen:!1,width:0,height:0,isApply:!1},{id:"4x",inputSrc:"",outputSrc:"",quality:4,gen:!1,width:0,height:0,isApply:!1}],this.visibilitySubject=new P.B,this.visibility$=this.visibilitySubject.asObservable(),this.isquickEditTool=!1,this.title=""}startGenerationProgress(U={}){this.inProgress=!0;const z=!!U?.indeterminate,Z=!1!==U?.deductsCredits&&!z,$=U?.message||(Z?d.b.label.generatingImage:d.b.label.processingImage);this.processingProgress.start({...U,indeterminate:z,message:$})}startProcessingProgress(U={}){this.startGenerationProgress({...U,deductsCredits:!1,message:U?.message||d.b.label.processingImage})}completeProcessingProgress(U){if(!this.processingProgress.isActive)return this.inProgress=!1,void(U&&U());this.processingProgress.complete(()=>{this.inProgress=!1,U&&U()})}clearProcessingProgress(){this.processingProgress.clear(),this.inProgress=!1}setPhotoEditorInputImages(U){var z=this;return(0,n.A)(function*(){z.inProgress=!0;let Z=null,$=null;U?(Z=yield new Promise((Y,Q)=>{M.k.checkAndResizeImage(U,X=>{Y(X)},S.TJ,S.gT)}),$=yield new Promise((Y,Q)=>{M.k.checkAndResizeImage(U,X=>{Y(X)},S.lL,S.iB)})):(U=null,Z=null,$=null),z.photoEditorInputImages=new O(U,Z,$),z.inProgress=!1})()}getPhotoEditorInputImages(){return this.photoEditorInputImages}get theOriginalOriginalImage(){return this.photoEditorInputImages.theOriginalOriginalImage}loadImageAndReize(U){var z=this;return new Promise((Z,$)=>{this.isApplyed=!1,"blank"===U&&(this.openImage(),Z()),x.fabric.util.loadImage(U,function(){var Y=(0,n.A)(function*(Q){Q?(yield z.setPhotoEditorInputImages(Q),Z()):z.envService.isMobileView?(yield z.setPhotoEditorInputImages(null),z.router.navigate(["/photo-editing/"+z.photoEditorOptions.from]),Z()):(yield z.setPhotoEditorInputImages(null),z.openImage(),$())});return function(Q){return Y.apply(this,arguments)}}(),null,"Anonymous")})}checkAndResizeImage(U,z,Z=S.TJ,$=S.gT){M.k.checkAndResizeImage(U,z,Z,$)}loadBgImage(U,z=null){x.fabric.util.loadImage(U,Z=>{if(!Z)return this.toast.showError(d.b.message.errorOnImage),void(z&&z(null));z&&z(Z)},null,"Anonymous")}getScaleDataPerToRealTimeResolutionWidth(U){let z,Z,$=1;if(U.width>S.TJ||U.height>S.gT){let Y=this.calculateAspectRatioFit(U.width,U.height);z=Y.width,Z=Y.height,$=Math.min(z/U.width,Z/U.height)}else z=U.width,Z=U.height;return z%2!=0&&(z-=1),Z%2!=0&&(Z-=1),{width:z,height:Z,scale:$}}calculateAspectRatioFit(U,z){var Z=Math.min(S.TJ/U,S.gT/z);return{width:Math.ceil(U*Z),height:Math.ceil(z*Z)}}getBgScaleDataPerToRealTimeResolutionWidth(U){let z,Z,$=1;return U.width>x.fabric.textureSize?(Z=x.fabric.textureSize,z=Z*(U.width/U.height),z=Math.ceil(z),z>x.fabric.textureSize&&(z=x.fabric.textureSize,Z=Math.ceil(z*(U.height/U.width))),$=Math.min(z/U.width,Z/U.height)):(z=U.width,Z=U.height),{width:z,height:Z,scale:$}}
1openImage(){this.route.snapshot.queryParamMap.get("tab");let z=this.route.snapshot.queryParamMap.get("from");this.isError=!0,"user-dashboard"==z||this.toast.showError(d.b.message.uploadNewImage)}getBase64ImageFromCanvas(U){return this.stateService.mainCanvas.toDataURL({multiplier:1/U,format:"jpg"}).replace(/^data:image\/(png|jpg);base64,/,"")}convertDataUrlToBlob(U){const z=U.split(","),Z=z[0].match(/:(.*?);/)[1],$=atob(z[1]);let Y=$.length;const Q=new Uint8Array(Y);for(;Y--;)Q[Y]=$.charCodeAt(Y);return new Blob([Q],{type:Z})}isValidDataUrl(U){return/^data:(.+);base64,(.+)$/.test(U)}getImageFromCanvas(U,z,Z,$){return new Promise((Y,Q)=>{$.width=U,$.height=z;const K=$.getContext("2d"),W=this.stateService.mainCanvas.toDataURL({multiplier:1/Z,format:"png"});var X=new Image;X.onload=function(){K.drawImage(X,0,0,U,z),$.toBlob(F=>{if(!F)return void Q(new Error("Failed to create blob from canvas"));let V=URL.createObjectURL(F),le=new Image;le.addEventListener("load",()=>{setTimeout(()=>{Y({uri:V,image:le})})},!1),le.src=V},"image/png")},X.src=W})}getImageFromCanvasBlob(U,z,Z,$){return new Promise((Y,Q)=>{try{this.stateService.mainCanvas.toBlobURL({multiplier:1/Z,format:"png"}).then(K=>{const W=new Image;W.onload=()=>Y({uri:K,image:W}),W.onerror=()=>Q(new Error("Failed to load image from blob URL")),W.src=K}).catch(Q)}catch(K){Q(K)}})}getImageFromCanvasCrop(U){return new Promise((z,Z)=>{let $=U.toDataURL({format:"png"}),Y=new Image;Y.addEventListener("load",()=>{setTimeout(()=>{z({uri:$,image:Y})})},!1),Y.src=$})}getImageFromCanvas2(U,z,Z,$){return new Promise((Y,Q)=>{$.width=U,$.height=z;const K=$.getContext("2d"),W=this.stateService.mainCanvas.toDataURL({multiplier:1/Z,format:"png"});var X=new Image;X.onload=function(){K.drawImage(X,0,0,U,z),$.toBlob(F=>{Y(F)},"image/png")},X.src=W})}checkProjectName(U=!1){U&&(this.projectName=null),this.projectName||(this.projectName=d.b.label.blankProjectName,this.originalProjectName=d.b.label.blankProjectName)}openVedio(U){let z=this.route.snapshot.queryParamMap.get("tab");if(U){const Z=this.modalService.open(C.P,{centered:!0,size:"xl",backdropClass:"bg-dark-blur",windowClass:"youtubevideo"});Z.componentInstance.videoId=U,Z.componentInstance.tabName=z,Z.result.then($=>{}).catch($=>{})}else console.log("no video url found")}tempSavePhotoEditorImage(){return new Promise((U,z)=>{try{this.getBase64ImageFromCanvas(this.zoomService.currentZoom),U(d.b.photoEditorTempLocalSave)}catch{this.toast.showError(d.b.message.somethingWrong),z()}})}changeBgColor(U){this.stateService.mainCanvas.setBackgroundColor(U,()=>{this.stateService.mainCanvas.renderAll()})}addBgImage(U,z,Z){var $=this;this.inProgress=!0,this.loadBgImage(U,function(){var Y=(0,n.A)(function*(Q){let K=z,W=$.getScaleDataPerToRealTimeResolutionWidth(Q),X=W.width,F=W.height;yield $.zoomService.initWithoutClear(26,X,F);const V=new a.b(null,X,F,W.scale);V.addBgImageFromHTMLImage(Q).then(le=>{$.stateService.mainCanvas.setBackgroundColor(null,()=>{}),$.zoomService.defaultZoom=!0,$.zoomService.fitToScreen(),V.addToCanvas($.stateService.mainCanvas),$.inProgress=!1;let fe=$.scaleMask(X,F,K);z.align(4),z.align(5),Z&&Z({_scale:fe,fabricImg:le})})});return function(Q){return Y.apply(this,arguments)}}())}scaleMask(U,z,Z,$=60){let X,F,Y=U,K=Z._mediaObjects.width,W=Z._mediaObjects.height,V=1;return X=z>=$?z-$:z,F=X*(K/W),F=Math.ceil(F),F>Y&&(F=Y>=$?Y-$:Y,X=Math.ceil(F*(W/K))),V=Math.min(F/K,X/W),Z._mediaObjects.set({scaleX:V,scaleY:V}),Z._frameObject.set({scaleX:V,scaleY:V}),V}addPattern(U){let z,Z;this.inProgress=!0,this.stateService.mainCanvas.clipPath?(z=this.stateService.mainCanvas.clipPath.width,Z=this.stateService.mainCanvas.clipPath.height):(z=this.stateService.mainCanvas.width/this.stateService.mainCanvas.viewportTransform[0],Z=this.stateService.mainCanvas.height/this.stateService.mainCanvas.viewportTransform[3]);const $=new h.b(null,z,Z,0,0,null);return $.addBgImage(U.imgUrl,null).then(Y=>($.addToCanvas(this.stateService.mainCanvas),this.inProgress=!1,Y))}download(U,z,Z=0){let $=Math.floor(1e3*Math.random());this.projectName="untitled"+$,this.isDisabled=!0,z&&(this.switchValue=z),this.tab=U;const Y={format:this.switchValue,quality:1};Y.multiplier=Z,setTimeout(()=>this.render(Y),0)}render(U){this.toBlob(U,this.stateService.mainCanvas,z=>{const Z=URL.createObjectURL(z);this.downloadUrl(Z,this.projectName+"."+this.switchValue),this.isDisabled=!1})}toBlob(U,z,Z){U||(U={});var $=U.format||"png",Y=U.quality||1,Q=(U.multiplier||1)*(U.enableRetinaScaling?z.getRetinaScaling():1);z.toCanvasElement(Q,U).toBlob(Z,$,Y)}downloadUrl(U,z){const Z=document.createElement("a");Z.href=U,Z.download=z,document.body.appendChild(Z),Z.style="display: none",Z.click(),Z.remove(),this.downloadMessage()}downloadMessage(){const U=this.modalService.open(l.W,{centered:!0,size:"md",backdrop:"static"});U.componentInstance.message=d.b.message.download,U.componentInstance.tab=this.tab,U.result.then(z=>{})}startProgressBar(){this.progressBarModalRef=this.modalService.open(_.M,{centered:!0,size:"md",backdrop:"static",windowClass:"downloadprogress"}),this.progressBarModalRef.result.then(U=>{"cancel"===U&&(this.isDisabled=!1)})}showStorageLimitError(){this.modalService.open(e.I,{centered:!1,size:"sm",backdrop:!0,windowClass:"storage-limit-error",backdropClass:"transparent-backdrop"}).componentInstance.message=d.b.message.dataLimitPhotoEditor}restoreResolution(U){const z=this.inputImageRefForDownload,Z=this.maskForDownload;return new Promise(($,Y)=>{const Q=this.stateService.mainCanvas;let K,W;this.stateService.mainCanvas.clipPath?(K=this.stateService.mainCanvas.clipPath.width,W=this.stateService.mainCanvas.clipPath.height):(K=this.stateService.mainCanvas.width/this.stateService.mainCanvas.viewportTransform[0],W=this.stateService.mainCanvas.height/this.stateService.mainCanvas.viewportTransform[3]);const X=x.fabric.perfLimitSizeTotal;x.fabric.perfLimitSizeTotal=16777216;const F=z.getScaledWidth()/K;let V=Math.round(F*U);V%2||(V-=1);const Ce=this.photoEditorInputImages.resolutionMax4096,Ze=this.upScaleByResizeFilter(V,V*this.photoEditorInputImages.theOriginalOriginalImage.height/this.photoEditorInputImages.theOriginalOriginalImage.width,V/Z.width,Z),de=new x.fabric.Image(Ce);de.set({left:z.left,top:z.top,scaleX:z.getScaledWidth()/de.width,scaleY:z.getScaledHeight()/de.height,clipPath:z.clipPath,angle:z.angle,flipX:z.flipX,flipY:z.flipY}
1),z.filters.forEach(Ie=>Ie.image=Ze),de.filters=z.filters,z.filters=[],de.applyFilters(),Q.remove(z),Q.add(de),Q.renderAll(),$(()=>{x.fabric.perfLimitSizeTotal=X,de.filters.forEach(Ie=>Ie.image=Z),z.filters=de.filters,de.filters=[],z.applyFilters(),Q.remove(de),Q.add(z),Q.renderAll()})})}upScaleByResizeFilter(U,z,Z,$){const Y=x.fabric.util.createCanvasElement();Y.width=U,Y.height=z;const Q=new x.fabric.StaticCanvas(Y,{enableRetinaScaling:!1}),K=x.fabric.util.createCanvasElement();K.width=$.width,K.height=$.height,K.getContext("2d").putImageData($,0,0);const W=new x.fabric.Image(K);return W.set({left:0,top:0,scaleX:U/$.width,scaleY:z/$.height}),Q.add(W),Q.renderAll(),Q.getContext().getImageData(0,0,Y.width,Y.height)}getMaxResolution(){if("expand"===this.activeSubTool&&this.selectedExpandedImage)return this.selectedExpandedImage.width>this.selectedExpandedImage.height?this.selectedExpandedImage.width:this.selectedExpandedImage.height;if("faceExpression"==this.toolNameForDownload)return this.originalImage.width>this.originalImage.height?this.originalImage.width:this.originalImage.height;{let z,U=this.photoEditorInputImages.theOriginalOriginalImage;const $=this.inputImageRefForDownload,Y=$.width*$.scaleX,Q=$.height*$.scaleY;let K,W;this.stateService.mainCanvas.clipPath?(K=this.stateService.mainCanvas.clipPath.width,W=this.stateService.mainCanvas.clipPath.height):(K=this.stateService.mainCanvas.width/this.stateService.mainCanvas.viewportTransform[0],W=this.stateService.mainCanvas.height/this.stateService.mainCanvas.viewportTransform[3]);const X=this.stateService.mainCanvas.backgroundImage;if(X&&X instanceof x.fabric.Image){const F=X.getElement();z=K>W?F.width:F.height,K>=W?z>U.width*K/Y&&(z=U.width*K/Y):z>U.height*W/Q&&(z=U.height*W/Q)}else z=K>W?U.width*K/Y:U.height*W/Q;return z<this.maxResolutionSupported+1?Math.round(z):this.maxResolutionSupported}}resetUpscaleImage(){this.upscaleImages.forEach(U=>{U.gen=!1,U.inputSrc="",U.outputSrc="",U.isApply=!1,U.width=0,U.height=0})}loadInputImageFromTool(U,z){if(!this.photoEditorInputImages.theOriginalOriginalImage?.src)return;let Z=this.photoEditorInputImages.theOriginalOriginalImage?.src||this.imgUrl;U.editorType==R._Y.AIPhoto&&(U.openNewTab=!0,U.tab=U.tab||U.toolName,(U.tab==R.Fs.STICKER||U.tab==R.Fs.TextToImage)&&(U.isBlank=!0),this.blobImageUrlToFile(Z,"image.png").then($=>{z.aiUploadImage($,U,null).then(Y=>{})}))}isBlobUrl(U){try{return"blob:"===new URL(U).protocol}catch{return!1}}blobImageUrlToFile(U,z){return(0,n.A)(function*(){const $=yield(yield fetch(U)).blob();return new File([$],z,{type:$.type||"image/png"})})()}onDrawerClick(U,z){let Z=null;Z=z.elementFromPoint(U.clientX,U.clientY);const $=Z?.closest('isgenerate,a, button, input, select, textarea, label, [role="button"], .btn, .pointer, .ai-video-thumbs, .videoThumb, .tool-name, .new_item, .new_badge, .slider, .adjust-item, .badge-temp, .btn-acc-title, .btn-collapse, .slider-track,navs-drawer,.ng-option');let Y=null,Q=null;const K=["a","button","input","select","textarea","label",'[role="button"]',".btn",".pointer",".ai-video-thumbs",".videoThumb",".tool-name",".new_item",".new_badge","quick-edits","eraser-drawer","ai-replace-drawer","expand-drawer","upscale-drawer","ai-image-variation-drawer",".slider",".adjust-item",".badge-temp",".btn-acc-title",".btn-collapse",".slider-track"];for(const W of K){const X=Z?.closest(W);if(X){Y=W,Q=X,console.log(Y+"/"+Q.innerText);break}}return!(!$||$&&"leftarrow"==$.getAttribute("name")&&(this.BackArrowClick.next(!0),this.updateRouteParams(),1))}updateRouteParams(){this.router.navigate([],{relativeTo:this.route,queryParams:{subTool:""},queryParamsHandling:"merge"})}}return(w=j).\u0275fac=function(U){return new(U||w)(o.KVO(I.X),o.KVO(D.f),o.KVO(p.f),o.KVO(u.Bq),o.KVO(m.nX),o.KVO(m.Ix),o.KVO(b.n),o.KVO(k.L),o.KVO(A.g),o.KVO(B.M))},w.\u0275prov=o.jDH({token:w,factory:w.\u0275fac}),j})();class O{constructor(j,L,U){this.theOriginalOriginalImage=j,this.resolutionMax1080=L,this.resolutionMax4096=U}}},28068:(_e,ie,g)=>{"use strict";g.d(ie,{V:()=>G});var n=g(10467),o=g(84412);
1class G{constructor(){this.isProcessingSubject=new o.t(!1),this.isProcessing$=this.isProcessingSubject.asObservable()}get isProcessing(){return this.isProcessingSubject.value}startProcessing(){this.isProcessingSubject.next(!0)}stopProcessing(){this.isProcessingSubject.next(!1)}executeWithProtection(h){var a=this;return(0,n.A)(function*(){if(a.isProcessing)console.warn("Undo/Redo operation already in progress, skipping...");else try{return a.startProcessing(),yield h()}finally{a.stopProcessing()}})()}executeSyncWithProtection(h){if(this.isProcessing)return console.warn("Undo/Redo operation already in progress, skipping..."),null;try{return this.startProcessing(),h()}finally{this.stopProcessing()}}}},32660:(_e,ie,g)=>{"use strict";g.d(ie,{Y:()=>Q});var n=g(10467),o=g(54438),G=g(84634),P=g(60177),h=g(16478),a=g(16471),d=g(40618),e=g(68010),l=g(79829),_=g(3781),C=g(28567),S=g(45975),x=g(6755),E=g(74710),M=g(94223),R=g(68287),I=g(80006),D=g(1408),p=g(34183),u=g(41300),m=g(630),b=g(72662);const k=["eraserdrawer"];function A(K,W){1&K&&(o.qex(0),o.j41(1,"div",55)(2,"span",31),o.EFF(3,"Create with AI "),o.k0s(),o.nrm(4,"pi",56),o.k0s(),o.bVm())}function B(K,W){1&K&&o.nrm(0,"div",12)}function y(K,W){if(1&K){const X=o.RV6();o.j41(0,"a",10),o.bIt("click",function(){const V=o.eBV(X).$implicit,le=o.XpG(3);return o.Njj(le.selectEcommerceTool(V))}),o.j41(1,"div",11),o.bIt("mouseenter",function(){const V=o.eBV(X).$implicit,le=o.XpG(3);return o.Njj(le.toggleVideo("ecom-video"+V.id))})("mouseleave",function(){const V=o.eBV(X).$implicit,le=o.XpG(3);return o.Njj(le.toggleVideo("ecom-video"+V.id))}),o.DNE(2,B,1,0,"div",57),o.j41(3,"div",13)(4,"video",58),o.nrm(5,"source",59),o.EFF(6," Your browser does not support the video tag. "),o.k0s()(),o.j41(7,"div",16),o.EFF(8),o.k0s()()()}if(2&K){const X=W.$implicit,F=o.XpG(3);o.R7$(2),o.Y8G("ngIf",1==X.isNew),o.R7$(2),o.AVh("playing",F.videoPlaying),o.FS9("id","ecom-video"+X.id),o.R7$(),o.FS9("src",X.squareVideoUrl,o.B4B),o.R7$(3),o.JRh(X.featureName)}}function O(K,W){if(1&K){const X=o.RV6();o.qex(0),o.DNE(1,A,5,0,"ng-container",7),o.j41(2,"div",8)(3,"div",9)(4,"a",10),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.selectUpscale())}),o.j41(5,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video12"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video12"))}),o.nrm(6,"div",12),o.j41(7,"div",13)(8,"video",14),o.nrm(9,"source",15),o.EFF(10," Your browser does not support the video tag. "),o.k0s()(),o.j41(11,"div",16),o.EFF(12,"AI Upscale"),o.k0s()()(),o.j41(13,"a",17),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.openExpandEditor())}),o.j41(14,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video11"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video11"))}),o.nrm(15,"div",12),o.j41(16,"div",13)(17,"video",18),o.nrm(18,"source",19),o.EFF(19," Your browser does not support the video tag. "),o.k0s()(),o.j41(20,"div",16),o.EFF(21,"AI Expand"),o.k0s()()(),o.j41(22,"a",10),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.selectReplace())}),o.j41(23,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video"))}),o.j41(24,"div",13)(25,"video",21),o.nrm(26,"source",22),o.EFF(27," Your browser does not support the video tag. "),o.k0s()(),o.j41(28,"div",16),o.EFF(29,"AI Replace"),o.k0s()()(),o.j41(30,"a",10),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);
1return o.Njj(V.selectErase())}),o.j41(31,"div",23),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video1"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video1"))}),o.j41(32,"div",13)(33,"video",24),o.nrm(34,"source",25),o.EFF(35," Your browser does not support the video tag. "),o.k0s()(),o.j41(36,"div",16),o.EFF(37,"AI Cleanup"),o.k0s()()(),o.j41(38,"a",10),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.selectChangeCameraAngle())}),o.j41(39,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video14"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video14"))}),o.nrm(40,"div",12),o.j41(41,"div",13)(42,"video",26),o.nrm(43,"source",27),o.EFF(44," Your browser does not support the video tag. "),o.k0s()(),o.j41(45,"div",16),o.EFF(46,"Change Camera"),o.k0s()()(),o.j41(47,"a",10),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.selectChangeLighting())}),o.j41(48,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video16"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video16"))}),o.nrm(49,"div",12),o.j41(50,"div",13)(51,"video",28),o.nrm(52,"source",29),o.EFF(53," Your browser does not support the video tag. "),o.k0s()(),o.j41(54,"div",16),o.EFF(55,"Change Lighting"),o.k0s()()()()(),o.j41(56,"div",8)(57,"div",30)(58,"span",31),o.EFF(59,"E-Commerce "),o.k0s()(),o.j41(60,"div",9),o.DNE(61,y,9,6,"a",32),o.k0s()(),o.j41(62,"div",33)(63,"quick-edits",34),o.bIt("updateImageEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.updateImageEvent(V))})("openCloseEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.openCloseEvent(V))}),o.k0s()(),o.j41(64,"div",35)(65,"div",30)(66,"span",31),o.EFF(67,"Other AI Tools "),o.k0s()(),o.j41(68,"div",9)(69,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiImageGeneratorUrl))}),o.j41(70,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video7"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video7"))}),o.nrm(71,"div",12),o.j41(72,"div",13)(73,"video",37),o.nrm(74,"source",38),o.EFF(75," Your browser does not support the video tag. "),o.k0s()(),o.j41(76,"div",16),o.EFF(77,"AI Image Generator"),o.k0s()()(),o.j41(78,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiDesignGeneratorUrl,"ai-design"))}),o.j41(79,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video13"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video13"))}),o.j41(80,"div",13)(81,"video",39),o.nrm(82,"source",40),o.EFF(83," Your browser does not support the video tag. "),o.k0s()(),o.j41(84,"div",16),o.EFF(85,"AI Design"),o.k0s()()(),o.j41(86,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiVideoGeneratorStoryUrl))}),o.j41(87,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video10"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video10"))}),o.j41(88,"div",13)(89,"video",41),o.nrm(90,"source",42),o.EFF(91," Your browser does not support the video tag. "),o.k0s()(),o.j41(92,"div",16),o.EFF(93,"AI Video Generator"),o.k0s()()(),o.j41(94,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiFilterStoryUrl))}),o.j41(95,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video2"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video2"))}),o.j41(96,"div",13)(97,"video",43),o.nrm(98,"source",44),o.EFF(99," Your browser does not support the video tag. "),o.k0s()(),o.j41(100,"div",16),o.EFF(101,"AI Filter"),o.k0s()()(),o.j41(102,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiPhotoShootStoryUrl))}),o.j41(103,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video3"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video3"))}),o.j41(104,"div",13)(105,"video",45),o.nrm(106,"source",46),o.EFF(107," Your browser does not support the video tag. "),o.k0s()(),o.j41(108,"div",16),o.EFF(109,"AI Product Photoshoot"),o.k0s()()(),o.j41(110,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiPortraitStoryUrl))}),o.j41(111,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video4"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video4"))}),o.j41(112,"div",13)(113,"video",47),o.nrm(114,"source",48),o.EFF(115," Your browser does not support the video tag. "),o.k0s()(),o.j41(116,"div",16),o.EFF(117,"AI Portrait"),o.k0s()()(),o.j41(118,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiAvatarStoryUrl))}),o.j41(119,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video5"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video5"))}),o.j41(120,"div",13)(121,"video",49),o.nrm(122,"source",50),o.EFF(123," Your browser does not support the video tag. "),o.k0s()(),o.j41(124,"div",16),o.EFF(125,"AI Avatar"),o.k0s()()(),o.j41(126,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiPersonPhotoshootUrl))}),o.j41(127,"div",20),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video6"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video6"))}),o.j41(128,"div",13)(129,"video",51),o.nrm(130,"source",52),o.EFF(131," Your browser does not support the video tag. "),o.k0s()(),o.j41(132,"div",16),o.EFF(133,"AI Person Photoshoot"),o.k0s()()(),o.j41(134,"a",36),o.bIt("click",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.getStoryPage(V.aiStickerUrl))}),o.j41(135,"div",11),o.bIt("mouseenter",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video8"))})("mouseleave",function(){o.eBV(X);const V=o.XpG(2);return o.Njj(V.toggleVideo("video8"))}),o.j41(136,"div",13)(137,"video",53),o.nrm(138,"source",54),o.EFF(139," Your browser does not support the video tag. "),o.k0s()(),o.j41(140,"div",16),o.EFF(141,"AI Sticker"),o.k0s()()()()(),o.bVm()}if(2&K){const X=o.XpG(2);o.R7$(),o.Y8G("ngIf",!X.isQuickEditOpen),o.R7$(),o.Y8G("hidden",X.isQuickEditOpen),o.R7$(6),o.AVh("playing",X.videoPlaying),o.R7$(9),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(9),o.AVh("playing",X.videoPlaying),o.R7$(9),o.AVh("playing",X.videoPlaying),o.R7$(5),o.Y8G("hidden",X.isQuickEditOpen),o.R7$(5),o.Y8G("ngForOf",X.ecommerceTools),o.R7$(2),o.Y8G("imgUrl",X.imgUrl)("inProgress",X.photoEditorService.inProgress)("step",X.quickeditStep),o.R7$(),o.Y8G("hidden",X.isQuickEditOpen),o.R7$(9),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying),o.R7$(8),o.AVh("playing",X.videoPlaying)}}function w(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"eraser-drawer",60,0),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}}function j(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"ai-replace-drawer",60,0),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}}function L(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"expand-drawer",60,0),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}}function U(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"upscale-drawer",60,1),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}}function z(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"ai-image-variation-drawer",61),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}if(2&K){const X=o.XpG(2);o.R7$(),o.Y8G("drawerTitle","Change Camera Angle")("featureType","changecameraangle")("activeSubTool","changecameraangle")("categoryId",X.cameraAngleWorkflowCategoryId)}}function Z(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"ai-image-variation-drawer",61),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}if(2&K){const X=o.XpG(2);o.R7$(),o.Y8G("drawerTitle","Change Lighting")("featureType","changelighting")("activeSubTool","changelighting")("categoryId",X.changeLightingWorkflowCategoryId)}}function $(K,W){if(1&K){const X=o.RV6();o.qex(0),o.j41(1,"ecommerce-ai-tools",62),o.bIt("restAndApplyEvent",function(V){o.eBV(X);const le=o.XpG(2);return o.Njj(le.reset(V))}),o.k0s(),o.bVm()}if(2&K){const X=o.XpG(2);o.R7$(),o.Y8G("selectedTool",X.selectedEcommerceTool)}}function Y(K,W){if(1&K&&(o.j41(0,"div",3)(1,"div",4)(2,"div",5)(3,"div",6),o.DNE(4,O,142,38,"ng-container",7)(5,w,3,0,"ng-container",7)(6,j,3,0,"ng-container",7)(7,L,3,0,"ng-container",7)(8,U,3,0,"ng-container",7)(9,z,2,4,"ng-container",7)(10,Z,2,4,"ng-container",7)(11,$,2,1,"ng-container",7),o.k0s()()()()),2&K){const X=o.XpG();o.R7$(4),o.Y8G("ngIf",0==X.step),o.R7$(),o.Y8G("ngIf",1==X.step),o.R7$(),o.Y8G("ngIf",2==X.step),o.R7$(),o.Y8G("ngIf",3==X.step),o.R7$(),o.Y8G("ngIf",4==X.step),o.R7$(),o.Y8G("ngIf",5==X.step),o.R7$(),o.Y8G("ngIf",6==X.step),o.R7$(),o.Y8G("ngIf",7==X.step)}}let Q=(()=>{var K;class W extends G.O{constructor(F,V,le,fe,Ce,Ne,Ze,de,Ie,ue,ge,be,ye,Ve,ot,ct,pe,rt){var he;super(le,fe,Ce,Ne,Ie,"ai-tools"),he=this,this.authService=F,this.injector=V,this.photoEditorService=le,this.stateService=fe,this.zoomService=Ce,this.uploadService=Ne,this.uploadImageService=Ze,this.document=de,this.route=Ie,this.router=ue,this.aiphotoServies=ge,this.envService=be,this.aiUploadImageService=ye,this.editorService=Ve,this.storyPageService=ot,this.dialogService=ct,this.createPopupService=pe,this.ecommerceAiToolsService=rt,this.onDrawerClickEvent=new o.bkB,this.step=0,this.aiAvatarStoryUrl=h.b.slug.aiAvatarGenerator,this.aiPortraitStoryUrl=h.b.slug.aiPortraitGenerator,this.aiEraserStoryUrl=h.b.slug.aiEraserGenerator,this.aiPhotoShootStoryUrl=h.b.slug.aiPhotoshootGenerator,this.aiFilterStoryUrl=h.b.slug.aiFilterGenerator,this.aiPersonPhotoshootUrl=h.b.slug.aiPersonPhotoShootGenerator,this.aiImageGeneratorUrl=h.b.slug.aiImageGenerator,this.aiDesignGeneratorUrl=h.b.slug.aiDesignGenerator,this.aiStickerUrl=h.b.slug.aiStickerGenerator,this.aiVideoGeneratorStoryUrl=h.b.slug.aiVideoGenerator,this.aiExpandStoryUrl="/"+h.b.photoEditor.urlPart+h.b.slug.aiExpander,this.videoPlaying=!1,this.imgQueryParams={imageUrl:"",tabName:"",from:"",editorType:""},this.subTool="",this.isQuickEditOpen=!1,this.ecommerceTools=[],this.isExportable=!1,this.cameraAngleWorkflowCategoryId=351,this.changeLightingWorkflowCategoryId=350,this.showQuickEdit=!0,this.firstImageLoaded=!1,this.quickeditStep=1,this.user=this.authService.currentUser(),this.ecommerceTools=this.ecommerceAiToolsService.getTools(),this.backBtnClick=this.photoEditorService.BackArrowClick.subscribe(ze=>{ze&&(0==this.step?(this.quickEditsComponent.step=1,this.quickEditsComponent.backDrawer(!1)):(this.quickeditStep=1,this.isQuickEditOpen=!this.isQuickEditOpen&&this.isQuickEditOpen,this.reset(0)))}),this.OpenNewTabClick=this.photoEditorService.OpenNewTabClick.subscribe(ze=>
1{ze&&ze.slug&&("AI Image Generator"==ze.slug?this.getStoryPage(this.aiImageGeneratorUrl):"AI Design"==ze.slug?this.getStoryPage(this.aiDesignGeneratorUrl,"ai-design"):"AI Video Generator"==ze.slug?this.getStoryPage(this.aiVideoGeneratorStoryUrl):"AI Filter"==ze.slug?this.getStoryPage(this.aiFilterStoryUrl):"AI Product Photoshoot"==ze.slug?this.getStoryPage(this.aiPhotoShootStoryUrl):"AI Portrait"==ze.slug?this.getStoryPage(this.aiPortraitStoryUrl):"AI Avatar"==ze.slug?this.getStoryPage(this.aiAvatarStoryUrl):"AI Person Photoshoot"==ze.slug?this.getStoryPage(this.aiPersonPhotoshootUrl):"AI Sticker"==ze.slug&&this.getStoryPage(this.aiStickerUrl))}),this.activeToolPanelSubscription=this.editorService.activeToolPanel.subscribe(function(){var ze=(0,n.A)(function*(Fe){he.subTool="";const we=!!Fe?.subTool&&(yield he.validateQuickEdit(Fe.subTool)),qe=he.photoEditorService?.photoEditorOptions?.subTool,et=!!qe&&(yield he.validateQuickEdit(qe));he.photoEditorService.photoEditorOptions&&1!=he.step&&"eraser"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.step=1,he.photoEditorService.selectedUpscaleItem=null,he.photoEditorService.selectedExpandedImage=null,he.photoEditorService.aiReplaceGenUrl=null):he.photoEditorService.photoEditorOptions&&2!=he.step&&"replace"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.photoEditorService.selectedUpscaleItem=null,he.photoEditorService.selectedExpandedImage=null,he.step=2):he.photoEditorService.photoEditorOptions&&3!=he.step&&"expand"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.photoEditorService.selectedUpscaleItem=null,he.photoEditorService.aiReplaceGenUrl=null,he.step=3):he.photoEditorService.photoEditorOptions&&4!=he.step&&"upscale"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.photoEditorService.aiReplaceGenUrl=null,he.photoEditorService.selectedExpandedImage=null,he.step=4):he.photoEditorService.photoEditorOptions&&5!=he.step&&"changecameraangle"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.photoEditorService.aiReplaceGenUrl=null,he.photoEditorService.selectedExpandedImage=null,he.photoEditorService.selectedUpscaleItem=null,he.step=5):he.photoEditorService.photoEditorOptions&&6!=he.step&&"changelighting"==Fe.subTool?(he.photoEditorService.photoEditorOptions.subTool=Fe.subTool,he.photoEditorService.aiReplaceGenUrl=null,he.photoEditorService.selectedExpandedImage=null,he.photoEditorService.selectedUpscaleItem=null,he.step=6):he.photoEditorService.photoEditorOptions&&7!=he.step&&he.getEcommerceTool(Fe.subTool)?he.selectEcommerceTool(he.getEcommerceTool(Fe.subTool)):he.photoEditorService.photoEditorOptions&&Fe?.subTool&&we?(he.step=0,he.isQuickEditOpen=!0,he.photoEditorService.photoEditorOptions.subTool=Fe?.subTool,he.photoEditorService.isExportable=!0,he.updateRouteParams(),setTimeout((0,n.A)(function*(){he.aiphotoServies.quickEditReset=!0,he.aiphotoServies.imageUpload.next(!0)}),200)):Fe?.panel==a.Fs.AIQuickEdit&&!et&&(he.isQuickEditOpen=!1,Fe?.subTool?he.photoEditorService.photoEditorOptions.subTool=Fe.subTool:"nav"===Fe?.from&&(he.photoEditorService.photoEditorOptions.subTool=""),he.photoEditorService.isExportable=!0,he.updateRouteParams(),setTimeout((0,n.A)(function*(){he.aiphotoServies.quickEditReset=!0,he.aiphotoServies.imageUpload.next(!0)}),200))});return function(Fe){return ze.apply(this,arguments)}}()),!this.photoEditorService.photoEditorOptions||"eraser"!=this.photoEditorService.photoEditorOptions.subTool&&"aieraser"!=this.photoEditorService.photoEditorOptions.subTool?this.photoEditorService.photoEditorOptions&&"replace"==this.photoEditorService.photoEditorOptions.subTool?this.step=2:this.photoEditorService.photoEditorOptions&&"expand"==this.photoEditorService.photoEditorOptions.subTool?this.step=3:this.photoEditorService.photoEditorOptions&&"upscale"==this.photoEditorService.photoEditorOptions.subTool?this.step=4:this.photoEditorService.photoEditorOptions&&"changecameraangle"==this.photoEditorService.photoEditorOptions.subTool?this.step=5:this.photoEditorService.ph
1otoEditorOptions&&"changelighting"==this.photoEditorService.photoEditorOptions.subTool?this.step=6:this.photoEditorService.photoEditorOptions&&this.getEcommerceTool(this.photoEditorService.photoEditorOptions.subTool)?this.selectEcommerceTool(this.getEcommerceTool(this.photoEditorService.photoEditorOptions.subTool)):this.photoEditorService.photoEditorOptions&&this.photoEditorService.photoEditorOptions.tab==a.Fs.AIQuickEdit&&this.photoEditorService.photoEditorOptions.subTool!=a.do.QuickEdit?(this.isQuickEditOpen=!1,this.quickeditStep=1):this.photoEditorService.photoEditorOptions&&this.photoEditorService.photoEditorOptions.tab==a.Fs.AIQuickEdit&&this.photoEditorService.photoEditorOptions.subTool==a.do.QuickEdit&&setTimeout(()=>{this.photoEditorService.isExportable=!0},200):this.step=1,this.videoPlaying=!1,this.uploadImageServiceAfterImageLoadSub1=this.photoEditorService.imageUpload.subscribe(ze=>{ze||this.imgUrl||(this.isQuickEditOpen=!this.isQuickEditOpen&&this.isQuickEditOpen,this.photoEditorService.isExportable=!1,this.aiphotoServies.imageUpload.next(ze))}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(ze=>{ze&&(this.photoEditorService.isDirty=!1,setTimeout((0,n.A)(function*(){if(!he.photoEditorService.photoEditorOptions||"eraser"!=he.photoEditorService.photoEditorOptions.subTool&&"aieraser"!=he.photoEditorService.photoEditorOptions.subTool?he.photoEditorService.photoEditorOptions&&"replace"==he.photoEditorService.photoEditorOptions.subTool?he.step=2:he.photoEditorService.photoEditorOptions&&"expand"==he.photoEditorService.photoEditorOptions.subTool?he.step=3:he.photoEditorService.photoEditorOptions&&"upscale"==he.photoEditorService.photoEditorOptions.subTool?he.step=4:he.photoEditorService.photoEditorOptions&&"changecameraangle"==he.photoEditorService.photoEditorOptions.subTool?he.step=5:he.photoEditorService.photoEditorOptions&&"changelighting"==he.photoEditorService.photoEditorOptions.subTool?he.step=6:he.photoEditorService.photoEditorOptions&&he.getEcommerceTool(he.photoEditorService.photoEditorOptions.subTool)?he.selectEcommerceTool(he.getEcommerceTool(he.photoEditorService.photoEditorOptions.subTool)):((yield he.validateQuickEdit(le.photoEditorOptions.subTool))&&(he.photoEditorService.isExportable=!0),he.imgUrl="",he.init(),setTimeout(()=>{he.photoEditorService.inProgress=!0,he.firstImageLoaded=!1,he.aiphotoServies.imageUpload.next(!0),he.loadAiImage(!0)},200)):he.step=1,he.videoPlaying=!1,he.photoEditorService.resetUpscaleImage(),"load_image"==ze){const Fe=!!he.getEcommerceTool(he.photoEditorService.photoEditorOptions?.subTool);he.resetItem(!Fe)}}),500))})}ngAfterViewInit(){this.document.querySelector(".drawer-content")}handleOverlayClickCapture(F){if(!this.photoEditorService.isError&&this.photoEditorService.originalImage)return;if(this.document.elementFromPoint(F.clientX,F.clientY)?.closest("quick-edits")){const Ce=this.photoEditorService.onDrawerClick(F,this.document);return F.preventDefault(),F.stopImmediatePropagation(),void(Ce&&this.onDrawerClickEvent.emit(F))}const fe=this.photoEditorService.onDrawerClick(F,this.document);F.preventDefault(),F.stopImmediatePropagation(),fe&&this.onDrawerClickEvent.emit(F)}resetItem(F=!0){this.photoEditorService.isFreeTool=!1,this.photoEditorService.downloadImgUrl="",this.photoEditorService.selectedUpscaleItem=null,this.photoEditorService.aiGenerateImgCount=null,this.photoEditorService.selectedExpandedImage=null,F&&(this.photoEditorService.isExportable=!1),this.photoEditorService.AiToolcompareImageUrl=""}ngOnDestroy(){this.resetItem(),this.photoEditorService.photoEditorOptions.subTool="",this.isQuickEditOpen&&(this.isQuickEditOpen=!1),this.OpenNewTabClick&&this.OpenNewTabClick.unsubscribe(),this.photoEditorService.AiToolcompareImageUrl="",this.uploadImageServiceAfterImageLoadSub&&this.uploadImageServiceAfterImageLoadSub.unsubscribe(),this.uploadImageServiceAfterImageLoadSub1&&this.uploadImageServiceAfterImageLoadSub1.unsubscribe(),this.backBtnClick&&this.backBtnClick.unsubscribe(),this.photoEditorService.generateImageFn(null)}getStoryPage(F,V=null){V||(V=h.b.photoEditor.type),this.slug=F,this.storyPageService.getStoryPageContent(V,h.b.pageType,this.slug,le=>{if(this.storyPage=le.body.storyPage,this.storyPage){let fe=Object.assign({},this.storyPage.sections[0].metadata,this.storyPage.metadata);if(fe?.queryString){const Ce=this.aiUploadImageService.getParams(fe?.queryString);fe=Object.assign({},fe,Ce)}fe.editorType=a._Y.AIPhoto,fe.tab=fe.tab?fe.tab:fe.toolName,"aidesign"===fe.tab||"text2image"===fe.tab||"text2video"===fe.tab||"sticker"===fe.tab?(fe.openNewTab=!0,this.aiUploadImageService.loadInputTextToAiEditor(fe)):this.photoEditorService.originalImage?this.photoEditorService.loadInputImageFromTool(fe,this.aiUploadImageService):(fe.openNewTab=!0,this.aiUploadImageService.loadInputTextToAiEditor(fe))}},le=>{})}loadImageFromUrl(F){return new Promise((V,le)=>{const fe=new Image;fe.crossOrigin="anonymous",fe.onload=()=>V(fe),fe.onerror=Ce=>le(Ce),fe.src=F})}loadAiImage(){var F=this;return(0,n.A)(function*(V=!1){if(!F.firstImageLoaded){let le=F.photoEditorService.originalImage;if(V&&(le=F.photoEditorService.compareImageUrl),"string"==typeof le&&le)try{le=yield F.loadImageFromUrl(String(le))}catch{return F.photoEditorService.inProgress=!1,void(F.photoEditorService.isExportable=!1)}le?F.aiUploadImageService.aierUploadImage(le).then(Ce=>
1{F.imgUrl=String(Ce),F.firstImageLoaded=!0,String(Ce),F.photoEditorService.inProgress=!1,F.zoomService.fitToScreen()}).catch(Ce=>{F.photoEditorService.inProgress=!1,F.displayErrorMsg(Ce)}):F.photoEditorService.inProgress=!1}}).apply(this,arguments)}updateImageEvent(F){if(F?.hasOwnProperty("inProgress"))this.photoEditorService.inProgress=F?.inProgress,this.photoEditorService.isDirty=!1;else{const V=()=>{const le=JSON.parse(JSON.stringify(this.photoEditorService.compareImageUrl));this.photoEditorService.AiToolcompareImageUrl=le,this.photoEditorService.imgUrl=String(F),this.photoEditorService.downloadImgUrl=String(F),this.photoEditorService.inProgress=!1,this.photoEditorService.isExportable=!0,this.photoEditorService.isCompareEnable=!0,this.photoEditorService.activeSubTool=this.photoEditorService.photoEditorOptions.subTool,this.photoEditorService.photoEditorOptions.tab="aitools",this.photoEditorService.isFreeTool=!0,this.validateQuickEdit(this.photoEditorService.activeSubTool).then(fe=>{this.photoEditorService.isquickEditTool=fe,this.init()})};this.photoEditorService.processingProgress.isActive?this.photoEditorService.completeProcessingProgress(V):V()}}updateRouteParams(F=!1){this.router.navigate([],F?{relativeTo:this.route,queryParams:{img:this.imgUrl,subTool:this.photoEditorService.photoEditorOptions.subTool},replaceUrl:!0,queryParamsHandling:"merge"}:{relativeTo:this.route,queryParams:{tab:this.photoEditorService.photoEditorOptions.tab,subTool:this.photoEditorService.photoEditorOptions.subTool},replaceUrl:!0,queryParamsHandling:"merge"})}displayErrorMsg(F=null){this.photoEditorService.inProgress=!1;let V=F?.description;this.createPopupService.openWarningDialog("Error",V)}ngOnInit(){this.photoEditorService.isCompareEnable=!1,this.isExportable=this.photoEditorService.isExportable,this.photoEditorService.originalImage?(this.imgUrl=this.photoEditorService.imgUrl,this.compareImageUrl=JSON.parse(JSON.stringify(this.imgUrl)),this.photoEditorService.inProgress=!0,this.stateService.mainCanvas.clear(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.photoEditorService.originalImage&&!this.photoEditorService.isDirty?this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1}):0===this.step?this.init():3===this.step&&(this.editorService.setOnChange({name:"photoEditorType",value:"EXPAND"}),this.init())):this.photoEditorService.originalImage&&!this.photoEditorService.isDirty?this.reloadImage(()=>{this.photoEditorService.isDirty=!1,this.photoEditorService.inProgress=!1}):0===this.step?this.init():3===this.step&&(this.editorService.setOnChange({name:"photoEditorType",value:"EXPAND"}),this.init()),this.photoEditorService.isApplyed||(this.photoEditorService.inProgress=!0),this.photoEditorService.originalImage?this.loadAiImage():this.loadAiImage(!0)}isUndoable(){let F,V=!1;return this.cutoutTool&&(F=this.cutoutTool.first,F&&F.isUndoable()&&(V=!0)),V}isRedoable(){let F,V=!1;return this.cutoutTool&&(F=this.cutoutTool.first,F&&F.isRedoable()&&(V=!0)),V}undoClicked(){this.cutoutTool.first.undoClicked()}redoClicked(){this.cutoutTool.first.redoClicked()}applyChanges(F,V=null){this.brushSliderValue=50,this.photoEditorService.aiReplaceProduct=[],this.photoEditorService.isApplyed=!0;let le=F.image;if(this.photoEditorService.originalImage=le,this.loadImageAfterApply(F.uri),V){const fe=this.document.createElement("canvas");this.zoomService.fitToScreen(),this._saveImage(fe,le,F.uri,V)}this.ngOnInit()}loadImageAfterApply(F){this.photoEditorService.isDirty=!1,this.photoEditorService.isCompareEnable=!1,this.unconfigureFabricCanvas(),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen(),this.photoEditorService.imgUrl=F}apply(){var F=this;return(0,n.A)(function*(){const V=F.photoEditorService.originalImage;yield F.photoEditorService.setPhotoEditorInputImages(V),F.user?(F.checkStorage(V.src,(le,fe)=>{F.applyChanges({uri:V.src,image:V},le&&fe?fe:null)}),F.photoEditorService.isDirty=!0):F.applyChanges({uri:V.src,image:V},null)})()}afterImageLoad(F){}resetReplace(){this.step=2}reset(F){this.step=F||0,0===this.step&&(this.selectedEcommerceTool=null,this.reloadImage(()=>{},!1),this.imgUrl||this.photoEditorService.originalImage&&this.loadAiImage())}toggleVideo(F){this.videoPlaying=!this.videoPlaying;const V=document.getElementById(F);this.videoPlaying?V.play():(V.pause(),setTimeout(()=>{V.currentTime=0},200))}openExpandEditor(){this.photoEditorService.activeSubTool=h.b.tool.aiExpand,this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.title="AI Expand",this.step=3}configureCanvas(F="expand"){}selectErase(){this.step=1,this.photoEditorService.activeSubTool=h.b.tool.aiEraser,this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.ph
1otoEditorOptions.subTool=h.b.tool.aiEraser,this.photoEditorService.title="AI Cleanup"}selectUpscale(){this.step=4,this.photoEditorService.activeSubTool=a.Fs.Upscale,this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.photoEditorOptions.subTool=a.Fs.Upscale,this.photoEditorService.title="AI Upscale"}selectReplace(){this.step=2,this.photoEditorService.activeSubTool=h.b.tool.aiReplace,this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.photoEditorOptions.subTool="replace",this.photoEditorService.title="AI Replace"}selectChangeCameraAngle(){this.step=5,this.photoEditorService.activeSubTool="changecameraangle",this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.photoEditorOptions.subTool="changecameraangle",this.photoEditorService.title="Change Camera Angle"}selectChangeLighting(){this.step=6,this.photoEditorService.activeSubTool="changelighting",this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.photoEditorOptions.subTool="changelighting",this.photoEditorService.title="Change Lighting"}getEcommerceTool(F){return F?this.ecommerceTools.find(V=>V.featureType===F):null}selectEcommerceTool(F){F&&(this.selectedEcommerceTool=F,this.step=7,this.photoEditorService.activeSubTool=F.featureType,this.photoEditorService.activeTool=a.Fs.AIQuickEdit,this.photoEditorService.photoEditorOptions.subTool=F.featureType,this.photoEditorService.title=F.featureName)}openCloseEvent(F){this.onListToolEvent(F,"quickedit")}onListToolEvent(F,V="quickedit"){F?.subTool&&""!=F?.subTool&&(this.photoEditorService.photoEditorOptions.subTool=F.subTool,this.photoEditorService.title=F.title,setTimeout(()=>{this.photoEditorService.isExportable=!0},200),this.photoEditorService.photoEditorOptions.tab=a.Fs.AIQuickEdit,this.updateRouteParams());const le=!!F?.isQuickEditOpen;if(this.isQuickEditOpen=le,le&&!this.imgUrl&&!F?.isImg)return this.isQuickEditOpen=!1,this.aiphotoServies.imageUpload.next(!1),this.photoEditorService.inProgress=!0,void this.init();!this.isExportable&&this.isQuickEditOpen?this.photoEditorService.isExportable=!0:F?.isCancel&&!this.photoEditorService.isApplyed||F?.isback&&F?.isReset?this.resetListToolSession():F?.isback&&!F?.isReset?(this.photoEditorService.photoEditorOptions.subTool=a.do.QuickEdit,this.photoEditorService.photoEditorOptions.tab=a.Fs.AIQuickEdit,this.updateRouteParams()):F?.isApply?(this.photoEditorService.activeSubTool=this.photoEditorService.photoEditorOptions.subTool,this.photoEditorService.activeTool=this.photoEditorService.photoEditorOptions.tab,this.photoEditorService.isDirty=!0,this.photoEditorService.isApplyed=!0,this.imgUrl=this.photoEditorService.imgUrl,this.apply(),setTimeout(()=>{this.photoEditorService.photoEditorOptions.subTool=a.do.QuickEdit,this.photoEditorService.AiToolcompareImageUrl="",this.photoEditorService.isCompareEnable=!1,this.updateRouteParams(!0)},400)):this.isQuickEditOpen&&F?.isImg&&(this.photoEditorService.inProgress=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1)}resetListToolSession(){this.photoEditorService.inProgress=!1,this.photoEditorService.isExportable=!1,this.photoEditorService.isCompareEnable=!1,this.photoEditorService.photoEditorOptions.subTool=a.do.QuickEdit,this.photoEditorService.photoEditorOptions.tab=a.Fs.AIQuickEdit,this.photoEditorService.isquickEditTool=!1,this.updateRouteParams(),this.init()}validateQuickEdit(F){var V=this;return(0,n.A)(function*(){return!!F&&(V.aiphotoServies.quickEditTools.length>0||(yield new Promise(le=>{V.aiphotoServies.getQuickToolLists();const fe=()=>{V.aiphotoServies.quickEditTools.length>0?le():setTimeout(fe,50)};fe()})),V.aiphotoServies.quickEditTools.some(le=>le.featureType===F))})()}onDrawerClick(F){}handleOverlayClick(F){(this.photoEditorService.isError||!this.photoEditorService.originalImage)&&(F.preventDefault(),F.stopPropagation(),this.onDrawerClick(F))}}return(K=W).\u0275fac=function(F){return new(F||K)(o.rXU(e.u),o.rXU(o.zZn),o.rXU(l.p),o.rXU(_.X),o.rXU(C.n),o.rXU(S.B),o.rXU(x.A),o.rXU(P.qQ),o.rXU(E.nX),o.rXU(E.Ix),o.rXU(M.s),o.rXU(R.L),o.rXU(I.M),o.rXU(D.x),o.rXU(p.K),o.rXU(u.g),o.rXU(m.A),o.rXU(b.P))},K.\u0275cmp=o.VBU({type:K,selectors:[["ai-tools-drawer"]],viewQuery:function(F,V){if(1&F&&(o.GBs(d.s,5),o.GBs(k,5)),2&F){let le;o.mGM(le=o.lsd())&&(V.quickEditsComponent=le.first),o.mGM(le=o.lsd())&&(V.cutoutTool=le)}},inputs:{imgUrl:"imgUrl"},outputs:{onDrawerClickEvent:"onDrawerClickEvent"},features:[o.Vt3],decls:1,vars:1,consts:[["eraserdrawer",""],["upscaledrawer",""],["class","drawer-content",4,"ngIf"],[1,"drawer-content"],[1,"scroll-content","aiToolsList"],["customScrollDir","",1,"scroll-container","position-relative"],[1,"h-100",2,"position","relative"],[4,"ngIf"],[1,"common-container","m-0","p-0",3,"hidden"],[1,"ai-video-list","d-flex","align-items-start","justify-content-between"],[3,"click"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-3","position-relative",3,"mouseenter","mouseleave"],[1,"new_item"],[1,"videoThumb"],["id","video12","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-v
1ideos/Ai-upscale.mp4","type","video/mp4"],[1,"tool-name","text-medium","mt-1"],["target","_blank",3,"click"],["id","video11","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-Expand.mp4","type","video/mp4"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-3",3,"mouseenter","mouseleave"],["id","video","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/AI-replace.mp4","type","video/mp4"],[1,"ai-video-thumbs","d-flex","align-items-center","mb-2",3,"mouseenter","mouseleave"],["id","video1","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-cleanup.mp4","type","video/mp4"],["id","video14","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/change-camera.mp4","type","video/mp4"],["id","video16","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/change-lighting.mp4","type","video/mp4"],[1,"d-flex","align-items-center","justify-content-between",2,"min-height","56px"],[1,"text-lg","text-semi","text-dark","lh-125"],[3,"click",4,"ngFor","ngForOf"],[1,"common-container","m-0","p-0"],[1,"w-100",3,"updateImageEvent","openCloseEvent","imgUrl","inProgress","step"],[1,"common-container","m-0","p-0",2,"margin-top","-8px !important",3,"hidden"],[1,"is-new-tab",3,"click"],["id","video7","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-Image-Genrator.mp4","type","video/mp4"],["id","video13","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/ai-design-video.mp4","type","video/mp4"],["id","video10","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-Video Genrator.mp4","type","video/mp4"],["id","video2","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/AI-filter.mp4","type","video/mp4"],["id","video3","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-productshoot.mp4","type","video/mp4"],["id","video4","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-portrait.mp4","type","video/mp4"],["id","video5","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-avatar.mp4","type","video/mp4"],["id","video6","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Ai-person-photoshoot.mp4","type","video/mp4"],["id","video8","loop","",2,"border-radius","8px","width","100%"],["src","https://static.lightxeditor.com/assets/AI-tools-videos/Text-to-sticker.mp4","type","video/mp4"],[1,"d-flex","align-items-center","justify-content-between","common-container","p-0","m-0",2,"min-height","56px"],["name","tutorials","placement","right","ngbTooltip","Watch Tutorial","tooltipClass","tooltip-custom-all","container","body",1,"pointer","f-32",2,"visibility","hidden"],["class","new_item",4,"ngIf"],["loop","",2,"border-radius","8px","width","100%",3,"id"],["type","video/mp4",3,"src"],[1,"w-100",3,"restAndApplyEvent"],[1,"w-100",3,"restAndApplyEvent","drawerTitle","featureType","activeSubTool","categoryId"],[1,"w-100",3,"restAndApplyEvent","selectedTool"]],template:function(F,V){1&F&&o.DNE(0,Y,12,8,"div",2),2&F&&o.Y8G("ngIf",!V.envService.isMobileView)},styles:['@charset "UTF-8";.ai-video-list[_ngcontent-%COMP%]{flex-flow:wrap}.ai-video-list[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{text-decoration:none;outline:none}.ai-video-list[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:focus-visible{outline:none}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]{width:84px;flex-direction:column;border-radius:8px;justify-content:flex-end;cursor:pointer}.ai-video-list[_ngcontent-%COMP%] .ai-video-thumbs[_ngcontent-%COMP%]:hover .tool-name[_ng
1content-%COMP%]{color:#000;transition:color .3s ease-in-out}.new_item[_ngcontent-%COMP%], .new_badge[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;padding-right:0;z-index:1}.new_item[_ngcontent-%COMP%]:after, .new_badge[_ngcontent-%COMP%]:after{content:url(https://static.lightxeditor.com/assets/icons/newbadge.svg);position:relative;top:0}.tool-name[_ngcontent-%COMP%]{width:100%;position:relative;font-size:12px;color:#4a4f5e;text-align:center;padding:0;line-height:140%}.videoThumb[_ngcontent-%COMP%]{width:84px;height:84px;overflow:hidden;display:flex;align-items:center;justify-content:center;border-radius:8px;transition:opacity .3s ease-in,visibility .3s ease-in!important}.videoThumb[_ngcontent-%COMP%] video[_ngcontent-%COMP%]{transform:scale(1.1);transition:transform .2s ease-in}.videoThumb[_ngcontent-%COMP%]:hover video[_ngcontent-%COMP%]{transform:scale(1);transition:transform .2s ease-in}.drawer-click-overlay[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10;pointer-events:none}']}),W})()},79358:(_e,ie,g)=>{"use strict";g.d(ie,{E:()=>G,J:()=>P});var n=g(21413),o=g(54438);let G=(()=>{var h;class a{constructor(){this._onChange=new n.B,this.onChange=this._onChange.asObservable(),this._onUndoRedo=new n.B,this.onUndoRedo=this._onUndoRedo.asObservable(),this.clientRectangle={}}setOnChange(e,l){this._onChange.next({name:e,options:l})}setOnUndoRedo(){this._onUndoRedo.next()}imageEdited(e,l=null){e&&l?(l.isDirty=!0,l.isExportable=!0,l.isCompareEnable=!0):l&&(l.isDirty=!1,l.isExportable=!1,l.isCompareEnable=!1)}}return(h=a).\u0275fac=function(e){return new(e||h)},h.\u0275prov=o.jDH({token:h,factory:h.\u0275fac}),a})();var P=function(h){return h[h.None=-1]="None",h[h.Tall=0]="Tall",h[h.Slim=1]="Slim",h[h.Head=2]="Head",h[h.Breast=3]="Breast",h[h.Belly=2]="Belly",h[h.Waist=4]="Waist",h}(P||{})},70372:(_e,ie,g)=>{"use strict";g.d(ie,{F:()=>G});var n=g(21413),o=g(54438);let G=(()=>{var P;class h{constructor(){this._onChange=new n.B,this.onChange=this._onChange.asObservable(),this._changeCropBox=new n.B,this.changeCropBox=this._changeCropBox.asObservable()}}return(P=h).\u0275fac=function(d){return new(d||P)},P.\u0275prov=o.jDH({token:P,factory:P.\u0275fac}),h})()},12658:(_e,ie,g)=>{"use strict";g.d(ie,{g:()=>h});var n=g(10467),o=g(93552),P=g(54438);let h=(()=>{var a;class d{constructor(){this.faceDetector=null,this.modelsLoaded=!1,this.faceapi=null}getFaceApi(){var l=this;return(0,n.A)(function*(){return l.faceapi||(l.faceapi=yield g.e(7259).then(g.bind(g,97259))),l.faceapi})()}waitForVision(){return(0,n.A)(function*(){return new Promise((l,_)=>{let S=0;const x=setInterval(()=>{window.FilesetResolver&&window.FaceLandmarker?(clearInterval(x),l({FilesetResolver:window.FilesetResolver,FaceLandmarker:window.FaceLandmarker,FaceDetector:window.FaceDetector})):S>=50&&(clearInterval(x),_(new Error("MediaPipe Tasks Vision library not loaded after timeout."))),S++},500)})})()}initializeFaceLandmarker(){var l=this;return(0,n.A)(function*(){const _=yield l.waitForVision();if(!_)throw new Error("MediaPipe Tasks Vision library not loaded. Please check your internet connection.");const C=yield _.FilesetResolver.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm");l.faceDetector=yield _.FaceDetector.createFromOptions(C,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",delegate:"GPU"},runningMode:"IMAGE",numFaces:10})})()}getFaceDetector(){return this.faceDetector}loadModels(){var l=this;return(0,n.A)(function*(_="https://static.lightxeditor.com/assets/models/ssd_mobilenetv1"){if(l.modelsLoaded)return;const C=yield l.getFaceApi();yield Promise.all([C.nets.ssdMobilenetv1.loadFromUri(_)]),l.modelsLoaded=!0}).apply(this,arguments)}detectFacesFaceApi(l){var _=this;return(0,n.A)(function*(){if(!_.modelsLoaded)throw new Error("Face-api.js models not loaded. Call loadModels() first.");const C=yield _.getFaceApi(),x=(yield C.detectAllFaces(l,new C.SsdMobilenetv1Options({minConfidence:.3}))).map((M,R)=>{const I=M.box;return{boundingBox:{x:I.x,y:I.y,originX:I.x,originY:I.y,width:I.width,height:I.height},id:"id_"+R}});let E=null;return E=x[x.length-1],x.sort((M,R)=>("number"==typeof M.boundingBox.originX?M.boundingBox.originX:0)-("number"==typeof R.boundingBox.originX?R.boundingBox.originX:0)),x.forEach((M,R)=>{M.id="id_"+R}),{detections:{detections:x},firstOne:E}})()}detectFaces(l){var _=this;return(0,n.A)(function*(){if(!_.faceDetector)throw new Error("FaceLandmarker not initialized.");const C=yield _.faceDetector.detect(l);let S=null;return C&&Array.isArray(C.detections)&&(C.detections.forEach((x,E)=>{x.id="id_"+E}),S=C.detections[0],C.detections.sort((x,E)=>(x.boundingBox&&"number"==typeof x.boundingBox.originX?x.boundingBox.originX:0)-(E.boundingBox&&"number"==typeof E.boundingBox.originX?
1E.boundingBox.originX:0))),{detections:C,firstOne:S}})()}cropFace(l,_,C,S,x){var E=this;return(0,n.A)(function*(){const M=document.createElement("canvas");M.width=S,M.height=x;const R=M.getContext("2d");R&&R.drawImage(l,_,C,S,x,0,0,S,x);const I=yield E.resizeCanvasIfSmall(M,"image/jpeg",.9);return{blob:I,blobUrl:URL.createObjectURL(I)}})()}cropFaceForLatestFaces(l,_,C,S,x){const E=document.createElement("canvas");E.width=S,E.height=x;const M=E.getContext("2d");return M&&M.drawImage(l,_,C,S,x,0,0,S,x),new o.fabric.Image(E,{left:_,top:C,width:S,height:x,selectable:!1,evented:!1})}checkAndResizeInpuImage(l,_,C){return(0,n.A)(function*(){let S=0,x=0;l.detections.forEach(M=>{M.boundingBox.width*C>S&&(S=M.boundingBox.width*C),M.boundingBox.height*C>x&&(x=M.boundingBox.height*C)});const E=Math.max(S,x);if(E>1024){const M=1024/E,R=Math.round(_.width*M),I=Math.round(_.height*M),D=document.createElement("canvas");D.width=R,D.height=I,D.getContext("2d").drawImage(_,0,0,R,I);const u=yield new Promise((k,A)=>{D.toBlob(B=>{B?k(B):A(new Error("Failed to create blob from canvas"))},"image/png",.9)}),m=URL.createObjectURL(u),b=new window.Image;return b.src=m,yield new Promise(k=>{b.onload=k}),l.detections=l.detections.map(k=>({...k,boundingBox:{originX:k.boundingBox.originX*M,originY:k.boundingBox.originY*M,width:k.boundingBox.width*M,height:k.boundingBox.height*M}})),b}return null})()}createFaceList(l,_,C){var S=this;return(0,n.A)(function*(){const x=[];if(l.detections&&_){for(let E=0;E<l.detections.length;E++){const M=l.detections[E],{originX:R,originY:I,width:D,height:p}=M.boundingBox,u=0;let m=R-u,b=I-u,k=R+D,A=I+p,B=Math.max(0,m),y=Math.max(0,b),O=Math.min(_.width,k),w=Math.min(_.height,A);const j=yield S.cropFace(_,B,y,O-B,w-y),L=Math.floor(Math.min(Math.max(D,p),Math.min(_.width,_.height))),z=I+p/2;let Z=Math.round(R+D/2-L/2),$=Math.round(z-L/2);Z=Math.max(0,Math.min(_.width-L,Z)),$=Math.max(0,Math.min(_.height-L,$));const Y=yield S.cropFace(_,Z,$,L,L);m=R+D/2-D*C/2,b=I+p/2-p*C/2,k=R+D/2+D*C/2,A=I+p/2+p*C/2,B=Math.floor(Math.max(0,m)),y=Math.floor(Math.max(0,b)),O=Math.floor(Math.min(_.width,k)),w=Math.floor(Math.min(_.height,A)),(O-B)%2!=0&&(O+=1),(w-y)%2!=0&&(w+=1);const Q=yield S.cropFace(_,B,y,O-B,w-y);x.push({...j,...M.boundingBox,id:M.id,thumbUrl:Y.blobUrl,uploadBlob:Q.blob,cropParam:{boundedMinX:B,boundedMinY:y,boundedMaxX:O,boundedMaxY:w}})}return x}})()}resizeCanvasIfSmall(l){return(0,n.A)(function*(_,C="image/png",S){const{width:x,height:E}=_;if(x>=512||E>=512)return new Promise((u,m)=>{_.toBlob(b=>{b?u(b):m(new Error("Failed to create blob from canvas"))},C,S)});const M=512/Math.max(x,E),R=Math.round(x*M),I=Math.round(E*M),D=document.createElement("canvas");return D.width=R,D.height=I,D.getContext("2d").drawImage(_,0,0,R,I),new Promise((u,m)=>{D.toBlob(b=>{b?u(b):m(new Error("Failed to create blob from resized canvas"))},C,S)})}).apply(this,arguments)}}return(a=d).\u0275fac=function(l){return new(l||a)},a.\u0275prov=P.jDH({token:a,factory:a.\u0275fac}),d})()},19282:(_e,ie,g)=>{"use strict";g.d(ie,{JJ:()=>P,jj:()=>G,zp:()=>h});var n=g(93552);class G extends n.fabric.Rect{constructor(d){super({...d,fill:null,stroke:null,selectable:!1,evented:!1}),this.cornerLength=d.cornerLength||20,this.padding=d.padding||10}_render(d){this.canvas?.getZoom&&this.canvas.getZoom();const l=this.padding||0,_=this.width*this.scaleX+2*l,C=this.height*this.scaleY+2*l,S=-_/2,x=-C/2,E=.2*Math.min(_,C);d.save(),d.strokeStyle="white",d.lineWidth=Math.ceil(E/3),d.beginPath(),d.moveTo(S,x+E),d.lineTo(S,x),d.lineTo(S+E,x),d.moveTo(S+_-E,x),d.lineTo(S+_,x),d.lineTo(S+_,x+E),d.moveTo(S,x+C-E),d.lineTo(S,x+C),d.lineTo(S+E,x+C),d.moveTo(S+_-E,x+C),d.lineTo(S+_,x+C),d.lineTo(S+_,x+C-E),d.stroke(),d.strokeStyle="black",d.lineWidth=E/6,d.beginPath(),d.moveTo(S,x+E),d.lineTo(S,x),d.lineTo(S+E,x),d.moveTo(S+_-E,x),d.lineTo(S+_,x),d.lineTo(S+_,x+E),d.moveTo(S,x+C-E),d.lineTo(S,x+C),d.lineTo(S+E,x+C),d.moveTo(S+_-E,x+C),d.lineTo(S+_,x+C),d.lineTo(S+_,x+C-E),d.stroke(),d.restore()}}const P=["ToolTypeHeadExpressionRotateHor","ToolTypeHeadExpressionBlink","ToolTypeHeadExpressionEyeBrow","ToolTypeHeadExpressionWink","ToolTypeHeadExpressionGazeHor","ToolTypeHeadExpressionGazeVer","ToolTypeHeadExpressionAAASound","ToolTypeHeadExpressionEEESound","ToolTypeHeadExpressionWOOSound","ToolTypeHeadExpressionSmile","ToolTypeHeadExpressionRotateVer","ToolTypeHeadExpressionSideTilt"],h=[{toolName:"Mouth",toolId:"RetouchFaceExpressionMouth",activeImageName:"fe_mouth_s",inactiveImageName:"fe_mouth",showProBadge:!1,gaName:"Mouth",
1subToolArray:[{toolName:"AAA Sound",subToolId:"ToolTypeHeadExpressionAAASound",showProBadge:!1,gaName:"AAA Sound",icon:"AAAsound",minValue:-30,maxValue:120,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_mouth_aaa"},{toolName:"EEE Sound",subToolId:"ToolTypeHeadExpressionEEESound",showProBadge:!1,gaName:"EEE Sound",icon:"EEEsound",minValue:-20,maxValue:15,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_mouth_eee"},{toolName:"WOO Sound",subToolId:"ToolTypeHeadExpressionWOOSound",showProBadge:!1,gaName:"WOO Sound",icon:"WOOsound",minValue:-20,maxValue:15,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_mouth_woo"},{toolName:"Smile",subToolId:"ToolTypeHeadExpressionSmile",showProBadge:!1,gaName:"Smile",icon:"smile",minValue:-.3,maxValue:1.3,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_mouth_smile"}]},{toolName:"Head",toolId:"RetouchFaceExpressionHead",activeImageName:"fe_head_s",inactiveImageName:"fe_head",showProBadge:!1,gaName:"Head",subToolArray:[{toolName:"Tilt",subToolId:"ToolTypeHeadExpressionSideTilt",showProBadge:!1,gaName:"Side tilt",icon:"headtilt",minValue:-20,maxValue:20,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_head_side_tilt"},{toolName:"Up Down",subToolId:"ToolTypeHeadExpressionRotateVer",showProBadge:!1,gaName:"Rotate Vertically",icon:"headupdown",minValue:-20,maxValue:20,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_head_rotate_ver"},{toolName:"Left Right",subToolId:"ToolTypeHeadExpressionRotateHor",showProBadge:!1,gaName:"Rotate Horizontally",icon:"headleftright",minValue:-20,maxValue:20,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_head_rotate_hor"}]},{toolName:"Eyes",toolId:"RetouchFaceExpressionEye",activeImageName:"fe_eye_s",inactiveImageName:"fe_eye",showProBadge:!1,gaName:"Eyes",subToolArray:[{toolName:"Wink",subToolId:"ToolTypeHeadExpressionWink",showProBadge:!1,gaName:"Wink",icon:"eyewink",minValue:0,maxValue:25,min:0,max:100,isBidirectional:!1,activeImageName:"fe_eye_wink"},{toolName:"Blink",subToolId:"ToolTypeHeadExpressionBlink",showProBadge:!1,gaName:"Blink",icon:"eyeblink",minValue:5,maxValue:-20,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_eye_blink"},{toolName:"Eyebrows",subToolId:"ToolTypeHeadExpressionEyeBrow",showProBadge:!1,gaName:"Eyebrows",icon:"eyebrow",minValue:-10,maxValue:15,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_eye_brow"},{toolName:"Gaze Vertically",subToolId:"ToolTypeHeadExpressionGazeVer",showProBadge:!1,gaName:"Gaze Vertically",icon:"eyeverticle",minValue:-15,maxValue:15,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_eye_gaze_ver"},{toolName:"Gaze Horizontally",subToolId:"ToolTypeHeadExpressionGazeHor",showProBadge:!1,gaName:"Gaze Horizontally",icon:"eyehorizontal",minValue:-15,maxValue:15,min:-100,max:100,isBidirectional:!0,activeImageName:"fe_eye_gaze_hor"}]}]},96710:(_e,ie,g)=>{"use strict";g.d(ie,{o:()=>d});
1class n{constructor(l=0,_=0){this.x=l,this.y=_}set(l){this.x=l.x,this.y=l.y}dist2(l){const _=this.x-l.x,C=this.y-l.y;return _*_+C*C}dist(l){return Math.sqrt(this.dist2(l))}equals(l){return this.x===l.x&&this.y===l.y}}class o{constructor(l,_){this.p1=l,this.p2=_,this.isBad=!1}equals(l){return this.p1.equals(l.p1)&&this.p2.equals(l.p2)||this.p1.equals(l.p2)&&this.p2.equals(l.p1)}}class G{constructor(l,_,C){this.p1=l,this.p2=_,this.p3=C,this.isBad=!1,this.e1=new o(l,_),this.e2=new o(_,C),this.e3=new o(C,l)}containsVertex(l){return this.p1.equals(l)||this.p2.equals(l)||this.p3.equals(l)}circumCircleContains(l){const _=this.p1.x*this.p1.x+this.p1.y*this.p1.y,C=this.p2.x*this.p2.x+this.p2.y*this.p2.y,S=this.p3.x*this.p3.x+this.p3.y*this.p3.y,x=(_*(this.p3.y-this.p2.y)+C*(this.p1.y-this.p3.y)+S*(this.p2.y-this.p1.y))/(this.p1.x*(this.p3.y-this.p2.y)+this.p2.x*(this.p1.y-this.p3.y)+this.p3.x*(this.p2.y-this.p1.y))/2,E=(_*(this.p3.x-this.p2.x)+C*(this.p1.x-this.p3.x)+S*(this.p2.x-this.p1.x))/(this.p1.y*(this.p3.x-this.p2.x)+this.p2.y*(this.p1.x-this.p3.x)+this.p3.y*(this.p2.x-this.p1.x))/2,M=Math.sqrt((this.p1.x-x)**2+(this.p1.y-E)**2);return Math.sqrt((l.x-x)**2+(l.y-E)**2)<=M}equals(l){return this.containsVertex(l.p1)&&this.containsVertex(l.p2)&&this.containsVertex(l.p3)}}class P{constructor(){this._triangles=[],this._edges=[],this._vertices=[]}triangulate(l){this._vertices=[...l];let _=l[0].x,C=l[0].y,S=_,x=C;for(const b of l)b.x<_&&(_=b.x),b.y<C&&(C=b.y),b.x>S&&(S=b.x),b.y>x&&(x=b.y);const R=Math.max(S-_,x-C),I=(_+S)/2,D=(C+x)/2,p=new n(I-20*R,D-R),u=new n(I,D+20*R),m=new n(I+20*R,D-R);this._triangles=[new G(p,u,m)];for(const b of l){const k=[];for(const B of this._triangles)B.circumCircleContains(b)&&(B.isBad=!0,k.push(B.e1,B.e2,B.e3));this._triangles=this._triangles.filter(B=>!B.isBad);for(let B=0;B<k.length;B++)for(let y=0;y<k.length;y++)B!==y&&k[B].equals(k[y])&&(k[B].isBad=!0,k[y].isBad=!0);const A=k.filter(B=>!B.isBad);for(const B of A)this._triangles.push(new G(B.p1,B.p2,b))}this._triangles=this._triangles.filter(b=>!b.containsVertex(p)&&!b.containsVertex(u)&&!b.containsVertex(m)),this._edges=[];for(const b of this._triangles)this._edges.push(b.e1,b.e2,b.e3);return this._triangles}getTriangles(){return this._triangles}getEdges(){return this._edges}getVertices(){return this._vertices}}class h{constructor(l){if(this.canvas=l,this.gl=l.getContext("webgl",{antialias:!1}),!this.gl)throw new Error("WebGL not supported");this.program=this.createProgram(`\n attribute vec2 aPosition;\n attribute vec3 aColor;\n varying vec3 vColor;\n void main() {\n // Convert from pixel coords to clip space [-1, 1]\n gl_Position = vec4(\n (aPosition.x / ${l.width}.0) * 2.0 - 1.0,\n 1.0 - (aPosition.y / ${l.height}.0) * 2.0,\n 0.0,\n 1.0\n );\n vColor = aColor;\n }\n `,"\n precision mediump float;\n varying vec3 vColor;\n void main() {\n gl_FragColor = vec4(vColor, 1.0);\n }\n "),this.positionBuffer=this.gl.createBuffer(),this.colorBuffer=this.gl.createBuffer()}createShader(l,_){const C=this.gl.createShader(l);if(this.gl.shaderSource(C,_),this.gl.compileShader(C),!this.gl.getShaderParameter(C,this.gl.COMPILE_STATUS))throw new Error("Shader compile error: "+this.gl.getShaderInfoLog(C));return C}createProgram(l,_){const C=this.createShader(this.gl.VERTEX_SHADER,l),S=this.createShader(this.gl.FRAGMENT_SHADER,_),x=this.gl.createProgram();if(this.gl.attachShader(x,C),this.gl.attachShader(x,S),this.gl.linkProgram(x),!this.gl.getProgramParameter(x,this.gl.LINK_STATUS))throw new Error("Program link error: "+this.gl.getProgramInfoLog(x));return x}draw(l,_){const C=[],S=[];for(const R of l)C.push(R.p1.x,R.p1.y,R.p2.x,R.p2.y,R.p3.x,R.p3.y),S.push(0,0,0,0,0,0,0,0,0);for(let R=0;R<_.length;R++){const I=_[R],D=I.p1Updated??I.p1,p=I.p2Updated??I.p2,u=I.p3Updated??I.p3,m=R+1,b=Math.min(255,m)/255,k=Math.min(255,Math.floor(m/255))/255,A=Math.min(255,Math.floor(m/65025))/255;C.push(D.x,D.y,p.x,p.y,u.x,u.y),S.push(b,k,A,b,k,A,b,k,A)}const x=this.gl;x.viewport(0,0,this.canvas.width,this.canvas.height),x.clearColor(0,0,0,0),x.clear(x.COLOR_BUFFER_BIT),x.useProgram(this.program);const E=x.getAttribLocation(this.program,"aPosition");x.bindBuffer(x.ARRAY_BUFFER,this.positionBuffer),x.bufferData(x.ARRAY_BUFFER,new Float32Array(C),x.STATIC_DRAW),x.enableVertexAttribArray(E),x.vertexAttribPointer(E,2,x.FLOAT,!1,0,0);const M=x.getAttribLocation(this.program,"aColor");x.bindBuffer(x.ARRAY_BUFFER,this.colorBuffer),x.bufferData(x.ARRAY_BUFFER,new Float32Array(S),x.STATIC_DRAW),x.enableVertexAttribArray(M),x.vertexAttribPointer(M,3,x.FLOAT,!1,0,0),x.drawArrays(x.TRIANGLES,0,C.length/2)}}class a{constructor(){this.frameDuration=0,this.distance=0,this.imageDimension=new n(0,0),this.totalPoints=[],this.staticPoints=[],this.dynamicStartPoints=[],this.dynamicEndPoints=[],this.staticTriangles=[],this.dynamicTriangles=[],this.totalTriangles=[],this.dynamicUpdatedStartPoints=[]}setImageSize(l){this.imageDimension=l}setInitialCoordinateArray(l){for(const _ of l)this.totalPoints.push(_),this.staticPoints.push(_)}setFrameLength(l){this.frameDuration=l}addStaticPointForPlay(l){this.totalPoints.push(l),this.staticPoints.push(l)}applyPlayDelauney(l){const _=new P;this.totalTriangles=_.triangulate(this.totalPoints);for(let C=0;C<this.totalTriangles.length;C++){const S=this.totalTriangles[C];S.p1Updated=new n(S.p1.x,S.p1.y),S.p2Updated=new n(S.p2.x,S.p2.y),S.p3Updated=new n(S.p3.x,S.p3.y)}}addDynamicPointForPlay(l,_){this.totalPoints.push(l),this.dynamicStartPoints.push(l),this.dynamicEndPoints.push(_)}addStaticPoint(l){this.totalPoints.push(l),this.staticPoints.push(l),this.retriangulateAndStore()}addStaticPointArray(l){this.totalPoints.push(...l),this.staticPoints.push(...l),this.retriangulateAndStore()}addDynamicPoint(l,_){this.totalPoints.push(l),this.dynamicStartPoints.push(l),this.dynamicEndPoints.push(_),this.retriangulateAndStore()}addDynamicPointArray(l,_){this.totalPoints.push(...l),this.dynamicStartPoints.push(...l),this.dynamicEndPoints.push(..._),this.retriangulateAndStore()}removeStaticPoint(l){this.totalPoints=this.totalPoints.filter(_=>!(_.x===l.x&&_.y===l.y)),this.staticPoints=this.staticPoints.filter(_=>!(_.x===l.x&&_.y===l.y)),this.retriangulateAndStore()}resetTotalTriangles(){this.totalPoints=this.totalPoints.slice(0,4),this.staticPoints=this.staticPoints.slice(0,4),this.dynamicStartPoints=[],this.dynamicEndPoints=[]}removeDynamicPoint(l){this.totalPoints=this.totalPoints.filter(_=>!(_.x===l.x&&_.y===l.y));for(let _=0;_<this.dynamicStartPoints.length;_++)if(l.x===this.dynamicStartPoints[_].x&&l.y===this.dynamicStartPoints[_].y){this.dynamicStartPoints.splice(_,1),this.dynamicEndPoints.splice(_,1);break}this.retriangulateAndStore()}getStaticTriangles(){return this.staticTriangles}getDynamicTriangles(){return this.dynamicTriangles}updatedDynamicPoints(l){const _=[];let C=0;for(const S of this.totalTriangles)this.isTriangularPointStatic(S)?_.push(S):(this.dynamicStartPoints=this.dynamicStartPoints.map(x=>this.updatePointFromTriangle(x,S,l[C])),this.dynamicEndPoints=this.dynamicEndPoints.map(x=>this.updatePointFromTriangle(x,S,l[C])),_.push(l[C]),C++);this.totalTriangles=_}applyDelaunayForFrame(l){this.staticTriangles=[],this.dynamicTriangles=[];for(const _ of this.totalTriangles)this.isTriangularPointStatic(_)?this.staticTriangles.push(_):this.dynamicTriangles.push(_);this.dynamicUpdatedStartPoints=this.dynamicStartPoints.map((_,C)=>this.getPointAtInterval(_,this.dynamicEndPoints[C],l)),this.dynamicTriangles.forEac
1h(_=>{for(let C=0;C<this.dynamicStartPoints.length;C++){const S=this.dynamicStartPoints[C];_.p1.equals(S)&&(_.p1Updated=this.dynamicUpdatedStartPoints[C]),_.p2.equals(S)&&(_.p2Updated=this.dynamicUpdatedStartPoints[C]),_.p3.equals(S)&&(_.p3Updated=this.dynamicUpdatedStartPoints[C])}})}finalMat(){this.renderer.draw(this.staticTriangles,this.dynamicTriangles)}buildTriangleMaskCanvas(l){if(!l)return null;const _=l.getElement?.(),C=_&&(_.naturalWidth||_.videoWidth)||l.width,S=_&&(_.naturalHeight||_.videoHeight)||l.height;return this.triangleMaskCanvas?(this.triangleMaskCanvas.width=C,this.triangleMaskCanvas.height=S):(this.triangleMaskCanvas=document.createElement("canvas"),this.triangleMaskCanvas.width=C,this.triangleMaskCanvas.height=S,this.renderer=new h(this.triangleMaskCanvas)),this.finalMat(),this.triangleMaskCanvas}retriangulateAndStore(){const l=new P;this.totalTriangles=l.triangulate(this.totalPoints);for(let _=0;_<this.totalTriangles.length;_++){const C=this.totalTriangles[_];C.p1Updated=new n(C.p1.x,C.p1.y),C.p2Updated=new n(C.p2.x,C.p2.y),C.p3Updated=new n(C.p3.x,C.p3.y)}}updatePointFromTriangle(l,_,C){return _.p1.equals(l)?new n(C.p1.x,C.p1.y):_.p2.equals(l)?new n(C.p2.x,C.p2.y):_.p3.equals(l)?new n(C.p3.x,C.p3.y):l}getPointAtInterval(l,_,C){const S=(_.y-l.y)/(_.x-l.x);let x=new n(l.x,l.y),E=new n(_.x,_.y);if(0===S)x.x=l.x-(_.x-l.x);else if(_.x-l.x==0)x.y=l.y-(_.y-l.y);else{const u=_.x-l.x,m=_.y-l.y,k=Math.sqrt(u*u+m*m)/Math.sqrt(1+S*S),A=Math.abs(S*k);_.x>l.x&&_.y>l.y?(x.x-=k,x.y-=A):_.x>l.x&&_.y<l.y?(x.x-=k,x.y+=A):_.x<l.x&&_.y>l.y?(x.x+=k,x.y-=A):(x.x+=k,x.y+=A)}const M=E.x-x.x,R=E.y-x.y,I=Math.sqrt(M*M+R*R);return this.distance=I*(C/this.frameDuration),new n(x.x+M/I*this.distance,x.y+R/I*this.distance)}isTriangularPointStatic(l){let _=0;for(const C of this.staticPoints)l.containsVertex(C)&&_++;return 3===_}}class d{constructor(){this.delaunyFilter=null,this.delaunyFilter=new a}setInitialCoordinates(l){const _=l.map(C=>new n(C.x,C.y));this.delaunyFilter?.setInitialCoordinateArray(_)}setImageSize(l){this.delaunyFilter?.setImageSize(new n(l.width,l.height))}setFrameLength(l){this.delaunyFilter?.setFrameLength(l)}applyDelaunayForFrame(l){this.delaunyFilter?.applyDelaunayForFrame(l)}applyPlayDelaunay(l){this.delaunyFilter?.applyPlayDelauney(l)}addStaticPointForPlay(l){this.delaunyFilter?.addStaticPointForPlay(new n(l.x,l.y))}addDynamicPointForPlay(l,_){this.delaunyFilter?.addDynamicPointForPlay(new n(l.x,l.y),new n(_.x,_.y))}addStaticPoint(l){this.delaunyFilter?.addStaticPoint(new n(l.x,l.y))}addStaticPointArray(l){this.delaunyFilter?.addStaticPointArray(l.map(_=>new n(_.x,_.y)))}addDynamicPoint(l,_){this.delaunyFilter?.addDynamicPoint(new n(l.x,l.y),new n(_.x,_.y))}addDynamicPointArray(l,_){this.delaunyFilter?.addDynamicPointArray(l.map(C=>new n(C.x,C.y)),_.map(C=>new n(C.x,C.y)))}updatePointInDelaunay(l){if(!this.delaunyFilter)return;const _=this.delaunyFilter.getDynamicTriangles();for(let C=0;C<l.length;C++){const S=l[C],x=_[C];x.p1.x=S[0].x,x.p1.y=S[0].y,x.p2.x=S[1].x,x.p2.y=S[1].y,x.p3.x=S[2].x,x.p3.y=S[2].y}this.delaunyFilter.updatedDynamicPoints(_)}getDynamicTriangles(){return this.delaunyFilter?this.delaunyFilter.getDynamicTriangles().map(_=>[new n(_.p1.x,_.p1.y),new n(_.p2.x,_.p2.y),new n(_.p3.x,_.p3.y),new n(_.p1Updated?.x,_.p1Updated?.y),new n(_.p2Updated?.x,_.p2Updated?.y),new n(_.p3Updated?.x,_.p3Updated?.y)]):[]}algoExist(){return null!==this.delaunyFilter}getStaticTriangles(){return this.delaunyFilter?this.delaunyFilter.getStaticTriangles().map(_=>[new n(_.p1.x,_.p1.y),new n(_.p2.x,_.p2.y),new n(_.p3.x,_.p3.y),new n(_.p1Updated?.x,_.p1Updated?.y),new n(_.p2Updated?.x,_.p2Updated?.y),new n(_.p3Updated?.x,_.p3Updated?.y)]):[]}removeStaticPoint(l){this.delaunyFilter?.removeStaticPoint(new n(l.x,l.y))}removeDynamicPoint(l){this.delaunyFilter?.removeDynamicPoint(new n(l.x,l.y))}resetTotalTriangles(l){this.delaunyFilter?.resetTotalTriangles()}buildTriangleMaskCanvas(l){return this.delaunyFilter?.buildTriangleMaskCanvas(l)}resetAlgo(){this.delaunyFilter=null}}},42498:(_e,ie,g)=>{"use strict";g.d(ie,{W:()=>n});
1class n{getFacialLengthFactor(){return.1}}},41783:(_e,ie,g)=>{"use strict";g.d(ie,{t:()=>o});var n=g(40580);class o{constructor(P,h,a,d,e,l,_){this.landmarks=P,this.width=h,this.height=a,this.facialAngle=d,this.facialAngleX=e,this.facialAngleY=l,this.facialLength=_}getLandmarks(){return this.landmarks}setLandmarks(P){this.landmarks=P}getWidth(){return this.width}setWidth(P){this.width=P}getHeight(){return this.height}setHeight(P){this.height=P}getFacialAngle(P){return n.k.getAngle(P,this.facialAngleY,this.facialAngleX)}getFacialAngleX(){return this.facialAngleX}setFacialAngleX(P){this.facialAngleX=P}getFacialAngleY(){return this.facialAngleY}setFacialAngleY(P){this.facialAngleY=P}getFacialLength(){return this.facialLength}setFacialLength(P){this.facialLength=P}}},96408:(_e,ie,g)=>{"use strict";g.d(ie,{o:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{constructor(){super(...arguments),this.tiltLeftFixedStaticPoints=[],this.tiltLeftDynamicStartPoints=[],this.tiltRightFixedStaticPoints=[],this.tiltRightDynamicStartPoints=[],this.tiltCenterPoint=null,this.tiltRightCenterPoint=null}getFacialLengthFactor(){return.025}updatePointsForSelection(d,e,l=0,_){const C=[],S=[],x=[],E=d.getFacialLength()*this.getFacialLengthFactor();if(null==d.getLandmarks())return{staticPointArray:C,startPointArray:S,endPointArray:x};const M=d.getWidth(),R=d.getHeight();for(const D of o.tj.getFaceStaticPointArray()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}switch(e){case G.I.EYE_WIDTH:if(2!==l){for(const D of h.getLeftEyeStaticPointArray()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getLeftEyeTopPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_WIDTH),A=new P.b(u+E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getLeftEyeBottomPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_WIDTH),A=new P.b(u-E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}}if(1!==l){for(const D of h.getRightEyeStaticPointArray()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getRightEyeTopPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_WIDTH),A=new P.b(u+E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getRightEyeBottomPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_WIDTH),A=new P.b(u-E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}}break;case G.I.EYE_SIZE:if(2!==l){for(const B of h.getLeftEyeStaticPointArray()){const y=d.getLandmarks()[B];C.push(new P.b(y.x*M,y.y*R))}const D=[],p=[],u=[],m=[],b=d.getLandmarks()[468],k=new P.b(b.x*M,b.y*R);for(const B of h.getLeftEyeLiftTopPointArray()){const y=d.getLandmarks()[B];D.push(new P.b(y.x*M,y.y*R))}for(const B of h.getLeftEyeLiftBottomPointArray()){const y=d.getLandmarks()[B];p.push(new P.b(y.x*M,y.y*R))}const A=d.getFacialAngle(G.I.EYE_SIZE);for(const B of D)u.push(h.rotatePoint(k,B,-A));for(const B of p)m.push(h.rotatePoint(k,B,-A));for(let B=0;B<u.length;B++){const y=u[B],O=h.getSlopeOfTangent(y,B,u)+Math.PI/2,w=new P.b(y.x+E*Math.cos(O+Math.PI),y.y+E*Math.sin(O+Math.PI)),j=h.rotatePoint(k,w,A);S.push(D[B]),x.push(j)}for(let B=0;B<m.length;B++){const y=m[B],O=h.getSlopeOfTangent(y,B,m)+Math.PI/2,w=new P.b(y.x+E*Math.cos(O+Math.PI),y.y+E*Math.sin(O+Math.PI)),j=h.rotatePoint(k,w,A);S.push(p[B]),x.push(j)}}if(1!==l){for(const B of h.getRightEyeStaticPointArray()){const y=d.getLandmarks()[B];C.push(new P.b(y.x*M,y.y*R))}const D=[],p=[],u=[],m=[],b=d.getLandmarks()[473],k=new P.b(b.x*M,b.y*R);for(const B of h.getRightEyeLiftTopPointArray()){const y=d.getLandmarks()[B];D.push(new P.b(y.x*M,y.y*R))}for(const B of h.getRightEyeLiftBottomPointArray()){const y=d.getLandmarks()[B];p.push(new P.b(y.x*M,y.y*R))}const A=d.getFacialAngle(G.I.EYE_SIZE);for(const B of D)u.push(h.rotatePoint(k,B,-A));for(const B of p)m.push(h.rotatePoint(k,B,-A));for(let B=0;B<u.length;B++){const y=u[B],O=h.getSlopeOfTangent(y,B,u)+Math.PI/2,w=new P.b(y.x+E*Math.cos(O+Math.PI),y.y+E*Math.sin(O+Math.PI)),j=h.rotatePoint(k,w,A);S.push(D[B]),x.push(j)}for(let B=0;B<m.length;B++){const y=m[B],O=h.getSlopeOfTangent(y,B,m)+Math.PI/2,w=new P.b(y.x+E*Math.cos(O+Math.PI),y.y+E*Math.sin(O+Math.PI)),j=h.rotatePoint(k,w,A);S.push(p[B]),x.push(j)}}break;case G.I.EYE_LIFT:if(2!==l){for(const D of h.getLeftEyeStaticPointArray()){const p=d.getLandmarks()[D];
1C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getLeftEyeLiftTopPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_LIFT),A=new P.b(u-E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getLeftEyeLiftBottomPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_LIFT),A=new P.b(u-E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}}if(1!==l){for(const D of h.getRightEyeStaticPointArray()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getRightEyeLiftTopPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_LIFT),A=new P.b(u-E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getRightEyeLiftBottomPointArray()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYE_LIFT),A=new P.b(u-E*Math.sin(k),m-E*Math.cos(k));S.push(b),x.push(A)}}break;case G.I.EYE_HEIGHT:if(2!==l){for(const u of h.getLeftEyeStaticPointArray()){const m=d.getLandmarks()[u];C.push(new P.b(m.x*M,m.y*R))}const D=[113,225,224,223,222,221,189],p=[31,228,229,230,231,232,233];for(const u of D){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_HEIGHT),y=new P.b(b-E*Math.sin(B),k-E*Math.cos(B));S.push(A),x.push(y)}for(const u of p){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_HEIGHT),y=new P.b(b+E*Math.sin(B),k+E*Math.cos(B));S.push(A),x.push(y)}}if(1!==l){for(const u of h.getRightEyeStaticPointArray()){const m=d.getLandmarks()[u];C.push(new P.b(m.x*M,m.y*R))}const D=[413,441,442,443,444,445,342],p=[453,452,451,450,449,448,261];for(const u of D){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_HEIGHT),y=new P.b(b-E*Math.sin(B),k-E*Math.cos(B));S.push(A),x.push(y)}for(const u of p){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_HEIGHT),y=new P.b(b+E*Math.sin(B),k+E*Math.cos(B));S.push(A),x.push(y)}}break;case G.I.EYEBROW_PEAK:if(2!==l){for(const D of h.getPeakLeftStaticPoints()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getPeakLeftDynamicTopPoints()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYEBROW_PEAK),A=new P.b(u+E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getPeakLeftDynamicBottomPoints()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYEBROW_PEAK),A=new P.b(u+E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}}if(1!==l){for(const D of h.getPeakRightStaticPoints()){const p=d.getLandmarks()[D];C.push(new P.b(p.x*M,p.y*R))}for(const D of h.getPeakRightDynamicTopPoints()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYEBROW_PEAK),A=new P.b(u+E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}for(const D of h.getPeakRightDynamicBottomPoints()){const p=d.getLandmarks()[D],u=p.x*M,m=p.y*R,b=new P.b(u,m),k=d.getFacialAngle(G.I.EYEBROW_PEAK),A=new P.b(u+E*Math.sin(k),m+E*Math.cos(k));S.push(b),x.push(A)}}break;case G.I.EYE_DISTANCE:if(2!==l){for(const u of h.getLeftEyeStaticPointArray()){const m=d.getLandmarks()[u];C.push(new P.b(m.x*M,m.y*R))}const D=[223,224,225,113,226,31,228,229],p=[222,221,189,244,233,232,231,230];for(const u of D){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_DISTANCE),y=new P.b(b+E*Math.sin(B),k+E*Math.cos(B));S.push(A),x.push(y)}for(const u of p){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_DISTANCE),y=new P.b(b+E*Math.sin(B),k+E*Math.cos(B));S.push(A),x.push(y)}}if(1!==l){for(const u of h.getRightEyeStaticPointArray()){const m=d.getLandmarks()[u];C.push(new P.b(m.x*M,m.y*R))}const D=[443,442,441,413,464,453,452,451],p=[444,445,342,446,261,448,449,450];for(const u of D){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_DISTANCE),y=new P.b(b-E*Math.sin(B),k-E*Math.cos(B));S.push(A),x.push(y)}for(const u of p){const m=d.getLandmarks()[u],b=m.x*M,k=m.y*R,A=new P.b(b,k),B=d.getFacialAngle(G.I.EYE_DISTANCE),y=new P.b(b-E*Math.sin(B),k-E*Math.cos(B));S.push(A),x.push(y)}}break;case G.I.EYE_TILT:if(2!==l){if(0===this.tiltLeftFixedStaticPoints.length)for(const u of h.getLeftEyeStaticPointArray()){const m=d.getLandmarks()[u];this.tiltLeftFixedStaticPoints.push(new P.b(m.x*M,m.y*R))}if(C.push(...this.tiltLeftFixedStaticPoints),0===this.tiltLeftDynamicStartPoints.length){const u=[...h.getLeftEyeTopPointArray(),...h.getLeftEyeBottomPointArray()];this.tiltLeftDynamicStartPoints.push(...o.tj.getArrayIndexListToPointList(u,d))}const D=d.getLandmarks()[468];this.tiltCenterPoint||(this.tiltCenterPoint=new P.b(D.x*M,D.y*R));let p=1.5708;0===p&&(p=1e-4);for(const u of this.tiltLeftDynamicStartPoints){const m=h.rotatePoint(this.tiltCenterPoint,u,p);S.push(u),x.push(m)}}if(1!==l){if(0===this.tiltRightFixedStaticPoints.length)for(const u of h.getRightEyeStaticPointArray()){const m=d.getLandmarks()[u];this.tiltRightFixedStaticPoints.push(new P.b(m.x*M,m.y*R))}if(C.push(...this.tiltRightFixedStaticPoints),0===this.tiltRightDynamicStartPoints.length){const u=[...h.getRightEyeTopPointArray(),...h.getRightEyeBottomPointArray()];this.tiltRightDynamicStartPoints.push(...o.tj.getArrayIndexListToPointList(u,d))}const D=d.getLandmarks()[473];this.tiltRightCenterPoint||(this.tiltRightCenterPoint=new P.b(D.x*M,D.y*R));let p=-1.5708;0===p&&(p=-1e-4);for(const u of this.tiltRightDynamicStartPoints){const m=h.rotatePoint(this.tiltRightCenterPoint,u,p);S.push(u),x.push(m)}}}return{staticPointArray:P.k.minusArray(C,[...x,...S]),startPointArray:S,endPointArray:x}}static getLeftEyeStaticPointArray(){return[143,156,46,53,52,65,55,193,245,128,121,120,119,118,117,111]}static getLeftEyeLiftTopPointArray(){return[113,225,224,223,222,221,189,244]}static getLeftEyeLiftBottomPointArray(){return[226,31,228,229,230,231,232,233]}static getRightEyeLiftTopPointArray(){return[413,441,442,443,444,445,342,446]}static getRightEyeLiftBottomPointArray(){return[464,453,452,451,450,449,448,261]}static getPeakLeftStaticPoints(){return[68,104,69,71,70,46,225,108,107,55,221,30,29,27,28,56]}static getPeakLeftDynamicTopPoints(){return[63,105,66]}static getPeakLeftDynamicBottomPoints(){return[53,52,65]}static getPeakRightStaticPoints(){return[299,333,298,337,336,285,441,301,300,276,445,258,257,259,260]}static getPeakRightDynamicTopPoints(){return[296,334,293]}static getPeakRightDynamicBottomPoints(){return[295,282,283]}static getLeftEyeTopPointArray(){return[224,225,113,226,31,228,229]}static getLeftEyeBottomPointArray(){return[222,221,189,244,233,232,231]}static getRightEyeStaticPointArray(){return[417,285,295,282,283,276,353,265,340,346,347,348,349,350,357,465]}static getRightEyeTopPointArray(){return[442,441,413,464,453,452,451]}static getRightEyeBottomPointArray(){return[444,445,342,446,261,448,449]}static rotatePoint(d,e,l){const _=d.x-e.x,C=d.y-e.y,S=_*Math.cos(l)-C*Math.sin(l),x=_*Math.sin(l)+C*Math.cos(l);return new P.b(S+e.x,x+e.y)}static calculateBezierCoefficient(d,e,l,_){const C=3*(e-d),S=3*(l-e)-C;return[_-d-C-S,S,C]}static getSlopeOfTangent(d,e,l){let _=e-2;_<0&&(_=l.length+_);let C=e-1;C<0&&(C=l.length+C);let x=e+1;e+1>=l.length&&(x=0);
1const E=l[_],M=l[C],R=l[e],I=l[x],[D,p,u]=h.calculateBezierCoefficient(E.x,M.x,R.x,I.x),[m,b,k]=h.calculateBezierCoefficient(E.y,M.y,R.y,I.y),A=h.getTvalFromBezierPath(d.x,E.x,M.x,R.x,I.x);return(3*m*A*A+2*b*A+k)/(3*D*A*A+2*p*A+u)}static getTvalFromBezierPath(d,e,l,_,C){const[S,x,E]=h.calculateBezierCoefficient(e,l,_,C);return h.cubicFormula(S,x,E,e-d)}static cubicFormula(d,e,l,_){let C=0,S=0,x=0,E=0,M=0,R=0,I=0,D=0,p=0,u=0;if(0===d){const O=l*l-4*e*_;O>=0&&(S=(-l+Math.sqrt(O))/(2*e),x=(-l-Math.sqrt(O))/(2*e),S>=0&&S<=1&&(C=S),x>=0&&x<=1&&(C=x))}if(0===_){S=0;const O=e*e-4*d*l;O>=0&&(x=(-e+Math.sqrt(O))/(2*d),E=(-e-Math.sqrt(O))/(2*d),S>=0&&S<=1&&(C=S),x>=0&&x<=1&&(C=x),E>=0&&E<=1&&(C=E))}const b=(3*(l/=d)-(e/=d)*e)/9;let B=(27*(_/=d)-e*(9*l-2*e*e))/27;B/=2,M=B*B;const y=b*b*b+M;return D=e/3,y>0&&(R=-B+Math.sqrt(y)>0?Math.pow(-B+Math.sqrt(y),1/3):-Math.pow(B+Math.sqrt(y),1/3),I=-B-Math.sqrt(y)>0?Math.pow(-B-Math.sqrt(y),1/3):-Math.pow(B+Math.sqrt(y),1/3),S=-D+R+I,S>=0&&S<=1&&(C=S)),y<0&&(u=Math.sqrt(-b*b*b),p=Math.atan(Math.sqrt(-y)/-B),B>0&&(p=Math.PI+p),S=Math.pow(u,1/3)*(Math.cos((6*Math.PI-p)/3)+Math.cos(p/3))-D,x=Math.pow(u,1/3)*(Math.cos((2*Math.PI+p)/3)+Math.cos((4*Math.PI-p)/3))-D,E=Math.pow(u,1/3)*(Math.cos((4*Math.PI+p)/3)+Math.cos((2*Math.PI-p)/3))-D,S>=0&&S<=1&&(C=S),x>=0&&x<=1&&(C=x),E>=0&&E<=1&&(C=E)),0===y&&(R=Math.pow(-B,1/3),I=Math.pow(-B,1/3),S=-D+R+I,S>=0&&S<=1&&(C=S)),C}}},87502:(_e,ie,g)=>{"use strict";g.d(ie,{i:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{constructor(){super(...arguments),this.tiltLeftFixedStaticPoints=[],this.tiltLeftDynamicStartPoints=[],this.tiltRightFixedStaticPoints=[],this.tiltRightDynamicStartPoints=[]}getFacialLengthFactor(){return.025}updatePointsForSelection(e,l,_=0){const x=[],E=e.getFacialLength()*this.getFacialLengthFactor();if(null!=e.getLandmarks()){for(const p of o.tj.getFaceStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}const M=[],R=[];let I=e.getFacialAngle(l);switch(l){case G.I.EYEBROW_LENGTH:if(2!=_){for(const p of o.tj.getLeftEyebrowStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of o.tj.getLeftEyebrowDynamicWidthPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}}if(1!=_){for(const p of o.tj.getRightEyebrowStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of o.tj.getRightEyebrowDynamicWidthPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}}break;case G.I.EYEBROW_LIFT:if(2!=_){for(const p of o.tj.getLeftEyebrowTopPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of o.tj.getLeftEyebrowBottomPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of a.getLeftEyeBrowExtraStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}}if(1!=_){for(const p of o.tj.getRightEyebrowTopPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of o.tj.getRightEyebrowBottomPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of o.tj.getRightEyebrowExtraStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}}break;case G.I.EYEBROW_THICKNESS:if(2!=_){for(const p of o.tj.getLeftEyebrowStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}
1for(const p of a.getThicknessLeftExtraStaticPoints()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of o.tj.getLeftEyebrowTopPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of o.tj.getLeftEyebrowBottomPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}}if(1!=_){for(const p of o.tj.getRightEyebrowStaticPointArray()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of o.tj.getRightEyebrowTopPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m-E*Math.sin(I),b+E*Math.cos(I));M.push(k),R.push(A)}for(const p of o.tj.getRightEyebrowBottomPointArray()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}for(const p of a.getThicknessRightExtraStaticPoints()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}}break;case G.I.EYEBROW_PEAK:if(2!=_){for(const p of a.getPeakLeftStaticPoints()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of a.getPeakLeftDynamicTopPoints()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}for(const p of a.getPeakLeftDynamicBottomPoints()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}}if(1!=_){for(const p of a.getPeakRightStaticPoints()){const u=e.getLandmarks()[p],m=new P.b(u.x*e.getWidth(),u.y*e.getHeight());x.push(m)}for(const p of a.getPeakRightDynamicTopPoints()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}for(const p of a.getPeakRightDynamicBottomPoints()){const u=e.getLandmarks()[p],m=u.x*e.getWidth(),b=u.y*e.getHeight(),k=new P.b(m,b),A=new P.b(m+E*Math.sin(I),b-E*Math.cos(I));M.push(k),R.push(A)}}break;case G.I.EYEBROW_DISTANCE:if(2!=_){const p=[];p.push(...o.tj.getLeftEyebrowStaticPointArray()),p.push(8),p.push(9);for(const u of p){const m=e.getLandmarks()[u],b=new P.b(m.x*e.getWidth(),m.y*e.getHeight());x.push(b)}for(const u of a.getDistanceLeftDynamicTopPoints()){const m=e.getLandmarks()[u],b=m.x*e.getWidth(),k=m.y*e.getHeight(),A=new P.b(b,k),B=new P.b(b+E*Math.sin(I),k-E*Math.cos(I));M.push(A),R.push(B)}}if(1!=_){const p=[];p.push(...o.tj.getRightEyebrowStaticPointArray()),p.push(9),p.push(8);for(const u of p){const m=e.getLandmarks()[u],b=new P.b(m.x*e.getWidth(),m.y*e.getHeight());x.push(b)}for(const u of a.getDistanceRightDynamicTopPoints()){const m=e.getLandmarks()[u],b=m.x*e.getWidth(),k=m.y*e.getHeight(),A=new P.b(b,k),B=new P.b(b-E*Math.sin(I),k+E*Math.cos(I));M.push(A),R.push(B)}}break;case G.I.EYEBROW_TILT:if(2!=_){if(0==this.tiltLeftFixedStaticPoints.length)for(const m of a.getLeftEyeBrowExtraStaticPointArray()){const b=e.getLandmarks()[m],k=new P.b(b.x*e.getWidth(),b.y*e.getHeight());this.tiltLeftFixedStaticPoints.push(k)}if(x.push(...this.tiltLeftFixedStaticPoints),0==this.tiltLeftDynamicStartPoints.length){const m=[];m.push(...o.tj.getLeftEyebrowTopPointArray()),m.push(...o.tj.getLeftEyebrowBottomPointArray()),this.tiltLeftDynamicStartPoints.push(...o.tj.getArrayIndexListToPointList(m,e))}const p=e.getLandmarks()[223];this.tiltCenterPoint||(this.tiltCenterPoint=new P.b(p.x*e.getWidth(),p.y*e.getHeight()));const u=1.5708;for(const m of this.tiltLeftDynamicStartPoints){const b=a.rotatePoint(this.tiltCenterPoint,m,u);M.push(m),R.push(b)}}if(1!=_){if(0==this.tiltRightFixedStaticPoints.length)for(const m of o.tj.getRightEyebrowExtraStaticPointArray()){const b=e.getLandmarks()[m],k=new P.b(b.x*e.getWidth(),b.y*e.getHeight());this.tiltRightFixedStaticPoints.push(k)}if(x.push(...this.tiltRightFixedStaticPoints),0==this.tiltRightDynamicStartPoints.length){const m=[];m.push(...o.tj.getRightEyebrowTopPointArray()),m.push(...o.tj.getRightEyebrowBottomPointArray()),this.tiltRightDynamicStartPoints.push(...o.tj.getArrayIndexListToPointList(m,e))}const p=e.getLandmarks()[443];this.tiltRightCenterPoint||(this.tiltRightCenterPoint=new P.b(p.x*e.getWidth(),p.y*e.getHeight()));const u=-1.5708;for(const m of this.tiltRightDynamicStartPoints){const b=a.rotatePoint(this.tiltRightCenterPoint,m,u);M.push(m),R.push(b)}}}return{staticPointArray:P.k.minusArray(x,[...R,...M]),startPointArray:M,endPointArray:R}}}}class a{static rotatePoint(e,l,_){const C=e.x-l.x,S=e.y-l.y,x=C*Math.cos(_)-S*Math.sin(_),E=C*Math.sin(_)+S*Math.cos(_);return new P.b(x+l.x,E+l.y)}
1static getThicknessLeftExtraStaticPoints(){return[156,9,124,8]}static getThicknessRightExtraStaticPoints(){return[9,383,353,8]}static getPeakLeftStaticPoints(){return[68,104,69,71,70,46,225,108,107,55,221,30,29,27,28,56]}static getPeakLeftDynamicTopPoints(){return[63,105,66]}static getPeakLeftDynamicBottomPoints(){return[53,52,65]}static getPeakRightStaticPoints(){return[299,333,298,337,336,285,441,301,300,276,445,258,257,259,260]}static getPeakRightDynamicTopPoints(){return[296,334,293]}static getPeakRightDynamicBottomPoints(){return[295,282,283]}static getLeftEyeBrowExtraStaticPointArray(){return[156,9,124,8,113,247,30,29,27,28,56,190,189,193]}static getDistanceLeftDynamicTopPoints(){return[156,70,63,105,66,107,124,46,53,52,65,55]}static getDistanceRightDynamicTopPoints(){return[336,296,334,293,300,383,285,295,282,283,276,353]}}},25693:(_e,ie,g)=>{"use strict";g.d(ie,{b:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{getFacialLengthFactor(){return.2}updatePointsForSelection(d,e){if(null!=d&&null!=d.getLandmarks()){let l=[],_=[],C=[];switch(e){case G.I.LIP_LIFT:l=[0,37,39,40,185,146,91,181,84],_=[267,269,270,409,375,321,405,314,17],C=[216,206,203,98,97,2,326,327,423,426,436,212,202,204,194,201,200,421,418,424,422,432];break;case G.I.LIP_SIZE:l=[0,37,39,40,185,61,146,91,181,84],_=[267,269,270,409,291,375,321,405,314,17],C=[216,206,203,98,97,2,326,327,423,426,436,212,202,204,194,201,200,421,418,424,422,432];break;case G.I.LIP_WIDTH:l=[37,39,40,212,91,181,84],_=[267,269,270,432,321,405,314],C=[0,11,12,13,14,15,16,17,207,205,203,98,97,2,326,327,423,425,427,210,204,203,202,201,200,428,262,431,430,364];break;case G.I.LIP_UPPER:case G.I.LIP_UPPER:l=[61,185,40,39,37,0,267,269,270,409,291],_=[],C=[216,206,203,98,97,2,326,327,423,426,436,57,95,88,178,87,14,317,402,318,324,287];break;case G.I.LIP_LOWER:l=[146,91,181,84,17,314,405,321,375],_=[],C=[191,80,81,82,13,312,311,310,415,308,292,57,43,106,182,83,18,313,406,335,273,287];break;case G.I.LIP_SMILE:const x=[267,269,270,409,291],E=[17,84,181,91,146],M=[314,405,321,375],R=[17,0,192,187,205,36,203,98,97,2,326,327,423,266,425,411,416,135,210,211,32,208,199,428,262,431,430,364],I=o.tj.getArrayIndexToPointList([0,37,39,40,185,61],d),D=o.tj.getArrayIndexToPointList(x,d),p=o.tj.getArrayIndexToPointList(E,d),u=o.tj.getArrayIndexToPointList(M,d);return this.addContoursForSmilePoints(I,D,p,u,R,d,e)}if(l.length>0)return this.evaluateAndAddPoints(l,_,C,d,e)}}addContoursForSmilePoints(d,e,l,_,C,S,x){const E=S.getFacialLength(),M=S.getFacialAngle(x),R=[],I=[];this.getMotionPointsForSmile(d,E,M,!0,I,R),this.getMotionPointsForSmile(l,E,M,!0,I,R),this.getMotionPointsForSmile(e,E,M,!1,I,R),this.getMotionPointsForSmile(_,E,M,!1,I,R);const D=o.tj.getArrayIndexToPointList(C,S);return{staticPointArray:P.k.minusArray(D,[...R,...I]),startPointArray:I,endPointArray:R}}getMotionPointsForSmile(d,e,l,_,C,S){const E=e*this.getFacialLengthFactor();for(let M=0;M<d.length;M++){const R=d[M],I=R.x+.05*E*M*Math.cos(l)*(_?1:-1),D=R.y+.1*E*M*Math.sin(l);0!=M&&(S.push(new P.b(I,D)),C.push(R))}}evaluateAndAddPoints(d,e,l,_,C){const S=[],x=[],E=[],M=[],R=[];R.push(...o.tj.getArrayIndexListToPointList(o.tj.getFaceStaticPointArray(),_)),R.push(...o.tj.getArrayIndexToPointList(l,_)),S.push(...o.tj.getArrayIndexToPointList(d,_)),x.push(...o.tj.getArrayIndexToPointList(e,_));const I=[];I.push(...S),I.push(...x);let D=0,p=0;for(const m of I)D+=m.x,p+=m.y;D/=I.length,p/=I.length;for(const m of S){const b=this.getUpdatedPoint(m,D,p,_,C);null!=b&&(E.push(b),M.push(m))}for(const m of x){const b=this.getUpdatedPoint(m,D,p,_,C);null!=b&&(E.push(b),M.push(m))}return{staticPointArray:P.k.minusArray(R,[...E,...M]),startPointArray:M,endPointArray:E}}getUpdatedPoint(d,e,l,_,C){const S=_.getFacialLength()*this.getFacialLengthFactor();switch(C){case G.I.LIP_SIZE:return new P.b(e+1.2*(d.x-e),l+1.2*(d.y-l));case G.I.LIP_WIDTH:return new P.b(e+1.2*(d.x-e),d.y);case G.I.LIP_LIFT:case G.I.LIP_UPPER:{const x=d.x+.1*S*Math.cos(_.getFacialAngle(C)),E=d.y+.1*S*Math.sin(_.getFacialAngle(C));return new P.b(x,E)}case G.I.LIP_LOWER:{const x=d.x-.1*S*Math.cos(_.getFacialAngle(C)),E=d.y-.1*S*Math.sin(_.getFacialAngle(C));return new P.b(x,E)}}return null}}},57160:(_e,ie,g)=>{"use strict";g.d(ie,{g:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{updatePointsForSelection(d,e){if(null!=d&&null!=d.getLandmarks())switch(e){case G.I.NOSE_SIZE:return this.noseSizeChange(0,d);case G.I.NOSE_WIDTH:return this.noseWidthChange(!1,d);case G.I.NOSE_TIP:return this.noseWidthChange(!0,d);case G.I.NOSE_WING:return this.noseSizeChange(1,d);case G.I.NOSE_BRIDGE:return this.noseSizeChange(2,d);case G.I.NOSE_LIFT:return this.noseSizeChange(3,d)}}noseWidthChange(d,e){let l=[],_=[],C=[],S=[];S.push(...o.tj.getArrayIndexListToPointList(o.tj.getFaceStaticPointArray(),e)),d?(l=[220,237,238,20,242,97],_=[440,457,458,250,462,326],C=[245,188,174,236,134,465,412,399,456,363,8,168,6,167,195,5,4,1,19,94,164]):(l=[188,174,236,134,220,237,239,20],_=[412,399,456,363,440,457,459,250],C=[8,168,6,167,195,5,4,1,19,94,164]);const x=o.tj.getArrayIndexToPointList(l,e),E=o.tj.getArrayIndexToPointList(_,e);S.push(...o.tj.getArrayIndexToPointList(C,e));const M=[],R=[];return this.addContoursForWidthPoints(x,E,S,d,M,R),{staticPointArray:P.k.minusArray(S,[...M,...R]),startPointArray:R,endPointArray:M}}
1addContoursForWidthPoints(d,e,l,_,C,S){const x=[],E=[];x.push(...d),x.push(...e);for(const R of l)o.tj.isDynamicPoint(x,R)||E.push(R);const M=Math.min(d.length,e.length);for(let R=0;R<M;R++){const I=d[R],D=e[R],p=.5*P.k.calculateDistanceB(I,D),u=this.pointsOnLineFrom(I,D,p),m=this.pointsOnLineFrom(I,D,2*p);C.push(u[0]),C.push(u[1]),S.push(I),S.push(D),E.push(m[0]),E.push(m[1])}}pointsOnLineFrom(d,e,l){const _=e.x-d.x,C=e.y-d.y,S=P.k.calculateDistanceB(d,e);if(0==S)return[new P.b(d.x,d.y),new P.b(d.x,d.y)];const x=_/S,E=C/S,M=new P.b(e.x+l*x,e.y+l*E);return[new P.b(d.x-l*x,d.y-l*E),M]}noseSizeChange(d,e){let l=[],_=[],C=[],S=[];switch(S.push(...o.tj.getArrayIndexListToPointList(o.tj.getFaceStaticPointArray(),e)),d){case 0:l=[188,114,217,126,142,129,98,97,2],_=[412,343,437,355,371,358,327,326],C=[193,417,186,185,40,39,37,0,267,269,270,409,243,112,26,231,463,341,256,451];break;case 1:l=[126,142,129,98,97,2],_=[355,371,358,327,326],C=[417,465,412,343,193,245,188,114,186,185,40,39,37,0,267,269,270,409];break;case 2:l=[188,114,217,198],_=[412,343,437,420],C=[417,193,142,129,98,97,2,371,358,327,326,243,112,26,231,463,341,256,451];break;case 3:l=[129,98,97],_=[358,327,326],C=[142,371,36,205,266,425,217,126,437,355,100,47,114,174,196,197,419,399,277,186,185,40,39,37,0,267,269,270,409]}let x=o.tj.getArrayIndexToPointList(l,e),E=o.tj.getArrayIndexToPointList(_,e);S.push(...o.tj.getArrayIndexToPointList(C,e));const M=[],R=[];return this.addContoursForNosePoints(x,E,S,d,M,R,e),{staticPointArray:P.k.minusArray(S,[...M,...R]),startPointArray:R,endPointArray:M}}addContoursForNosePoints(d,e,l,_,C,S,x){let E=[];[].push(...l),E.push(...d),E.push(...e);let R=0,I=0;for(const D of E)R+=D.x,I+=D.y;R/=E.length,I/=E.length;for(const D of E){const p=this.getModifiedPoint(D,R,I,!1,_,x),u=this.getModifiedPoint(D,R,I,!0,_,x);null!=p&&(S.push(D),C.push(p)),null!=u&&l.push(u)}}getModifiedPoint(d,e,l,_,C,S){let x=0,E=0,M=S.getFacialAngleX(),R=S.getFacialAngleY(),I=S.getFacialLength()*this.getFacialLengthFactor();switch(C){case 0:_?(x=e+.7*(d.x-e),E=l+.7*(d.y-l)):(x=e+1.2*(d.x-e),E=l+1.2*(d.y-l));break;case 1:_?(x=d.x-.3*(d.x-e)*Math.cos(M),E=d.y-.3*(d.x-e)*Math.sin(M)):(x=d.x+.2*(d.x-e)*Math.cos(M),E=d.y+.2*(d.x-e)*Math.sin(M));break;case 2:_?(x=d.x-.4*(d.x-e)*Math.cos(M),E=d.y-.4*(d.x-e)*Math.sin(M)):(x=d.x+.3*(d.x-e)*Math.cos(M),E=d.y+.3*(d.x-e)*Math.sin(M));break;case 3:if(_)return null;x=d.x-.7*I*Math.cos(R),E=d.y-.7*I*Math.sin(R)}return new P.b(x,E)}}},61355:(_e,ie,g)=>{"use strict";g.d(ie,{tj:()=>o});var n=g(40580);class o{static getFaceStaticPointArray(){return[103,54,21,162,127,234,93,132,58,172,136,150,149,176,148,152,377,400,378,379,365,397,288,435,361,401,323,454,356,389,251,284,332,297,338,10,109,67]}static getLeftEyebrowTopPointArray(){return[70,63,105,66,107]}static getLeftEyebrowBottomPointArray(){return[46,53,52,65,55]}static getRightEyebrowTopPointArray(){return[336,296,334,293,300]}static getRightEyebrowBottomPointArray(){return[285,295,282,283,276]}static getLeftEyebrowStaticPointArray(){return[139,71,68,104,69,108,151,113,225,224,223,222,221,189]}static getRightEyebrowStaticPointArray(){return[151,337,299,333,298,301,368,342,445,444,443,442,441,413]}static getLeftEyebrowDynamicWidthPointArray(){return[156,70,63,105,66,124,46,53,52,65]}static getRightEyebrowDynamicWidthPointArray(){return[296,334,293,300,383,295,282,283,276,353]}static getRightEyebrowExtraStaticPointArray(){return[9,383,353,8,417,413,414,286,258,257,259,260,467,342]}static getRightEyeStaticPointArray(){return[417,285,295,282,283,276,353,265,340,346,347,348,349,350,357,465]}static getLeftEyeTopPointArray(){return[113,225,224,223,222,221,189]}static getLeftEyeBottomPointArray(){return[31,228,229,230,231,232,233]}static getRightEyeTopPointArray(){return[413,441,442,443,444,445,342]}static getRightEyeBottomPointArray(){return[453,452,451,450,449,448,261]}static getArrayIndexListToPointList(a,d){const e=[];for(const l of a){const _=d.getLandmarks()[l],C=new n.b(_.x*d.getWidth(),_.y*d.getHeight());e.push(C)}return e}static getArrayIndexToPointList(a,d){const e=[];for(const l of a){const _=d.getLandmarks()[l],C=new n.b(_.x*d.getWidth(),_.y*d.getHeight());e.push(C)}return e}static isDynamic(a,d){for(const e of a)if(e.startPoint.x==d.x&&e.startPoint.y==d.y)return!0;return!1}static isDynamicPoint(a,d){for(const e of a)if(e.x==d.x&&e.y==d.y)return!0;return!1}static getCenter(a){let d=0,e=0;for(const _ of a)d+=_.x,e+=_.y;const l=a.length;return 0==l?new n.b(0,0):new n.b(d/l,e/l)}static updateMotionPointsMotionPoints(a,d,e){if(null==a||null==d||null==e)throw new Error("Input point arrays cannot be null");const l=[...a,...d],_=[];for(const C of e)null!=C&&!this.isDynamic(l,C)&&_.push(C);return{dynamicPointArray:l,resultStaticPoints:_}}static findCentroid(a){if(0===a.length)return{x:0,y:0};const d=a.reduce((l,_)=>l+_.x,0),e=a.reduce((l,_)=>l+_.y,0);return{x:d/a.length,y:e/a.length}}static zoomPolygon(a,d){if(0===a.length)return[];const e=this.findCentroid(a),l=[];for(const _ of a)l.push({x:e.x+(_.x-e.x)*d,y:e.y+(_.y-e.y)*d});return l}}},16966:(_e,ie,g)=>{"use strict";g.d(ie,{g:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{updatePointsForSelection(d,e){if(null==d)return;const l=[],_=[],C=[],S=d.getFacialLength()*this.getFacialLengthFactor();if(null!=d.getLandmarks()){const x=d.getWidth(),E=d.getHeight(),M=[],R=[];M.push(...o.tj.getFaceStaticPointArray());for(const D of M){const p=d.getLandmarks()[D],u=new P.b(p.x*x,p.y*E);l.push(u)}switch(e){case G.I.RATIO_TOP:l.push(...o.tj.zoomPolygon(l,2.2));for(const u of this.getRatioTopDynamicPointsArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);R.push(b)}for(let u=0;u<R.length;u++){const m=R[u];let b=2*S;0==u||u==R.length-1?b*=.5:1==u||u==R.length-2||(b*=1.2);let k=d.getFacialAngle(e)-Math.PI,A=m.x-b*Math.cos(k),B=m.y-b*Math.sin(k);const y=new P.b(A,B);_.push(y),b=3.5*d.getFacialAngle(e),k=d.getFacialAngle(e)-Math.PI,A=m.x-b*Math.cos(k),B=m.y-b*Math.sin(k);const O=new P.b(A,B);C.push(O)}break;case G.I.RATIO_UPPER:const D=o.tj.zoomPolygon(l,.85),p=o.tj.zoomPolygon(l,2.5);l.push(...D,...p);for(const u of this.getRatioUpperDynamicPointsArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);R.push(b)}for(let u=0;u<R.length;u++){const m=R[u];let b=d.getFacialAngle(e)-Math.PI,k=S;0==u||u==R.length-1?k*=.5:1==u||u==R.length-2||(k*=1.2);
1const A=m.x-k*Math.cos(b),B=m.y-k*Math.sin(b);_.push(m),C.push(new P.b(A,B))}break;case G.I.RATIO_MIDDLE:for(const u of this.getRatioMiddleStaticPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);l.push(b)}for(const u of this.getRatioMiddleStaticPointExtraArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);l.push(b)}for(const u of this.getRatioMiddleBottomPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E),k=b.x-1.4*S*Math.cos(d.getFacialAngle(e)),A=b.y-1.4*S*Math.sin(d.getFacialAngle(e));l.push(new P.b(k,A));const B=b.x-.7*S*Math.cos(d.getFacialAngle(e)),y=b.y-.7*S*Math.sin(d.getFacialAngle(e));_.push(b),C.push(new P.b(B,y))}for(const u of this.getRatioMiddleUpperPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E),k=b.x-.7*S*Math.cos(d.getFacialAngle(e)),A=b.y-.7*S*Math.sin(d.getFacialAngle(e));_.push(b),C.push(new P.b(k,A))}break;case G.I.RATIO_LOWER:for(const u of this.getRatioLowerStaticPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);l.push(b)}for(const u of this.getRatioLowerStaticPointExtraArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E);l.push(b)}for(const u of this.getRatioLowerBottomPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E),k=b.x-1.4*S*Math.cos(d.getFacialAngle(e)),A=b.y-1.4*S*Math.sin(d.getFacialAngle(e));l.push(new P.b(k,A));const B=b.x-.7*S*Math.cos(d.getFacialAngle(e)),y=b.y-.7*S*Math.sin(d.getFacialAngle(e));_.push(b),C.push(new P.b(B,y))}for(const u of this.getRatioLowerUpperPointArray()){const m=d.getLandmarks()[u],b=new P.b(m.x*x,m.y*E),k=b.x-.7*S*Math.cos(d.getFacialAngle(e)),A=b.y-.7*S*Math.sin(d.getFacialAngle(e));_.push(b),C.push(new P.b(k,A))}}return l.push(new P.b(0,0)),l.push(new P.b(x,0)),l.push(new P.b(x,E)),l.push(new P.b(0,E)),{staticPointArray:P.k.minusArray(l,[...C,..._]),startPointArray:_,endPointArray:C}}}getRatioTopDynamicPointsArray(){return[21,54,103,67,109,10,338,297,332,284,251]}getRatioUpperDynamicPointsArray(){return[54,103,67,109,10,338,297,332,284]}getRatioMiddleStaticPointsArray(){return[123,101,120,121,128,122,351,412,357,350,349,330,352,323,132,137,366,361]}getRatioMiddleDynamicTopPointsArray(){return[123,101,120,121,128,122,351,412,357,350,349,330,352,323,132,137,366,361]}getRatioMiddleUpperPointArray(){return[205,36,142,126,217,174,196,197,419,399,437,355,371,266,425]}getRatioMiddleBottomPointArray(){return[172,136,150,149,176,148,152,377,400,378,379,365,397]}getRatioMiddleStaticPointArray(){return[123,101,120,121,128,122,351,412,357,350,349,330,352,323]}getRatioMiddleStaticPointExtraArray(){return[132,137,366,361]}getRatioLowerStaticPointArray(){return[123,50,205,203,203,98,97,2,326,327,423,425,280,352,401,323]}getRatioLowerStaticPointExtraArray(){return[93,137,288,361]}getRatioLowerUpperPointArray(){return[177,147,187,207,206,165,167,164,393,391,426,411,376,427,411]}getRatioLowerBottomPointArray(){return[132,58,172,136,150,149,176,148,152,377,400,378,379,365,397]}}},83316:(_e,ie,g)=>{"use strict";g.d(ie,{y:()=>h});var n=g(42498),o=g(61355),G=g(10235),P=g(40580);class h extends n.W{updatePointsForSelection(d,e){const l=[],_=[];let C=[],S=[];const x=d.getFacialLength()*this.getFacialLengthFactor();if(null!=d.getLandmarks()){const E=d.getWidth(),M=d.getHeight();for(const p of o.tj.getFaceStaticPointArray()){const u=d.getLandmarks()[p],m=new P.b(u.x*E,u.y*M);_.push(m)}const R=[],I=[];switch(e){case G.I.SHAPE_SLIM:{const p=[132,58,172,136,150,149,176,148],u=[377,400,378,379,365,397,288,435,361,401];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m&&(A*=.5),m==p.length-1||(A*=m==p.length-2?1.2:1.3);const B=d.getFacialAngle(e),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m&&(A*=.5),A*=m==p.length-2?1.2:1.3;const B=d.getFacialAngle(e),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_WIDTH:{const p=[21,162,127,234,93,132,58,172,136],u=[251,389,356,454,323,401,361,435,288,397,365];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m||m==p.length-1?A*=.5:1==m||m==p.length-2||(A*=1.3);const B=d.getFacialAngleX(),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m||m==u.length-1?A*=.5:1==m||m==u.length-2||(A*=1.3);const B=d.getFacialAngleX(),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.65),l.push(...C,...S,..._),l.push(new P.b(0,0)),l.push(new P.b(0,M)),l.push(new P.b(E,0)),l.push(new P.b(E,M));break}case G.I.SHAPE_CHEEKBONE:{const p=[127,234,93,132],u=[356,454,323,401,361];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_JAW:{const p=[132,58,172,136],u=[401,361,435,288,397,365];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_TEMPLES:{const p=[54,21,162,127],u=[284,251,389,356];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||3==m)&&(A*=.5);const B=d.getFacialAngle(e),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_FOREHEAD:{const p=[21,54,103,67,109,10,338,297,332,284,251];for(const u of p){const m=d.getLandmarks()[u],b=new P.b(m.x*E,m.y*M);R.push(b);let k=x;0==u||u==p.length-1?k*=.5:1==u||u==p.length-2||(k*=1.2);const A=d.getFacialAngle(e)-Math.PI,B=new P.b(b.x-k*Math.cos(A),b.y-k*Math.sin(A));I.push(B)}C=o.tj.zoomPolygon(_,.85),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_CHIN:{const p=[172,136,150,149,176,148,152,377,400,378,379,365,397];for(const u of p){const m=d.getLandmarks()[u],b=new P.b(m.x*E,m.y*M);R.push(b);let k=x;0==u||u==p.length-1?k*=.5:1==u||u==p.length-2||(k*=1.3);const A=d.getFacialAngle(e)-Math.PI,B=new P.b(b.x+k*Math.cos(A),b.y+k*Math.sin(A));I.push(B)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}case G.I.SHAPE_VSHAPE:{const p=[172,136,150,149,176,148],u=[397,365,379,378,400,377];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||5==m)&&(A*=.5);const B=d.getFacialAngleX(),y=d.getFacialAngleY(),O=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(y));I.push(O)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;(0==m||5==m)&&(A*=.5);const B=d.getFacialAngleX(),y=d.getFacialAngleY(),O=new P.b(k.x-A*Math.cos(B),k.y+A*Math.sin(y));I.push(O)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._);break}default:{const p=[132,58,172,136,150,149,176,148],u=[377,400,378,379,365,397,288,435,361,401];for(const m of p){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m&&(A*=.5),m==p.length-1||(A*=m==p.length-2?1.2:1.3);const B=d.getFacialAngle(G.I.SHAPE_SLIM),y=new P.b(k.x+A*Math.cos(B),k.y+A*Math.sin(B));I.push(y)}for(const m of u){const b=d.getLandmarks()[m],k=new P.b(b.x*E,b.y*M);R.push(k);let A=x;0==m&&(A*=.5),A*=m==p.length-2?1.2:1.3;const B=d.getFacialAngle(G.I.SHAPE_SLIM),y=new P.b(k.x-A*Math.cos(B),k.y-A*Math.sin(B));I.push(y)}C=o.tj.zoomPolygon(_,.75),S=o.tj.zoomPolygon(_,1.5),l.push(...C,...S,..._)}}return{staticPointArray:P.k.minusArray(l,[...I,...R]),startPointArray:R,endPointArray:I}}}}},40580:(_e,ie,g)=>{"use strict";g.d(ie,{b:()=>P,k:()=>G});var n=g(10235);class G{static calculateDistanceA(a,d){const e=d.x-a.x,l=d.y-a.y;return Math.sqrt(e*e+l*l)}static calculateDistanceB(a,d){const e=d.x-a.x,l=d.y-a.y;return Math.sqrt(e*e+l*l)}static calculateAngle(a,d){return Math.atan2(d.y-a.y,d.x-a.x)}static getAngle(a,d,e){return G.yShapes.has(a)?d:e}static minusArray(a,d){return a.filter(e=>!d.some(l=>e.x===l.x&&e.y===l.y))}}G.yShapes=new Set([n.I.EYEBROW_LENGTH,n.I.EYEBROW_DISTANCE,n.I.RATIO_TOP,n.I.RATIO_UPPER,n.I.RATIO_MIDDLE,n.I.RATIO_LOWER,n.I.EYE_WIDTH,n.I.EYE_DISTANCE,n.I.LIP_UPPER,n.I.LIP_LOWER,n.I.LIP_SMILE,n.I.LIP_LIFT,n.I.SHAPE_FOREHEAD,n.I.SHAPE_CHIN]);class P{constructor(a,d){this.x=a,this.y=d}}},62922:(_e,ie,g)=>{"use strict";g.d(ie,{s:()=>n});
1class n{static computeAffineFromTriangles(G,P,h,a,d,e){return this.solve6x6([[a.x,a.y,1,0,0,0],[0,0,0,a.x,a.y,1],[d.x,d.y,1,0,0,0],[0,0,0,d.x,d.y,1],[e.x,e.y,1,0,0,0],[0,0,0,e.x,e.y,1]],[G.x,G.y,P.x,P.y,h.x,h.y])}static solve6x6(G,P){const a=G.map(e=>e.slice()),d=P.slice();for(let e=0;e<6;e++){let l=e;for(let C=e+1;C<6;C++)Math.abs(a[C][e])>Math.abs(a[l][e])&&(l=C);[a[e],a[l]]=[a[l],a[e]],[d[e],d[l]]=[d[l],d[e]];const _=a[e][e];for(let C=e;C<6;C++)a[e][C]/=_;d[e]/=_;for(let C=0;C<6;C++){if(C===e)continue;const S=a[C][e];for(let x=e;x<6;x++)a[C][x]-=S*a[e][x];d[C]-=S*d[e]}}return d}}},98081:(_e,ie,g)=>{"use strict";g.d(ie,{x:()=>G});var n=g(10467),o=g(54438);let G=(()=>{var P;class h{constructor(){this.faceLandmarker=null,this.initialized=!1}waitForMediaPipe(){return(0,n.A)(function*(){return new Promise((d,e)=>{let _=0;const C=setInterval(()=>{window.FilesetResolver&&window.FaceLandmarker?(clearInterval(C),d({FilesetResolver:window.FilesetResolver,FaceLandmarker:window.FaceLandmarker})):_>=50&&(clearInterval(C),e(new Error("MediaPipe Tasks Vision library not loaded after timeout."))),_++},500)})})()}initialize(){var d=this;return(0,n.A)(function*(){if(d.initialized)return;const e=yield d.waitForMediaPipe();if(!e)throw new Error("MediaPipe Tasks Vision library not loaded.");const l=yield e.FilesetResolver.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm");d.faceLandmarker=yield e.FaceLandmarker.createFromOptions(l,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},runningMode:"IMAGE",numFaces:1,outputFaceBlendshapes:!1,outputFacialTransformationMatrixes:!1}),d.initialized=!0})()}getLandmarks(d){var e=this;return(0,n.A)(function*(){if(!e.initialized||!e.faceLandmarker)throw new Error("FaceLandmarker not initialized. Call initialize() first.");return(yield e.faceLandmarker.detect(d)).faceLandmarks})()}getFaceLandmarker(){return this.faceLandmarker}}return(P=h).\u0275fac=function(d){return new(d||P)},P.\u0275prov=o.jDH({token:P,factory:P.\u0275fac}),h})()},10235:(_e,ie,g)=>{"use strict";g.d(ie,{I:()=>n});var n=function(o){return o[o.EYEBROW_LIFT=0]="EYEBROW_LIFT",o[o.EYE_LIFT=1]="EYE_LIFT",o[o.EYE_DISTANCE=2]="EYE_DISTANCE",o[o.EYE_HEIGHT=3]="EYE_HEIGHT",o[o.NOSE_WIDTH=4]="NOSE_WIDTH",o[o.NOSE_TIP=5]="NOSE_TIP",o[o.EYE_SIZE=6]="EYE_SIZE",o[o.EYEBROW_PEAK=7]="EYEBROW_PEAK",o[o.EYEBROW_TILT=8]="EYEBROW_TILT",o[o.EYE_TILT=9]="EYE_TILT",o[o.NOSE_WING=10]="NOSE_WING",o[o.RATIO_MIDDLE=11]="RATIO_MIDDLE",o[o.NOSE_BRIDGE=12]="NOSE_BRIDGE",o[o.NOSE_LIFT=13]="NOSE_LIFT",o[o.NOSE_SIZE=14]="NOSE_SIZE",o[o.RATIO_TOP=15]="RATIO_TOP",o[o.RATIO_UPPER=16]="RATIO_UPPER",o[o.RATIO_LOWER=17]="RATIO_LOWER",o[o.SHAPE_CHIN=18]="SHAPE_CHIN",o[o.SHAPE_VSHAPE=19]="SHAPE_VSHAPE",o[o.SHAPE_SLIM=20]="SHAPE_SLIM",o[o.EYEBROW_LENGTH=21]="EYEBROW_LENGTH",o[o.EYEBROW_DISTANCE=22]="EYEBROW_DISTANCE",o[o.EYE_WIDTH=23]="EYE_WIDTH",o[o.EYEBROW_THICKNESS=24]="EYEBROW_THICKNESS",o[o.LIP_SMILE=25]="LIP_SMILE",o[o.SHAPE_JAW=26]="SHAPE_JAW",o[o.SHAPE_FOREHEAD=27]="SHAPE_FOREHEAD",o[o.SHAPE_CHEEKBONE=28]="SHAPE_CHEEKBONE",o[o.LIP_UPPER=29]="LIP_UPPER",o[o.LIP_LOWER=30]="LIP_LOWER",o[o.LIP_SIZE=31]="LIP_SIZE",o[o.LIP_LIFT=32]="LIP_LIFT",o[o.LIP_WIDTH=33]="LIP_WIDTH",o[o.SHAPE_WIDTH=34]="SHAPE_WIDTH",o[o.SHAPE_TEMPLES=35]="SHAPE_TEMPLES",o}(n||{})},7259:(_e,ie,g)=>{"use strict";g.d(ie,{IX:()=>o,Jy:()=>d});var n=g(10235),o=function(e){return e.SHAPE="Shape",e.RATIO="Ratio",e.EYEBROWS="Eyebrows",e.EYES="Eyes",e.NOSE="Nose",e.LIPS="Lips",e}(o||{});const d=[{name:"Shape",type:o.SHAPE,subtools:[{name:"Chin",type:n.I.SHAPE_CHIN,pro:!1,iconName:"shapechin",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"V-shape",type:n.I.SHAPE_VSHAPE,pro:!1,iconName:"shapev",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Slim",type:n.I.SHAPE_SLIM,pro:!0,iconName:"shapeslim",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Width",type:n.I.SHAPE_WIDTH,pro:!0,iconName:"shapewidth",values:{both:{current:0,previous:0}
1,left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Jaw",type:n.I.SHAPE_JAW,pro:!0,iconName:"shapejaw",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Cheekbone",type:n.I.SHAPE_CHEEKBONE,pro:!1,iconName:"shapecheekbones",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Forehead",type:n.I.SHAPE_FOREHEAD,pro:!1,iconName:"shapeforhead",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Temples",type:n.I.SHAPE_TEMPLES,pro:!1,iconName:"shapetemples",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]},{name:"Ratio",type:o.RATIO,subtools:[{name:"Top",type:n.I.RATIO_TOP,pro:!1,iconName:"ratiotop",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Upper",type:n.I.RATIO_UPPER,pro:!0,iconName:"ratioupper",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Middle",type:n.I.RATIO_MIDDLE,pro:!0,iconName:"ratiomiddle",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lower",type:n.I.RATIO_LOWER,pro:!1,iconName:"ratiolower",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]},{name:"Eyebrows",type:o.EYEBROWS,subtools:[{name:"Length",type:n.I.EYEBROW_LENGTH,pro:!1,iconName:"eyebrowlength",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Thickness",type:n.I.EYEBROW_THICKNESS,pro:!0,iconName:"eyebrowthikness",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lift",type:n.I.EYEBROW_LIFT,pro:!1,iconName:"eyebrowlift",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Peak",type:n.I.EYEBROW_PEAK,pro:!0,iconName:"eyebrowpeak",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Tilt",type:n.I.EYEBROW_TILT,pro:!0,iconName:"eyebrowtilt",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Distance",type:n.I.EYEBROW_DISTANCE,pro:!1,iconName:"eyebrowdistance",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]},{name:"Eyes",type:o.EYES,subtools:[{name:"Width",type:n.I.EYE_WIDTH,pro:!1,iconName:"eyeswidth",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Size",type:n.I.EYE_SIZE,pro:!0,iconName:"eyessize",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lift",type:n.I.EYE_LIFT,pro:!1,iconName:"eyeslift",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Height",type:n.I.EYE_HEIGHT,pro:!0,iconName:"eyesheight",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Tilt",type:n.I.EYE_TILT,pro:!1,iconName:"eyestilt",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Distance",type:n.I.EYE_DISTANCE,pro:!1,iconName:"eyesdistance",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]},{name:"Nose",type:o.NOSE,subtools:[{name:"Tip",type:n.I.NOSE_TIP,pro:!1,iconName:"nosetip",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Wing",type:n.I.NOSE_WING,pro:!1,iconName:"nosewing",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Size",type:n.I.NOSE_SIZE,pro:!0,iconName:"nosesize",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Width",type:n.I.NOSE_WIDTH,pro:!0,iconName:"nosewidth",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lift",type:n.I.NOSE_LIFT,pro:!1,iconName:"noselift",values:{both:{current:0,previous:0}
1,left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Bridge",type:n.I.NOSE_BRIDGE,pro:!0,iconName:"nosebridge",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]},{name:"Lips",type:o.LIPS,subtools:[{name:"Size",type:n.I.LIP_SIZE,pro:!1,iconName:"lipssize",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lift",type:n.I.LIP_LIFT,pro:!1,iconName:"lipslift",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Width",type:n.I.LIP_WIDTH,pro:!1,iconName:"lipswidth",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Upper Lip",type:n.I.LIP_UPPER,pro:!0,iconName:"lipsupper",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Lower Lip",type:n.I.LIP_LOWER,pro:!0,iconName:"lipslower",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}},{name:"Smile",type:n.I.LIP_SMILE,pro:!0,iconName:"lipssmile",values:{both:{current:0,previous:0},left:{current:0,previous:0},right:{current:0,previous:0}}}]}]},39762:(_e,ie,g)=>{"use strict";g.d(ie,{V:()=>x});var n=g(93552),G=g(84412),P=g(21413),h=g(70152),_=(g(786),g(31284),g(54438)),C=g(21626),S=g(68287);let x=(()=>{var E;class M{constructor(I,D){this.http=I,this.env=D,this.tabChange=new G.t(!1),this.isAllEdit=!1,this.colorWheel=!1,this.faceMasks=new Map,this.filterColorMap=new Map,this.onChange$=new P.B,this.filterColorMap.set("Eyes",[{r:55,g:90,b:140},{r:62,g:73,b:137}]),this.filterColorMap.set("Eyebrows",[{r:43,g:117,b:142},{r:49,g:104,b:142}]),this.filterColorMap.set("Teeth",[{r:31,g:158,b:137}]),this.filterColorMap.set("Lips",[{r:53,g:183,b:121},{r:37,g:171,b:130}]),this.filterColorMap.set("Hair",[{r:110,g:206,b:88}]),this.filterColorMap.set("Skin",[{r:72,g:22,b:104},{r:72,g:40,b:120},{r:218,g:227,b:25},{r:181,g:222,b:43},{r:144,g:215,b:67},{r:33,g:145,b:140},{r:38,g:130,b:142}]),this.onChange$.pipe((0,h.B)(0)).subscribe(p=>{p()})}reset(I=null){this.allmaskFabricImage=null,this.hairMaskImageData=null,this.faceMasks=new Map,this.imageEdited(!1,I)}imageEdited(I,D=null){I&&D?(D.isDirty=!0,D.isExportable=!0,D.isCompareEnable=!0):D&&(D.isDirty=!1,D.isExportable=!1,D.isCompareEnable=!1)}setAllmaskFabricImage(I){this.allmaskFabricImage=I}getAllmaskFabricImage(){return this.allmaskFabricImage}setHairMaskImageData(I){this.hairMaskImageData=I,this.faceMasks.set("Hair",this.hairMaskImageData)}setSkinMaskImageData(I){this.skinMaskImageData=I,this.faceMasks.set("Skin",this.skinMaskImageData)}getMask(I){if(this.allmaskFabricImage){if(!this.faceMasks.has(I)){if("Hair"===I)return null;this.faceMasks.set(I,this.extractMask(I))}return this.faceMasks.get(I)}return null}fillmaskMap(){this.faceMasks.set("Teeth",this.extractMask("Teeth")),this.faceMasks.set("Lips",this.extractMask("Lips")),this.faceMasks.set("Eyebrows",this.extractMask("Eyebrows")),this.faceMasks.set("Eyes",this.extractMask("Eyes")),this.faceMasks.set("Skin",this.extractMask("Skin"))}extractMask(I){const D=this.hairMaskImageData.width,p=this.hairMaskImageData.height;let u;this.allmaskFabricImage.filters=[],u="Teeth"==I?new n.fabric.Image.filters.ReTouchMaskTeeth:"Skin"==I?new n.fabric.Image.filters.ReTouchMaskSkin:new n.fabric.Image.filters.ReTouchMask,u.red=[],u.green=[],u.blue=[];const m=this.filterColorMap.get(I);u.colorCount=m.length,u.fragmentSource=null,u.createFragmentSource();for(const k of m)u.red.push(k.r),u.green.push(k.g),u.blue.push(k.b);if(this.allmaskFabricImage.filters.push(u),"Eyebrows"==I){const k=new n.fabric.Image.filters.BlurRetouch({blur:.2});this.allmaskFabricImage.filters.push(k)}else if("Skin"==I){const k=new n.fabric.Image.filters.Blur({blur:.2});this.allmaskFabricImage.filters.push(k)}else{const k=new n.fabric.Image.filters.Blur({blur:.04});this.allmaskFabricImage.filters.push(k)}let b;if(this.allmaskFabricImage.canvas)b=this.allmaskFabricImage.canvas;
1else{const k=n.fabric.util.createCanvasElement();k.width=D,k.height=p,b=new n.fabric.Canvas(k,{enableRetinaScaling:!1}),b.add(this.allmaskFabricImage)}return this.allmaskFabricImage.applyFilters(),b.renderAll(),b.getContext().getImageData(0,0,D,p)}getHairShadsColor(){return new Promise((I,D)=>{this.http.get("assets/json/faceRetouch/face_hair_shade.json").subscribe(p=>{const m=p.hairColors.map((b,k)=>({id:k+2,name:b.colorHex,pro:b.pro,obj:b}));m.unshift({id:1,name:"#EFEEF2",pro:"",icon:"adjustment",cssClass:""}),this.env.isMobileView&&(m.unshift({id:16,name:"seperatorPipeIcon",pro:"",icon:"seperatorPipeIcon",cssClass:"pe-none border-0"}),m.unshift({id:-1,name:"#EFEEF2",pro:"",icon:"noneIcon",cssClass:""})),I(m)})})}getLipShadsColor(){return new Promise((I,D)=>{this.http.get("assets/json/faceRetouch/face_lips_shade.json").subscribe(p=>{const m=p.lipColors.map((b,k)=>({id:k+2,name:b.colorHex,pro:b.pro,obj:b}));m.unshift({id:1,name:"#EFEEF2",pro:"1",icon:"colorwheel",cssClass:""}),this.env.isMobileView&&(m.unshift({id:16,name:"",pro:"",icon:"seperatorPipeIcon",cssClass:"pe-none border-0"}),m.unshift({id:-1,name:"#EFEEF2",pro:"",icon:"noneIcon",cssClass:"",obj:{brightnessValue:0,contrastValue:0,exposureValue:0,hueValue:0,gammaValue:0,intensityValue:0}})),I(m)})})}getBlurredImageData(I,D=5){const p=document.createElement("canvas"),u=p.getContext("2d");return p.width=I.naturalWidth,p.height=I.naturalHeight,u.filter=`blur(${D=D*p.width/1e3}px)`,u.drawImage(I,0,0),u.filter="none",u.getImageData(0,0,p.width,p.height)}}return(E=M).\u0275fac=function(I){return new(I||E)(_.KVO(C.Qq),_.KVO(S.L))},E.\u0275prov=_.jDH({token:E,factory:E.\u0275fac}),M})()},60655:(_e,ie,g)=>{"use strict";g.d(ie,{J:()=>A});var n=g(10467),o=g(54438),G=g(93552),P=g(6762),h=g(93226),e=(g(44953),g(30872),g(39762)),l=g(6755),_=g(49449),C=g(68287),S=g(68010),x=g(60177),E=g(84341),M=g(36561),R=g(20753),I=g(19338),D=g(85188);function p(B,y){if(1&B){const O=o.RV6();o.j41(0,"div",2)(1,"div",3)(2,"div",4)(3,"span",5),o.EFF(4,"Light"),o.k0s(),o.j41(5,"button",6),o.bIt("click",function(){o.eBV(O);const j=o.XpG();return o.Njj(j.resetAll())}),o.EFF(6,"Reset all"),o.k0s()(),o.j41(7,"span",7),o.EFF(8,"Brightness"),o.k0s(),o.j41(9,"div",8)(10,"div",9)(11,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputBrightness(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBrightness(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(12,"div",11)(13,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBrightness(j,!1))}),o.k0s()()()(),o.j41(14,"div",13)(15,"span",7),o.EFF(16,"Contrast"),o.k0s(),o.j41(17,"div",8)(18,"div",9)(19,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputContrast(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeContrast(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(20,"div",11)(21,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeContrast(j,!1))}),o.k0s()()()(),o.j41(22,"div",14)(23,"span",7),o.EFF(24,"Exposure"),o.k0s(),o.j41(25,"div",8)(26,"div",9)(27,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputExposure(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeExposure(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(28,"div",11)(29,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeExposure(j,!1))}),o.k0s()()()(),o.j41(30,"div",13)(31,"div",15)(32,"span",5),o.EFF(33,"Warmth"),o.k0s()(),o.j41(34,"span",7),o.EFF(35,"Temperature"),o.k0s(),o.j41(36,"div",8)(37,"div",9)(38,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputTemperature(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeTemperature(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(39,"div",11)(40,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeTemperature(j,!1))}),o.k0s()()()(),o.j41(41,"div",14)(42,"span",7),o.EFF(43,"Tint"),o.k0s(),o.j41(44,"div",8)(45,"div",9)(46,"mv-sl
1ider",16),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputTint(j))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeTint(j,!0))}),o.k0s()(),o.j41(47,"div",11)(48,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeTint(j,!1))}),o.k0s()()()(),o.j41(49,"div",13)(50,"div",15)(51,"span",5),o.EFF(52,"Color"),o.k0s()(),o.j41(53,"span",7),o.EFF(54,"Hue"),o.k0s(),o.j41(55,"div",8)(56,"div",9)(57,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputHue(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHue(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(58,"div",11)(59,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHue(j,!1))}),o.k0s()()()(),o.j41(60,"div",13)(61,"span",7),o.EFF(62,"Saturation"),o.k0s(),o.j41(63,"div",8)(64,"div",9)(65,"mv-slider",16),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputSaturation(j))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeSaturation(j,!0))}),o.k0s()(),o.j41(66,"div",11)(67,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeSaturation(j,!1))}),o.k0s()()()(),o.j41(68,"div",14)(69,"span",7),o.EFF(70,"Intensity"),o.k0s(),o.j41(71,"div",8)(72,"div",9)(73,"mv-slider",16),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputHueIntensity(j))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHueIntensity(j,!0))}),o.k0s()(),o.j41(74,"div",11)(75,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHueIntensity(j,!1))}),o.k0s()()()(),o.j41(76,"div",13)(77,"div",15)(78,"span",5),o.EFF(79,"RGB"),o.k0s()(),o.j41(80,"span",7),o.EFF(81,"Red"),o.k0s(),o.j41(82,"div",8)(83,"div",9)(84,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputRed(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeRed(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(85,"div",11)(86,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeRed(j,!1))}),o.k0s()()()(),o.j41(87,"div",13)(88,"span",7),o.EFF(89,"Green"),o.k0s(),o.j41(90,"div",8)(91,"div",9)(92,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputGreen(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeGreen(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(93,"div",11)(94,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeGreen(j,!1))}),o.k0s()()()(),o.j41(95,"div",17)(96,"span",7),o.EFF(97,"Blue"),o.k0s(),o.j41(98,"div",8)(99,"div",9)(100,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputBlue(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBlue(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(101,"div",11)(102,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBlue(j,!1))}),o.k0s()()()()()}if(2&B){const O=o.XpG();o.R7$(5),o.Y8G("disabled",!O.isAllEdit),o.R7$(6),o.Y8G("value",O.colorService.brightness/.4)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.Math.round(O.colorService.brightness/.4)),o.R7$(6),o.Y8G("value",O.colorService.contrast/.4)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.Math.round(O.colorService.contrast/.4)),o.R7$(6),o.Y8G("value",O.colorService.exposure/.4)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.Math.round(O.colorService.exposure/.4)),o.R7$(9),o.Y8G("value",O.colorService.temperature)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.temperature),o.R7$(6),o.Y8G("value",O.colorService.tint)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.tint),o.R7$(9),o.Y8G("value",O.colorService.hue)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.hue),o.R7$(6),o.Y8G("value",O.colorService.saturation)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.saturation),o.R7$(6),o.Y8G("value",O.colorService.hueIntensity)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.hueIntensity),o.R7$(9),o.Y8G("value",O.colorService.red/.7)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",O.Math.round(O.colorService.red/.7)),o.R7$(6),o.Y8G("value",O.colorService.green/.7)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",O.Math.round(O.colorService.green/.7)),o.R7$(6),o.Y8G("value",O.colorService.blue/.7)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",O.Math.round(O.colorService.blue/.7))}}
1function u(B,y){if(1&B){const O=o.RV6();o.j41(0,"div")(1,"div",18)(2,"div",13)(3,"div",19)(4,"span",5),o.EFF(5,"Brightness"),o.k0s(),o.j41(6,"button",20),o.bIt("click",function(){o.eBV(O);const j=o.XpG();return o.Njj(j.resetAll())}),o.EFF(7,"Reset all"),o.k0s()(),o.j41(8,"div",8)(9,"div",9)(10,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputBrightness(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBrightness(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(11,"div",11)(12,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeBrightness(j,!1))}),o.k0s()()()(),o.j41(13,"div",13)(14,"span",5),o.EFF(15,"Contrast"),o.k0s(),o.j41(16,"div",8)(17,"div",9)(18,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputContrast(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeContrast(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(19,"div",11)(20,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeContrast(j,!1))}),o.k0s()()()(),o.j41(21,"div",13)(22,"span",5),o.EFF(23,"Saturation"),o.k0s(),o.j41(24,"div",8)(25,"div",9)(26,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputSaturation(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeSaturation(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(27,"div",11)(28,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeSaturation(j,!1))}),o.k0s()()()(),o.j41(29,"div",13)(30,"span",5),o.EFF(31,"Hue"),o.k0s(),o.j41(32,"div",8)(33,"div",9)(34,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputHue(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHue(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(35,"div",11)(36,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeHue(j,!1))}),o.k0s()()()(),o.j41(37,"div",13)(38,"span",5),o.EFF(39,"Gamma"),o.k0s(),o.j41(40,"div",8)(41,"div",9)(42,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputGamma(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeGamma(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(43,"div",11)(44,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeGamma(j,!1))}),o.k0s()()()(),o.j41(45,"div",17)(46,"span",5),o.EFF(47,"Intensity"),o.k0s(),o.j41(48,"div",8)(49,"div",9)(50,"mv-slider",10),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputIntensity(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeIntensity(j,!0))})("slideStart",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()(),o.j41(51,"div",11)(52,"input",12),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.changeIntensity(j,!1))}),o.k0s()()()()()()}if(2&B){const O=o.XpG();o.R7$(6),o.Y8G("disabled",!O.isAllEdit),o.R7$(4),o.Y8G("value",O.colorService.brightness)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.brightness),o.R7$(6),o.Y8G("value",O.colorService.contrast)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.contrast),o.R7$(6),o.Y8G("value",O.colorService.saturation)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.saturation),o.R7$(6),o.Y8G("value",O.colorService.hue)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.hue),o.R7$(6),o.Y8G("value",O.colorService.gamma)("min",-100)("max",100)("step",1),o.R7$(2),o.Y8G("min",-100)("max",100)("ngModel",O.colorService.gamma),o.R7$(6),o.Y8G("value",O.colorService.intensity)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",O.colorService.intensity)}}let m=(()=>{var B;class y{constructor(w){this.colorService=w,this.Math=Math,this.toolName="",this.isAllEdit=!1,this.onChange=new o.bkB,this.onSlide=new o.bkB}ngOnInit(){this.initialized=!0}emitChange(){this.onChange.emit(!0)}inputBrightness(w){this.changeBrightness(w.newValue,!0)}inputContrast(w){this.changeContrast(w.newValue,!0)}inputExposure(w){this.changeExposure(w.newValue,!0)}inputHue(w){this.changeHue(w.newValue,!0)}inputSaturation(w){this.changeSaturation(w.newValue,!0)}inputHueIntensity(w){this.changeHueIntensity(w.newValue,!0)}inputRed(w){this.changeRed(w.newValue,!0)}inputGreen(w){this.changeGreen(w.newValue,!0)}inputBlue(w){this.changeBlue(w.newValue,!0)}inputTemperature(w){this.changeTemperature(w.newValue,!0)}inputTint(w){this.changeTint(w.newValue,!0)}inputShadows(w){this.changeShadows(w.newValue,!0)}inputHighlights(w){this.changeHighlights(w.newValue,!0)}inputGamma(w){this.changeGamma(w.newValue,!0)}inputIntensity(w){this.changeIntensity(w.newValue,!0)}changeBrightness(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeBrightness(w*=.4,j),this.emitChange())}changeContrast(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeContrast(w*=.4,j),this.emitChange())}changeExposure(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeExposure(w*=.4,j),this.emitChange())}changeHue(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeHue(w,j),this.emitChange())}changeSaturation(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeSaturation(w,j),this.emitChange())}changeHueIntensity(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeHueIntensity(w,j),this.emitChange())}changeRed(w,j){(w=j?w:w.target.value)<101&&w>-1&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeRed(w*=.7,j),this.emitChange())}changeGreen(w,j){(w=j?w:w.target.value)<101&&w>-1&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeGreen(w*=.7,j),this.emitChange())}changeBlue(w,j){(w=j?w:w.target.value)<101&&w>-1&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeBlue(w*=.7,j),this.emitChange())}changeTemperature(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeTemperature(w,j),this.emitChange())}changeTint(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeTint(w,j),this.emitChange())}changeShadows(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeShadows(w,j),this.emitChange())}changeHighlights(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeHighlights(w,j),this.emitChange())}changeGamma(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeGamma(w,j),this.emitChange())}changeIntensity(w,j){(w=j?w:w.target.value)<101&&w>-101&&(j||(this.onSlide.emit(!0),this.isAllEdit=!0),this.colorService.changeIntensity(w,j),this.emitChange())}onSlideStart(w){this.onSlide.emit(!0),this.isAllEdit=!0}resetAll(){this.colorService.resetAll(()=>{this.emitChange(),this.isAllEdit=!1})}}return(B=y).\u0275fac=function(w){return new(w||B)(o.rXU(h.n))},B.\u0275cmp=o.VBU({type:B,selectors:[["retouch-adjustment-change-color"]],inputs:{toolName:"toolName"},outputs:{onChange:"onChange",onSlide:"onSlide"},decls:2,vars:2,consts:[["class","",4,"ngIf"],[4,"ngIf"],[1,""],[1,"card-body","mb-9",2,"margin-top","-4px"],[1,"d-flex","align-items-center","w-100","justify-content-between","mb-10","position-relative"],[1,"text-13","grey-800","text-semi"],[1,"btn-all","reset-all","text-semi","d-flex","align-items-center","justify-content-center",3,"click","disabled"],[1,"text-13","grey-800","lh-125","text-regular"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","slideStart","value","min","max","step"],[1,"ms-3"],["type","text","numberSettings","",1,"form-control","form-input-sm","text-normal","text-black","float-end",3,"change","min","max","ngModel"],[1,"card-body","mb-9"],[1,"card-body","mb-10"],[1,"d-flex","align-items-center","w-100","justify-content-between","mb-10"],[1,"opacity-slider",2,"width","100%",3,"change","slideStart","slideStop","value","min","max","step"],[1,"card-body"],[1,"pt-9"],[1,"d-flex","align-items-center","w-100","justify-content-between","position-relative"],[1,"btn-all","reset-all","text-semi","position-absolute","d-flex","align-items-center","justify-content-center",2,"right","-8px","top","-20px",3,"click","disabled"]],template:function(w,j){1&w&&o.DNE(0,p,103,78,"div",0)(1,u,53,43,"div",1),2&w&&(o.Y8G("ngIf","Hair"==j.toolName),o.R7$(),o.Y8G("ngIf","Lips"==j.toolName))},dependencies:[x.bT,E.me,E.BC,E.vS,R.I,I.d1],styles:["label[_ngcontent-%COMP%]{font-size:14px;color:#272b34}
1.reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:7px;height:32px}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important;pointer-events:none}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#626adf}"]}),y})();function b(B,y){if(1&B){const O=o.RV6();o.j41(0,"div",10)(1,"span",4),o.EFF(2,"Intensity"),o.k0s(),o.j41(3,"div",11)(4,"div",12)(5,"mv-slider",13),o.bIt("change",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputShadeIntesity(j))})("slideStop",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputShadeIntesity(j))}),o.k0s()(),o.j41(6,"div",14)(7,"input",15,0),o.bIt("ngModelChange",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.inputShadeIntesity(j))}),o.k0s()()()()}if(2&B){const O=o.XpG();o.R7$(5),o.Y8G("value",O.shadeIntesity)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",O.shadeIntesity)("allowNegativeNumbers",!0)}}function k(B,y){if(1&B){const O=o.RV6();o.j41(0,"retouch-adjustment-change-color",16),o.bIt("onChange",function(){o.eBV(O);const j=o.XpG();return o.Njj(j.renderAll())})("onSlide",function(j){o.eBV(O);const L=o.XpG();return o.Njj(L.onSlideStart(j))}),o.k0s()}if(2&B){const O=o.XpG();o.Y8G("toolName",O.toolName)}}let A=(()=>{var B;class y{constructor(w,j,L,U,z,Z){this.faceRetouchService=w,this.uploadImageService=j,this.changeColorService=L,this.subsService=U,this.env=z,this.authService=Z,this.selectLayout=new o.bkB,this.adjustment=!1,this.shadeIntesity=100,this.toolName="Hair",this.filterIndex=4,this.selectedShade=null,this.colors=[],this.isAllEdit=!1,this.loggedInObserver=this.authService.loggedIn.subscribe($=>{this.user=this.authService.currentUser()}),this.usrPropChangedObserver=this.authService.usrPropChanged.subscribe($=>{this.user=this.authService.currentUser()}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe($=>{$&&this.reset()})}ngOnInit(){var w=this;return(0,n.A)(function*(){w.user=w.authService.currentUser(),yield w.getRetouchColors(),w.env.isMobileView?w.selectedShade=w.colors[0]:(w.selectedShade=w.colors[1],w.shadeIntesity=w.selectedShade.obj.intensityValue),w.actionController=new P.Z,w.changeColorService.setActionController(w.actionController),w.changeColorService.updateAdjustmentValues()})()}ngOnChanges(w){w.active&&this.inputImage&&(this.active?(this.maskImageData=this.faceRetouchService.getMask(this.toolName),this.selectedShade&&this.selectTab(this.selectedShade,this.shadeIntesity)):(this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()))}renderAll(){this.faceRetouchService.onChange$.next(()=>{this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()})}onSlideStart(w){}selectTab(w,j=null){this.selectLayout.emit(w),this.user=this.authService.currentUser();const L=()=>{this.selectedShade=w,-1==w.id?(this.adjustment=!1,this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()):1==w.id?(this.adjustment=!0,this.addAdjustmentFilter(),this.isAllEdit||(this.isAllEdit=!0)):(this.adjustment=!1,this.isAllEdit=!0,j||(this.shadeIntesity=w.obj.intensityValue),this.addShadeFilter(w))};Number(w.pro)&&(!this.user||this.user&&!this.user.subscribed)?this.subsService.loginWithUpgrade(()=>{this.user=this.authService.currentUser(),this.user&&this.user.subscribed&&L()},{coinSectionHide:this.env.isMobileView}):L()}addAdjustmentFilter(){this.maskImageData&&(this.filter=new G.fabric.Image.filters.Adjustment({image:this.maskImageData,adjustment:this.actionController.getAdjustedValues(),adztOn:"1.0"}),this.inputImage.filters[this.filterIndex]=this.filter,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll())}hexToRgbPercent(w){if(3===(w=w.replace(/^#/,"")).length&&(w=w.split("").map(Z=>Z+Z).join("")),6!==w.length)throw new Error("Invalid hex color");const j=parseInt(w.substring(0,2),16),L=parseInt(w.substring(2,4),16),U=parseInt(w.substring(4,6),16),z=Z=>+(Z/255).toFixed(2);return[z(j),z(L),z(U)]}hexToHsvForGLSL(w){if(3===(w=w.replace(/^#/,"")).length&&(w=w.split("").map(W=>W+W).join("")),6!==w.length)throw new Error("Invalid hex color");const j=parseInt(w.substring(0,2),16)/255,L=parseInt(w.substring(2,4),16)/255,U=parseInt(w.substring(4,6),16)/255,z=Math.max(j,L,U),$=z-Math.min(j,L,U);let Y=0;0!==$&&(Y=z===j?(L-U)/$%6:z===L?(U-j)/$+2:(j-L)/$+4,Y/=6,Y<0&&(Y+=1));const Q=0===z?0:$/z,K=z;return[+Y.toFixed(4),+Q.toFixed(4),+K.toFixed(4)]}addShadeFilter(w){const j=this.hexToHsvForGLSL(w.obj.colorHex);j.push(1);const L=this.shadeIntesity/100;this.shadeIntesity=this.shadeIntesity,this.maskImageData&&(this.inputImage.filters[this.filterIndex]&&"ShadeOnMaskNew"==this.inputImage.filters[this.filterIndex].type?(this.inputImage.filters[this.filterIndex].mixColor=j,this.inputImage.filters[this.filterIndex].alpha=L):(this.filter=new G.fabric.Image.filters.ShadeOnMaskNew({image:this.maskImageData,mixColor:j,colorShadeOption:2,alpha:L}),this.inputImage.filters[this.filterIndex]=this.filter),this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll())}getRetouchColors(){var w=this;return(0,n.A)(function*(){w.colors=yield w.faceRetouchService.getHairShadsColor()})()}changeFilterValue(){this.filter.alpha=this.shadeIntesity/100,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}inputShadeIntesity(w){let U,z;w.hasOwnProperty("newValue")?(U=w.newValue,z=!1):(U=w,z=!0),""==U&&(U=0),""!==U&&!Number.isNaN(Number(U))&&(this.shadeIntesity=U>100?100:U<0?0:U,this.faceRetouchService.onChange$.next(()=>{this.changeFilterValue()}))}reset(){this.ngOnInit(),this.adjustment=!1,this.inputImage&&(this.inputImage.filters[this.filterIndex]=null)}ngOnDestroy(){this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.usrPropChangedObserver&&this.usrPropChangedObserver.unsubscribe()}}return(B=y).\u0275fac=function(w){return new(w||B)(o.rXU(e.V),o.rXU(l.A),o.rXU(h.n),o.rXU(_.n),o.rXU(C.L),o.rXU(S.u))},B.\u0275cmp=o.VBU({type:B,selectors:[["shade-tool-hair"]],inputs:{active:"active",inputImage:"inputImage",user:"user"},outputs:{selectLayout:"selectLayout"},features:[o.Jv_([h.n]),o.OA$],decls:10,vars:6,consts:[["xDirInput",""],[1,"common-container","mt-2","mb-3"],[1,"card-body"],[1,"d-flex","align-items-center","w-100","justify-content-between","mb-3"],[1,"text-13","grey-800","text-semi"],[1,"d-flex","mb-3"],[1,"colors-bg","sticker-buttons-scroll","face-retouch-background"],[3,"selectLayout","items","type","categoryId","user"],["class","card-body mb-0",4,"ngIf"],[3,"toolName","onChange","onSlide",4,"ngIf"],[1,"card-body","mb-0"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","mask","separator","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","min","max","ngModel","allowNegativeNumbers"],[3,"onChange","onSlide","toolName"]],template:function(w,j){1&w&&(o.j41(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),o.EFF(4,"Shade"),o.k0s()(),o.j41(5,"div",5)(6,"div",6)(7,"buttons-scroll-menu",7),o.bIt("selectLayout",function(U){return j.selectTab(U)}),o.k0s()()()(),o.DNE(8,b,9,8,"div",8)(9,k,1,1,"retouch-adjustment-change-color",9),o.k0s()),2&w&&(o.R7$(7),o.Y8G("items",j.colors)("type","airetouchcolors")("categoryId",null==j.selectedShade?null:j.selectedShade.id)("user",j.user),o.R7$(),o.Y8G("ngIf",!j.adjustment&&-1!=(null==j.selectedShade?null:j.selectedShade.id)),o.R7$(),o.Y8G("ngIf",j.adjustment))},dependencies:[x.bT,E.me,E.BC,E.tU,E.vS,M.B,R.I,I.d1,D.Zr,m],styles:[".reset-all[_ng
1content-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:.5rem}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#626adf}"]}),y})()},95854:(_e,ie,g)=>{"use strict";g.d(ie,{H:()=>L});var n=g(10467),o=g(54438),G=g(93552),h=g(93226),_=(g(44953),g(30872),g(69333)),C=g(21413),S=g(70152),x=g(39762),E=g(6755),M=g(49449),R=g(68287),I=g(33391),D=g(68010),p=g(60177),u=g(84341),m=g(68064),b=g(36561),k=g(20753),A=g(19338),B=g(85188);const y=U=>({"rmbg-color-picker":U}),O=U=>({"d-none":U});function w(U,z){if(1&U){const Z=o.RV6();o.j41(0,"div",10)(1,"span",4),o.EFF(2,"Intensity"),o.k0s(),o.j41(3,"div",11)(4,"div",12)(5,"mv-slider",13),o.bIt("change",function(Y){o.eBV(Z);const Q=o.XpG();return o.Njj(Q.inputShadeIntesity(Y))})("slideStop",function(Y){o.eBV(Z);const Q=o.XpG();return o.Njj(Q.inputShadeIntesity(Y))}),o.k0s()(),o.j41(6,"div",14)(7,"input",15,0),o.bIt("ngModelChange",function(Y){o.eBV(Z);const Q=o.XpG();return o.Njj(Q.inputShadeIntesity(Y))}),o.k0s()()()()}if(2&U){const Z=o.XpG();o.R7$(5),o.Y8G("value",Z.shadeIntesity)("min",0)("max",100)("step",1),o.R7$(2),o.Y8G("min",0)("max",100)("ngModel",Z.shadeIntesity)("allowNegativeNumbers",!0)}}function j(U,z){if(1&U){const Z=o.RV6();o.j41(0,"div",16)(1,"div",17)(2,"div",18)(3,"div",19)(4,"button",20),o.EFF(5,"Custom"),o.k0s(),o.j41(6,"button",21),o.bIt("click",function(){o.eBV(Z);const Y=o.XpG();return o.Njj(Y.colorPickerClose())}),o.nrm(7,"pi",22),o.k0s()(),o.j41(8,"app-color-picker-panel",23),o.bIt("colorEnable",function(){o.eBV(Z);const Y=o.XpG();return o.Njj(Y.colorPickerClose())})("changed",function(Y){o.eBV(Z);const Q=o.XpG();return o.Njj(Q.changeColor(Y))}),o.k0s()()()()}if(2&U){const Z=o.XpG();o.Y8G("ngClass",o.eq3(3,y,Z.env.isMobileView)),o.R7$(3),o.Y8G("ngClass",o.eq3(5,O,Z.env.isMobileView)),o.R7$(5),o.Y8G("selectedColor",Z.hexColor)}}let L=(()=>{var U;class z{constructor($,Y,Q,K,W,X){this.faceRetouchService=$,this.uploadImageService=Y,this.subsService=Q,this.env=K,this.modalService=W,this.authService=X,this.hexColor="#000000",this.selectLayout=new o.bkB,this.shadeIntesity=100,this.toolName="Lips",this.filterIndex=5,this.selectedShade=null,this.colors=[],this.isAllEdit=!1,this.changeColorSubject=new C.B,this.subscriptions=[],this.loggedInObserver=this.authService.loggedIn.subscribe(F=>{this.user=this.authService.currentUser()}),this.usrPropChangedObserver=this.authService.usrPropChanged.subscribe(F=>{this.user=this.authService.currentUser()}),this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(F=>{F&&this.reset()})}ngOnInit(){var $=this;return(0,n.A)(function*(){$.user=$.authService.currentUser(),yield $.getRetouchColors(),$.env.isMobileView?$.selectedShade=$.colors[0]:($.selectedShade=$.colors[1],$.shadeIntesity=$.selectedShade.obj.intensityValue),$.subscriptions[0]=$.changeColorSubject.pipe((0,S.B)(0)).subscribe(Y=>{$.addShadeFilter(Y)})})()}ngOnChanges($){$.active&&this.inputImage&&(this.active?(this.maskImageData=this.faceRetouchService.getMask(this.toolName),this.selectedShade&&this.selectTab(this.selectedShade,this.shadeIntesity,!0)):(this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()))}renderAll(){this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}onSlideStart($){}selectTab($,Y=null,Q=!1){this.selectLayout.emit($),this.user=this.authService.currentUser();const K=()=>{if(this.selectedShade=$,-1==$.id)this.faceRetouchService.colorWheel=!1,this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll();else if(1==$.id){if(this.env.isMobileView){const W=this.modalService.open(_.n,{centered:!0,size:"semi-xxl face-retouch-modal",backdrop:"static",windowClass:"removeBg"});W.componentInstance.selectedColor=this.hexColor,W.componentInstance.isDialog=!0,W.result.then(X=>{this.changeColor(X)})}else this.faceRetouchService.colorWheel=!Q;this.isAllEdit||(this.isAllEdit=!0),this.addShadeFilter(this.hexColor)}else this.faceRetouchService.colorWheel=!1,this.isAllEdit=!0,Y||(this.shadeIntesity=$.obj.intensityValue),this.addShadeFilter($.obj.colorHex)};Number($.pro)&&(!this.user||this.user&&!this.user.subscribed)?this.subsService.loginWithUpgrade(()=>{this.user=this.authService.currentUser(),this.user&&this.user.subscribed&&K()},{coinSectionHide:this.env.isMobileView}):K()}hexToHsvForGLSL($){if(3===($=$.replace(/^#/,"")).length&&($=$.split("").map(Ce=>Ce+Ce).join("")),6!==$.length)throw new Error("Invalid hex color");const Y=parseInt($.substring(0,2),16)/255,Q=parseInt($.substring(2,4),16)/255,K=parseInt($.substring(4,6),16)/255,W=Math.max(Y,Q,K),F=W-Math.min(Y,Q,K);let V=0;0!==F&&(V=W===Y?(Q-K)/F%6:W===Q?(K-Y)/F+2:(Y-Q)/F+4,V/=6,V<0&&(V+=1));const le=0===W?0:F/W,fe=W;return[+V.toFixed(4),+le.toFixed(4),+fe.toFixed(4)]}addShadeFilter($){this.hexColor=$;
1const Y=this.hexToHsvForGLSL($);Y.push(1);const Q=this.shadeIntesity/100;this.shadeIntesity=this.shadeIntesity,this.maskImageData&&(this.inputImage.filters[this.filterIndex]?(this.inputImage.filters[this.filterIndex].mixColor=Y,this.inputImage.filters[this.filterIndex].alpha=Q):(this.filter=new G.fabric.Image.filters.ShadeOnMaskNew({image:this.maskImageData,mixColor:Y,colorShadeOption:2,alpha:Q}),this.inputImage.filters[this.filterIndex]=this.filter),this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll())}getRetouchColors(){var $=this;return(0,n.A)(function*(){$.colors=yield $.faceRetouchService.getLipShadsColor()})()}changeFilterValue(){this.filter.alpha=this.shadeIntesity/100,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}inputShadeIntesity($){let K,W;$.hasOwnProperty("newValue")?(K=$.newValue,W=!1):(K=$,W=!0),""==K&&(K=0),""!==K&&!Number.isNaN(Number(K))&&(this.shadeIntesity=K>100?100:K<0?0:K,this.faceRetouchService.onChange$.next(()=>this.changeFilterValue()))}reset(){this.ngOnInit(),this.faceRetouchService.colorWheel=!1,this.inputImage&&(this.inputImage.filters[this.filterIndex]=null)}ngOnDestroy(){this.loggedInObserver&&this.loggedInObserver.unsubscribe(),this.usrPropChangedObserver&&this.usrPropChangedObserver.unsubscribe(),this.subscriptions.forEach($=>$.unsubscribe())}changeColor($){this.changeColorSubject.next($)}colorPickerClose(){this.faceRetouchService.colorWheel=!1}}return(U=z).\u0275fac=function($){return new($||U)(o.rXU(x.V),o.rXU(E.A),o.rXU(M.n),o.rXU(R.L),o.rXU(I.Bq),o.rXU(D.u))},U.\u0275cmp=o.VBU({type:U,selectors:[["shade-tool-lips"]],inputs:{active:"active",inputImage:"inputImage",user:"user"},outputs:{selectLayout:"selectLayout"},features:[o.Jv_([h.n]),o.OA$],decls:10,vars:6,consts:[["xDirInput",""],[1,"common-container","mt-2","mb-3","position-relative"],[1,"card-body"],[1,"d-flex","align-items-center","w-100","justify-content-between","mb-3"],[1,"text-13","grey-800","text-semi"],[1,"d-flex","mb-3"],[1,"colors-bg","sticker-buttons-scroll","face-retouch-background"],[3,"selectLayout","items","type","categoryId","user"],["class","card-body mb-0",4,"ngIf"],["class","pane-section position-intl",3,"ngClass",4,"ngIf"],[1,"card-body","mb-0"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","mask","separator","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","min","max","ngModel","allowNegativeNumbers"],[1,"pane-section","position-intl",3,"ngClass"],[1,"scroll-content","bg-color-picker","bg-color-picker-active"],[1,"bg-color-panel","pe-3","ps-3","pt-10"],[1,"",3,"ngClass"],[1,"btn-all","p-0","m-0","btn-left-color","text-normal"],[1,"btn-all","p-0","m-0","btn-right-color","float-end",3,"click"],["name","closecolortool"],[3,"colorEnable","changed","selectedColor"]],template:function($,Y){1&$&&(o.j41(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),o.EFF(4,"Shade"),o.k0s()(),o.j41(5,"div",5)(6,"div",6)(7,"buttons-scroll-menu",7),o.bIt("selectLayout",function(K){return Y.selectTab(K)}),o.k0s()()()(),o.DNE(8,w,9,8,"div",8),o.k0s(),o.DNE(9,j,9,7,"div",9)),2&$&&(o.R7$(7),o.Y8G("items",Y.colors)("type","airetouchcolors")("categoryId",null==Y.selectedShade?null:Y.selectedShade.id)("user",Y.user),o.R7$(),o.Y8G("ngIf",!Y.faceRetouchService.colorWheel&&-1!=(null==Y.selectedShade?null:Y.selectedShade.id)),o.R7$(),o.Y8G("ngIf",Y.faceRetouchService.colorWheel))},dependencies:[p.YU,p.bT,u.me,u.BC,u.tU,u.vS,m.b,b.B,k.I,_.n,A.d1,B.Zr],styles:[".reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:.5rem}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#626adf}.position-intl[_ngcontent-%COMP%]{position:initial}.bg-color-picker-active[_ngcontent-%COMP%]{background:#fffc!important;-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important;left:0;z-index:99;position:fixed}"]}),z})()},58426:(_e,ie,g)=>{"use strict";g.d(ie,{O:()=>p});var n=g(93552),l=(g(683),g(22046),g(63297),g(54438)),_=g(39762),C=g(60177),S=g(84341),x=g(20753),E=g(19338),M=g(85188);function R(u,m){if(1&u){const b=l.RV6();l.j41(0,"div",3)(1,"span",4),l.EFF(2,"Contrast"),l.k0s(),l.j41(3,"div",5)(4,"div",6)(5,"mv-sl
1ider",7),l.bIt("change",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("slideStop",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))}),l.k0s()(),l.j41(6,"div",8)(7,"input",9,0),l.bIt("ngModelChange",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("keydown.enter",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.focusOut(A))}),l.k0s()()()()}if(2&u){const b=l.XpG();l.R7$(5),l.Y8G("value",b.value)("min",0)("max",100)("step",1),l.R7$(2),l.Y8G("min",0)("max",100)("ngModel",b.value)("allowNegativeNumbers",!0)}}function I(u,m){if(1&u){const b=l.RV6();l.j41(0,"div",3)(1,"span",4),l.EFF(2,"Darker"),l.k0s(),l.j41(3,"div",5)(4,"div",6)(5,"mv-slider",7),l.bIt("change",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("slideStop",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))}),l.k0s()(),l.j41(6,"div",8)(7,"input",9,0),l.bIt("ngModelChange",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("keydown.enter",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.focusOut(A))}),l.k0s()()()()}if(2&u){const b=l.XpG();l.R7$(5),l.Y8G("value",b.value)("min",0)("max",100)("step",1),l.R7$(2),l.Y8G("min",0)("max",100)("ngModel",b.value)("allowNegativeNumbers",!0)}}function D(u,m){if(1&u){const b=l.RV6();l.j41(0,"div",3)(1,"span",4),l.EFF(2,"Whitening"),l.k0s(),l.j41(3,"div",5)(4,"div",6)(5,"mv-slider",7),l.bIt("change",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("slideStop",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))}),l.k0s()(),l.j41(6,"div",8)(7,"input",9,0),l.bIt("ngModelChange",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.inputContrast(A))})("keydown.enter",function(A){l.eBV(b);const B=l.XpG();return l.Njj(B.focusOut(A))}),l.k0s()()()()}if(2&u){const b=l.XpG();l.R7$(5),l.Y8G("value",b.value)("min",0)("max",100)("step",1),l.R7$(2),l.Y8G("min",0)("max",100)("ngModel",b.value)("allowNegativeNumbers",!0)}}let p=(()=>{var u;class m{constructor(k){this.faceRetouchService=k,this.value=0,this.filterIndex=0,this.brightnessMultiplicationConstant=1,this.isAllEdit=!1,this.isMobile=!1,this.tabChange=this.faceRetouchService.tabChange.subscribe(A=>{})}ngOnDestroy(){this.tabChange.subscribe&&this.tabChange.unsubscribe()}ngAfterViewInit(){this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(k=>{k&&this.reset()})}ngOnInit(){switch(this.faceRetouchService.isAllEdit=!1,this.toolName){case"Eyes":this.value=0,this.filterIndex=0,this.brightnessMultiplicationConstant=.04;break;case"Eyebrows":this.value=0,this.filterIndex=1,this.brightnessMultiplicationConstant=-.12;break;case"Teeth":this.value=0,this.filterIndex=2,this.brightnessMultiplicationConstant=.5}}ngOnChanges(k){if(k.active&&this.inputImage)if(this.active){const A=this.faceRetouchService.getMask(this.toolName);A&&("Teeth"==this.toolName?(this.filterIndex=2,this.filter=new n.fabric.Image.filters.BritnessOnMaskTeeth({image:A,filterValue:this.getBrightness()})):"Eyes"==this.toolName?(this.filterIndex=0,this.filter=new n.fabric.Image.filters.BritnessOnMaskEye({image:A,filterValue:this.getBrightness()})):(this.filterIndex=1,this.filter=new n.fabric.Image.filters.BritnessOnMask({image:A,filterValue:this.getBrightness()})),this.inputImage.filters[this.filterIndex]=this.filter,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll())}else this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}getBrightness(){let k=this.value/100;return"Teeth"==this.toolName&&k>0?k/=4:"Eyes"==this.toolName?k=1+.4*k:k*=this.brightnessMultiplicationConstant,k}changeFilterValue(){this.filter.filterValue=this.getBrightness(),this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}inputContrast(k){let y,O;k.hasOwnProperty("newValue")?(y=k.newValue,O=!1):(y=k,O=!0),""==y&&(y=0),""!==y&&!Number.isNaN(Number(y))&&(this.value=y>100?100:y<0?0:y,this.faceRetouchService.onChange$.next(()=>this.changeFilterValue())),this.isAllEdit=!0,this.faceRetouchService.isAllEdit=!0}focusOut(k){}reset(){this.ngOnInit(),this.inputImage&&(this.inputImage.filters[this.filterIndex]=null)}}return(u=m).\u0275fac=function(k){return new(k||u)(l.rXU(_.V))},u.\u0275cmp=l.VBU({type:u,selectors:[["single-tool"]],inputs:{toolName:"toolName",active:"active",inputImage:"inputImage",uploadImageService:"uploadImageService",isMobile:"isMobile"},features:[l.OA$],decls:4,vars:3,consts:[["xDirInput",""],[1,"common-container","mt-2","mb-3"],["class","card-body",4,"ngIf"],[1,"card-body"],[1,"text-semi","text-13","grey-800","lh-125"],[1,"d-flex"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ms-3"],["type","text","numberSettings","","maxlength","3","mask","separator","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","min","max","ngModel","allowNegativeNumbers"]],template:function(k,A){1&k&&(l.j41(0,"div",1),l.DNE(1,R,9,8,"div",2)(2,I,9,8,"div",2)(3,D,9,8,"div",2),l.k0s()),2&k&&(l.R7$(),l.Y8G("ngIf","Eyes"==A.toolName),l.R7$(),l.Y8G("ngIf","Eyebrows"==A.toolName),l.R7$(),l.Y8G("ngIf","Teeth"==A.toolName))},dependencies:[C.bT,S.me,S.BC,S.tU,S.vS,x.I,E.d1,M.Zr]}
1),m})()},89334:(_e,ie,g)=>{"use strict";g.d(ie,{R:()=>x});var n=g(93552),G=g(6762),P=g(21413),h=g(70152),a=g(54438),d=g(39762),e=g(6755),l=g(84341),_=g(20753),C=g(19338),S=g(85188);let x=(()=>{var E;class M{constructor(I,D){this.faceRetouchService=I,this.uploadImageService=D,this.isAllEdit=!1,this.isAllReset=!1,this.toolName="Skin",this.filterIndex=3,this.skinTone=0,this.sliderChangeSkinTone$=new P.B,this.highlight=0,this.sliderChangeHighlight$=new P.B,this.shadow=0,this.sliderChangeShadow$=new P.B,this.smoothness=0,this.sliderChangeSmoothness$=new P.B,this.sharpness=0,this.subscriptions=[],this.uploadImageServiceAfterImageLoadSub=this.uploadImageService.afterImageLoad.subscribe(p=>{p&&this.reset()})}ngOnDestroy(){this.subscriptions.forEach(I=>I.unsubscribe())}ngOnInit(){this.subscriptions[0]=this.sliderChangeSkinTone$.pipe((0,h.B)(0)).subscribe(()=>{this.changeSkinToneValue()}),this.subscriptions[1]=this.sliderChangeHighlight$.pipe((0,h.B)(0)).subscribe(()=>{this.actionController.updateHighlights(this.getHighlights(),!1),this.isAllEdit=!0,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}),this.subscriptions[2]=this.sliderChangeShadow$.pipe((0,h.B)(0)).subscribe(()=>{this.actionController.updateShadows(this.getShadows(),!1),this.isAllEdit=!0,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}),this.subscriptions[3]=this.sliderChangeSmoothness$.pipe((0,h.B)(0)).subscribe(()=>{this.checkSmoothSharp(),this.isAllEdit=!0,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()})}ngOnChanges(I){if(I.active&&this.inputImage)if(this.active){const D=this.faceRetouchService.getMask(this.toolName);if(D){this.actionController=new G.Z,this.initFilterValues();const p=this.faceRetouchService.getBlurredImageData(this.originalImage);this.filter=new n.fabric.Image.filters.SkinAdjustment({image:D,adjustment:this.actionController.getAdjustedValues(),blurImage:p,smoothness:this.getSmoothness(),sharpness:this.getSharpness()}),this.inputImage.filters[this.filterIndex]=this.filter,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}}else this.inputImage.filters[this.filterIndex]=null,this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll()}initFilterValues(){this.actionController.updateTint(this.getTint(),!1),this.actionController.updateTemperature(this.getTemperature(),!1),this.actionController.updateHighlights(this.getHighlights(),!1),this.actionController.updateShadows(this.getShadows(),!1)}changeSkinToneValue(){this.actionController.updateTint(this.getTint(),!1),this.actionController.updateTemperature(this.getTemperature(),!1),this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll(),this.isAllEdit=!0}getSmoothness(){return.4*this.smoothness/100}getSharpness(){return 1+40*this.sharpness/100*3/100}getTint(){return this.skinTone<=0?.25*-this.skinTone:0}getTemperature(){return this.skinTone<=0?0:this.skinTone}getShadows(){return.6*this.shadow}getHighlights(){return.4*this.highlight}inputSkinTone(I){let u,m;I.hasOwnProperty("newValue")?(u=I.newValue,m=!1):(u=I,m=!0),""==u&&(u=0),""!==u&&!Number.isNaN(Number(u))&&(u>100?u=100:u<-100&&(u=-100),this.skinTone=u,this.sliderChangeSkinTone$.next())}inputHighlight(I){let u,m;I.hasOwnProperty("newValue")?(u=I.newValue,m=!1):(u=I,m=!0),""==u&&(u=0),""!==u&&!Number.isNaN(Number(u))&&(u>100?u=100:u<-100&&(u=-100),this.highlight=u,this.sliderChangeHighlight$.next())}inputShadow(I){let u,m;I.hasOwnProperty("newValue")?(u=I.newValue,m=!1):(u=I,m=!0),""==u&&(u=0),""!==u&&!Number.isNaN(Number(u))&&(this.shadow=u>100?100:u<-100?-100:u,this.sliderChangeShadow$.next())}checkSmoothSharp(){this.inputImage.filters[this.filterIndex].smoothness=this.getSmoothness(),this.inputImage.filters[this.filterIndex].sharpness=this.getSharpness()}inputSmoothness(I){let u,m;I.hasOwnProperty("newValue")?(u=I.newValue,m=!1):(u=I,m=!0),""==u&&(u=0),""!==u&&!Number.isNaN(Number(u))&&(this.smoothness=u>100?100:u<0?0:u,this.sliderChangeSmoothness$.next())}inputSharpness(I){let u,m;I.hasOwnProperty("newValue")?(u=I.newValue,m=!1):(u=I,m=!0),""==u&&(u=0),""!==u&&!Number.isNaN(Number(u))&&(this.sharpness=u>100?100:u<0?0:u,this.sliderChangeSmoothness$.next())}focusOutRotate(I){}reset(){this.skinTone=0,this.highlight=0,this.shadow=0,this.smoothness=0,this.sharpness=0}resetAll(){this.reset(),this.actionController.updateShadows(this.getShadows(),!1),this.actionController.updateHighlights(this.getHighlights(),!1),this.actionController.updateTemperature(this.getTemperature(),!1),this.actionController.updateTint(this.getTint(),!1),this.checkSmoothSharp(),this.inputImage.applyFilters(),this.inputImage.canvas.requestRenderAll(),this.isAllEdit=!1,this.isAllReset=!0}}return(E=M).\u0275fac=function(I){return new(I||E)(a.rXU(d.V),a.rXU(e.A))},E.\u0275cmp=a.VBU({type:E,selectors:[["skin-tool"]],inputs:{active:"active",inputImage:"inputImage",originalImage:"originalImage"},features:[a.OA$],decls:48,vars:41,consts:[["xDirInput",""],[1,"common-container","mt-10","mb-3"],[1,"card-body","mb-9","position-relative","for-skin"],[1,"btn-all","reset-all","text-semi","position-absolute","d-flex","align-items-center","justify-content-center",2,"right","-8px","top","-16px",3,"click","disabled"],[1,"text-semi","text-13","grey-800","lh-125"],[1,"d-flex","margin-skin"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ms-3"],["type","text","numberSettings","","maxlength","4","mask","separator","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","min","max","ngModel","allowNegativeNumbers"],[1,"card-body","mb-9"],[1,"d-flex"],[1,"card-body"]],template:function(I,D){if(1&I){const p=a.RV6();a.j41(0,"div",1)(1,"div",2)(2,"button",3),a.bIt("click",function(){return a.eBV(p),a.Njj(D.resetAll())}),a.EFF(3,"Reset all"),a.k0s(),a.j41(4,"span",4),a.EFF(5,"Skin Tone"),a.k0s(),a.j41(6,"div",5)(7,"div",6)(8,"mv-slider",7),a.bIt("change",function(m){return a.eBV(p),a.Njj(D.inputSkinTone(m))})("slideStop",function(m){return a.eBV(p),a.Njj(D.inputSkinTone(m))}),a.k0s()(),a.j41(9,"div",8)(10,"input",9,0),a.bIt("ngModelChange",function(m){return a.eBV(p),a.Njj(D.inputSkinTone(m))})("keydown.enter",function(m){return a.eBV(p),a.Njj(D.focusOutRotate(m))}),a.k0s()()()(),a.j41(12,"div",10)(13,"span",4),a.EFF(14,"Highlight"),a.k0s(),a.j41(15,"div",11)(16,"div",6)(17,"mv-sl
1ider",7),a.bIt("change",function(m){return a.eBV(p),a.Njj(D.inputHighlight(m))})("slideStop",function(m){return a.eBV(p),a.Njj(D.inputHighlight(m))}),a.k0s()(),a.j41(18,"div",8)(19,"input",9,0),a.bIt("ngModelChange",function(m){return a.eBV(p),a.Njj(D.inputHighlight(m))})("keydown.enter",function(m){return a.eBV(p),a.Njj(D.focusOutRotate(m))}),a.k0s()()()(),a.j41(21,"div",10)(22,"span",4),a.EFF(23,"Shadow"),a.k0s(),a.j41(24,"div",11)(25,"div",6)(26,"mv-slider",7),a.bIt("change",function(m){return a.eBV(p),a.Njj(D.inputShadow(m))})("slideStop",function(m){return a.eBV(p),a.Njj(D.inputShadow(m))}),a.k0s()(),a.j41(27,"div",8)(28,"input",9,0),a.bIt("ngModelChange",function(m){return a.eBV(p),a.Njj(D.inputShadow(m))})("keydown.enter",function(m){return a.eBV(p),a.Njj(D.focusOutRotate(m))}),a.k0s()()()(),a.j41(30,"div",10)(31,"span",4),a.EFF(32,"Smoothness"),a.k0s(),a.j41(33,"div",11)(34,"div",6)(35,"mv-slider",7),a.bIt("change",function(m){return a.eBV(p),a.Njj(D.inputSmoothness(m))})("slideStop",function(m){return a.eBV(p),a.Njj(D.inputSmoothness(m))}),a.k0s()(),a.j41(36,"div",8)(37,"input",9,0),a.bIt("ngModelChange",function(m){return a.eBV(p),a.Njj(D.inputSmoothness(m))})("keydown.enter",function(m){return a.eBV(p),a.Njj(D.focusOutRotate(m))}),a.k0s()()()(),a.j41(39,"div",12)(40,"span",4),a.EFF(41,"Sharpness"),a.k0s(),a.j41(42,"div",11)(43,"div",6)(44,"mv-slider",7),a.bIt("change",function(m){return a.eBV(p),a.Njj(D.inputSharpness(m))})("slideStop",function(m){return a.eBV(p),a.Njj(D.inputSharpness(m))}),a.k0s()(),a.j41(45,"div",8)(46,"input",9,0),a.bIt("ngModelChange",function(m){return a.eBV(p),a.Njj(D.inputSharpness(m))})("keydown.enter",function(m){return a.eBV(p),a.Njj(D.focusOutRotate(m))}),a.k0s()()()()()}2&I&&(a.R7$(2),a.Y8G("disabled",!D.isAllEdit),a.R7$(6),a.Y8G("value",D.skinTone)("min",-100)("max",100)("step",1),a.R7$(2),a.Y8G("min",-100)("max",100)("ngModel",D.skinTone)("allowNegativeNumbers",!0),a.R7$(7),a.Y8G("value",D.highlight)("min",-100)("max",100)("step",1),a.R7$(2),a.Y8G("min",-100)("max",100)("ngModel",D.highlight)("allowNegativeNumbers",!0),a.R7$(7),a.Y8G("value",D.shadow)("min",-100)("max",100)("step",1),a.R7$(2),a.Y8G("min",-100)("max",100)("ngModel",D.shadow)("allowNegativeNumbers",!0),a.R7$(7),a.Y8G("value",D.smoothness)("min",0)("max",100)("step",1),a.R7$(2),a.Y8G("min",0)("max",100)("ngModel",D.smoothness)("allowNegativeNumbers",!0),a.R7$(7),a.Y8G("value",D.sharpness)("min",0)("max",100)("step",1),a.R7$(2),a.Y8G("min",0)("max",100)("ngModel",D.sharpness)("allowNegativeNumbers",!0))},dependencies:[l.me,l.BC,l.tU,l.vS,_.I,C.d1,S.Zr],styles:[".reset-all[_ngcontent-%COMP%]{font-size:12px;line-height:16px;color:#626adf;border-radius:8px;padding:7px;height:32px}.reset-all[_ngcontent-%COMP%]:disabled{background-color:transparent!important;color:#b0b3bf!important;pointer-events:none}.reset-all[_ngcontent-%COMP%]:hover{background:#626adf0d;color:#626adf}"]}),M})()},84634:(_e,ie,g)=>{"use strict";g.d(ie,{O:()=>e});var n=g(10467),o=g(21413),G=g(93552),h=g(75243),a=g(79774),d=g(16478);class e{constructor(C,S,x,E,M,R=""){this.photoEditorService=C,this.stateService=S,this.zoomService=x,this.uploadService=E,this.route=M,this.toolNameAtBase=R,this.isAuto=!1,this.brushSliderValue=50,this.selectedOption=null,this.loaderaserImage=new o.B,this.scale=1}onInit(){this.zoomserviceSubscription=this.zoomService.canvasScale.subscribe(()=>{this.setBruceIcon(this.brushSliderValue,this.selectedOption,this.isAuto)})}init(C=null,S=!1){this.photoEditorService.isLoaded=!1,this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="default",this.stateService.mainCanvas.setCursor("default");let x="";if(this.photoEditorService.isError)return this.photoEditorService.isError=!0,this.photoEditorService.isDirty=!1,this.photoEditorService.isLoaded=!0,this.photoEditorService.initialLoad=!0,void this.stateService.mainCanvas.clear();this.photoEditorService.isRemoveObj&&"aieraser"==this.photoEditorService.activeSubTool?(x=this.photoEditorService.imgUrl,this.photoEditorService.isRemoveObj=!1,this.photoEditorService.isLoaded=!0,this.photoEditorService.isDirty=!0):this.photoEditorService.isquickEditTool?(x=this.photoEditorService.imgUrl,this.photoEditorService.isLoaded=!0,this.photoEditorService.isquickEditTool=!1,this.photoEditorService.activeSubTool="quickedits"):(x=this.photoEditorService.imgUrl=this.checkImageUrl(),this.photoEditorService.compareImageUrl=x,this.photoEditorService.isLoaded=!1,this.photoEditorService.isDirty=!1,this.stateService.mainCanvas.clear()),this.photoEditorService.isError=!1,this.photoEditorService.checkProjectName(),this.loadInputImage(x,E=>{this.photoEditorService.initialLoad=!0,setTimeout(()=>{this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()},0),this.afterImageLoad&&this.afterImageLoad({module:this.photoEditorService.resolvedModule,imageData:E}),C&&C(),this.photoEditorService.afterImageLoad.next({}),setTimeout(()=>{this.photoEditorService.isLoaded=!0},200),"aieraser"==this.photoEditorService.activeSubTool&&!this.photoEditorService.isRemoveObj&&this.loaderaserImage.next("aieraser")},E=>{this.photoEditorService.initialLoad=!0,setTimeout(()=>{this.photoEditorService.isLoaded=!0},200),this.photoEditorService.isError=!0,this.photoEditorService.isDirty=!1,"tools"==this.photoEditorService.selectedTool&&C&&C()},S)}setBruceIcon(C,S,x=!1){if(C>0){let E=this.brushSliderValue=C>5?C:5;if(this.selectedOption=S,S==h.l4||S==h.lh){const M=this.photoEditorService.originalImage;E=Math.floor(E/5*(.05*(M.width>M.height?M.width:M.height)/2)/4),E=E<5?5:E,E/=2;let D=E-2/this.zoomService.currentZoom;
1if(this.hoverCursor)if(this.hoverCursor.radius!==E){let p=this.getAbsTopAndLeft();this.hoverCursor.set({top:p.top,left:p.left}).canvas.renderAll();let u=this.hoverCursor._objects;if(D>0)for(let m=0;m<u.length;m++){let b=u[m];"circle"===b.type&&"white"===b.stroke&&(b.set({radius:E,strokeWidth:2/this.zoomService.currentZoom}),this.hoverCursor.radius=E),"circle"===b.type&&"black"===b.stroke&&b.set({radius:E-2/this.zoomService.currentZoom,strokeWidth:2/this.zoomService.currentZoom}),"text"===b.type&&b.set({fontSize:E}),this.hoverCursor.addWithUpdate()}}else this.removeCursor();this.addCursor(E)}else this.removeCursor(),this.stateService.mainCanvas.hoverCursor="move";this.photoEditorService.slidersize=E}else this.removeCursor(),this.stateService.mainCanvas.hoverCursor="move"}getAbsTopAndLeft(){let C=this.stateService.maskWrapperEl.parentElement,S=50,x=50;return C&&(this.stateService.mainCanvas.height>C.clientHeight?(S=(this.stateService.mainCanvas.height-(this.stateService.mainCanvas.height-C.clientHeight))/2,S+=C.scrollTop):S=this.stateService.mainCanvas.height/2,this.stateService.mainCanvas.width>C.clientWidth?(x=(this.stateService.mainCanvas.width-(this.stateService.mainCanvas.width-C.clientWidth))/2,x+=C.scrollLeft):x=this.stateService.mainCanvas.width/2),{top:S/this.zoomService.currentZoom,left:x/this.zoomService.currentZoom}}showBrushSizePreview(C){}addCursor(C){if(!this.hoverCursor&&C>0){let x="+";this.selectedOption==h.lh&&(x="-"),this.isAuto&&(x="+"===x?"-":"+");let E=new G.fabric.Circle({radius:C,fill:"transparent",stroke:"white",strokeWidth:2/this.zoomService.currentZoom,originX:"center",originY:"center"}),M=C-2/this.zoomService.currentZoom,R=new G.fabric.Circle({radius:M>0?M:0,fill:"transparent",stroke:"black",strokeWidth:2/this.zoomService.currentZoom,originX:"center",originY:"center"});var S=new G.fabric.Text(x,{fontFamily:"sans-serif",fontSize:C,stroke:"white",textAlign:"center",originX:"center",originY:"center",left:0,top:0});this.hoverCursor=new G.fabric.Group([E,R,S],{left:-100,top:-100,originX:"center",originY:"center",selectable:!1}),this.hoverCursor.radius=C,this.stateService.mainCanvas.add(this.hoverCursor),this.stateService.mainCanvas.hoverCursor="none"}}removeCursor(){this.hoverCursor&&(this.stateService.mainCanvas.remove(this.hoverCursor),this.hoverCursor=null)}checkImageUrl(){let C;return"stripe"===localStorage.getItem("exit_for")&&localStorage.removeItem("exit_for"),C===d.b.photoEditorTempLocalSave||(C=this.photoEditorService.photoEditorOptions.isDialog?this.photoEditorService.photoEditorOptions.img:this.route.snapshot.queryParamMap.get("img")),C}getLocalStorageImgURL(C){const S=localStorage.getItem(C);return localStorage.removeItem(C),"data:image/png;base64,"+S}onMouseMove(C){if(this.mouseDown){this.prevX=this.currX,this.prevY=this.currY;let S=this.getPoints(C);this.currX=S.x,this.currY=S.y}if(this.hoverCursor){let S=this.getPoints(C);this.hoverCursor.set({top:S.y,left:S.x}).setCoords(),this.stateService.mainCanvas.renderAll()}}onMouseUp(C){this.mouseDown=!1}onMouseDown(C){this.mouseDown=!0;let S=this.getPoints(C);this.currX=S.x,this.currY=S.y,this.prevX=this.currX,this.prevY=this.currY,this.index=0}onMouseOut(C){this.hoverCursor&&(this.hoverCursor.set({top:-100,left:-100}).setCoords(),this.stateService.mainCanvas.renderAll())}getPoints(C){let S,x,E;return E=this.scale&&"object"==typeof this.scale?this.scale._scale:this.scale,S=C.absolutePointer.x*E,x=C.absolutePointer.y*E,{x:S,y:x}}checkAndEnableDrawingMode(C,S){C?(this.stateService.mainCanvas.freeDrawingBrush.color=S==h.Uq?"White":"Black",this.stateService.mainCanvas.freeDrawingBrush.width=3/this.zoomService.currentZoom,this.stateService.mainCanvas.isDrawingMode=!0):this.stateService.mainCanvas.isDrawingMode=!1}drawOutputImage(C,S){this.photoEditorService.maskForDownload=C,this.inputImage.applyFilters(),this.stateService.mainCanvas.renderAll()}reloadImage(C){var S=this;return(0,n.A)(function*(x,E=!0,M=!1){S.photoEditorService.isError||(S.stateService.mainCanvas.isDrawingMode=!1,S.stateService.mainCanvas.hoverCursor="default",S.stateService.mainCanvas.setCursor("default"),S.setOriginalImage(M),yield S.initFabricCanvas(S.photoEditorService.originalImage,R=>{E&&S.afterImageLoad({module:S.photoEditorService.resolvedModule,imageData:R}),x&&x()}))}).apply(this,arguments)}loadInputImage(C,S,x,E=!1){var M=this;this.photoEditorService.loadImageAndReize(C).then((0,n.A)(function*(){M.setOriginalImage(E),yield M.initFabricCanvas(M.photoEditorService.originalImage,S)})).catch(R=>{x(null)})}
1setOriginalImage(C){C||this.photoEditorService.photoEditorOptions.isDialog||"tools"!=this.toolNameAtBase&&"faceRetouch"!=this.toolNameAtBase&&"adjustment"!=this.toolNameAtBase&&"cutout-master"!=this.toolNameAtBase&&"cutout"!=this.toolNameAtBase&&"portait"!=this.toolNameAtBase&&"silhouette"!=this.toolNameAtBase&&"bodyRetouch"!=this.toolNameAtBase&&"faceExpression"!=this.toolNameAtBase&&"faceReshape"!=this.toolNameAtBase&&"changeCameraOrLight"!=this.toolNameAtBase&&"removeBg"!=this.photoEditorService.toolNameForDownload?"ai-tools"==this.toolNameAtBase||"upscale"==this.toolNameAtBase?(this.photoEditorService.originalImage=this.photoEditorService.getPhotoEditorInputImages().theOriginalOriginalImage,this.photoEditorService.compareImageUrl=this.photoEditorService.getPhotoEditorInputImages().theOriginalOriginalImage.src):(this.photoEditorService.originalImage=this.photoEditorService.getPhotoEditorInputImages().resolutionMax1080,"aitools"!=this.photoEditorService.selectedTool&&(this.photoEditorService.compareImageUrl=this.photoEditorService.getPhotoEditorInputImages().resolutionMax1080.src)):(this.photoEditorService.originalImage=this.photoEditorService.getPhotoEditorInputImages().resolutionMax4096,this.photoEditorService.compareImageUrl=this.photoEditorService.getPhotoEditorInputImages().resolutionMax4096.src)}initFabricCanvas(C){var S=this;return(0,n.A)(function*(x,E=null){let M,R;S.selectedOption=null,yield S.zoomService.init(26,x.width,x.height),M=x.width,R=x.height,S.inputImage=new G.fabric.Image(x),S.photoEditorService.inputImageRefForDownload=S.inputImage,S.inputImage.set({selectable:!1});typeof S.stateService.mainCanvas<"u"&&S.stateService.mainCanvas&&S.stateService.mainCanvas.contains(S.inputImage)&&S.stateService.mainCanvas.remove(S.inputImage),S.configureFabricCanvas(),S.inputImage.lockMovementX=!0,S.inputImage.lockMovementY=!0,S.inputImage.hasControls=!1,S.inputImage.selectable=!1,S.stateService.mainCanvas.selection=!1,S.stateService.mainCanvas.add(S.inputImage),S.addFilter(),S.stateService.mainCanvas.renderAll(),E&&E(S.getImageDataFromImg(x))}).apply(this,arguments)}getImageDataFromImg(C){const S=C.width,x=C.height;let E=document.createElement("canvas");E.width=S,E.height=x;const M=E.getContext("2d");return M.drawImage(C,0,0,S,x),M.getImageData(0,0,S,x)}addFilter(){this.baseFilter&&(this.inputImage.filters=[],Array.isArray(this.baseFilter)?this.baseFilter.forEach(C=>{this.inputImage.filters.push(C)}):this.inputImage.filters.push(this.baseFilter))}configureFabricCanvas(){let C=this;this.stateService.mainCanvas.on("mouse:down",S=>{C.onMouseDown(S)}),this.stateService.mainCanvas.on("mouse:up",S=>{C.onMouseUp(S)}),this.stateService.mainCanvas.on("mouse:move",S=>{C.onMouseMove(S)}),this.stateService.mainCanvas.on("mouse:out",S=>{C.onMouseOut(S)})}configureFabricCanvasMouseDownEvent(){let C=this;this.stateService.mainCanvas.on("mouse:down",S=>{C.onMouseDown(S)})}configureFabricCanvasMouseMoveAndUpEvent(){let C=this;this.stateService.mainCanvas.on("mouse:up",S=>{C.onMouseUp(S)}),this.stateService.mainCanvas.on("mouse:move",S=>{C.onMouseMove(S)})}unconfigureFabricCanvas(){this.stateService.mainCanvas.off("mouse:down"),this.stateService.mainCanvas.off("mouse:up"),this.stateService.mainCanvas.off("mouse:move"),this.stateService.mainCanvas.off("mouse:out")}checkStorage(C=null,S=null){this.loadXHR(C).then(x=>{x.name=this.photoEditorService.projectName,this.uploadService.checkStorage(x,E=>{E.status||this.photoEditorService.showStorageLimitError(),S&&S(E.status,x)})})}_saveImage(C,S,x=null,E=null){E.name=this.photoEditorService.projectName,this.uploadService.addImageFile(E,S,R=>{},a.P.IMG_EDITS,null,this.photoEditorService)}loadXHR(C){return new Promise(function(S,x){try{var E=new XMLHttpRequest;E.open("GET",C),E.responseType="blob",E.onerror=function(){x("Network error.")},E.onload=function(){200===E.status?S(E.response):x("Loading error:"+E.statusText)},E.send()}catch(M){x(M.message)}})}getBlobFromImage(C,S,x){C.width=S.width,C.height=S.height;const E=new G.fabric.Canvas(C);var M=new G.fabric.Image(S,{left:0,top:0,scaleX:1,scaleY:1}
1);E.add(M),E.renderAll(),C.toBlob(R=>{R.name=this.photoEditorService.projectName,x(R)},"image/jpeg",.95)}shouldRender(C){return this.index%2==0&&!C}onDestroy(){this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.hoverCursor="default",this.stateService.mainCanvas.setCursor("default"),this.zoomserviceSubscription&&this.zoomserviceSubscription.unsubscribe()}apply(C=!0){var S=this;if(this.photoEditorService.inProgress)return;this.photoEditorService.inProgress=!0;let x=G.fabric.util.createCanvasElement();const E=this.photoEditorService.theOriginalOriginalImage,M=this.photoEditorService.getMaxResolution();let R;R=C?this.photoEditorService.restoreResolution(E.width):Promise.resolve(),R.then(()=>{const I=G.fabric.perfLimitSizeTotal;G.fabric.perfLimitSizeTotal=16777216;const D=this.stateService.mainCanvas;let p,u,m;D.renderAll(),D.width>D.height?(p=M,u=M*D.height/D.width,m=this.zoomService.currentZoom*this.stateService.original.width/M):(u=M,p=M*D.width/D.height,m=this.zoomService.currentZoom*this.stateService.original.height/M),this.photoEditorService.getImageFromCanvas(p,u,m,x).then(function(){var b=(0,n.A)(function*(k){S.user?S.checkStorage(k.uri,function(){var A=(0,n.A)(function*(B,y){B&&y?(G.fabric.perfLimitSizeTotal=I,yield S.photoEditorService.setPhotoEditorInputImages(k.image),S.applyChanges(k,y)):(G.fabric.perfLimitSizeTotal=I,yield S.photoEditorService.setPhotoEditorInputImages(k.image),S.applyChanges(k,null))});return function(B,y){return A.apply(this,arguments)}}()):(G.fabric.perfLimitSizeTotal=I,yield S.photoEditorService.setPhotoEditorInputImages(k.image),S.applyChanges(k,null))});return function(k){return b.apply(this,arguments)}}()),this.zoomService.defaultZoom=!0,this.zoomService.fitToScreen()})}}},18770:(_e,ie,g)=>{"use strict";g.d(ie,{z:()=>I});var n=g(10467),o=g(19282),G=g(93552),P=g(50724),h=g(31151),d=(g(37228),g(54438)),e=g(33391),l=g(68287),_=g(10634),C=g(68010),S=g(91367);let x=(()=>{var D;class p extends h.Y{constructor(m,b,k,A,B,y){super(m),this.activeModal=m,this.modalService=b,this.env=k,this.paymentService=A,this.authService=B,this.loginService=y,this.fromAction="",this.projectId="",this.isNewUpgradePopup=!1,this.beforeImgUrl="https://d2v5dzhdg4zhx3.cloudfront.net/Test2024/ai_face_retouch/webp/frame1.webp",this.afterImgUrl="https://d2v5dzhdg4zhx3.cloudfront.net/Test2024/ai_face_retouch/webp/frame2.webp"}closePopup(){this.activeModal.close("ok")}upgrade(){let b=this.authService.currentUser();if(b&&!b.subscribed&&!b.trialConsumed&&window&&window.fbq&&window.fbq("track","StartTrial",{value:"0.00",currency:"USD",predicted_ltv:"0.00"}),b){if(b&&!b.subscribed){const k=this.modalService.open(P.n,{centered:!0,size:"lg",backdrop:"static",windowClass:"plans-dialog plans-dialog-mobile"+(this.env?.isMobileView?" hide-coin-section":"")});k.componentInstance.fromAction=this.fromAction,k.componentInstance.projectId=this.projectId,k.componentInstance.tabName=void 0,k.result.then(A=>{this.activeModal.close("ok"===A||"sucess"===A?"sucess":"close")})}}else this.loginService.openLoginDialog(k=>{b=this.authService.currentUser(),b&&!b.subscribed&&this.upgrade()})}ngOnInit(){}}return(D=p).\u0275fac=function(m){return new(m||D)(d.rXU(e.Lw),d.rXU(e.Bq),d.rXU(l.L),d.rXU(_.W),d.rXU(C.u),d.rXU(S.H))},D.\u0275cmp=d.VBU({type:D,selectors:[["app-comp-img-subsciption-popup"]],inputs:{fromAction:"fromAction",projectId:"projectId",isNewUpgradePopup:"isNewUpgradePopup"},features:[d.Vt3],decls:16,vars:0,consts:[[1,"d-flex","align-items-center","justify-content-center","flex-column","w-100"],[1,"text-24","text-black","text-semi","lh-125","text-center","mb-0"],[1,"mb-4","mt-4","position-relative"],["src","https://static.lightxeditor.com/assets/images/free-sessions.jpg",1,"border-radius-12","responsive"],[1,"position-absolute","beforeAfterBtn","text-sm","text-semi","grey-500",2,"top","12px","left","12px"],[1,"position-absolute","beforeAfterBtn","text-sm","text-semi","grey-500",2,"top","12px","right","12px"],[1,"text-lg","text-semi","lh-160","grey-700","mb-4"],[1,"d-flex","align-items-center","justify-content-center","w-100",2,"max-width","334px"],["id","upgrde_plan_from_popup",1,"btn-all","btn-outline-primary","text-13","btn-h40","me-2","w-100",3,"click"],[1,"btn-all","text-13","text-semi","btn-h40","pro-btn","text-white","border-radius-12","w-100",3,"click"]],template:function(m,b){1&m&&(d.j41(0,"div",0)(1,"h3",1),d.EFF(2,"You're Out Of Free Sessions Today"),d.k0s(),d.j41(3,"div",2),d.nrm(4,"img",3),d.j41(5,"div",4),d.EFF(6,"Before"),d.k0s(),d.j41(7,"div",5),d.EFF(8,"After"),d.k0s()(),d.j41(9,"span",6),d.EFF(10,"Upgrade to Pro today and unlock your best look all the time."),d.k0s(),d.j41(11,"div",7)(12,"button",8),d.bIt("click",function(){return b.closePopup()}),d.EFF(13,"Not Now"),d.k0s(),d.j41(14,"button",9),d.bIt("click",function(){return b.upgrade()}
1),d.EFF(15,"Upgrade to Pro"),d.k0s()()())},styles:[".feature-list[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{display:flex;color:#4a4f5e;padding:8px 0 12px;font-size:16px;line-height:21.79px;align-items:center}.scroll-y[_ngcontent-%COMP%]{height:200px;overflow:auto;scrollbar-width:thin;scrollbar-color:#7684ee #e5e7fe}.scroll-y[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px;height:8px}.scroll-y[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#e5e7fe;border-radius:20px}.scroll-y[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background-color:#7684ee;border-radius:20px}.pricing-box[_ngcontent-%COMP%]{background:#fff;border-radius:16px;z-index:1050;display:flex;min-height:517px}.feature-list[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .check-blue[_ngcontent-%COMP%]{display:inline-block;width:18px;margin-right:1.3rem;-webkit-mask-size:cover;mask-size:cover}.bg-page[_ngcontent-%COMP%]{border-radius:16px;background:linear-gradient(225.44deg,#7dc0d5,#dae8ec 16.15%,#a6d3e1 33.33%,#eefffb 52.6%,#daf4ff 73.96%,#f1fbff 89.06%,#d0f0ff)}.ml-40[_ngcontent-%COMP%]{margin-left:40px!important}@media (max-width: 576px){.ml-40[_ngcontent-%COMP%]{margin-left:16px!important}}.exceedMsg[_ngcontent-%COMP%]{background:#f25555;min-height:27px;font-size:14px;border-radius:4px;width:fit-content}.beforeAfterBtn[_ngcontent-%COMP%]{border-radius:6px;background:#ffffffb3;padding:4px 8px}"]}),p})();var E=g(16471),M=g(12658),R=g(74983);let I=(()=>{var D;class p{constructor(m,b,k){this.faceDetectionService=m,this.toastService=b,this.modalService=k,this.faceDataList=[],this.latestFaces=[],this.toolkeys=o.JJ,this.faceExpressionTools=o.zp,this.faceExpressionSubToolMap=new Map,this.mobileScreen=!1}detectFaces(m){var b=this;return(0,n.A)(function*(){return b.faceDetectionService.detectFaces(m)})()}checkAndResizeInpuImage(m,b,k){var A=this;return(0,n.A)(function*(){return A.faceDetectionService.checkAndResizeInpuImage(m,b,k)})()}createFaceList(m,b,k){var A=this;return(0,n.A)(function*(){return A.faceDataList=yield A.faceDetectionService.createFaceList(m,b,k),A.faceDataList})()}initializeFaceLandmarker(){var m=this;return(0,n.A)(function*(){return m.faceDetectionService.initializeFaceLandmarker()})()}loadModels(){var m=this;return(0,n.A)(function*(){return m.faceDetectionService.loadModels()})()}detectFacesFaceApi(m){var b=this;return(0,n.A)(function*(){return b.faceDetectionService.detectFacesFaceApi(m)})()}getFaceDetector(){return this.faceDetectionService.getFaceDetector()}updateFaceDataList(m,b){var k=this;return(0,n.A)(function*(){if(k.faceDataList.length>1){const A=k.mainCanvas.toDataURL({multiplier:1/k.mainCanvas.getZoom()}),B=new window.Image;B.src=A,yield new Promise(O=>{B.onload=O});const y=k.faceDataList;k.faceDataList=yield k.faceDetectionService.createFaceList(m,B,b),k.faceDataList.forEach(O=>{const w=y.find(j=>j.id===O.id);w&&(O.toolValues=w.toolValues,O.toolpreviousValues=w.toolpreviousValues,O.isEdited=w.isEdited)})}})()}putImageOnCanvas(){var m=this;return(0,n.A)(function*(){return new Promise(b=>{if(!m.selectedFace||!m.selectedFace.resultFace)return void m.showError("No face result image to put on canvas.");const k=m.selectedFace;G.fabric.Image.fromURL(k.resultFace,A=>{A.set({left:k.cropParam.boundedMinX,top:k.cropParam.boundedMinY,scaleX:(k.cropParam.boundedMaxX-k.cropParam.boundedMinX)/A.width,scaleY:(k.cropParam.boundedMaxY-k.cropParam.boundedMinY)/A.height,selectable:!1,hasControls:!1,hasBorders:!1}),m.mainCanvas.add(A),b()},{crossOrigin:"anonymous"})})})()}getBiggestFace(m){var b=this;return(0,n.A)(function*(k,A="canvas-mask-wrapper",B){b.faceDataList.forEach(O=>{O.toolValues=new Map,O.toolpreviousValues=new Map,o.zp.forEach(w=>{w.subToolArray.forEach(j=>{O.toolValues.set(j.subToolId,0),O.toolpreviousValues.set(j.subToolId,0)})})});let y=b.faceDataList.find(O=>O.id==k.firstOne.id);b.selectFaceImg(y,!0,A,B)}).apply(this,arguments)}selectFaceImg(m,b=!1,k="canvas-mask-wrapper",A){let B;B=m.hasOwnProperty("product")?m.product:m,this.selectedFace=B,this.checkandupdateFaceBoundingBox(),b||this.focusOnSelectedFace(k,A)}focusOnSelectedFace(m,b){if(!this.selectedFace||!this.mainCanvas)return;const k=this.mainCanvas,A=b.width,B=b.height,w=Math.min(.4*A/this.selectedFace.width,.4*B/this.selectedFace.height,2);if(this.mobileScreen?(k.setViewportTransform([w,0,0,w,A/2-(this.selectedFace.originX+this.selectedFace.width/2)*w,B/2-(this.selectedFace.originY+this.selectedFace.height/2)*w]),k.requestRenderAll()):this.zoomService&&(this.zoomService.set?(this.zoomService.set(w),this.zoomService.zoomValue$&&this.zoomService.zoomValue$.next()):k.setZoom(w)),!this.selectedFace)return;const j=document.getElementById(m),L=k.getZoom?k.getZoom():1,Z=this.selectedFace.originX*L+this.selectedFace.width/2-j.clientWidth/2,$=this.selectedFace.originY*L+this.selectedFace.height/2-j.clientHeight/2;setTimeout(()=>{j.scrollTo({left:Z,top:$,behavior:"smooth"})})}getFacesWithNonZeroToolValues(){const m=new Map;for(const b of this.faceDataList)b.toolValues&&Array.from(b.toolValues.values()).some(k=>0!==k)?(m.set(Number(b.id),b),b.isEdited=!0):b.isEdited=!1;return m}hideFaceBoundingBox(){this.faceBoundingBox&&this.mainCanvas.remove(this.faceBoundingBox)}showFaceBoundingBox(){this.checkandupdateFaceBoundingBox()}showError(m){const b=document.getElementById("error");b&&(b.textContent=m,console.error(m))}setServices(m){this.zoomService=m}mapValue(m,b,k,A,B){return m<0?A+(0-A)*(m-b)/(0-b):m>0?0+(B-0)*(m-0)/(k-0):0}checkandupdateFaceBoundingBox(){const m=this.selectedFace;this.faceDataList.length>1&&(this.faceBoundingBox?(this.mainCanvas.remove(this.faceBoundingBox),this.faceBoundingBox.set({left:m.originX,top:m.originY,width:m.width,height:m.height}),this.mainCanvas.add(this.faceBoundingBox)):(this.faceBoundingBox=new o.jj({left:m.originX,top:m.originY,width:m.width,height:m.height,objectCaching:!1}),this.mainCanvas.add(this.faceBoundingBox)))}getCanvasImageRegardlessViewTransform(){const m=this.mainCanvas,b=m.getObjects("image"),k=b&&b.length?b.reduce((Z,$)=>{const Y=(Z?.width||0)*(Z?.height||0);return($?.width||0)*($?.height||0)>Y?$:Z},b[0]):null;if(!k)return;let A;
1const B=k.getElement&&k.getElement(),y=B&&(B.naturalWidth||B.width)||k.width||m.getWidth(),O=B&&(B.naturalHeight||B.height)||k.height||m.getHeight(),w=m.viewportTransform?[...m.viewportTransform]:[1,0,0,1,0,0],j=m.getZoom?m.getZoom():1,L=m.getWidth(),U=m.getHeight(),z=m.clipPath;return m.setViewportTransform([1,0,0,1,0,0]),m.setZoom(1),m.clipPath=void 0,m.setWidth(y),m.setHeight(O),m.requestRenderAll(),A=m.toDataURL({multiplier:1}),m.setWidth(L),m.setHeight(U),m.setViewportTransform(w),m.setZoom(j),m.clipPath=z,m.requestRenderAll(),A}cutlatestfaces(){var m=this;return(0,n.A)(function*(b=!1){let k;m.latestFaces=[],k=b?m.getCanvasImageRegardlessViewTransform():m.mainCanvas.toDataURL({multiplier:1/m.mainCanvas.getZoom()});const A=new window.Image;let B;A.src=k,yield new Promise(O=>{A.onload=O});try{B=yield m.faceDetectionService.detectFaces(A)}catch{try{yield m.faceDetectionService.loadModels(),B=yield m.faceDetectionService.detectFacesFaceApi(A)}catch{return void m.toastService.showError("Face detection failed.")}}const y=B.detections.detections;for(let O=0;O<y.length;O++){const w=y[O],{originX:j,originY:L,width:U,height:z}=w.boundingBox,Z=1;let Y=L+z/2-z*Z/2,Q=j+U/2+U*Z/2,K=L+z/2+z*Z/2,W=Math.max(0,j+U/2-U*Z/2),X=Math.max(0,Y),F=Math.min(A.width,Q),V=Math.min(A.height,K);const le=yield m.faceDetectionService.cropFaceForLatestFaces(A,W,X,F-W,V-X);m.latestFaces.push({image:le,id:w.id})}}).apply(this,arguments)}putlatestfacesoncanvas(){this.latestFaces.forEach(m=>{m.id!==this.selectedFace.id&&this.mainCanvas.add(m.image)})}showSubscriptionModal(m=E.Fs.PhotoShoot,b="expression"){const k=this.modalService.open(x,{centered:!0,size:"md",backdrop:"static",windowClass:"free-sessions"});return k.componentInstance.tool=m,k.componentInstance.fromAction=b,k}}return(D=p).\u0275fac=function(m){return new(m||D)(d.KVO(M.g),d.KVO(R.f),d.KVO(e.Bq))},D.\u0275prov=d.jDH({token:D,factory:D.\u0275fac}),p})()},67298:(_e,ie,g)=>{"use strict";g.d(ie,{v:()=>D});var n=g(54438),o=g(71971),G=g(32294),P=g(1408),h=g(60177),a=g(2820),d=g(84341),e=g(19338),l=g(85188),_=g(23486);const C=["scaleInput"],S=["rotateInput"];function x(p,u){if(1&p){const m=n.RV6();n.j41(0,"div",4)(1,"div",5)(2,"h5",6),n.EFF(3,"Resize"),n.k0s(),n.j41(4,"div",7)(5,"div",8)(6,"button",9),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.fillCanvas(!0))}),n.nrm(7,"ei",10),n.EFF(8,"Fill "),n.k0s()(),n.j41(9,"div",11)(10,"button",9),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.fillCanvas(!1))}),n.nrm(11,"ei",12),n.EFF(12,"Fit "),n.k0s()()()()()}}function E(p,u){if(1&p){const m=n.RV6();n.j41(0,"div",13)(1,"div",5)(2,"h5",6),n.EFF(3,"Scale"),n.k0s(),n.j41(4,"div",14)(5,"div",8)(6,"mv-slider",15),n.bIt("change",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputScale(k))})("slideStop",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputScale(k))}),n.k0s()(),n.j41(7,"div",11)(8,"input",16,0),n.mxI("ngModelChange",function(k){n.eBV(m);const A=n.XpG();return n.DH7(A.scale,k)||(A.scale=k),n.Njj(k)}),n.bIt("ngModelChange",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputScale(k))})("keydown.enter",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.focusOutScale(k))})("focusout",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.focusOutScale(k))}),n.k0s()()()()()}if(2&p){const m=n.XpG();n.R7$(6),n.Y8G("value",m.scale)("min",m.scaleMin)("max",m.scaleMax)("step",1),n.R7$(2),n.R50("ngModel",m.scale)}}function M(p,u){if(1&p){const m=n.RV6();n.j41(0,"div",4)(1,"div",5)(2,"h5",6),n.EFF(3,"Rotate"),n.k0s(),n.j41(4,"div",14)(5,"div",8)(6,"mv-slider",15),n.bIt("change",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputAngle(k))})("slideStop",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputAngle(k))}),n.k0s()(),n.j41(7,"div",11)(8,"input",17,1),n.mxI("ngModelChange",function(k){n.eBV(m);const A=n.XpG();return n.DH7(A.rotateAngle,k)||(A.rotateAngle=k),n.Njj(k)}),n.bIt("ngModelChange",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.inputAngle(k))})("keydown.enter",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.focusOutRotate(k))})("focusout",function(k){n.eBV(m);const A=n.XpG();return n.Njj(A.focusOutRotate(k))}),n.k0s()()(),n.j41(10,"div",18)(11,"div",19)(12,"button",20),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.antiClockwise())}),n.nrm(13,"ei",21),n.EFF(14,"Anti CW "),n.k0s()(),n.j41(15,"div",19)(16,"button",20),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.clockwise())}),n.nrm(17,"ei",22),n.EFF(18,"CW "),n.k0s()()()()()}if(2&p){const m=n.XpG();n.R7$(6),n.Y8G("value",m.rotateAngle)("min",-180)("max",180)("step",1),n.R7$(2),n.R50("ngModel",m.rotateAngle),n.Y8G("allowNegativeNumbers",!0)}}function R(p,u){if(1&p){const m=n.RV6();n.j41(0,"div",4)(1,"div",5)(2,"h5",6),n.EFF(3,"Align"),n.k0s(),n.j41(4,"div",23)(5,"div",24)(6,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.TOP))}),n.nrm(7,"ei",26),n.EFF(8,"Top"),n.k0s()(),n.j41(9,"div",27)(10,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.LEFT))}),n.nrm(11,"ei",28),n.EFF(12," Left"),n.k0s()()(),n.j41(13,"div",29)(14,"div",24)(15,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.MIDDLE))}),n.nrm(16,"ei",30),n.EFF(17," Middle"),n.k0s()(),n.j41(18,"div",27)(19,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.CENTER))}),n.nrm(20,"ei",31),n.EFF(21," Center"),n.k0s()()(),n.j41(22,"div",29)(23,"div",24)(24,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.BOTTOM))}),n.nrm(25,"ei",32),n.EFF(26," Bottom"),n.k0s()(),n.j41(27,"div",27)(28,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.align(k.ALIGN.RIGHT))}),n.nrm(29,"ei",33),n.EFF(30," Right"),n.k0s()()()(),n.j41(31,"div",34)(32,"h5",6),n.EFF(33,"Arrange"),n.k0s(),n.j41(34,"div",23)(35,"div",24)(36,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.bringToFront())}),n.nrm(37,"ei",35),n.EFF(38,"Bring to front"),n.k0s()(),n.j41(39,"div",27)(40,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.sendToBack())}),n.nrm(41,"ei",36),n.EFF(42,"Send to back"),n.k0s()()()()()}}function I(p,u){if(1&p){const m=n.RV6();n.j41(0,"div",4)(1,"div",5)(2,"h5",37),n.EFF(3,"Flip"),n.k0s(),n.j41(4,"div",23)(5,"div",24)(6,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.flipVertical())}),n.nrm(7,"ei",38),n.EFF(8," Horizontal "),n.k0s()(),n.j41(9,"div",24)(10,"button",25),n.bIt("click",function(){n.eBV(m);const k=n.XpG();return n.Njj(k.flipHorizontal())}),n.nrm(11,"ei",39),n.EFF(12,"Vertical "),n.k0s()()()()()}}let D=(()=>{var p;class u{constructor(b,k,A){this.zone=b,this.sceneController=k,this.editorService=A,this.isBackbroun
1d=!1,this.Resize=!1,this.scaled=new n.bkB,this.fillCanvasEvent=new n.bkB,this.rotateAngle=0,this.scale=0,this.ALIGN=o.W3,this.scaleMin=1,this.scaleMax=200}ngOnInit(){this.isBackbround&&(this.scaleMin=100,this.scaleMax=300)}ngOnChanges(){this.activeObject&&(this.scale=Math.round(100*this.activeObject.getScale()),this.Rotate&&this.initAngle(),this.activeObject.tansformation.subscribe(()=>{this.Rotate&&this.initAngle(),this.zone.run(()=>{let b=Math.round(100*this.activeObject.getScale());this.scale=b})}))}inputScale(b){let k,A;b.newValue?(k=b.newValue,A=!1):(k=b,A=!0),""!==k&&!Number.isNaN(Number(k))&&(k>this.scaleMax?setTimeout(()=>{k=this.scaleMax,this.activeObject.setScale(k/100,A)},0):k<this.scaleMin?setTimeout(()=>{k=this.scaleMin,this.activeObject.setScale(k/100,A)},0):this.activeObject.setScale(k/100,A),A&&this.scaled.emit())}initAngle(){let b=this.activeObject.getAngle();b=Math.round(100*b)/100,this.rotateAngle=b<=180?b:b>=360?-180:b-360}inputAngle(b){let k,A;b.newValue||0===b.newValue?(k=b.newValue,A=!1):(k=b,A=!0),(k||0===k)&&!Number.isNaN(k)&&((k>360||k<-360)&&setTimeout(()=>{k=0},0),setTimeout(()=>{this.activeObject.setAngle(k,A)},0))}clockwise(){let b=this.rotateAngle+90;b>180&&(b=-360+b),this.inputAngle(b)}antiClockwise(){let b=this.rotateAngle-90;b<-180&&(b=360+b),this.inputAngle(b)}align(b){this.activeObject.align(b)}flipVertical(){this.activeObject.xFlip()}flipHorizontal(){this.activeObject.yFlip()}bringToFront(){this.sceneController.getSelectedScene().moveUpwards(()=>{this.editorService.setOnChange({name:"zOrder"})},this.editorService)}sendToBack(){this.sceneController.getSelectedScene().moveDownwards(()=>{this.editorService.setOnChange({name:"zOrder"})},this.editorService)}focusOutScale(b){b.preventDefault(),this.scale||(this.scale=100,this.inputScale(this.scale)),this.scaleInput.nativeElement.blur()}focusOutRotate(b){b.preventDefault(),this.rotateAngle||(this.rotateAngle=0,this.inputAngle(this.rotateAngle)),this.rotateInput.nativeElement.blur()}fillCanvas(b){this.fillCanvasEvent.emit(b)}}return(p=u).\u0275fac=function(b){return new(b||p)(n.rXU(n.SKi),n.rXU(G.Z,8),n.rXU(P.x))},p.\u0275cmp=n.VBU({type:p,selectors:[["adjust-tool"]],viewQuery:function(b,k){if(1&b&&(n.GBs(C,5),n.GBs(S,5)),2&b){let A;n.mGM(A=n.lsd())&&(k.scaleInput=A.first),n.mGM(A=n.lsd())&&(k.rotateInput=A.first)}}
1,inputs:{isBackbround:"isBackbround",activeObject:"activeObject",Align:"Align",Scale:"Scale",Rotate:"Rotate",Flip:"Flip",Arrange:"Arrange",Resize:"Resize"},outputs:{scaled:"scaled",fillCanvasEvent:"fillCanvasEvent"},features:[n.OA$],decls:5,vars:5,consts:[["scaleInput",""],["rotateInput",""],["class","card drawer-card",4,"ngIf"],["class","card drawer-card mt-0",4,"ngIf"],[1,"card","drawer-card"],[1,"card-body"],[1,"card-title","m-0","text-semi"],[1,"d-flex","mt-2"],[1,"wp-100","d-flex","align-items-center"],["type","button",1,"btn","btn-link","active-btn","d-flex","align-items-center","p-0","f-13","text-semi",3,"click"],["name","fill",1,"icon","f-24","mr-9","no-valign","ms-2"],[1,"ml-9"],["name","fit",1,"icon","f-24","mr-9","no-valign","ms-2"],[1,"card","drawer-card","mt-0"],[1,"d-flex","mt-1"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],["type","text","numbersOnly","",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","focusout","ngModel"],["type","text","mask","separator.2","separatorLimit","100",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","focusout","ngModel","allowNegativeNumbers"],[1,"d-flex","justify-content-between","mt-8"],[1,""],["type","button",1,"btn","btn-link","d-flex","align-items-center","p-0",3,"click"],["name","anticlockwise",1,"icon","f-24","mr-9","no-valign","ms-2"],["name","clockwise",1,"icon","f-24","mr-9","no-valign","ms-2"],[1,"d-flex","mt-8"],[1,"col-sm-6","p-0"],["type","button",1,"btn","btn-link","text-semi","p-0","d-flex","align-items-center",3,"click"],["name","aligntop",1,"icon","f-24","mr-9","ms-2"],[1,"col-sm-6","p-0","ms-1"],["name","alignleft",1,"icon","f-24","mr-9","ms-2"],[1,"d-flex","mt-9"],["name","alignmiddle",1,"icon","f-24","mr-9","ms-2"],["name","aligncenter",1,"icon","f-24","mr-9","ms-2"],["name","alignbottom",1,"icon","f-24","mr-9","ms-2"],["name","alignright",1,"icon","f-24","mr-9","ms-2"],[1,"card-body","mt-10"],["name","bringtofront",1,"icon","f-24","mr-9","ms-1"],["name","sendtoback",1,"icon","f-24","mr-9","ms-1"],[1,"card-title","mt-1","text-semi"],["name","horizontalflip",1,"icon","f-24","mr-9","ms-2"],["name","verticalflip",1,"icon","f-24","mr-9","ms-2"]],template:function(b,k){1&b&&n.DNE(0,x,13,0,"div",2)(1,E,10,5,"div",3)(2,M,19,6,"div",2)(3,R,43,0,"div",2)(4,I,13,0,"div",2),2&b&&(n.Y8G("ngIf",k.Resize),n.R7$(),n.Y8G("ngIf",k.Scale),n.R7$(),n.Y8G("ngIf",k.Rotate),n.R7$(),n.Y8G("ngIf",k.Align),n.R7$(),n.Y8G("ngIf",k.Flip))},dependencies:[h.bT,a.Z,d.me,d.BC,d.vS,e.d1,l.Zr,_.KK]}),u})()},69333:(_e,ie,g)=>{"use strict";g.d(ie,{n:()=>d});var n=g(54438),o=g(33391),G=g(60177),P=g(21652),h=g(68064);function a(e,l){if(1&e){const _=n.RV6();n.j41(0,"div")(1,"div",3)(2,"button",4),n.EFF(3,"Custom"),n.k0s(),n.j41(4,"button",5),n.bIt("click",function(){n.eBV(_);const S=n.XpG();return n.Njj(S.colorPickerClose())}),n.nrm(5,"pi",6),n.k0s()()()}}let d=(()=>{var e;class l{constructor(C){this.activeModal=C,this.changed=new n.bkB,this.colorEnable=new n.bkB,this.isDialog=!1,this.colorsBgPresets=[],this.appPanelVisible=!0}ngOnInit(){}changeColor(C){this.selectedColor=C,this.changed.emit(C)}closeColor(){this.appPanelVisible=!1,this.colorEnable.emit()}colorPickerClose(){this.activeModal.close(this.selectedColor)}inputColor(){}}return(e=l).\u0275fac=function(C){return new(C||e)(n.rXU(o.Lw))},e.\u0275cmp=n.VBU({type:e,selectors:[["app-color-picker-panel"]],inputs:{colorMap:"colorMap",selectedColor:"selectedColor",isDialog:"isDialog"},outputs:{changed:"changed",colorEnable:"colorEnable"},decls:3,vars:8,consts:[[4,"ngIf"],[1,"bg-color-panel","mt-10",2,"box-shadow","0px 4px 8px rgb(0 0 0 / 5%)","border-radius","16px"],[3,"colorPickerChange","cpToggle","cpDialogDisplay","colorPicker","cpOutputFormat","cpEyeDropper"],[1,"w-100","mt-2","mb-9","pl-9","pr-9","d-inline-flex","align-items-center","justify-content-between",2,"min-height","24px"],[1,"btn-all","p-0","m-0","btn-left-color","text-14","text-semi","grey-800"],[1,"btn-all","p-0","m-0","btn-right-color","float-end",3,"click"],["name","closecolortool"]],template:function(C,S){1&C&&(n.DNE(0,a,6,0,"div",0),n.j41(1,"div",1)(2,"span",2),n.mxI("colorPickerChange",function(E){return n.DH7(S.selectedColor,E)||(S.selectedColor=E),E}),n.bIt("colorPickerChange",function(E){return S.changeColor(E)}),n.k0s()()),2&C&&(n.Y8G("ngIf",S.isDialog),n.R7$(2),n.xc7("background",S.selectedColor),n.Y8G("cpToggle",!0)("cpDialogDisplay","inline"),n.R50("colorPicker",S.selectedColor),n.Y8G("cpOutputFormat","hex")("cpEyeDropper",!0))},dependencies:[G.bT,P.bk,h.b],styles:[".bg-color-panel[_ngcontent-%COMP%]{top:0;background:#fff;height:100%;width:100%;z-index:9}"]}),l})()},90858:(_e,ie,g)=>{"use strict";g.d(ie,{V:()=>d});var n=g(54438),o=g(60177),G=g(2820),P=g(84341),h=g(19338);function a(e,l){if(1&e){const _=n.RV6();n.j41(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"input",5),n.mxI("ngModelChange",function(S){n.eBV(_);const x=n.XpG();return n.DH7(x.opacity,S)||(x.opacity=S),n.Njj(S)}),n.bIt("ngModelChange",function(S){n.eBV(_);const x=n.XpG();return n.Njj(x.inputOpacity(S))}),n.k0s(),n.j41(5,"div")(6,"mv-slider",6),n.bIt("change",function(S){n.eBV(_);const x=n.XpG();return n.Njj(x.inputOpacity(S))})("slideStop",function(S){n.eBV(_);const x=n.XpG();return n.Njj(x.inputOpacity(S))}),n.k0s()()()()()()}if(2&e){const _=n.XpG();n.R7$(4),n.R50("ngModel",_.opacity),n.R7$(2),n.Y8G("orientation",_.vertical)("value",_.opacity)("min",1)("max",100)("step",1)}}let d=(()=>{var e;class l{constructor(){this.opacity=100,this.vertical="vertical"}ngOnChanges(){this.opacity=100*this.activeObject.getOpacity()}inputOpacity(C){let S;if(C){let x;return C.newValue?(S=C.newValue,x=!1):(S=C,x=!0),S>0?S>100?setTimeout(()=>{this.setOpacity(1,x)},0):setTimeout(()=>{this.setOpacity(S/100,x)},0):setTimeout(()=>{this.setOpacity(.01,x)},0),!0}}setOpacity(C,S){let x=this.activeObject.setOpacity(C,S);x*=100,this.opacity=Math.round(10*x)/10}}return(e=l).\u0275fac=function(C){return new(C||e)},e.\u0275cmp=n.VBU({type:e,selectors:[["opacity-tool"]],inputs:{activeObject:"activeObject",verticalOrientation:"verticalOrientation"},features:[n.OA$],decls:1,vars:1,consts:[["class","card drawer-card",4,"ngIf"],[1,"card","drawer-card"],[1,"card-body"],[1,"d-flex"],[2,"margin","0 auto !important"],["type","text","numbersOnly","",1,"form-control","text-normal","text-black","form-input-sm","mb-3",3,"ngModelChange","ngModel"],["reversed","true","natural_arrow_keys","false",1,"opacity-slider-reverse","opacity-slider",3,"change","slideStop","orientation","value","min","max","step"]],template:function(C,S){1&C&&n.DNE(0,a,7,6,"div",0),2&C&&n.Y8G("ngIf",S.verticalOrientation)},dependencies:[o.bT,G.Z,P.me,P.BC,P.vS,h.d1],styles:[".button-row[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{display:table-cell;margin-right:8px}.button-row[_ngcontent-%COMP%]{display:inline-block}.tool-card[_ngcontent-%COMP%]{margin-bottom:10px}.rotate-button[_ngcontent-%COMP%]{text-align:center;cursor:pointer;margin:0 5px;padding:5px;width:45px;height:45px;flex-shrink:0;border-radius:4px;border:1px solid #eee;background-color:#fff;
1transition:box-shadow .3s ease}.animation-type-section[_ngcontent-%COMP%]{margin-top:20px}.in-animation-section[_ngcontent-%COMP%] small[_ngcontent-%COMP%]{font-size:13px;padding-left:8px}.anim-tool[_ngcontent-%COMP%]{display:inline-block;margin:auto;width:25%}.slider[_ngcontent-%COMP%]{display:flex;align-items:center}.is-active[_ngcontent-%COMP%]{border:2px solid #007AFF!important}button[_ngcontent-%COMP%]:focus{outline:#007AFF auto 1px}.form-input-sm[_ngcontent-%COMP%]{width:40px;height:32px;letter-spacing:.28px;text-align:center;padding:0;border:1px solid #E2E3E9;border-radius:12px}"]}),l})()},549:(_e,ie,g)=>{"use strict";g.d(ie,{Z:()=>Y});var n=g(54438),o=g(27707),G=g(16471),P=g(45312),h=g(33391),a=g(68010),d=g(3781),e=g(79829),l=g(32764),_=g(93391),C=g(2820),S=g(84341),x=g(89818),E=g(19338),M=g(68064),R=g(36561),I=g(69333);const D=["scaleInput"],p=["widthInput"],u=["heightInput"],m=(Q,K)=>K.id;function b(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"pi",26),n.bIt("click",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.onCancel())}),n.k0s()}}function k(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"div",12)(1,"buttons-scroll-menu",27),n.bIt("selectLayout",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.layoutSelect(F))}),n.k0s()()}if(2&Q){const W=n.XpG(2);n.R7$(),n.Y8G("items",W.socialMediaLayout)("type","resizeSocialIcon")("name",W.name)}}function A(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"li")(1,"a",30),n.bIt("click",function(){const F=n.eBV(W).$implicit,V=n.XpG(5);return n.Njj(V.onSizeChange(F))}),n.j41(2,"div",31)(3,"div",32)(4,"div",33),n.nrm(5,"pi",34),n.k0s()(),n.j41(6,"div")(7,"div",35),n.EFF(8),n.k0s(),n.j41(9,"div",36),n.EFF(10),n.k0s()()()()()}if(2&Q){const W=K.$implicit,X=n.XpG(5);n.R7$(2),n.AVh("iconDivActive",W.id===X.selectedLayoutId),n.R7$(2),n.xc7("width",W.boxWidth,"px")("height",W.boxHeight,"px"),n.R7$(),n.Y8G("name",W.iconName),n.R7$(),n.AVh("tw-line",W.socialPlatform.length>12)("th-line",W.socialPlatform.length>20),n.R7$(2),n.JRh(W.short_name||W.socialPlatform),n.R7$(2),n.Lme("",W.width," x ",W.height,"")}}function B(Q,K){if(1&Q&&(n.j41(0,"div",28)(1,"ul",29),n.Z7z(2,A,11,14,"li",null,m),n.k0s()()),2&Q){const W=n.XpG().$implicit;n.R7$(2),n.Dyx(W.socialPlatformFormats)}}function y(Q,K){1&Q&&n.DNE(0,B,4,0,"div",28),2&Q&&n.vxM(0!==K.$implicit.id?0:-1)}function O(Q,K){if(1&Q&&n.Z7z(0,y,1,1,null,null,m),2&Q){const W=n.XpG(2);n.Dyx(W.resizeLayouts)}}function w(Q,K){1&Q&&(n.j41(0,"div",46),n.EFF(1," All sizes are in pixels. "),n.k0s())}function j(Q,K){if(1&Q&&(n.j41(0,"div",47),n.EFF(1),n.k0s()),2&Q){const W=n.XpG(3);n.R7$(),n.SpI(" ",W.errorsmsg," ")}}function L(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"div",37)(1,"div",38)(2,"input",39,2),n.mxI("ngModelChange",function(F){n.eBV(W);const V=n.XpG(2);return n.DH7(V.width,F)||(V.width=F),n.Njj(F)}),n.bIt("keyup",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.onKeyUpWidth(F))})("focusout",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.onFocusOut())})("click",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.inputWidthClicked=!0)})("keyup.enter",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.keyEnter())}),n.k0s(),n.j41(4,"div",40)(5,"span",41),n.EFF(6,"W"),n.k0s(),n.j41(7,"div",42),n.nrm(8,"pi",43),n.k0s()()(),n.nrm(9,"pi",44),n.j41(10,"div",38)(11,"input",45,3),n.mxI("ngModelChange",function(F){n.eBV(W);const V=n.XpG(2);return n.DH7(V.height,F)||(V.height=F),n.Njj(F)}),n.bIt("keyup",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.onKeyUpHeight(F))})("click",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.inputHeightClicked=!0)})("focusout",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.onFocusOut())})("keyup.enter",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.keyEnter())}),n.k0s(),n.j41(13,"div",40)(14,"span",41),n.EFF(15,"H"),n.k0s(),n.j41(16,"div",42),n.nrm(17,"pi",43),n.k0s()()()(),n.DNE(18,w,2,0,"div",46)(19,j,2,1,"div",47),n.j41(20,"div",48)(21,"div",49)(22,"input",50),n.mxI("ngModelChange",function(F){n.eBV(W);const V=n.XpG(2);return n.DH7(V.lockedAspectRatio,F)||(V.lockedAspectRatio=F),n.Njj(F)}),n.bIt("change",function(){n.eBV(W);const F=n.XpG(2);return n.Njj(F.changeAspectRatio())}),n.k0s()(),n.j41(23,"span",51),n.EFF(24,"Lock Aspect Ratio"),n.k0s()()}if(2&Q){const W=n.XpG(2);n.R7$(),n.AVh("cus-error",W.width<40||W.width>4e3),n.R7$(),n.R50("ngModel",W.width),n.R7$(3),n.AVh("widthHeightTextN",W.inputWidthClicked),n.R7$(5),n.AVh("cus-error",W.he
1ight<40||W.height>4e3),n.R7$(),n.R50("ngModel",W.height),n.R7$(3),n.AVh("widthHeightTextN",W.inputHeightClicked),n.R7$(4),n.vxM(""===W.errorsmsg?18:19),n.R7$(4),n.R50("ngModel",W.lockedAspectRatio)}}function U(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"div",23)(1,"div",52)(2,"div",53)(3,"h5",54),n.EFF(4,"Scale"),n.k0s(),n.j41(5,"div",55)(6,"div",56)(7,"mv-slider",57),n.bIt("change",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.inputScale(F))})("slideStop",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.inputScale(F))}),n.k0s()(),n.j41(8,"div",58)(9,"input",59,4),n.mxI("ngModelChange",function(F){n.eBV(W);const V=n.XpG(2);return n.DH7(V.scale,F)||(V.scale=F),n.Njj(F)}),n.bIt("ngModelChange",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.inputScale(F))})("keydown.enter",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.focusOutScale(F))})("focusout",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.focusOutScale(F))}),n.k0s()()()()()()}if(2&Q){const W=n.XpG(2);n.R7$(),n.AVh("is-disabled",!W.activeObject),n.R7$(6),n.Y8G("value",W.scale)("min",W.scaleMin)("max",W.scaleMax)("step",1),n.R7$(),n.AVh("error-scale",W.scale<100||W.scale>300),n.R7$(),n.R50("ngModel",W.scale)}}function z(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"buttons-scroll-menu",60),n.bIt("selectMenu",function(F){n.eBV(W);const V=n.XpG(2);return n.Njj(V.changeColor(F))}),n.k0s()}if(2&Q){const W=n.XpG(2);n.Y8G("selectedBgColor",W.selectedBgColor)("items",W.colorsBgPresets)("type","resizeBgColor")}}function Z(Q,K){if(1&Q){const W=n.RV6();n.SS7(0)(1),n.j41(2,"div",7)(3,"div",8),n.DNE(4,b,1,0,"pi",9),n.j41(5,"div",10),n.EFF(6,"Resize Photos"),n.k0s()(),n.j41(7,"ng-select",11),n.bIt("open",function(){n.eBV(W);const F=n.XpG();return n.Njj(F.onSelectOpen())})("close",function(){n.eBV(W);const F=n.XpG();return n.Njj(F.onSelectClose())})("change",function(F){n.eBV(W);const V=n.XpG();return n.Njj(V.onCategorySelect(F))}),n.k0s(),n.DNE(8,k,2,3,"div",12),n.k0s(),n.j41(9,"div",13)(10,"div",14)(11,"div",15,0)(13,"div")(14,"div",16),n.DNE(15,O,2,0),n.j41(16,"div",17),n.DNE(17,L,25,12),n.k0s(),n.j41(18,"div",18)(19,"div",19)(20,"div",20),n.EFF(21,"Fill Canvas"),n.k0s()(),n.j41(22,"div",21)(23,"toggle-switch",22),n.bIt("changeT",function(F){n.eBV(W);const V=n.XpG();return n.Njj(V.toggleFillCanvas(F))}),n.k0s()()(),n.DNE(24,U,11,9,"div",23),n.j41(25,"div",24,1),n.DNE(27,z,1,3,"buttons-scroll-menu",25),n.k0s()()()()()()}if(2&Q){const W=n.XpG(),X="socialmedia"===W.selectedLayoutTitle,F="custom"===W.selectedLayoutTitle;n.R7$(4),n.vxM(W.showBackArrow?4:-1),n.R7$(3),n.Y8G("items",W.CreateFromScratch)("ngModel",W.selectedLayoutTitle)("searchable",!1)("clearable",!1),n.R7$(),n.vxM(X?8:-1),n.R7$(7),n.vxM(F?-1:15),n.R7$(2),n.vxM(F?17:-1),n.R7$(5),n.AVh("toggle-disabled",!W.selectedLayoutId&&W.batchResize),n.R7$(),n.Y8G("selected",W.fillCanvas),n.R7$(),n.vxM(W.showScale&&W.fillCanvas?24:-1),n.R7$(3),n.vxM(W.fillCanvas?-1:27)}}function $(Q,K){if(1&Q){const W=n.RV6();n.j41(0,"div",6)(1,"div",61)(2,"div",62)(3,"div")(4,"button",63),n.EFF(5,"Custom"),n.k0s(),n.j41(6,"button",64),n.bIt("click",function(){n.eBV(W);const F=n.XpG();return n.Njj(F.closeColorPicker("custom-color"))}),n.nrm(7,"pi",65),n.k0s()(),n.j41(8,"app-color-picker-panel",66),n.bIt("colorEnable",function(){n.eBV(W);const F=n.XpG();return n.Njj(F.colorPickerEnable=!1)})("changed",function(F){n.eBV(W);const V=n.XpG();return n.Njj(V.changeColor(F))}),n.k0s()()()()}if(2&Q){const W=n.XpG();n.R7$(8),n.Y8G("selectedColor",50==W.selectedCustomColor||100==W.selectedCustomColor?null:W.selectedCustomColor)}}let Y=(()=>{var Q;class K{constructor(X,F,V,le,fe,Ce){this.activeModal=X,this.authService=F,this.renderer=V,this.stateService=le,this.photoEditorService=fe,this.templateService=Ce,this.url=P.c.staticAssetsPath+"assets/json/resize.config.json",this.showBackArrow=!1,this.showScale=!0,this.changeSize=new n.bkB,this.changeScale=new n.bkB,this.bgColorChanged=new n.bkB,this.cancel=new n.bkB,this.changeLockAspectRatio=new n.bkB,this.customError=new n.bkB,this.scale=100,this.fillCanvas=!0,this.width=0,this.height=0,this.name="",this.batchResize=!1,this.inputWi
1dthClicked=!1,this.inputHeightClicked=!1,this.originalWidth=0,this.originalHeight=0,this.templateType=1,this.scaleMin=100,this.scaleMax=300,this.colorsBgPresets=[],this.isdisabled=!0,this.errorsmsg="",this.lockedAspectRatio=!0,this.selectedBgColor=null,this.colorPickerEnable=!1,this.selectedCustomColor=null,this.selectedLayoutTitle="popular",this.customsize={width:null,height:null},this.layoutsCache=new Map,this.user=this.authService.currentUser(),this.isSubscribed=!!this.user&&this.user.subscribed,this.colorsBgPresets=o.PV.ui.colorBgPresets.items,this.originalWidth=this.photoEditorService?.originalImage?.width,this.originalHeight=this.photoEditorService?.originalImage?.height}ngOnInit(){this.templateService.getResizeContent(this.templateType,X=>{if(!X)return;this.CreateFromScratch=X,this.layoutsCache.clear();const F=this.CreateFromScratch.find(V=>V.title==G.zu.SocialMedia);if(this.socialMediaLayout=F?.socialMediaLayout,this.name){this.resizeLayouts=this.getResizeLayouts(this.name),this.resizeLayouts?.length>0?this.selectedLayoutTitle=this.resizeLayouts[0].title:(this.selectedLayoutTitle=G.zu.SocialMedia,this.resizeLayouts=this.getResizeLayouts(G.zu.SocialMedia,this.name),this.selectedLayoutTitle=this.resizeLayouts[0]?.title);const V=this.photoEditorService?.photoEditorOptions,le=this.resizeLayouts?.[0]?.socialPlatformFormats?.find(fe=>fe.width==V?._rw&&fe.height==V?._rh&&fe.socialPlatformId==V?.socialPlatformId);le&&(this.selectedLayoutId=le.id,this.selectedLayout=le)}else this.resizeLayouts=this.getResizeLayouts(this.selectedLayoutTitle);this.selectedLayout=this.selectedLayout??this.resizeLayouts[0]?.socialPlatformFormats?.[0],this.stateService&&(this.stateService.mainCanvas.isDrawingMode=!1,this.stateService.mainCanvas.defaultCursor="move")})}getResizeLayouts(X,F){const V=F?.toLowerCase(),le=V?`${X}:${V}`:X,fe=this.layoutsCache.get(le);if(fe)return fe;const Ce=this.CreateFromScratch.filter(Ne=>Ne.title.startsWith(X)).map(Ne=>({...Ne,socialPlatformFormats:V?Ne.socialPlatformFormats.filter(Ze=>Ze.socialPlatform.toLowerCase().startsWith(V)):Ne.socialPlatformFormats}));return this.layoutsCache.set(le,Ce),Ce}layoutSelect(X){this.selectedLayoutId=0,this.resizeLayouts=this.getResizeLayouts(G.zu.SocialMedia,X)}onCategorySelect(X){this.name="",this.isdisabled=!1,this.selectedLayoutId=0,this.selectedLayoutTitle=X.title,this.selectedLayoutTitle==G.zu.SocialMedia?(this.name=G.zu.Instagram,this.layoutSelect(this.name)):this.resizeLayouts=this.getResizeLayouts(this.selectedLayoutTitle),this.selectedLayoutTitle===G.zu.Custom&&(this.lockedWidth=Number(this.width),this.lockedHeight=Number(this.height),this.selectedLayoutId||(this.setCustomValue(!0),setTimeout(()=>{this.widthInput&&this.widthInput.nativeElement.focus()},100)),this.selectedLayoutId=this.resizeLayouts[0].socialPlatformFormats[0].id),this.customError.emit(this.isdisabled)}onSizeChange(X){this.batchResize=!1,this.scale=this.scaleMin,this.selectedLayoutId=X.id,this.selectedLayout={...X,fillCanvas:this.fillCanvas,isValid:!0,isApply:!0},this.changeSize.emit(this.selectedLayout)}setCustomValue(X){this.selectedLayout={...this.resizeLayouts[0].socialPlatformFormats[0],width:Number(this.width),height:Number(this.height),fillCanvas:this.fillCanvas,isValid:this.isValidate(),isApply:X},this.changeSize.emit(this.selectedLayout)}keyEnter(){this.inputWidthClicked=!1,this.inputHeightClicked=!1,this.setCustomValue(!0),this.widthInput&&this.heightInput&&(this.widthInput.nativeElement.blur(),this.heightInput.nativeElement.blur())}onFocusOut(){(this.width>this.originalWidth||this.height>this.originalHeight)&&(this.width=this.originalWidth,this.height=this.originalHeight),this.keyEnter()}isValidate(){let X=this.width,F=this.height,V=!1,le="";return this.errorsmsg="",(null!=X&&(X<40||X>4e3)||null!=F&&(F<40||F>4e3))&&(V=!0),X<40||F<40?le="Size cannot be smaller than 40x40":(X>4e3||F>4e3)&&(le="Size cannot be bigger than 4000 x 4000"),V?(this.isdisabled=!0,this.errorsmsg=le,this.customError.emit(this.isdisabled)):(null!=X&&null!=F&&(this.isdisabled=!1),this.customError.emit(this.isdisabled)),!V}onKeyUpWidth(X){let F=Number(X.target.value);this.width=isNaN(F)?0:F,this.lockedAspectRatio?this.calculateAspectRatio(X.target.value,"width"):this.isValidate(),this.setCustomValue(!1)}onKeyUpHeight(X){let F=Number(X.target.value);this.height=isNaN(F)?0:F,this.lockedAspectRatio?this.calculateAspectRatio(X.target.value,"height"):this.isValidate(),this.setCustomValue(!1)}calculateAspectRatio(X,F){const V=this.lockedWidth,le=this.lockedHeight;"height"===F?this.width=Math.round(V/le*Number(X)):this.height=Math.round(le/V*Number(X)),this.isValidate()}toggleFillCanvas(X){this.scale=this.scaleMin,this.fillCanvas=X,this.selectedLayout&&(this.selectedLayout={...this.selectedLayout,fillCanvas:X,isApply:!0},this.selectedLayoutId&&this.changeSize.emit(this.selectedLayout))}changeColor(X){"custom-color"===X?(this.colorPickerEnable=!0,this.selectedBgColor=X,this.selectedLayoutId&&this.bgColorChanged.emit({color:this.selectedCustomColor,
1isEdit:!1})):(this.selectedCustomColor=X,this.selectedBgColor=X,this.selectedLayoutId&&this.bgColorChanged.emit({color:X,isEdit:!this.colorPickerEnable}))}closeColorPicker(X){this.colorPickerEnable=!1,this.selectedBgColor&&this.selectedBgColor.includes("#")?this.selectedBgColor=X:this.selectedBgColor==X&&(this.selectedBgColor=this.selectedCustomColor),this.selectedLayoutId&&this.bgColorChanged.emit({color:this.selectedCustomColor,isEdit:!0})}inputScale(X){let F,V;X.newValue?(F=X.newValue,this.scale=F,V=!1):(F=X,V=!0),""!==F&&!Number.isNaN(Number(F))&&(F>this.scaleMax?setTimeout(()=>{F=this.scaleMax,this.changeScale.emit({scale:F/100,final:V})},0):F<this.scaleMin?setTimeout(()=>{F=this.scaleMin,this.changeScale.emit({scale:F/100,final:V})},0):this.changeScale.emit({scale:F/100,final:V}))}focusOutScale(X){X.preventDefault(),(this.scale<this.scaleMin||this.scale>this.scaleMax)&&(this.scale=this.scaleMin,this.changeScale.emit({scale:this.scale/100,final:!1})),this.scaleInput.nativeElement.blur()}changeAspectRatio(){this.lockedAspectRatio||(this.selectedLayoutTitle=G.zu.Custom),this.selectedLayoutTitle===G.zu.Custom&&(this.lockedWidth=Number(this.width),this.lockedHeight=Number(this.height))}onCancel(){this.cancel.emit()}onSelectOpen(){this.renderer.addClass(document.body,"resize-drop")}onSelectClose(){this.renderer.removeClass(document.body,"resize-drop")}ngOnDestroy(){this.renderer.removeClass(document.body,"resize-drop"),this.customError.emit(!1)}}return(Q=K).\u0275fac=function(X){return new(X||Q)(n.rXU(h.Lw),n.rXU(a.u),n.rXU(n.sFG),n.rXU(d.X,8),n.rXU(e.p,8),n.rXU(l.I))},Q.\u0275cmp=n.VBU({type:Q,selectors:[["resize-edit-tools"]],viewQuery:function(X,F){if(1&X&&(n.GBs(D,5),n.GBs(p,5),n.GBs(u,5)),2&X){let V;n.mGM(V=n.lsd())&&(F.scaleInput=V.first),n.mGM(V=n.lsd())&&(F.widthInput=V.first),n.mGM(V=n.lsd())&&(F.heightInput=V.first)}},inputs:{activeObject:"activeObject",showBackArrow:"showBackArrow",showScale:"showScale",toggleDisable:"toggleDisable",scale:"scale",fillCanvas:"fillCanvas",width:"width",height:"height",name:"name",batchResize:"batchResize"},outputs:{changeSize:"changeSize",changeScale:"changeScale",bgColorChanged:"bgColorChanged",cancel:"cancel",changeLockAspectRatio:"changeLockAspectRatio",customError:"customError"},decls:3,vars:2,consts:[["container",""],["resizeColorTool",""],["widthInput",""],["heightInput",""],["scaleInput",""],["type","hidden","id","gtm-photo-editor-active-sub-tool","value","Resize",1,"d-none"],[1,"pane-section","h-auto",2,"position","initial !important"],[1,"resize-tool-header","common-container","d-flex","flex-column","bg-white","resizeCustomTool","batch-editor-all","p-0","m-0"],[1,"d-flex","align-items-center","justify-content-start","w-100","batch-editor-hed",2,"min-height","56px"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8"],[1,"text-lg","text-semi","text-dark","lh-125","ms-2"],["bindLabel","socialLabelType","bindValue","title",1,"select-menu","resize-popup","w-100","batch-select-menu","mt-0",3,"open","close","change","items","ngModel","searchable","clearable"],[1,"colors-bg","sticker-buttons-scroll","scrollWidth-300"],[1,"resize-tool-content","common-container","pb-14","ps-0","pe-0","ms-0","me-0"],[1,"pt-0"],[1,"create-project"],[1,"templates-thumbs-custom","hometemplate","custom-items","p-0"],[1,"pt-9"],[1,"d-flex","align-items-center","mt-2"],[1,"wp-100"],[1,"text-normal","text-dark","text-semi","lh-125"],[1,"editor-toggle"],[1,"d-flex","align-items-center",3,"changeT","selected"],[1,"mt-10"],["id","resizeColorTool",1,"resizeColorTool"],[3,"selectedBgColor","items","type"],["name","leftarrow",1,"back-icon","f-24","d-flex","align-items-center","justify-content-center","pointer","border-radius-8",3,"click"],[1,"mt-9",3,"selectLayout","items","type","name"],[1,"nav-item","btn-tab","mt-1"],[1,"list-unstyled","d-flex","flex-row","flex-wrap","mb-0",2,"width","268px"],["data-toggle","tab",1,"nav-link",3,"click"],[1,"row","g-0","align-items-center","justify-content-center","textRatioDiv","text-center"],[1,"iconDiv","d-flex","align-items-center","justify-content-center","mt-9","resizeCrop"],[1,"imgFormatBg","d-flex","align-items-center","justify-content-center"],[1,"f-24",3,"name"],[1,"subtitleText","text-semi","mt-2"],[1,"subtitleRatio","text-semi","mt-2"],[1,"scratch-slider"],[1,"d-flex","align-items-center","position-relative"],["type","text","id","width","autocomplete","off","minlength","1","maxlength","4","placeholder","","numbersOnly","",1,"form-control","textBoxText","text-semi","textBoxCustom",3,"ngModelChange","keyup","focusout","click","keyup.enter","ngModel"],[1,"position-absolute","d-flex"],[1,"widthHeightText","text-semi","ml-9","mr-9"],[1,"me-3"],["name","dividerCustom"],["name","resizecross",1,"hw-24","align-self-center","ms-2","me-2","grey-600"],["type","text","id","height","autocomplete","off","minlength","1","maxlength","4","placeholder","","numbersOnly","",1,"form-control","textBoxText","text-semi","textBoxCustom",3,"ngModelChange","keyup","click","focusout","keyup.enter","ngModel"],[1,"scratch-slider","mt-1",2,"color","#B0B3BF","line-height","14.98px"],[1,"scratch-slider","mt-1",2,"color","#F25555","line-height","14.98px"],[1,"selectAll","d-flex","align-items-center","mt-9","mb-9"],[1,"checkboxc","d-flex"],["type","checkbox","checked","lockedAspectRatio",1,"marked-check",3,"ngModelChange","change","ngModel"],[1,"ms-2"],[1,"card","drawer-card"],[1,"card-body"],[1,"card-title","m-0","text-semi"],[1,"d-flex","mt-9"],[1,"wp-100","d-flex","align-items-center"],[1,"opacity-slider",2,"width","100%",3,"change","slideStop","value","min","max","step"],[1,"ml-9"],["type","text","numbersOnly","","minlength","1","maxlength","3",1,"form-control","form-input-sm","text-normal","text-black",3,"ngModelChange","keydown.enter","focusout","ngModel"],[3,"selectMenu","selectedBgColor","items","type"],[1,"scroll-content","bg-color-picker","bg-color-picker-active"],[1,"bg-color-panel","pe-3","ps-3","pt-10"],[1,"btn-all","p-0","m-0","btn-left-color","custom-text"],[1,"btn-all","p-0","m-0","btn-right-color","float-end",3,"click"],["name","closecolortool"],[3,"colorEnable","changed","selectedColor"]],template:function(X,F){1&X&&(n.nrm(0,"input",5),n.DNE(1,Z,28,13)(2,$,9,1,"div",6)),2&X&&
1(n.R7$(),n.vxM(F.CreateFromScratch?1:-1),n.R7$(),n.vxM(F.colorPickerEnable?2:-1))},dependencies:[_.C,C.Z,S.me,S.Zm,S.BC,S.xh,S.tU,S.vS,x.vr,E.d1,M.b,R.B,I.n],styles:["[_nghost-%COMP%]{display:block;width:100%}.resize-tool-header[_ngcontent-%COMP%]{position:sticky;top:0;z-index:999;width:100%}.resize-tool-content[_ngcontent-%COMP%]{min-height:0}@media screen and (min-width: 992px){.layout-box[_ngcontent-%COMP%]{flex:0 0 50%;min-height:400px}}.drawer-card.is-disabled[_ngcontent-%COMP%]{cursor:not-allowed}.drawer-card.is-disabled[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%]{pointer-events:none}.marginTop[_ngcontent-%COMP%]{margin-top:150px}.marginTopBit[_ngcontent-%COMP%]{margin-top:100px}.resize-heading[_ngcontent-%COMP%]{font-size:14px;color:#272b34;line-height:19.07px}.preview-canvas-wrapper[_ngcontent-%COMP%]{height:100%;width:100%;min-height:250px}.template-preview[_ngcontent-%COMP%]{height:100%;width:100%;display:flex;justify-content:center;align-items:center}.blank-preview[_ngcontent-%COMP%]{padding:20px;height:100%;width:100%;display:flex;justify-content:center;align-items:center}.preview-section[_ngcontent-%COMP%]{border-radius:16px;background:#e4e4eb 0% 0% no-repeat padding-box}.project-title[_ngcontent-%COMP%]{font-size:1.6rem;color:#000}.share-t-box[_ngcontent-%COMP%]{float:left}.share-t-text[_ngcontent-%COMP%]{display:flex;padding-left:15px}@media screen and (max-width: 991px){.layout-box[_ngcontent-%COMP%]{flex:0 0 100%;max-width:100%}.layout-design[_ngcontent-%COMP%], .bottom-btn[_ngcontent-%COMP%]{width:98%}.template-preview[_ngcontent-%COMP%]{height:100%;width:100%;display:flex;justify-content:center;align-items:center}.blank-preview[_ngcontent-%COMP%]{padding:20px;height:100%;width:100%;display:flex;justify-content:center;align-items:center}}.page-heading[_ngcontent-%COMP%]{font-size:14px;color:#272b34;font-weight:600}.tab-text-link[_ngcontent-%COMP%]{font-weight:700;font-size:14px;color:#b0b3bf;cursor:pointer}.tab-text-link[_ngcontent-%COMP%]:hover{color:#626adf}.nav-pills[_ngcontent-%COMP%] .nav-link.active[_ngcontent-%COMP%], .nav-pills[_ngcontent-%COMP%] .show[_ngcontent-%COMP%] > .nav-link[_ngcontent-%COMP%]{color:#626adf}.nav-link[_ngcontent-%COMP%]{padding:0rem}.nav-line[_ngcontent-%COMP%]{border-bottom:2px solid #626ADF}.button-slide[_ngcontent-%COMP%]{width:84px;height:150px;background:transparent;border:1px solid #B0B3BF;border-radius:8px}.error-scale[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border:1px solid #F25555!important}.form-control[_ngcontent-%COMP%]{display:inline;width:44px;height:32px;padding:0rem;font-size:.875rem;line-height:1.5;color:#000;background-color:#fff;border:1px solid #E2E3E9;border-radius:12px;text-align:center}.form-control[_ngcontent-%COMP%]:hover{border:1px solid #272B34}.form-control[_ngcontent-%COMP%]:focus{border:1px solid #626ADF}.form-group[_ngcontent-%COMP%] pi[_ngcontent-%COMP%], .form-group[_ngcontent-%COMP%] .ng-arrow-wrapper[_ngcontent-%COMP%]{margin-right:9px!important;margin-left:12px}.ddlsize[_ngcontent-%COMP%]{position:relative;width:85px}.textBoxText[_ngcontent-%COMP%]{font-size:13px;color:#272b34;line-height:17.7px}.scratch-slider[_ngcontent-%COMP%]{display:flex;font-size:12px;color:#e20e33}.scratch-slider[_ngcontent-%COMP%] .textBoxCustom[_ngcontent-%COMP%]{width:114px;height:40px;background-color:#fff;border:1px solid #E2E3E9;border-radius:12px}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]{display:inline;height:38px;padding:0 7px 0 50px;font-size:.875rem;line-height:1.5;color:#000;background-color:#fff;border:1px solid #E2E3E9;border-radius:12px;text-align:center}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:hover{border:1px solid #4A4F5E}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border:1px solid #626ADF}.scratch-slider[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus .widthHeightText[_ngcontent-%COMP%]{color:#626adf!important}.scratch-slider[_ngcontent-%COMP%] .cus-error[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]{border-color:#f25555!important}.scratch-slider[_ngcontent-%COMP%] .cus-error[_ngcontent-%COMP%] .widthHeightText[_ngcontent-%COMP%]{color:#f25555!important}.scratch-slider[_ngcontent-%COMP%] .cus-error[_ngcontent-%COMP%] .form-control[_ngcontent-%COMP%]:focus{border:1px solid #F25555!important}.scratch-slider[_ngcontent-%COMP%] .widthHeightText[_ngcontent-%COMP%]{font-size:13px;color:#272b34;line-height:17.7px}.scratch-slider[_ngcontent-%COMP%] .widthHeightTextN[_ngcontent-%COMP%]{color:#626adf!important}.templates-thumbs-custom[_ngcontent-%COMP%]{width:100%;height:100%}.product-layout[_ngcontent-%COMP%]{font-size:12px;color:#b0b3bf}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{width:78px;
1cursor:pointer;margin-right:17px}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]:nth-child(3n+3){margin-right:0}.iconDiv[_ngcontent-%COMP%]{width:78px;height:78px;background:#626adf0d;border-radius:12px}.iconDiv[_ngcontent-%COMP%] .imgFormatBg[_ngcontent-%COMP%]{background:#e2e3e9;border-radius:8px}.iconDivActive[_ngcontent-%COMP%] .iconDiv[_ngcontent-%COMP%]{background:#626adf0d;border:1px solid #626ADF;border-radius:12px}.iconDivActive[_ngcontent-%COMP%] .subtitleText[_ngcontent-%COMP%], .iconDivActive[_ngcontent-%COMP%] .subtitleRatio[_ngcontent-%COMP%]{color:#626adf!important}.iconDivActive[_ngcontent-%COMP%] .imgFormatBg[_ngcontent-%COMP%]{background:#626adf1a}.textRatioDiv[_ngcontent-%COMP%] .subtitleText[_ngcontent-%COMP%]{font-size:12px;color:#606576;line-height:16.34px}.textRatioDiv[_ngcontent-%COMP%] .subtitleRatio[_ngcontent-%COMP%], .textRatioDiv[_ngcontent-%COMP%]:hover .subtitleText[_ngcontent-%COMP%]{display:none}.textRatioDiv[_ngcontent-%COMP%]:hover .subtitleRatio[_ngcontent-%COMP%]{display:block;font-size:12px;color:#000;line-height:16.34px}.textRatioDiv[_ngcontent-%COMP%]:hover .imgFormatBg[_ngcontent-%COMP%]{background:#626adf1a}.h-48[_ngcontent-%COMP%]{height:48px!important}[_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #e2e3e9;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#626adf;border-radius:4px}[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#626adf}.close[_ngcontent-%COMP%]{background:none!important;top:unset!important}.grey-small-text[_ngcontent-%COMP%]{font-size:12px;color:#b0b3bf;margin-bottom:2px}.btn-ok[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:12px;background:#626adf;border:none}.rezise-ok-active[_ngcontent-%COMP%]{background:#626adf}.tw-line[_ngcontent-%COMP%]{height:33px}.tw-line.th-line[_ngcontent-%COMP%]{height:50px}.selectAll[_ngcontent-%COMP%]{border-radius:12px}.selectAll[_ngcontent-%COMP%] .checkboxc[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{cursor:pointer;-webkit-appearance:none;appearance:none;background-color:transparent!important;position:relative;width:24px;height:24px;border:0px solid transparent;border-radius:0!important;background:url(https://static.lightxeditor.com/assets/images/checkbox-grey.svg) no-repeat;background-size:cover!important}.selectAll[_ngcontent-%COMP%] .checkboxc[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked{background:url(https://static.lightxeditor.com/assets/images/checkbox-grey-active.svg) no-repeat!important;border:0px!important;background-size:cover!important}.bg-color-picker-active[_ngcontent-%COMP%]{background:#fffc!important;-webkit-backdrop-filter:blur(8px)!important;backdrop-filter:blur(8px)!important;left:0;z-index:9001;position:fixed}"]}),K})()},52581:(_e,ie,g)=>{"use strict";g.d(ie,{K:()=>bi});var n=g(54438),o=g(45312),G=g(79774),P=g(21413),h=g(16478),a=g(80197),e=g(6421),l=g(20999),_=g(24886),C=g(60177),S=g(30198),x=g(40605),E=g(75243),M=g(43695),R=g(16471),I=g(6755),D=g(68010),p=g(33391),u=g(74983),m=g(68887),b=g(41300),k=g(79301),A=g(45975),B=g(91367),y=g(345),O=g(32294),w=g(39385),j=g(60004),L=g(33645),U=g(48928),z=g(68064),Z=g(23486),$=g(86820),Y=g(54389),Q=g(54124);const K=["stockSb"],W=(oe,Ee)=>[oe,Ee],X=oe=>({"upload-progress":oe}),F=(oe,Ee)=>({show:oe,"d-none":Ee}),V=oe=>({"d-none":oe});function le(oe,Ee){if(1&oe&&(n.j41(0,"div",12),n.EFF(1,"or just drag and drop your media here"),n.k0s()),2&oe){const J=n.XpG();n.Y8G("ngClass",3===J.editorType?"grey-600 bg-white":"text-white bg-dark1")}}function fe(oe,Ee){1&oe&&n.nrm(0,"ei",43)}function Ce(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"img",44),n.bIt("error",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.errorOnImg(te))})("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.k0s()}if(2&oe){const J=n.XpG().$implicit;n.Y8G("src",J.thumbUrl,n.B4B)}}function Ne(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"img",44),n.bIt("error",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.errorOnImg(te))})("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.k0s()}if(2&oe){const J=n.XpG().$implicit;n.Y8G("src",J.metadata.contentUrl,n.B4B)}}function Ze(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",45)(1,"button",46),n.bIt("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.uploadLocalFile(te))}),n.nrm(2,"pi",47),n.k0s()()}}function de(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"li")(1,"a",36),n.bIt("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.nrm(2,"ei",48),n.EFF(3,"Add to canvas "),n.k0s()()}}function Ie(oe,Ee){1&oe&&(n.j41(0,"div",53)(1,"span",24),n.EFF(2,"
1Loading..."),n.k0s()())}function ue(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",49),n.bIt("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.j41(1,"video",50),n.bIt("ended",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.endVideo(te))})("timeupdate",function(te){n.eBV(J);const re=n.XpG().$implicit,Pe=n.XpG(2);return n.Njj(Pe.timeUpdate(te,re))}),n.nrm(2,"source",51),n.k0s(),n.DNE(3,Ie,3,0,"div",52),n.k0s()}if(2&oe){const J=n.XpG().$implicit,ee=n.XpG(2);n.R7$(),n.FS9("id",J.assetId),n.R7$(),n.Y8G("src",J.metadata.contentUrl,n.B4B),n.R7$(),n.Y8G("ngIf",J.assetId===(null==ee.lastPlayedVideo?null:ee.lastPlayedVideo.assetId)&&ee.loading)}}function ge(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"a",57),n.bIt("click",function(te){n.eBV(J);const re=n.XpG(2).$implicit,Pe=n.XpG(2);return n.Njj(Pe.playVideo(re,te))}),n.nrm(1,"ei",58),n.k0s()}}function be(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"a",57),n.bIt("click",function(te){n.eBV(J);const re=n.XpG(2).$implicit,Pe=n.XpG(2);return n.Njj(Pe.playVideo(re,te))}),n.nrm(1,"pi",59),n.k0s()}}function ye(oe,Ee){if(1&oe&&(n.j41(0,"div",54)(1,"div",55),n.DNE(2,ge,2,0,"a",56)(3,be,2,0,"a",56),n.k0s()()),2&oe){const J=n.XpG().$implicit,ee=n.XpG(2);n.Y8G("ngClass",n.eq3(3,V,ee.selectedMediaAssetIds.length)),n.R7$(2),n.Y8G("ngIf",!J.isPlay),n.R7$(),n.Y8G("ngIf",J.isPlay)}}function Ve(oe,Ee){if(1&oe&&(n.j41(0,"div",60)(1,"span",61),n.nrm(2,"pi",62),n.k0s()()),2&oe){n.XpG(3);const J=n.sdS(12);n.R7$(),n.Y8G("ngbPopover",J)}}function ot(oe,Ee){if(1&oe&&(n.j41(0,"span",63),n.EFF(1),n.nI1(2,"mstoseconds"),n.k0s()),2&oe){const J=n.XpG().$implicit;n.R7$(),n.JRh(n.bMT(2,1,(null==J.metadata?null:J.metadata.duration)-(J.currentTime?J.currentTime:0)))}}function ct(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",20)(1,"div",21)(2,"div",22)(3,"div",23)(4,"span",24),n.EFF(5,"Loading..."),n.k0s()(),n.DNE(6,fe,1,0,"ei",25)(7,Ce,1,1,"img",26)(8,Ne,1,1,"img",26),n.j41(9,"div",27)(10,"input",28),n.bIt("click",function(te){const re=n.eBV(J).$implicit,Pe=n.XpG(2);return n.Njj(Pe.markSelected(re,te))}),n.k0s()(),n.DNE(11,Ze,3,0,"div",29),n.j41(12,"div",30,2)(14,"button",31),n.bIt("click",function(te){return n.eBV(J),n.Njj(te.preventDefault())}),n.nrm(15,"pi",32),n.k0s(),n.j41(16,"div",33)(17,"ul",34),n.DNE(18,de,4,0,"li",35),n.j41(19,"li")(20,"a",36),n.bIt("click",function(){const te=n.eBV(J).$implicit,re=n.XpG(2);return n.Njj(re.download(te))}),n.nrm(21,"ei",37),n.EFF(22,"Download "),n.k0s()(),n.j41(23,"li")(24,"a",36),n.bIt("click",function(){const te=n.eBV(J).$implicit,re=n.XpG(2);return n.Njj(re.delete(te))}),n.nrm(25,"pi",38),n.EFF(26,"Delete "),n.k0s()()()()(),n.DNE(27,ue,4,3,"div",39)(28,ye,4,5,"div",40)(29,Ve,3,1,"div",41),n.k0s(),n.DNE(30,ot,3,3,"span",42),n.k0s()()}if(2&oe){const J=Ee.$implicit,ee=n.sdS(13),te=n.XpG(2);n.R7$(),n.Y8G("ngClass",n.eq3(14,X,J._uploadInProgress)),n.R7$(5),n.Y8G("ngIf",!J.metadata.contentUrl),n.R7$(),n.Y8G("ngIf",J.thumbUrl),n.R7$(),n.Y8G("ngIf",!J.thumbUrl),n.R7$(),n.Y8G("ngClass",n.l_i(16,F,te.selectedMediaAssetIds&&te.selectedMediaAssetIds.length>0,J.isPlay&&!te.loading)),n.R7$(),n.Y8G("checked",null==J?null:J.checked),n.R7$(),n.Y8G("ngIf",J.assetId.startsWith("temp-")),n.R7$(),n.Y8G("ngClass",n.eq3(19,V,te.selectedMediaAssetIds.length||J.isPlay&&!te.loading)),n.R7$(2),n.Y8G("disableTooltip",ee.isOpen()),n.R7$(4),n.Y8G("ngIf",!te.isDataLimit),n.R7$(9),n.Y8G("ngIf","video"===J.assetType.toLowerCase()&&J.isPlay),n.R7$(),n.Y8G("ngIf","video"===J.assetType.toLowerCase()),n.R7$(),n.Y8G("ngIf",te.isDataLimit),n.R7$(),n.Y8G("ngIf","video"==J.assetType.toLowerCase()&&(null==J.metadata?null:J.metadata.duration))}}function pe(oe,Ee){1&oe&&n.nrm(0,"ei",43)}function rt(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"img",44),n.bIt("error",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.errorOnImg(te))})("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.k0s()}if(2&oe){const J=n.XpG().$implicit;n.Y8G("src",J.thumbUrl,n.B4B)}}function he(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"img",44),n.bIt("error",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.errorOnImg(te))})("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.k0s()}if(2&oe){const J=n.XpG().$implicit;n.Y8G("src",J.metadata.contentUrl,n.B4B)}}function ze(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"button",46),n.bIt("click",function(){n.eBV(J);const te=n.XpG(2).$implicit,re=n.XpG(2);return n.Njj(re.uploadLocalFile(te))}),n.nrm(1,"pi",66),n.k0s()}}function Fe(oe,Ee){if(1&oe&&(n.j41(0,"div",45),n.DNE(1,ze,2,0,"button",65),n.k0s()),2&oe){const J=n.XpG().$implicit;n.R7$(),n.Y8G("ngIf",J.assetId.startsWith("temp-"))}}function we(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"li")(1,"a",36),n.bIt("click",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.addMedia(te))}),n.nrm(2,"ei",48),n.EFF(3,"Add to canvas "),n.k0s()()}}function qe(oe,Ee){1&oe&&(n.j41(0,"div",53)(1,"span",24),n.EFF(2,"
1Loading..."),n.k0s()())}function et(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",67)(1,"video",50),n.bIt("ended",function(){n.eBV(J);const te=n.XpG().$implicit,re=n.XpG(2);return n.Njj(re.endVideo(te))})("timeupdate",function(te){n.eBV(J);const re=n.XpG().$implicit,Pe=n.XpG(2);return n.Njj(Pe.timeUpdate(te,re))}),n.nrm(2,"source",51),n.k0s(),n.DNE(3,qe,3,0,"div",52),n.k0s()}if(2&oe){const J=n.XpG().$implicit,ee=n.XpG(2);n.R7$(),n.FS9("id",J.assetId),n.R7$(),n.Y8G("src",J.metadata.contentUrl,n.B4B),n.R7$(),n.Y8G("ngIf",J.assetId===(null==ee.lastPlayedVideo?null:ee.lastPlayedVideo.assetId)&&ee.loading)}}function Ct(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"a",57),n.bIt("click",function(te){n.eBV(J);const re=n.XpG(2).$implicit,Pe=n.XpG(2);return n.Njj(Pe.playVideo(re,te))}),n.nrm(1,"ei",58),n.k0s()}}function kt(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"a",57),n.bIt("click",function(te){n.eBV(J);const re=n.XpG(2).$implicit,Pe=n.XpG(2);return n.Njj(Pe.playVideo(re,te))}),n.nrm(1,"pi",59),n.k0s()}}function xt(oe,Ee){1&oe&&(n.j41(0,"div",69)(1,"div",22)(2,"div",70)(3,"span",24),n.EFF(4,"Loading..."),n.k0s()()()())}function Tt(oe,Ee){if(1&oe&&(n.j41(0,"div",54)(1,"div",55),n.DNE(2,Ct,2,0,"a",56)(3,kt,2,0,"a",56),n.k0s(),n.DNE(4,xt,5,0,"div",68),n.k0s()),2&oe){const J=n.XpG().$implicit,ee=n.XpG(2);n.Y8G("ngClass",n.eq3(4,V,ee.selectedMediaAssetIds.length)),n.R7$(2),n.Y8G("ngIf",!J.isPlay&&!ee.loading),n.R7$(),n.Y8G("ngIf",J.isPlay&&!ee.loading),n.R7$(),n.Y8G("ngIf",J.assetId===ee.downloadassetId&&ee.loading)}}function Wt(oe,Ee){if(1&oe&&(n.j41(0,"div",60)(1,"span",61),n.nrm(2,"pi",62),n.k0s()()),2&oe){n.XpG(3);const J=n.sdS(12);n.R7$(),n.Y8G("ngbPopover",J)}}function Yt(oe,Ee){if(1&oe&&(n.j41(0,"span",63),n.EFF(1),n.nI1(2,"mstoseconds"),n.k0s()),2&oe){const J=n.XpG().$implicit;n.R7$(),n.JRh(n.bMT(2,1,(null==J.metadata?null:J.metadata.duration)-(J.currentTime?J.currentTime:0)))}}function $t(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",20)(1,"div",21)(2,"div",22),n.DNE(3,pe,1,0,"ei",25),n.j41(4,"div",23)(5,"span",24),n.EFF(6,"Loading..."),n.k0s()(),n.DNE(7,rt,1,1,"img",26)(8,he,1,1,"img",26),n.j41(9,"div",27)(10,"input",28),n.bIt("click",function(te){const re=n.eBV(J).$implicit,Pe=n.XpG(2);return n.Njj(Pe.markSelected(re,te))}),n.k0s()(),n.DNE(11,Fe,2,1,"div",29),n.j41(12,"div",30,2)(14,"button",31),n.bIt("click",function(te){return n.eBV(J),n.Njj(te.preventDefault())}),n.nrm(15,"pi",32),n.k0s(),n.j41(16,"div",33)(17,"ul",34),n.DNE(18,we,4,0,"li",35),n.j41(19,"li")(20,"a",36),n.bIt("click",function(){const te=n.eBV(J).$implicit,re=n.XpG(2);return n.Njj(re.download(te))}),n.nrm(21,"ei",37),n.EFF(22,"Download "),n.k0s()(),n.j41(23,"li")(24,"a",36),n.bIt("click",function(){const te=n.eBV(J).$implicit,re=n.XpG(2);return n.Njj(re.delete(te))}),n.nrm(25,"pi",38),n.EFF(26,"Delete "),n.k0s()()()()(),n.DNE(27,et,4,3,"div",64)(28,Tt,5,6,"div",40)(29,Wt,3,1,"div",41),n.k0s(),n.DNE(30,Yt,3,3,"span",42),n.k0s()()}if(2&oe){const J=Ee.$implicit,ee=n.sdS(13),te=n.XpG(2);n.R7$(),n.Y8G("ngClass",n.eq3(14,X,J._uploadInProgress)),n.R7$(2),n.Y8G("ngIf",!J.metadata.contentUrl),n.R7$(4),n.Y8G("ngIf",J.thumbUrl),n.R7$(),n.Y8G("ngIf",!J.thumbUrl),n.R7$(),n.Y8G("ngClass",n.l_i(16,F,te.selectedMediaAssetIds&&te.selectedMediaAssetIds.length>0,J.isPlay&&!te.loading)),n.R7$(),n.Y8G("checked",null==J?null:J.checked),n.R7$(),n.Y8G("ngIf",J.assetId.startsWith("temp-")),n.R7$(),n.Y8G("ngClass",n.eq3(19,V,te.selectedMediaAssetIds.length||J.isPlay&&!te.loading)),n.R7$(2),n.Y8G("disableTooltip",ee.isOpen()),n.R7$(4),n.Y8G("ngIf",!te.isDataLimit),n.R7$(9),n.Y8G("ngIf","video"==J.assetType.toLowerCase()&&J.isPlay),n.R7$(),n.Y8G("ngIf","video"==J.assetType.toLowerCase()),n.R7$(),n.Y8G("ngIf",te.isDataLimit),n.R7$(),n.Y8G("ngIf","video"==J.assetType.toLowerCase()&&(null==J.metadata?null:J.metadata.duration))}}function Ht(oe,Ee){1&oe&&n.nrm(0,"blank-thumbs",71),2&oe&&n.Y8G("count",12)}function Kt(oe,Ee){1&oe&&n.nrm(0,"img",77)}function Zt(oe,Ee){1&oe&&n.nrm(0,"img",78)}function Qt(oe,Ee){if(1&oe&&(n.j41(0,"span",82),n.EFF(1,"Just drop your photos here."),n.k0s()),2&oe){const J=n.XpG(4);n.Y8G("ngClass",3==J.editorType?"text-black":"text-white")}}function Jt(oe,Ee){if(1&oe&&(n.j41(0,"span",82),n.EFF(1,"Upload your photos here."),n.k0s()),2&oe){const J=n.XpG(4);n.Y8G("ngClass",3==J.editorType?"text-black":"text-white")}}function qt(oe,Ee){if(1&oe&&(n.j41(0,"div",79),n.DNE(1,Qt,2,1,"span",80)(2,Jt,2,1,"span",80),n.j41(3,"span",81),n.EFF(4,"File type JPEG and PNG"),n.k0s()()),2&oe){const J=n.XpG(3);n.R7$(),n.Y8G("ngIf",J.user),n.R7$(),n.Y8G("ngIf",!J.user),n.R7$(),n.Y8G("ngClass",3==J.editorType?"grey-800":"grey-300")}}function ei(oe,Ee){1&oe&&(n.j41(0,"span",84),n.EFF(1,"Just drop your media here."),n.k0s())}function Bt(oe,Ee){1&oe&&(n.j41(0,"span",84),n.EFF(1,"Upload your media here."),n.k0s())}function Dt(oe,Ee){if(1&oe&&(n.j41(0,"div",79),n.DNE(1,ei,2,0,"span",83)(2,Bt,2,0,"span",83),n.k0s()),2&oe){const J=n.XpG(3);n.R7$(),n.Y8G("ngIf",J.user),n.R7$(),n.Y8G("ngIf",!J.user)}}function ti(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div")(1,"button",85),n.bIt("click",function(){n.eBV(J);const te=n.XpG(3);return n.Njj(te.loginToUpload())}),n.nrm(2,"pi",86),n.EFF(3,"Login to upload "),n.k0s()()}}function Ft(oe,Ee){if(1&oe&&(n.j41(0,"div",72)(1,"div",73),n.DNE(2,Kt,1,0,"img",74)(3,Zt,1,0,"img",75),n.k0s(),n.DNE(4,qt,5,3,"div",76)(5,Dt,3,2,"div",76)(6,ti,4,0,"div",35),n.k0s()),2&oe){const J=n.XpG(2);n.R7$(2),n.Y8G("ngIf",3!=J.editorType),n.R7$(),n.Y8G("ngIf",3==J.editorType),n.R7$(),n.Y8G("ngIf",2!=J.editorType&&6!=J.editorType),n.R7$(),n.Y8G("ngIf",2==J.editorType||6==J.editorType),n.R7$(),n.Y8G("ngIf",!J.user&&6!==J.editorType)}}function ii(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",13),n.bIt("ondragenter",function(te){n.eBV(J);const re=n.XpG();return n.Njj(re.dragEnterContent(te))}),n.j41(1,"div",14)(2,"div",15),n.DNE(3,ct,31,21,"div",16),n.k0s(),n.j41(4,"div",17),n.DNE(5,$t,31,21,"div",16),n.k0s()(),n.DNE(6,Ht,1,1,"blank-thumbs",18)(7,Ft,7,5,"div",19),n.k0s()}if(2&oe){const J=n.XpG();n.Y8G("ngClass",n.l_i(5,W,3===J.editorType?"grey-600 bg-white":"text-white bg-dark1",J.user?"":"m-h-auto pb-0")),n.R7$(3),n.Y8G("ngForOf",J.uplodedAssetsA),n.R7$(2),n.Y8G("ngForOf",J.uplodedAssetsB),n.R7$(),n.Y8G("ngIf",!J.isUploadedMediaLoaded),n.R7$(),n.Y8G("ngIf",J.uplodedAssetsA.length<1&&J.isUploadedMediaLoaded)}}function St(oe,Ee){1&oe&&n.nrm(0,"img",77)}function oi(oe,Ee){1&oe&&n.nrm(0,"img",78)}function ni(oe,Ee){if(1&oe&&(n.j41(0,"div",79)(1,"span",82),n.EFF(2,"Just drop your photos here."),n.k0s(),n.j41(3,"span",81),n.EFF(4,"File type JPEG and PNG"),n.k0s()()),2&oe){const J=n.XpG(3);n.R7$(),n.Y8G("ngClass",3==J.editorType?"text-black":"text-white"),n.R7$(2),n.Y8G("ngClass",3==J.editorType?"grey-800":"grey-300")}}function si(oe,Ee){1&oe&&(n.j41(0,"div",79)(1,"span",84),n.EFF(2,"Just drop your media here."),n.k0s()())}function ri(oe,Ee){if(1&oe&&(n.j41(0,"div",89)(1,"div",90)(2,"div",91)(3,"div",73),n.DNE(4,St,1,0,"img",74)(5,oi,1,0,"img",75),n.k0s(),n.DNE(6,ni,5,2,"div",76)(7,si,3,0,"div",76),n.k0s()()()),2&oe){const J=n.XpG(2);n.Y8G("ngClass",n.l_i(6,W,J.isShown?"showDrop":"d-none",3==J.editorType?"showDropLight":"showDropDark")),n.R7$(),n.Y8G("ngClass",3==J.editorType?"dragDropLight":"dragDropDark"),n.R7$(3),n.Y8G("ngIf",3!=J.editorType),n.R7$(),n.Y8G("ngIf",3==J.editorType),n.R7$(),n.Y8G("ngIf",2!=J.editorType&&6!=J.editorType),n.R7$(),n.Y8G("ngIf",2==J.editorType||6==J.editorType)}}function ai(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"ngx-file-drop",87),n.bIt("onFileDrop",function(te){n.eBV(J);const re=n.XpG();return n.Njj(re.dropped(te))})("onFileLeave",function(te){n.eBV(J);const re=n.XpG();return n.Njj(re.fileLeave(te))}),n.DNE(1,ri,8,9,"ng-template",88),n.k0s()}if(2&oe){const J=n.XpG();n.FS9("accept",J.accept)}}function li(oe,Ee){if(1&oe&&(n.j41(0,"span"),n.EFF(1),n.nI1(2,"formatSize"),n.k0s()),2&oe){const J=n.XpG(3);
1n.R7$(),n.SpI(" ",n.bMT(2,1,J.user.usedQuota),"")}}function ci(oe,Ee){if(1&oe&&(n.j41(0,"span"),n.EFF(1),n.nI1(2,"formatSize"),n.k0s()),2&oe){const J=n.XpG(3);n.R7$(),n.SpI(" ",n.bMT(2,1,J.user.usedQuota),"")}}function hi(oe,Ee){if(1&oe&&(n.j41(0,"span"),n.EFF(1),n.nI1(2,"formatSize"),n.k0s()),2&oe){const J=n.XpG(3);n.R7$(),n.SpI(" of ",n.bMT(2,1,J.user.quota),"")}}function di(oe,Ee){1&oe&&(n.j41(0,"span"),n.EFF(1,"of N/A "),n.k0s())}function pi(oe,Ee){1&oe&&n.nrm(0,"span",103)}function ui(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",94)(1,"div",95)(2,"div",96)(3,"div",97)(4,"span"),n.EFF(5,"Storage space"),n.k0s()(),n.j41(6,"div",98),n.DNE(7,li,3,3,"span",35)(8,ci,3,3,"span",35)(9,hi,3,3,"span",35)(10,di,2,0,"span",35),n.k0s()(),n.j41(11,"div",99)(12,"div",100)(13,"button",101),n.bIt("click",function(){n.eBV(J);const te=n.XpG(2);return n.Njj(te.manageSpace())}),n.EFF(14,"Manage"),n.k0s(),n.DNE(15,pi,1,0,"span",102),n.k0s()()()()}if(2&oe){const J=n.XpG(2);n.R7$(7),n.Y8G("ngIf",!J.user.usedQuota),n.R7$(),n.Y8G("ngIf",J.user.usedQuota),n.R7$(),n.Y8G("ngIf",J.user.quota),n.R7$(),n.Y8G("ngIf",!(null!=J.user&&J.user.quota)),n.R7$(5),n.Y8G("ngIf",!(J.user&&J.user.subscribed))}}function mi(oe,Ee){if(1&oe&&(n.j41(0,"div",92),n.DNE(1,ui,16,5,"div",93),n.k0s()),2&oe){const J=n.XpG();n.R7$(),n.Y8G("ngIf",0==J.selectedMediaAssetIds.length)}}function gi(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",104)(1,"div",100)(2,"div",105)(3,"div",106),n.EFF(4),n.k0s(),n.j41(5,"div")(6,"button",107),n.bIt("click",function(){n.eBV(J);const te=n.XpG();return n.Njj(te.delete())}),n.nrm(7,"pi",108),n.j41(8,"span",109),n.EFF(9,"Delete"),n.k0s()()(),n.j41(10,"div")(11,"button",110),n.bIt("click",function(){n.eBV(J);const te=n.XpG();return n.Njj(te.unmarkAll())}),n.nrm(12,"pi",111),n.k0s()()()()()}if(2&oe){const J=n.XpG();n.R7$(4),n.SpI("",J.selectedMediaAssetIds.length," Selected")}}function _i(oe,Ee){if(1&oe){const J=n.RV6();n.j41(0,"div",104)(1,"div",100)(2,"div",105)(3,"div",112),n.EFF(4),n.k0s(),n.j41(5,"div")(6,"button",113),n.bIt("click",function(){n.eBV(J);const te=n.XpG();return n.Njj(te.delete())}),n.nrm(7,"pi",114),n.j41(8,"span",109),n.EFF(9,"Delete"),n.k0s()()(),n.j41(10,"div")(11,"button",115),n.bIt("click",function(){n.eBV(J);const te=n.XpG();return n.Njj(te.unmarkAll())}),n.nrm(12,"pi",116),n.k0s()()()()()}if(2&oe){const J=n.XpG();n.R7$(4),n.SpI("",J.selectedMediaAssetIds.length," Selected")}}function fi(oe,Ee){1&oe&&n.eu8(0)}function vi(oe,Ee){if(1&oe&&n.DNE(0,fi,1,0,"ng-container",117),2&oe){const J=n.XpG();n.Y8G("ngComponentOutlet",J.propopover)("ngComponentOutletInjector",J.injector)}}let bi=(()=>{var oe;class Ee{methodTemp(ee,te){return ee.map(re=>new Promise(Pe=>{this.uploadService.addLocalFiles({status:!0,assetType:te,isLocal:!0,file:re},Oe=>{Oe?(this.uploadService.addLocalFile(Oe),this.uplodedAssetsA.length<=this.uplodedAssetsB.length?this.uplodedAssetsA.unshift(Oe):this.uplodedAssetsB.unshift(Oe),Pe(Oe)):Pe(null)})}))}constructor(ee,te,re,Pe,Be,Oe,ht,$e,me,ft,Ci,gt,xi){this.uploadImageService=ee,this.authService=te,this.modalService=re,this.toastService=Pe,this.projectSyncService=Be,this.dialogService=Oe,this.commonService=ht,this.uploadService=$e,this.injector=me,this.document=ft,this.loginService=Ci,this.sanitizer=gt,this.sceneController=xi,this.isShown=!1,this.invalidFormat=!1,this.invalidFormatMsg=h.b.message.uploadImageCommonValidMsg,this.files=[],this.currentTime=0,this.basePixabayVideoThumbUrl=o.c.basePixabayVideoThumbUrl,this.intervalSub={},this.uplodedAssets=[],this.uplodedAssetsA=[],this.uplodedAssetsB=[],this.isUploadedMediaLoaded=!1,this.addUploadedMedia=new n.bkB,this.emptySection=new n.bkB,this.selectedAssetIds=[],this.selectedMediaAssetIds=[],this.usedQuotaPerc=0,this.isUploadedImageLoaded=!1,this.unselectAll=new P.B,this.activePane="media",this.mediaAccept="video/*,image/*",this.countInProgress=0,this.showDropArea=!1,this.isDataLimit=!1,this.propopover=e.A,this.stockVideoPageEnd=!1,this.fromTime=(new Date).getTime(),this.isProgress=!1,this.assetsTypes=[],this.loading=!1,this.alternate=!1,this.afterChange=new n.bkB,this.maxWidth=E.lL,this.maxHeight=E.iB,this.onLoadStart=Ue=>{this.loading=!0},this.onCanPlay=Ue=>{this.loading=!1},this.downloadassetId=0,this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota),this.uploadServiceSubscribe=this.uploadService.afterUpload.subscribe(Ue=>{if(Ue.isMultipleFiles){const He=[];He.push(...this.methodTemp(Ue.imageFiles,G.P.Image)),He.push(...this.methodTemp(Ue.videoFiles,G.P.Video)),Promise.all(He).then(it=>{const Le=it.filter(dt=>null!=dt);this.addUploadedMedia.emit({asset:Le,isAdded:Ue.isAdded}),this.dialogService.closeModalRef&&(this.dialogService.closeModalRef.close(),this.dialogService.closeModalRef=null)}).finally(()=>{this.dialogService.closeModalRef&&(this.dialogService.closeModalRef.close(),this.dialogService.closeModalRef=null)})}else if(Ue.isLocal)this.uploadService.addLocalFiles(Ue,He=>{this.uploadService.addLocalFile(He),this.uplodedAssetsA.length<=this.uplodedAssetsB.length?this.uplodedAssetsA.unshift(He):this.uplodedAssetsB.unshift(He)});else if(Ue.status){if(Ue.assetType!==G.P.Audio&&Ue.asset){let it=!1;if(this.editorType===R._Y.VideoEditor)if(Ue.originalSrc&&Ue.originalSrc.startsWith("blob:http")){for(let Le=0;Le<this.uplodedAssetsA.length;Le++)this.uplodedAssetsA[Le].metadata.contentUrl===Ue.originalSrc&&(this.uplodedAssetsA[Le]=Ue.asset,it=!0);for(let Le=0;Le<this.uplodedAssetsB.length;Le++)this.uplodedAssetsB[Le].metadata.contentUrl===Ue.originalSrc&&(this.uplodedAssetsB[Le]=Ue.asset,it=!0)}else{for(let Le=0;Le<this.uplodedAssetsA.length;Le++)this.uplodedAssetsA[Le].file&&this.uplodedAssetsA[Le].file.name===Ue.originalSrc&&(this.uplodedAssetsA[Le]=Ue.asset,it=!0);for(let Le=0;Le<this.uplodedAssetsB.length;Le++)this.uplodedAssetsB[Le].file&&this.uplodedAssetsB[Le].file.name===Ue.originalSrc&&(this.uplodedAssetsB[Le]=Ue.asset,it=!0)}it||(this.uplodedAssetsA.length<=this.uplodedAssetsB.length?this.uplodedAssetsA.unshift(Ue.asset):this.uplodedAssetsB.unshift(Ue.asset))}let He=0;this.intervalSub[Ue.asset.assetId]=(0,x.Y)(h.b.imageStatusInterval).subscribe(it=>{this.projectSyncService.checkAssetStatus(Ue.asset.assetId,Le=>{let dt=Le.body;dt&&"init"===dt.status&&He<=5?He++:dt&&"active"===dt.status?(He=0,this.intervalSub[Ue.asset.assetId].unsubscribe(),this.getUserDetails()):(He=0,this.intervalSub[Ue.asset.assetId].unsubscribe())},Le=>{He=0,this.intervalSub[Ue.asset.assetId].unsubscribe()})})}}),this.injector=this.createInjector(),this.loggedInObserver=this.authService.loggedIn.subscribe(Ue=>{this.user=this.authService.currentUser()}),this.loggedInObserver=this.authService.usrPropChanged.subscribe(Ue=>{this.user=this.authService.currentUser()})}uploadLocalFile(ee){this.user?this.upload(ee):this.loginService.openLoginDialog(te=>{this.user=this.authService.currentUser(),this.user&&this.upload(ee)})}upload(ee){if(this.sceneController.isSaving)return;let te=new Promise((re,Pe)=>{let Be=ee.file;if(this.commonService.isAudeo(Be.type))this.uploadService.addAudioFile(Be,Oe=>{Oe.status||(this.isDataLimit=!0)},Oe=>{this.sceneController.syncAssetURL(ee.metadata.contentUrl,Oe.contentUrl,Oe.assetId).then(()=>{re()})});
1else if(this.commonService.isImage(Be.name)){let Oe=new Image;Oe.src=ee.metadata.contentUrl,Oe.onload=()=>{ee._uploadInProgress=!0,this.uploadService.addImageFile(Be,Oe,ht=>{ht.status||(this.isDataLimit=!0,ee._uploadInProgress=!1)},null,ht=>{this.sceneController.syncAssetURL(ee.metadata.contentUrl,ht.contentUrl,ht.assetId).then(()=>{re()})})}}else this.commonService.isVideo(Be.type)&&(ee._uploadInProgress=!0,this.uploadService.addVideoFile(Be,Oe=>{Oe.status||(this.isDataLimit=!0,ee._uploadInProgress=!1)},Oe=>{this.sceneController.syncAssetURL(ee.metadata.contentUrl,Oe.contentUrl,Oe.assetId).then(()=>{re()})}))});ee.metadata&&ee.metadata.contentUrl&&this.uploadService.uploadPromises.set(ee.metadata.contentUrl,te)}getUserDetails(){this.authService.getUserDetails(this.user.systemRefKey,ee=>{ee&&(this.user=this.authService.currentUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota))},ee=>{})}checkAssetStatus(ee,te=0){this.projectSyncService.checkAssetStatus(ee.assetId,re=>{re&&re.body&&"active"===re.body.status?ee.thumbUrl&&(ee.thumbUrl=ee.thumbUrl):0===te&&setTimeout(()=>{this.checkAssetStatus(ee,1)},1500)},re=>{})}createInjector(){let ee;return ee={title:h.b.popover.dataLimitTitle,desc:h.b.popover.dataLimitDesc,name:"datalimit"},n.zZn.create([{provide:l.hl,useValue:ee}],this.injector)}playVideo(ee,te){te.preventDefault(),ee.isPlay?(ee.isPlay=!1,this.stopTime(ee,ee.currentTime),this.removeEventFromvideo(ee),this.lastPlayedVideo&&(this.lastPlayedVideo.isPlay=!1,this.removeEventFromvideo(this.lastPlayedVideo))):(this.lastPlayedVideo&&(this.lastPlayedVideo.isPlay=!1,this.removeEventFromvideo(this.lastPlayedVideo)),ee.isPlay=!0,this.lastPlayedVideo=ee,ee.currentTime=0,setTimeout(()=>{this.addEventTovideo(ee)},0))}timeUpdate(ee,te){if(te.isPlay){let re=ee.srcElement.currentTime;te.currentTime=te.metadata.duration/1e3-re>.8?1e3*re:0}}seeking(ee){}startTime(ee,te){ee.currentTime=te;const re=()=>{ee.currentTime++,ee.isPlay?setTimeout(re,1e3):ee.currentTime=0};re()}stopTime(ee,te){ee.currentTime=0}endVideo(ee){ee.isPlay=!1,this.stopTime(ee,0)}addEventTovideo(ee){const te=this.document.getElementById(ee.picture_id);te&&(te.addEventListener("loadstart",this.onLoadStart),te.addEventListener("waiting",this.onLoadStart),te.addEventListener("canplay",this.onCanPlay))}removeEventFromvideo(ee){const te=this.document.getElementById(ee.picture_id);te&&(te.removeEventListener("loadstart",this.onLoadStart),te.removeEventListener("waiting",this.onLoadStart),te.removeEventListener("canplay",this.onCanPlay))}ngOnInit(){this.uplodedAssetsA=[],this.uplodedAssetsB=[],this.assetsTypes=this.templateType==_.If.VIDEO?[G.P.Video,G.P.Image,G.P.IMG_EDITS]:[G.P.Image,G.P.IMG_EDITS],this.getAssets(!0)}ngOnChanges(){this.emptySection.emit(!0)}getAssets(ee=!1){if(this.user)this.isProgress=!0,this.isUploadedMediaLoaded=!1,this.getUploadedAssets(this.assetsTypes,te=>{let re=te?.body?.projectAssets||[];if(ee&&this.uploadService.localFiles.length>0&&(re=this.uploadService.localFiles.concat(te?.body?.projectAssets)),this.uplodedAssets=te?.body?.projectAssets||[],re&&re.length>0){this.fromTime=re[re.length-1].createdDate;for(let Pe=0;Pe<re.length;Pe++)Pe%2==0?(this.uplodedAssetsA.push(re[Pe]),this.alternate=!0):(this.uplodedAssetsB.push(re[Pe]),this.alternate=!1);this.stockVideoPageEnd=!1}else this.stockVideoPageEnd=!0;this.isProgress=!1,this.isUploadedMediaLoaded=!0,setTimeout(()=>{window.dispatchEvent(new Event("resize")),this.checkScrollGetAssets()},50)},te=>{this.isProgress=!1,this.isUploadedMediaLoaded=!0});else{let te;if(ee&&this.uploadService.localFiles.length>0&&(this.uplodedAssets=te=this.uploadService.localFiles),te&&te.length>0){this.fromTime=te[te.length-1].createdDate;for(let re=0;re<te.length;re++)re%2==0?(this.uplodedAssetsA.push(te[re]),this.alternate=!0):(this.uplodedAssetsB.push(te[re]),this.alternate=!1);this.stockVideoPageEnd=!1}else this.stockVideoPageEnd=!0;this.isProgress=!1,this.isUploadedMediaLoaded=!0,setTimeout(()=>{window.dispatchEvent(new Event("resize")),this.checkScrollGetAssets()},50)}}checkScrollGetAssets(){setTimeout(()=>{const ee=this.stockSb?.nativeElement;ee&&ee.scrollHeight<=ee.clientHeight&&!this.stockVideoPageEnd&&!this.isProgress&&this.getAssets()},100)}getUploadedAssets(ee,te,re){this.projectSyncService.getUploadedAssets(this.user,ee,this.fromTime,Pe=>{te(Pe)},Pe=>{re(Pe)})}scrollVideoEnd(ee){!this.stockVideoPageEnd&&!this.isProgress&&this.getAssets()}addMedia(ee){this.lastPlayedVideo&&(this.lastPlayedVideo.isPlay=!1,this.removeEventFromvideo(this.lastPlayedVideo)),this.addUploadedMedia.emit(ee)}manageSpace(){this.modalService.open(S.D,{centered:!0,size:"xl",backdrop:"static",windowClass:"create-video-dialog"}).result.then(te=>{})}dragEnterContent(ee){}deleteLocalFile(ee){for(let te=0;te<this.uploadService.localFiles.length;te++)if(this.uploadService.localFiles[te].assetId===ee)return void this.uploadService.localFiles.splice(te,1)}delete(ee){let re,te=[];re=ee?h.b.message.deleteConfirmSingleAsset:h.b.message.deleteConfirmMultipleAssets,this.dialogService.open({okButtonText:"Delete",title:"Delete",message:re},Pe=>{if(ee)ee.assetId.startsWith("temp-")?this.deleteLocalFile(ee.assetId):te=[ee.assetId];else{let Be=[];for(let Oe=0;Oe<this.selectedMediaAssetIds.length;Oe++)this.selectedMediaAssetIds&&(this.selectedMediaAssetIds[Oe].startsWith("temp-")?this.deleteLocalFile(this.selectedMediaAssetIds[Oe]):Be.push(this.selectedMediaAssetIds[Oe]));te=this.selectedAssetIds.concat(Be)}te.length>0?this.projectSyncService.deleteAssets(te,Be=>{this.toastService.showSuccess(h.b.message.deleteSuccess),Be.body&&(Be.body.usedQuota>0||0==Be.body.usedQuota)&&(this.authService.profile.user.usedQuota=Be.body.usedQuota,this.authService.updateLocalUser(),this.user&&(this.isDataLimit=this.user.usedQuota>this.user.quota)),this.selectedMediaAssetIds=[],setTimeout(()=>{this.uplodedAssetsA=[],this.uplodedAssetsB=[],this.fromTime=(new Date).getTime(),this.getAssets(!0)},1e3)},Be=>{this.toastService.showError(Be)}):(this.selectedMediaAssetIds=[],setTimeout(()=>{this.uplodedAssetsA=[],this.uplodedAssetsB=[],this.fromTime=(new Date).getTime(),this.getAssets(!0)},1e3))},Pe=>{})}markSelected(ee,te){if(this.lastPlayedVideo&&(this.lastPlayedVideo.isPlay=!1,this.removeEventFromvideo(this.lastPlayedVideo)),ee.checked){ee.checked=!1;
1let re=this.getIndexOfMarkedProject(ee.assetId);-1!==re&&this.selectedMediaAssetIds.splice(re,1)}else ee.checked=!0,-1===this.getIndexOfMarkedProject(ee.assetId)&&this.selectedMediaAssetIds.push(ee.assetId)}getIndexOfMarkedProject(ee){for(let te=0;te<this.selectedMediaAssetIds.length;te++)if(this.selectedMediaAssetIds[te]===ee)return te;return-1}unmarkAll(){for(let ee=0;ee<this.uplodedAssetsA.length;ee++)this.uplodedAssetsA[ee].checked=!1;for(let ee=0;ee<this.uplodedAssetsB.length;ee++)this.uplodedAssetsB[ee].checked=!1;this.selectedMediaAssetIds=[],this.unselectAll.next(),this.selectedAssetIds=[]}download(ee){this.downloadassetId=ee.assetId?ee.assetId:0,"video"===ee.assetType||"VIDEO"===ee.assetType?(this.loading=!0,this.commonService.downloadFile(ee.metadata.contentUrl).subscribe(te=>{a.saveAs(te,"video.mp4"),this.loading=!1})):("img"===ee.assetType||"IMG"===ee.assetType)&&(this.loading=!0,this.commonService.downloadFile(ee.metadata.contentUrl).subscribe(te=>{a.saveAs(te,"file.jpg"),this.loading=!1}))}afterUpload(ee){}ngOnDestroy(){this.uploadServiceSubscribe&&this.uploadServiceSubscribe.unsubscribe(),this.loggedInObserver&&this.loggedInObserver.unsubscribe()}loginToUpload(){this.loginService.openLoginDialog(ee=>{this.user=this.authService.currentUser(),this.user&&this.getAssets()})}errorOnImg(ee){ee.originalThumbUrl=ee.thumbUrl,ee.thumbUrl="assets/images/on-error-thumb.png"}dropped(ee){if(this.files=ee,this.editorType===R._Y.VideoEditor){const te=this.files.filter(re=>re.fileEntry.isFile).map(re=>re.fileEntry).map(re=>new Promise(Pe=>re.file(Be=>{Pe(Be)})));Promise.all(te).then(re=>{const Pe=re.filter(Oe=>this.commonService.isImage(Oe.name)),Be=re.filter(Oe=>this.commonService.isVideo(Oe.name));Be.push(...re.filter(Oe=>{let $e=this.commonService._getExtension(Oe.name);if(""===Oe.type){if("mov"===$e&&this.commonService.isVideo("video/"+$e))return!0;this.toastService.showError(h.b.message.validVideoMessage)}return"jpeg"!=$e&&"jpg"!=$e&&"png"!=$e&&"mov"!=$e&&"mp4"!=$e&&this.toastService.showError(h.b.message.validImageMessageForEdit),!1})),(Pe.length>0||Be.length>0)&&this.uploadService.afterUpload.next({status:!0,isLocal:!0,isMultipleFiles:!0,imageFiles:Pe,videoFiles:Be})}),this.isShown=!1}else for(const te of ee)te.fileEntry.isFile&&te.fileEntry.file(Pe=>{this.droppedFile(Pe)}),this.isShown=!1}fileOver(ee){this.isShown=!0}fileLeave(ee){this.isShown=!1}fileDrop(ee){this.isShown=!1}droppedFile(ee){if(this.commonService.isAudeo(ee.type))this.uploadService.addAudioFile(ee,te=>{te.status||(this.isDataLimit=!0)});else if(this.commonService.isImage(ee.name)){if(6===this.editorType)return void this.uploadService.afterUpload.next({status:!0,assetType:G.P.Image,isLocal:!0,file:ee});let te=new Image;te.src=window.URL.createObjectURL(ee),te.onload=()=>{te.width>this.maxWidth||te.height>this.maxHeight?M.k.checkAndResizeImage(te,(re,Pe,Be)=>{this.uploadService.addImageBlob(Be,re,Oe=>{Oe.status||(this.isDataLimit=!0)},Oe=>{},"image/png")},this.maxWidth,this.maxHeight):this.uploadService.addImageFile(ee,te,re=>{re.status||(this.isDataLimit=!0)})}}else if(this.commonService.isVideo(ee.type)){if(6===this.editorType)return void this.uploadService.afterUpload.next({status:!0,assetType:G.P.Video,isLocal:!0,file:ee});if(this.editorType==R._Y.Photo||this.editorType==R._Y.DesignTemplate)return this.invalidFormat=!0,void this.toastService.showError(h.b.message.validImageMessageForEdit);this.uploadService.addVideoFile(ee,te=>{te.status||(this.isDataLimit=!0)})}else""===ee.type?(ee.name.split("."),6===this.editorType||2===this.editorType?this.uploadService.addVideoFile(ee,re=>{re.status||(this.isDataLimit=!0)}):(this.invalidFormat=!0,this.toastService.showError(h.b.message.validImageMessageForEdit))):(this.invalidFormat=!0,this.toastService.showError(h.b.message.validImageMessageForEdit))}}return(oe=Ee).\u0275fac=function(ee){return new(ee||oe)(n.rXU(I.A),n.rXU(D.u),n.rXU(p.Bq),n.rXU(u.f),n.rXU(m.A),n.rXU(b.g),n.rXU(k.h),n.rXU(A.B),n.rXU(n.zZn),n.rXU(C.qQ),n.rXU(B.H),n.rXU(y.up),n.rXU(O.Z))},oe.\u0275cmp=n.VBU({type:oe,selectors:[["uploaded-media-list"]],viewQuery:function(ee,te){if(1&ee&&n.GBs(K,5),2&ee){let re;n.mGM(re=n.lsd())&&(te.stockSb=re.first)}},inputs:{accept:"accept",isReplace:"isReplace",uplodedAssets:"uplodedAssets",isUploadedMediaLoaded:"isUploadedMediaLoaded",templateType:"templateType",editorType:"editorType"},outputs:{addUploadedMedia:"addUploadedMedia",emptySection:"emptySection",afterChange:"afterChange"},features:[n.OA$],decls:13,vars:11,consts:[["stockSb",""],["popContent",""],["myDrop","ngbDropdown"],["class","text-center text-11 position-absolute ms-3 mt-5 pt-3","style","z-index: 2;width: calc(100% - 32px);",3,"ngClass",4,"ngIf"],["customScrollDir","","infiniteScroll","",1,"scroll-container","darkscroll",3,"scrolled","scrollWindow","infiniteScrollDistance","infiniteScrollUpDistance","infiniteScrollThrottle"],["dropZoneLabel","Drop files here","dropZoneClassName","border-radius-12","contentClassName","drop-zone",3,"onFileOver","accept","multiple"],["ngx-file-drop-content-tmp","",1,"upload-container"],["dropZoneLabel","Drop files here","multiple","false","dropZoneClassName","","contentClassName","",3,"accept","onFileDrop","onFileLeave",4,"ngIf"],["class","wp-100 d-flex justify-content-center",4,"ngIf"],[1,"wp-100","d-flex","justify-content-center","dar
1k-theme"],["class","box-right-wrapper-delete",4,"ngIf"],[1,"wp-100","d-flex","justify-content-center","light-theme"],[1,"text-center","text-11","position-absolute","ms-3","mt-5","pt-3",2,"z-index","2","width","calc(100% - 32px)",3,"ngClass"],[1,"thumbs-content","mt-5","pt-4","h-100",2,"min-height","82vh","padding-bottom","82px",3,"ondragenter","ngClass"],[2,"display","flex"],["id","column",1,"colA","mt-3"],["class","image-thumb-template",4,"ngFor","ngForOf"],["id","column",1,"colB","mt-3"],[3,"count",4,"ngIf"],["class","position-fixed w-100 mx-auto text-center d-flex align-items-center justify-content-center flex-column noImageDiv",4,"ngIf"],[1,"image-thumb-template"],[1,"thumb-options","w-100",3,"ngClass"],[1,"inner"],["role","status",1,"spinner-border","loader-item"],[1,"sr-only","text-nowrap","border-0","position-absolute","overflow-hidden"],["name","defualtImg",4,"ngIf"],["style","min-height: 45px;","disableRC","",3,"src","error","click",4,"ngIf"],[1,"toolsCustomCheckbox","hw-24","checkboxc",3,"ngClass"],["type","checkbox",1,"",2,"height","24px !important","width","24px !important",3,"click","checked"],["class","sync-item d-inline-block",4,"ngIf"],["ngbDropdown","","container","body",1,"edit-menu","d-inline-block",3,"ngClass"],["id","dropdownBasic1","ngbDropdownToggle","","placement","top","tooltipClass","tooltip-custom-all","ngbTooltip","More","container","body",1,"btn","btn-lg","btn-secondary","icon",2,"border","none",3,"click","disableTooltip"],["name","dotverticalwhite",1,"f-24"],["ngbDropdownMenu","","aria-labelledby","dropdownBasic1",1,"nav-small-device"],[1,"list-unstyled"],[4,"ngIf"],["ngbDropdownItem","",3,"click"],["name","downloadcanvas",1,"mr-8"],["name","deleteoth",1,"mr-8","f-20"],["style","position: absolute;width: 100%;height: 100%; top: 0;",3,"click",4,"ngIf"],["class","meta justify-content-center align-items-center v-thumb-ico",3,"ngClass",4,"ngIf"],["class","asset-locked div-backdrop",4,"ngIf"],["class","duration-text",4,"ngIf"],["name","defualtImg"],["disableRC","",2,"min-height","45px",3,"error","click","src"],[1,"sync-item","d-inline-block"],[1,"btn","btn-lg","btn-secondary","icon",2,"border","none","width","28px","height","28px",3,"click"],["name","uploadmediaNew","placement","top","tooltipClass","custom-tooltip","ngbTooltip","Save to Uploads","container","body",1,"f-24"],["name","addtocanvas",1,"mr-8"],[2,"position","absolute","width","100%","height","100%","top","0",3,"click"],["width","100%","height","100%","muted","true","autoplay","autoplay","disableRC","",1,"video-box","p-0",3,"ended","timeupdate","id"],[3,"src"],["class","spinner-border","role","status","style","position: absolute;",4,"ngIf"],["role","status",1,"spinner-border",2,"position","absolute"],[1,"meta","justify-content-center","align-items-center","v-thumb-ico",3,"ngClass"],[2,"cursor","pointer"],[3,"click",4,"ngIf"],[3,"click"],["name","playvideothumb"],["name","pausevideothumb",1,"f-24"],[1,"asset-locked","div-backdrop"],["container","body",2,"cursor","pointer","height","20px","width","20px","position","absolute","top","40%","left","40%",3,"ngbPopover"],["name","infowhite",1,"f-32"],[1,"duration-text"],["style","position: absolute;width: 100%;height: 100%;top: 0;",4,"ngIf"],["class","btn btn-lg btn-secondary icon","style","border:none; width:28px; height: 28px;",3,"click",4,"ngIf"],["name","uploadmediaNew","placement","top","ngbTooltip","Save to Uploads","tooltipClass","custom-tooltip","container","body",1,"f-24"],[2,"position","absolute","width","100%","height","100%","top","0"],["class","meta justify-content-center align-items-center",4,"ngIf"],[1,"meta","justify-content-center","align-items-center"],[1,"spinner-border","spinner-border-lg"],[3,"count"],[1,"position-fixed","w-100","mx-auto","text-center","d-flex","align-items-center","justify-content-center","flex-column","noImageDiv"],[1,"mt-4"],["src","https://static.lightxeditor.com/assets/images/noimagefoundgrey-dark.png","class","img-fluid","disableRC","",4,"ngIf"],["src","https://static.lightxeditor.com/assets/images/noimagefoundgrey.png","class","img-fluid","disableRC","",4,"ngIf"],["class","d-flex flex-column mt-9",4,"ngIf"],["src","https://static.lightxeditor.com/assets/images/noimagefoundgrey-dark.png","disableRC","",1,"img-fluid"],["src","https://static.lightxeditor.com/assets/images/noimagefoundgrey.png","disableRC","",1,"img-fluid"],[1,"d-flex","flex-column","mt-9"],["class","no-upload-text-primary text-semi",3,"ngClass",4,"ngIf"],[1,"no-upload-text-secondary","mt-1",3,"ngClass"],[1,"n
1o-upload-text-primary","text-semi",3,"ngClass"],["class","no-upload-text-primary text-semi text-white",4,"ngIf"],[1,"no-upload-text-primary","text-semi","text-white"],[1,"btn","btn-primary","btn-auto","text-normal","upload-btn","mt-12",3,"click"],["name","uploadmediaNew",1,"me-3","f-24"],["dropZoneLabel","Drop files here","multiple","false","dropZoneClassName","","contentClassName","",3,"onFileDrop","onFileLeave","accept"],["ngx-file-drop-content-tmp","",1,""],["id","divshow",1,"row","g-0","centered","position-fixed","w-100",3,"ngClass"],[1,"d-flex","flex-column","align-items-center","justify-content-center","w-100","text-white","text-center",3,"ngClass"],[1,"position-fixed","w-100","mx-auto","text-center","d-flex","align-items-center","justify-content-center","flex-column","noImageDiv",2,"z-index","-99"],[1,"wp-100","d-flex","justify-content-center"],["class","box-right-wrapper",4,"ngIf"],[1,"box-right-wrapper"],[1,"row","g-0"],[1,"",2,"width","138px"],[1,"text-sm","grey-100","title"],[1,"text-11","text-white","text-semi","title"],[1,"",2,"width","auto"],[1,""],["color","primary",1,"btn","btn-primary","add-space-btn","text-semi","text-13",3,"click"],["style","position: absolute;top:7%;right:25px",4,"ngIf"],[2,"position","absolute","top","7%","right","25px"],[1,"box-right-wrapper-delete"],[1,"d-flex","align-items-center"],[1,"text-sm","text-white","ml-8"],[1,"btn-all","text-white","btn-delete","ms-4","align-items-center",2,"justify-content","space-around",3,"click"],["name","deleteoth",1,"me-1","f-20"],[1,"text-bottom"],[1,"btn-all","ml-7","text-white",3,"click"],["name","closeupload"],[1,"text-sm","grey-800","ml-8"],[1,"btn-all","btn-grey","btn-delete","ms-4","align-items-center","grey-800",2,"justify-content","space-around",3,"click"],["name","deleteoth",1,"me-1","f-20","grey-800"],[1,"btn-all","ml-7","grey-800",3,"click"],["name","closeupload",1,"grey-800"],[4,"ngComponentOutlet","ngComponentOutletInjector"]],template:function(ee,te){if(1&ee){const re=n.RV6();n.DNE(0,le,2,1,"div",3),n.j41(1,"div",4,0),n.bIt("scrolled",function(Be){return n.eBV(re),n.Njj(te.scrollVideoEnd(Be))}),n.j41(3,"ngx-file-drop",5),n.bIt("onFileOver",function(Be){return n.eBV(re),n.Njj(te.fileOver(Be))}),n.DNE(4,ii,8,8,"ng-template",6),n.k0s(),n.DNE(5,ai,2,1,"ngx-file-drop",7),n.k0s(),n.DNE(6,mi,2,1,"div",8),n.j41(7,"div",9),n.DNE(8,gi,13,1,"div",10),n.k0s(),n.j41(9,"div",11),n.DNE(10,_i,13,1,"div",10),n.k0s(),n.DNE(11,vi,1,2,"ng-template",null,1,n.C5r)}2&ee&&(n.Y8G("ngIf",te.uplodedAssetsA.length>=1&&te.isUploadedMediaLoaded),n.R7$(),n.Y8G("scrollWindow",!1)("infiniteScrollDistance",.6)("infiniteScrollUpDistance",2)("infiniteScrollThrottle",120),n.R7$(2),n.FS9("accept",te.accept),n.Y8G("multiple",!te.isReplace),n.R7$(2),n.Y8G("ngIf",te.user||!te.user&&6==te.editorType),n.R7$(),n.Y8G("ngIf",te.user),n.R7$(2),n.Y8G("ngIf",te.selectedAssetIds.length>0||te.selectedMediaAssetIds.length>0),n.R7$(2),n.Y8G("ngIf",te.selectedAssetIds.length>0||te.selectedMediaAssetIds.length>0))},dependencies:[C.YU,C.OI,C.Sq,C.bT,w.f,j.G,L.q,p.tg,p.do,p.U0,p._H,p.ZM,p.md,U.M$,U.vL,z.b,Z.KK,$.D,Y.p,Q.EX],styles:['#column[_ngcontent-%COMP%] .image-thumb-template[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{background:url(https://static.lightxeditor.com/assets/images/transparent-bg.png)}.asset-locked[_ngcontent-%COMP%]{position:absolute;top:0;width:100%;height:100%}.inner[_ngcontent-%COMP%]{background:none!important}.btn-secondary[_ngcontent-%COMP%]{height:24px;width:24px;color:#fff;background:#00000040;border-color:#575a6a;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.btn-secondary[_ngcontent-%COMP%]:hover, .btn-secondary[_ngcontent-%COMP%]:focus{background:#0006}.box-right-wrapper[_ngcontent-%COMP%]{position:absolute;height:68px;display:flex;align-items:center;justify-content:space-evenly;background:#4a4f5e;bottom:8px!important;left:16px;right:16px;width:auto;color:#fff;border-radius:8px;box-shadow:0 2px 8px #000000b3;padding:0;z-index:1}.box-right-wrapper-delete[_ngcontent-%COMP%]{position:absolute;height:48px;display:flex;align-items:center;justify-content:space-around;background:#4a4f5e;bottom:8px;left:16px;right:16px;width:auto;color:#fff;border-radius:8px;padding:0;z-index:1000}
1.btn-delete[_ngcontent-%COMP%]{width:100px;height:36px;border-radius:12px;background:#e2e3e90d;font-size:12px;font-weight:600}.btn-delete[_ngcontent-%COMP%]:hover{background:#e2e3e91a}.btn-secondary[_ngcontent-%COMP%], .btn-outline-secondary[_ngcontent-%COMP%]{padding:0rem;border-width:2px;line-height:0;border-radius:8px}#column[_ngcontent-%COMP%]{width:50%}.show[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important;height:24px;border-radius:8px}.show[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{background-color:#ffffff0d;background-size:24px 24px!important}.show[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:hover{background-color:#fff3}.duration-text[_ngcontent-%COMP%]{position:absolute;bottom:4px;right:4px;display:flex;align-items:center;justify-content:center;padding:2px 8px;background:#0006;border-radius:8px;font-size:11px;color:#fff;height:20px}.v-thumb-ico[_ngcontent-%COMP%]{bottom:4px;left:4px;height:auto;width:auto;right:auto}.thumb-options[_ngcontent-%COMP%] .edit-menu[_ngcontent-%COMP%]{right:4px;top:4px;width:24px;height:24px}.thumb-options[_ngcontent-%COMP%] .checkboxc[_ngcontent-%COMP%]{left:4px;top:4px;width:24px;height:24px}.thumb-options[_ngcontent-%COMP%] .sync-item[_ngcontent-%COMP%]{left:calc(50% - 14px);top:calc(50% - 14px);width:28px;height:28px;position:absolute;border-radius:8px}.thumb-options[_ngcontent-%COMP%] .sync-item[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{background:#00000040;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.thumb-options[_ngcontent-%COMP%] .sync-item[_ngcontent-%COMP%] button[_ngcontent-%COMP%]:hover{background:#0006}.loader-item[_ngcontent-%COMP%]{position:absolute;left:calc(50% - 12px);top:calc(50% - 12px);height:24px;width:24px;border-color:#fff;border-right-color:transparent;display:none;z-index:99}.upload-progress[_ngcontent-%COMP%]{position:relative}.upload-progress[_ngcontent-%COMP%] .sync-item[_ngcontent-%COMP%]{display:none}.upload-progress[_ngcontent-%COMP%] .loader-item[_ngcontent-%COMP%]{display:block}.upload-progress[_ngcontent-%COMP%]:before{position:absolute;width:100%;height:100%;left:0;top:0;content:"";border-radius:12px;background:#0003;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);z-index:9}.noImageDiv[_ngcontent-%COMP%]{height:60%;width:267px!important;border:3px solid transparent;left:16px;top:76px;border-radius:16px}.withOutLoginUser[_ngcontent-%COMP%]{border:none;background-color:#272b34}.showDropDark[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important;border-radius:8px;top:12px;z-index:3;background:#272b34;height:calc(100% - 11px);margin-left:-16px;padding:0 16px}.showDropLight[_ngcontent-%COMP%]{visibility:visible!important;opacity:1!important;border-radius:8px;top:12px;z-index:3;background:#fff;height:calc(100% - 11px);margin-left:-16px;padding:0 16px}.dragDropDark[_ngcontent-%COMP%]{height:calc(100% - 8px);border:3px dashed #494B5E;border-radius:16px}.dragDropLight[_ngcontent-%COMP%]{height:calc(100% - 8px);border:3px dashed rgba(98,106,223,.4);border-radius:16px}.light-theme[_ngcontent-%COMP%] .box-right-wrapper-delete[_ngcontent-%COMP%]{background:#f8f9f9}.light-theme[_ngcontent-%COMP%] .box-right-wrapper-delete[_ngcontent-%COMP%] .btn-delete[_ngcontent-%COMP%]{background:#5e6aef0d!important}.light-theme[_ngcontent-%COMP%] .box-right-wrapper-delete[_ngcontent-%COMP%] .btn-delete[_ngcontent-%COMP%]:hover{background:#5e6aef1a!important}.m-h-auto[_ngcontent-%COMP%]{min-height:auto!important}']}),Ee})()},93226:(_e,ie,g)=>{"use strict";g.d(ie,{n:()=>P}),g(14890);var G=g(54438);let P=(()=>{var h;class a{constructor(){}setActionController(e){this.actionController=e}init(){}changeBrightness(e,l){this.actionController.updateBrightness(e,l),this.brightness=Math.round(100*this.actionController.getImageAdjust().brightness)}changeIntensity(e,l){this.actionController.updateIntensity(e,l),this.intensity=Math.round(100*this.actionController.getImageAdjust().intensity)}changeContrast(e,l){this.actionController.updateContrast(e,l),this.contrast=Math.round(100*this.actionController.getImageAdjust().contrast)}changeExposure(e,l){this.actionController.updateExposure(e,l),this.exposure=Math.round(100*this.actionController.getImageAdjust().exposure)}changeHue(e,l){this.actionController.updateHue(e,l),this.hue=Math.round(1e4*this.actionController.getImageAdjust().hue/180)}changeSaturation(e,l){this.actionController.updateSaturation(e,l),this.saturation=Math.round(100*this.actionController.getImageAdjust().saturation)}changeHueIntensity(e,l){this.actionController.updateHueIntensity(e,l),this.hueIntensity=Math.round(100*this.actionController.getImageAdjust().hueIntensity)}changeRed(e,l){this.actionController.updateRed(e,l),this.red=Math.round(100*this.actionController.getImageAdjust().red)}changeGreen(e,l){this.actionController.updateGreen(e,l),this.green=Math.round(100*this.actionController.getImageAdjust().green)}changeBlue(e,l){this.actionController.updateBlue(e,l),this.blue=Math.round(100*this.actionController.getImageAdjust().blue)}changeTemperature(e,l){this.actionController.updateTemperature(e,l),this.temperature=Math.round(100*this.actionController.getImageAdjust().temperature)}changeTint(e,l){this.actionController.updateTint(e,l),this.tint=Math.round(100*this.actionController.getImageAdjust().tint)}changeShadows(e,l){this.actionController.updateShadows(e,l),this.shadows=Math.round(100*this.actionController.getImageAdjust().shadows)}changeHighlights(e,l){this.actionController.updateHighlights(e,l),this.highlights=Math.round(100*this.actionController.getImageAdjust().highlights)}changeGamma(e,l){this.actionController.updateGamma(e,l),this.gamma=Math.round(100*this.actionController.getImageAdjust().gamma)}updateAdjustmentValues(){let e=this.actionController.getImageAdjust();this.brightness=Math.round(100*e.brightness),this.intensity=Math.round(100*e.intensity),this.exposure=Math.round(100*e.exp
1osure),this.contrast=Math.round(100*e.contrast),this.hue=Math.round(e.hue/180*1e4),this.saturation=Math.round(100*e.saturation),this.red=Math.round(100*e.red),this.green=Math.round(100*e.green),this.blue=Math.round(100*e.blue),this.temperature=Math.round(100*e.temperature),this.tint=Math.round(100*e.tint),this.shadows=Math.round(100*e.shadows),this.highlights=Math.round(100*e.highlights),this.gamma=Math.round(100*e.gamma),this.hueIntensity=Math.round(100*e.hueIntensity)}resetAll(e){this.brightness=0,this.intensity=100,this.contrast=0,this.exposure=0,this.hue=0,this.red=0,this.saturation=0,this.green=0,this.blue=0,this.tint=0,this.temperature=0,this.shadows=0,this.highlights=0,this.gamma=0,this.hueIntensity=0,this.actionController.getAdjustment().length||(this.exposure=50),this.resetBrightness(this.brightness),this.resetIntensity(this.intensity),this.resetContrast(this.contrast),this.resetExposure(this.exposure),this.resetHue(this.hue),this.resetRed(this.red),this.resetSaturation(this.saturation),this.resetGreen(this.green),this.resetBlue(this.blue),this.resetTemperature(this.temperature),this.resetTint(this.tint),this.resetShadows(this.shadows),this.resetHighlights(this.highlights),this.resetGamma(this.gamma),this.resetHueIntensity(this.hueIntensity),e&&e()}resetBrightness(e){this.changeBrightness(e,!1)}resetIntensity(e){this.changeIntensity(e,!1)}resetContrast(e){this.changeContrast(e,!1)}resetExposure(e){this.changeExposure(e,!1)}resetHue(e){this.changeHue(e,!1)}resetSaturation(e){this.changeSaturation(e,!1)}resetHueIntensity(e){this.changeHueIntensity(e,!1)}resetRed(e){this.changeRed(e,!1)}resetGreen(e){this.changeGreen(e,!1)}resetBlue(e){this.changeBlue(e,!1)}resetTemperature(e){this.changeTemperature(e,!1)}resetTint(e){this.changeTint(e,!1)}resetShadows(e){this.changeShadows(e,!1)}resetHighlights(e){this.changeHighlights(e,!1)}resetGamma(e){this.changeGamma(e,!1)}}return(h=a).\u0275fac=function(e){return new(e||h)},h.\u0275prov=G.jDH({token:h,factory:h.\u0275fac}),a})()},46631:(_e,ie,g)=>{"use strict";g.d(ie,{f:()=>e});var n=g(54438),o=g(94449),G=g(33391);const P=["carousel"];function h(l,_){1&l&&(n.j41(0,"div",12),n.nrm(1,"img",13),n.k0s())}function a(l,_){1&l&&(n.j41(0,"div",12),n.nrm(1,"img",14),n.k0s())}function d(l,_){1&l&&(n.j41(0,"div",12),n.nrm(1,"img",15),n.k0s())}let e=(()=>{var l;class _{constructor(S){this.removeBgService=S,this.interval=100,this.isMove=!1,this.activetabId=0,this.pauseOnIndicator=!1,this.pauseOnHover=!0,this.pauseOnFocus=!0,this.theme="white",this.afterResolveModule=new n.bkB,this.startObjectRembg=new n.bkB,this.inProgress="false"}ngOnChanges(){}ngOnInit(){}processBg(S){this.startObjectRembg.next(0)}onSlide(S){this.isMove||(this.isMove=!0,this.interval=2e3),this.activetabId=parseInt(S.current?S.current:"0")}}return(l=_).\u0275fac=function(S){return new(S||l)(n.rXU(o.r))},l.\u0275cmp=n.VBU({type:l,selectors:[["remove-bg-panel"]],viewQuery:function(S,x){if(1&S&&n.GBs(P,7),2&S){let E;n.mGM(E=n.lsd())&&(x.carousel=E.first)}},inputs:{theme:"theme",inProgress:"inProgress"},outputs:{afterResolveModule:"afterResolveModule",startObjectRembg:"startObjectRembg"},features:[n.OA$],decls:19,vars:8,consts:[["carousel",""],[1,"common-container"],[1,"pt-10","mb-8"],[1,"text-lg","text-semi","text-dark","lh-125"],[1,"mt-10"],[1,"mt-10","removeBgPanel","carouselDesignTool"],[1,"gray-100",2,"border-radius","16px"],[2,"min-height","124px",3,"slide","interval","activeId","pauseOnHover","pauseOnFocus"],["ngbSlide","",3,"id"],[1,"text-sm","lh-inherit","text-dark","mt-2"],[1,"ps-3","pe-3"],[1,"btn","btn-primary","text-13","w-100","btn-h40","mt-8","mb-3",3,"click","mouseout","mouseover","disabled"],[2,"min-height","119px"],["src","https://static.lightxeditor.com/assets/images/remove-bg-panel.png",2,"max-width","267px"],["src","https://static.lightxeditor.com/assets/images/remove-bg-animal.png",2,"max-width","267px"],["src","https://static.lightxeditor.com/assets/images/remove-bg-product.png",2,"max-width","267px"]],template:function(S,x){if(1&S){const E=n.RV6();n.j41(0,"div",1)(1,"div",2)(2,"span",3),n.EFF(3,"Remove Backgroun
1d"),n.k0s()(),n.nrm(4,"div",1),n.j41(5,"div",4)(6,"div",5)(7,"div",6)(8,"ngb-carousel",7,0),n.bIt("slide",function(R){return n.eBV(E),n.Njj(x.onSlide(R))}),n.DNE(10,h,2,0,"ng-template",8)(11,a,2,0,"ng-template",8)(12,d,2,0,"ng-template",8),n.k0s(),n.j41(13,"div",1)(14,"p",9),n.EFF(15,"Click 'Remove Now' to automatically erase the background in seconds."),n.k0s()(),n.j41(16,"div",10)(17,"button",11),n.bIt("click",function(){return n.eBV(E),n.Njj(x.processBg(0))})("mouseout",function(){return n.eBV(E),n.Njj(x.interval=2e3)})("mouseover",function(){return n.eBV(E),n.Njj(x.interval=3e3)}),n.EFF(18,"Remove Now"),n.k0s()()()()()()}2&S&&(n.R7$(8),n.Y8G("interval",x.interval)("activeId",0)("pauseOnHover",x.pauseOnHover)("pauseOnFocus",x.pauseOnFocus),n.R7$(2),n.Y8G("id",0),n.R7$(),n.Y8G("id",1),n.R7$(),n.Y8G("id",2),n.R7$(5),n.Y8G("disabled",x.inProgress))},dependencies:[G.Oj,G.bD],styles:[".removeBgPanel[_ngcontent-%COMP%]{border:solid 1px transparent!important;background-image:linear-gradient(90deg,#fc5cff -4%,#2520f6)!important;border-radius:16px;background:#f8f9f9;background-origin:border-box}.removeBgPanel[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{border-radius:16px 16px 0 0}"]}),_})()},94475:(_e,ie,g)=>{"use strict";g.d(ie,{C:()=>a});var n=g(21413),o=g(28567),G=g(54438),P=g(3781),h=g(22154);let a=(()=>{var d;class e extends o.n{constructor(_,C){super(_,C),this.state=_,this.configService=C,this.maxScale=3,this.minScale=.1,this.currentZoom=1,this.extraWidth=200,this.viewZoom=100,this.defaultZoom=!0,this._canvasScale=new n.B,this.canvasScale=this._canvasScale.asObservable()}set(_,C=!0){this.updateMaxScaleForOriginal(),_<this.minScale&&(_=this.minScale),_>this.maxScale&&(_=this.maxScale);const S=this.state.original.width*_,x=this.state.original.height*_;this.state.mainCanvas.setZoom(_),C&&this.state.mainCanvas.setDimensions({width:S,height:x});const E=this.state.canvasMaskWrapperLoaded;if(E){const M=E.getBoundingClientRect();let R=window.__canvasZoomMouseX,I=window.__canvasZoomMouseY;("number"!=typeof R||"number"!=typeof I)&&(R=M.left+M.width/2,I=M.top+M.height/2);const D=R-M.left,p=I-M.top;if("number"==typeof E.scrollLeft&&"number"==typeof E.scrollTop){const b=_/(this.currentZoom||1),B=(E.scrollLeft+D)*b-D,y=(E.scrollTop+p)*b-p,O=Math.max(0,E.scrollWidth-E.clientWidth),w=Math.max(0,E.scrollHeight-E.clientHeight);E.scrollLeft=Math.max(0,Math.min(O,B)),E.scrollTop=Math.max(0,Math.min(w,y))}}this.currentZoom=_,this.viewZoom=this.getPercent(),this.setScenePreviewPosition()}fitToScreen(_=null){if(this.defaultZoom){const C=this.state.calcWrapperSize();let S,x,E;_?(S=C.width,x=C.height-20,E=this.viewZoom/100):(C.width>768?(S=C.width-this.extraWidth,x=C.height-20):(S=C.width,x=C.height),E=this.state.original?Math.min(x/this.state.original.height,S/this.state.original.width):1),E>this.maxScale&&(E=this.maxScale,this.currentZoom=1,this.viewZoom=100,this.defaultZoom=!0),this.set(E,!0),this.zoomDropdownReset.next(!0)}}fitToScreenByPercent(_,C=null){const S=this.state.calcWrapperSize();let x,E,M;S.width>768?(x=S.width-this.extraWidth,E=S.height-20):(x=S.width,E=S.height),M=this.state.original?Math.min(E/this.state.original.height,x/this.state.original.width):1,M-=15*M/100,this.set(M,!0),this.zoomDropdownReset.next(!0)}bindMouseWheel(){this.state.mainCanvas.on("mouse:wheel",C=>{C.e.preventDefault(),C.e.stopPropagation(),this.set(C.e.deltaY<0?this.currentZoom+.05:this.currentZoom-.05),this.state.mainCanvas.requestRenderAll()})}}return(d=e).\u0275fac=function(_){return new(_||d)(G.KVO(P.X),G.KVO(h.w))},d.\u0275prov=G.jDH({token:d,factory:d.\u0275fac}),e})()},95894:(_e,ie,g)=>{"use strict";g.d(ie,{u:()=>_});var n=g(10467),o=g(21413),G=g(33726),P=g(70152),h=g(23294),a=g(16478),d=g(16471),e=g(54438),l=g(22154);let _=(()=>{var C;class S{constructor(E){this.configService=E,this.maxScale=2,this.minScale=.1,this.currentZoom=1,this.extraWidth=200,this.viewZoom=100,this.defaultZoom=!0,this._canvasScale=new o.B,this.canvasScale=this._canvasScale.asObservable(),this.original={height:0,width:0}}get(){return this.currentZoom}getPercent(){return Math.floor(100*this.currentZoom)}setCanvas(E,M){this.mainCanvas=E,this.wrapperEl=M}setWrapper(E){this.wrapperEl=E}init(E=0,M=0){this.mainCanvas.clear(),this.setInitialLayout(E,M)}initWithoutClear(E,M=0,R=0){this.original.width=M,this.original.height=R,this.setInitialLayout(M,R)}setInitialLayout(E=0,M=0){this.original={height:M,width:E},this.fitToScreen()}setLayout(E){var M=this;return(0,n.A)(function*(R,I=0,D=0){let p,u;if(R===a.b.customFormatId)p=D,u=I;else{yield M.configService.waitForSettings();let m=M.configService.settings?.[d.jn.SocialFormat]?.[R];p=m?.height||1080,u=m?.width||1920}M.original={height:p,width:u},M.fitToScreen()}).apply(this,arguments)}set(E,M=!0){const R=this.original.width*E,I=this.original.height*E;this.mainCanvas.setZoom(E),M&&(this.mainCanvas.setHeight(I),this.mainCanvas.setWidth(R)),this.currentZoom=E,this.viewZo
1om=this.getPercent()}fitToScreen(E=null){if(this.defaultZoom){const M=this.wrapperEl.getBoundingClientRect();let R,I,D;E?(R=M.width,I=M.height-20,D=this.viewZoom/100):(M.width>768?(R=M.width-this.extraWidth,I=M.height-20):(R=M.width,I=M.height),D=Math.min(I/this.original.height,R/this.original.width)),this.set(D,!0)}}bindMouseWheel(){this.mainCanvas.on("mouse:wheel",M=>{M.e.preventDefault(),M.e.stopPropagation(),this.set(M.e.deltaY<0?this.currentZoom+.05:this.currentZoom-.05),this.mainCanvas.requestRenderAll()})}fitCanvasToScreenOnResize(){(0,G.R)(window,"resize").pipe((0,P.B)(200),(0,h.F)()).subscribe(()=>{this.fitToScreen()})}}return(C=S).\u0275fac=function(E){return new(E||C)(e.KVO(l.w))},C.\u0275prov=e.jDH({token:C,factory:C.\u0275fac}),S})()},3781:(_e,ie,g)=>{"use strict";g.d(ie,{X:()=>h});var n=g(93552),G=g(60177),P=g(54438);let h=(()=>{var a;class d{constructor(l,_){this.document=l,this.zone=_,this.loading=!1,this.videoEditor=!1}init(l,_,C,S,x=null,E=!1,M=null,R=null,I=null){this.canvasMaskWrapperLoaded=I?.nativeElement,this.videoEditor=E,this.wrapperEl=l.nativeElement,this.maskWrapperEl=_.nativeElement,this.mainCanvas=new n.fabric.Canvas(C.nativeElement,{uniScaleKey:null,altActionKey:null}),this.mainCanvasNative=C,this.outputCanvas=x,this.mainCanvas.selection=!E,S&&(this.previewCanvasWrapper=S.nativeElement),M&&(this.previewCanvas=new n.fabric.Canvas(M.nativeElement),this.previewCanvas.setHeight(this.mainCanvas.height),this.previewCanvas.setWidth(this.mainCanvas.width)),R&&(this.canvasBgWrapper=R.nativeElement),this.startAnimation()}stopAnimation(){this.render=()=>{},this.req&&n.fabric.util.cancelAnimFrame(this.req)}startAnimation(){this.videoEditor&&this.zone.runOutsideAngular(()=>this.animationRenderAll(this.mainCanvas))}animationRenderAll(l){this.render=()=>{l.requestRenderAll(),this.req=n.fabric.util.requestAnimFrame(this.render)},this.req=n.fabric.util.requestAnimFrame(this.render)}calcWrapperSize(){if(this.wrapperEl){const l=this.wrapperEl.getBoundingClientRect();return{width:l.width,height:l.height}}return{width:100,height:100}}disableCanvasRightClick(){let l=this.document.getElementsByClassName("upper-canvas");for(let _=0;_<l.length;_++)n.fabric.util.addListener(l[_],"contextmenu",function(S){S.preventDefault()})}onDestory(){this.stopAnimation()}}return(a=d).\u0275fac=function(l){return new(l||a)(P.KVO(G.qQ),P.KVO(P.SKi))},a.\u0275prov=P.jDH({token:a,factory:a.\u0275fac}),d})()},28567:(_e,ie,g)=>{"use strict";g.d(ie,{B:()=>E,n:()=>x});var n=g(10467),o=g(21413),G=g(33726),P=g(70152),h=g(23294),a=g(16478),d=g(16471),e=g(93552),_=g(54438),C=g(3781),S=g(22154);class x{constructor(R,I){this.state=R,this.configService=I,this.maxScale=3,this.minScale=.1,this.currentZoom=1,this.extraWidth=200,this.viewZoom=100,this.defaultZoom=!0,this._canvasScale=new o.B,this.canvasScale=this._canvasScale.asObservable(),this.zoomDropdownReset=new o.B,this.zoomValue$=new o.B,this.maxScaleChanged=new o.B,this.hardCanvasMaxSide=4096,this.configuredMaxScale=3}get(){return this.currentZoom}getPercent(){return Math.floor(100*this.currentZoom)}updateMaxScaleForOriginal(){const D=Math.max(this.state?.original?.width||0,this.state?.original?.height||0)||1,p=Math.floor(this.hardCanvasMaxSide/D),u=Math.max(this.minScale,p);this.maxScale=Math.min(this.configuredMaxScale,u),this.maxScaleChanged.next(this.maxScale)}init(R){var I=this;return(0,n.A)(function*(D,p=0,u=0){I.state.mainCanvas.clear(),yield I.setInitialLayout(D,p,u),I.fitCanvasToScreenOnResize()}).apply(this,arguments)}initWithoutClear(R){var I=this;return(0,n.A)(function*(D,p=0,u=0){I.state.original.width=p,I.state.original.height=u,yield I.setInitialLayout(D,p,u),I.fitCanvasToScreenOnResize()}).apply(this,arguments)}setInitialLayout(R){var I=this;return(0,n.A)(function*(D,p=0,u=0){let m,b;if(yield I.configService.waitForSettings(),D===a.b.customFormatId)m=u,b=p;else{let k=I.configService.settings?.[d.jn.SocialFormat]?.[D];m=k?.height||p,b=k?.width||u}I.state.original={height:m,width:b},I.updateMaxScaleForOriginal(),I.fitToScreen(),I.setScenePreviewPosition()}).apply(this,arguments)}setLayout(R){var I=this;return(0,n.A)(function*(D,p=0,u=0){let m,b;if(yield I.configService.waitForSettings(),D===a.b.customFormatId)m=u,b=p;else{let k=I.configService.settings?.[d.jn.SocialFormat]?.[D];m=k?.height||u,b=k?.width||p}I.state.original={height:m,width:b},I.updateMaxScaleForOriginal(),I.fitToScreen(),I.setScenePreviewPosition()}).apply(this,arguments)}setScenePreviewPosition(){if(!this.state.previewCanvasWrapper)return;let R=this.state.mainCanvas.wrapperEl.getBoundingClientRect(),D=R.top;this.state.previewCanvasWrapper.style.left=R.left+"px",this.state.previewCanvasWrapper.style.top=D+"px"}setWidthTimelineCanvas(){}fitCanvasToScreenOnResize(){(0,G.R)(window,"resize").pipe((0,P.B)(200),(0,h.F)()).subscribe(()=>{this.fitToScreen()})}}let E=(()=>{var M;class R extends x{constructor(D,p){super(D,p),this.maxScale=3,this.minScale=.1,this.currentZoom=1,this.extraWidth=200,this.canvasPadding=40,this.fitToScreenFrame=null,this.viewZo
1om=100,this.defaultZoom=!0,this._canvasScale=new o.B,this.canvasScale=this._canvasScale.asObservable(),this.zoomDropdownReset=new o.B}set(D,p=!0){this.updateMaxScaleForOriginal(),D<this.minScale&&(D=this.minScale),D>this.maxScale&&(D=this.maxScale),this.state.mainCanvas.setZoom(D);const u=this.state.original.width*D,m=this.state.original.height*D,b=this.state.canvasMaskWrapperLoaded,k=this.state.calcWrapperSize(),A=b?.clientWidth||k.width,B=b?.clientHeight||k.height,y=u+this.canvasPadding,O=m+this.canvasPadding,w=this.getSideOverlayInsets(b,A),j=y+w.left+w.right,L=j>A||O>B;this.state.mainCanvas.setDimensions({width:Math.max(A,j),height:Math.max(B,O)});const U=this.state.mainCanvas.width/2-u/2,z=this.state.mainCanvas.height/2-m/2;var Z=new e.fabric.Point(-U,-z);if(this.state.mainCanvas.absolutePan(Z),L){if(b){const $=b.getBoundingClientRect();let Y=window.__canvasZoomMouseX,Q=window.__canvasZoomMouseY;("number"!=typeof Y||"number"!=typeof Q)&&(Y=$.left+$.width/2,Q=$.top+$.height/2);const K=Y-$.left,W=Q-$.top;if("number"==typeof b.scrollLeft&&"number"==typeof b.scrollTop){const V=D/(this.currentZoom||1),Ce=(b.scrollLeft+K)*V-K,Ne=(b.scrollTop+W)*V-W,Ze=Math.max(0,b.scrollWidth-b.clientWidth),de=Math.max(0,b.scrollHeight-b.clientHeight);b.scrollLeft=Math.max(0,Math.min(Ze,Ce)),b.scrollTop=Math.max(0,Math.min(de,Ne))}}}else b&&(b.scrollLeft=0,b.scrollTop=0);this.state.mainCanvas.controlsAboveOverlay=!0,this.state.mainCanvas.clipPath=new e.fabric.Rect({width:this.state.original.width,height:this.state.original.height}),this.currentZoom=D,this.viewZoom=this.getPercent(),this.setScenePreviewPosition(),this.state.mainCanvas.requestRenderAll(),this.setCanvasBgWrapperPos(U,z,this.state.original.width*D,this.state.original.height*D)}getSideOverlayInsets(D,p){if(!D)return{left:0,right:0};const u=D.getBoundingClientRect(),m=this.state.wrapperEl?.closest(".wrapper-for-timeline")||this.state.wrapperEl||D.parentElement;if(!m)return{left:0,right:0};const b=m.querySelector(".editNavInner"),k=m.querySelector(".canvas-action-right:not(.v-action-editor)")||m.querySelector(".canvas-action-right");let A=0,B=0;if(b){const y=b.getBoundingClientRect();A=Math.max(0,Math.min(p,y.right-u.left))}if(k){const y=k.getBoundingClientRect();B=Math.max(0,Math.min(p,u.right-y.left))}return{left:A,right:B}}setCanvasBgWrapperPos(D,p,u,m){this.state.canvasBgWrapper&&(this.state.canvasBgWrapper.style.left=D+"px",this.state.canvasBgWrapper.style.top=p+"px",this.state.canvasBgWrapper.style.width=u+"px",this.state.canvasBgWrapper.style.height=m+"px")}fitToScreen(){if(this.defaultZoom){const D=()=>{const p=this.state.calcWrapperSize(),u=this.state.canvasMaskWrapperLoaded,m=u?.clientWidth||p.width,k=this.state.original?Math.min(((u?.clientHeight||p.height)-this.canvasPadding)/this.state.original.height,(m-this.extraWidth)/this.state.original.width):1;this.set(k,!1),u&&(u.scrollLeft=0,u.scrollTop=0)};D(),null!==this.fitToScreenFrame&&cancelAnimationFrame(this.fitToScreenFrame),this.fitToScreenFrame=requestAnimationFrame(()=>{this.fitToScreenFrame=null,D()}),this.zoomDropdownReset.next(!0)}}fitToScreenByPercent(){}bindMouseWheel(){this.state.mainCanvas.on("mouse:wheel",p=>{p.e.preventDefault(),p.e.stopPropagation(),this.set(p.e.deltaY<0?this.currentZoom+.05:this.currentZoom-.05),this.state.mainCanvas.requestRenderAll()})}}return(M=R).\u0275fac=function(D){return new(D||M)(_.KVO(C.X),_.KVO(S.w))},M.\u0275prov=_.jDH({token:M,factory:M.\u0275fac}),R})()},1408:(_e,ie,g)=>{"use strict";g.d(ie,{x:()=>e});var n=g(84412),o=g(21413),G=g(45312),P=g(67091),h=g(54438),a=g(95301),d=g(84246);let e=(()=>{var l;class _{constructor(S,x){this.dataService=S,this.indexedDBService=x,this._activeToolPanel=new n.t({panel:"media",from:"default",SubTool:null}),this._activeEditToolSubPanel=new n.t({panel:""}),this._sceneChanged=new n.t(0),this._onChange=new o.B,this.sceneChanged=this._sceneChanged.asObservable(),this.activeToolPanel=this._activeToolPanel.asObservable(),this.onChange=this._onChange.asObservable(),this.activeEditSubPane=this._activeEditToolSubPanel.asObservable(),this.baseUrl=G.c.baseUrl,this.replace=!1,this.zOrderEdit=!1,this.replaceEdit=!1,this.removebgEdit=!1,this.maskEdit=!1,this.designItemMouseOver=new o.B,this.designItemMouseOverLayer=new o.B,this.videoTemplateUIJsonUrl=G.c.staticAssetsPath+"assets/json/video-template-editor-ui-config.json"}setOnChange(S){this._onChange.next(S)}setActiveToolPanel(S){this._activeToolPanel.next(S.panel?{...S,panel:S.panel,from:S.from,toolName:S.toolName||"",title:S?.title||""}:{panel:S,from:""})}setActiveToolPanelWithoutBroadcast(S){this._activeToolPanel.next(S.panel?{panel:S.panel,from:S.from}:{panel:S,from:""})}
1setActiveEditToolSubPanel(S){this._activeEditToolSubPanel.next({panel:S})}getActiveToolPanel(){let S=this._activeToolPanel.getValue();return S&&"canvas"===S.from&&(S.from=""),S}sceneIndexChanged(S){this._sceneChanged.next(S)}loadProject(S,x,E){this.dataService.postApi(this.baseUrl+"andorsocial-1.0/project/getDesignById",{assetId:S}).subscribe(D=>{x(D.body.designs[0])},D=>{E()})}isVideoEditorSupported(){const S=(0,P.o0)();return S&&S.name&&("chrome"===S.name||"edge-chromium"===S.name)}getEditorUiConfig(S,x=null){this.indexedDBService.getJson(S).then(E=>{E?x&&x(E):this.getJsonFileData(S).subscribe(M=>{M&&(this.indexedDBService.saveJson(S,M),x&&x(M))},M=>{console.log(M)})})}getJsonFileData(S){return this.dataService.get(S,!1)}}return(l=_).\u0275fac=function(S){return new(S||l)(h.KVO(a.u),h.KVO(d.T))},l.\u0275prov=h.jDH({token:l,factory:l.\u0275fac}),_})()},95659:(_e,ie,g)=>{"use strict";g.d(ie,{J:()=>G});var n=g(54438),o=g(28567);let G=(()=>{var P;class h{constructor(d){this.injectedZoomService=d}attachPinchPanHandlers(d,e){const l=e||this.injectedZoomService,_=()=>l?l.get():1,C=l?l.minScale:.1;let x=!0,E=_();const M=p=>Math.max(C,Math.min(l?l.maxScale:3,p)),R=p=>{if(!p.ctrlKey||!x)return;p.preventDefault(),"number"==typeof p.clientX&&"number"==typeof p.clientY&&(window.__canvasZoomMouseX=p.clientX,window.__canvasZoomMouseY=p.clientY);const u=_(),b=M(u*Math.exp(.01*-p.deltaY));l&&l.set(b),l._canvasScale.next(b),l.zoomValue$.next()},I=p=>{x&&(E=_(),"function"==typeof p.preventDefault&&p.preventDefault())},D=p=>{if(!x)return;"function"==typeof p.preventDefault&&p.preventDefault();const u=M(E*(p.scale||1));l&&l.set(u)};return d.addEventListener("wheel",R,{passive:!1}),d.addEventListener("gesturestart",I,{passive:!1}),d.addEventListener("gesturechange",D,{passive:!1}),{disable:()=>{x=!1},enable:()=>{x=!0},isEnabled:()=>x,destroy:()=>{d.removeEventListener("wheel",R),d.removeEventListener("gesturestart",I),d.removeEventListener("gesturechange",D)}}}}return(P=h).\u0275fac=function(d){return new(d||P)(n.KVO(o.n,8))},P.\u0275prov=n.jDH({token:P,factory:P.\u0275fac}),h})()},25119:(_e,ie,g)=>{"use strict";g.d(ie,{_:()=>n});class n{constructor(){}setActiveScrollPos(G,P){G&&P&&setTimeout(()=>{this.scrollParentToChild(G,P)},100)}scrollParentToChild(G,P){const h=G.getBoundingClientRect(),d=P.getBoundingClientRect().top-h.top;G.scrollTo({top:G.scrollTop+d-10,behavior:"smooth"})}scrollParentToChildOld(G,P){var h=G.getBoundingClientRect(),d=P.getBoundingClientRect();G.scrollTop+=d.top-h.top-10}}},2820:(_e,ie,g)=>{"use strict";g.d(ie,{Z:()=>o});var n=g(54438);let o=(()=>{var P;class h{constructor(d){this.el=d,this.regex=new RegExp(/^[0-9]+(\.[0-9][0-9]*){0,1}$/g),this.specialKeys=["Backspace","Tab","End","Home","ArrowLeft","ArrowRight","Delete"]}
1onKeyDown(d){if((d.metaKey||d.ctrlKey)&&("v"===d.key||"a"===d.key||"c"===d.key))return;if(-1!==this.specialKeys.indexOf(d.key))return;let l=this.el.nativeElement.value.concat(d.key);l&&!String(l).match(this.regex)&&d.preventDefault()}}return(P=h).\u0275fac=function(d){return new(d||P)(n.rXU(n.aKT))},P.\u0275dir=n.FsC({type:P,selectors:[["","numbersOnly",""]],hostBindings:function(d,e){1&d&&n.bIt("keydown",function(_){return e.onKeyDown(_)})}}),h})()},20753:(_e,ie,g)=>{"use strict";g.d(ie,{I:()=>o,z:()=>G});var n=g(54438);let o=(()=>{var P;class h{constructor(d){this.el=d,this.regex=new RegExp(/^-?[0-9]+(\.[0-9][0-9]*){0,1}$/g),this.specialKeys=["Backspace","Tab","End","Home","ArrowLeft","ArrowRight"],this.defaultValue="0"}onInput(d){let e=this.el.nativeElement.value;this.el.nativeElement.value=e.replace(/[^-0-9]/g,""),e!==this.el.nativeElement.value?d.stopPropagation():"00"===e||e&&(Number(this.el.nativeElement.value)>Number(this.max)||Number(this.el.nativeElement.value)<Number(this.min))||e.includes("-")&&e.length>1&&"-"===d.data?(this.el.nativeElement.value=this.el.nativeElement.defaultValue,d.stopPropagation()):(e.includes("-0")||e.startsWith("--")||"--"===e)&&(this.el.nativeElement.value="0",d.stopPropagation()),this.el.nativeElement.defaultValue=this.el.nativeElement.value}onBlur(d){""===this.el.nativeElement.value.trim()&&(this.el.nativeElement.value=this.el.nativeElement.defaultValue=this.defaultValue)}}return(P=h).\u0275fac=function(d){return new(d||P)(n.rXU(n.aKT))},P.\u0275dir=n.FsC({type:P,selectors:[["","numberSettings",""]],hostBindings:function(d,e){1&d&&n.bIt("input",function(_){return e.onInput(_)})("blur",function(_){return e.onBlur(_)})},inputs:{min:"min",max:"max",defaultValue:"defaultValue"}}),h})(),G=(()=>{var P;class h{constructor(d){this.el=d,this.regex=new RegExp(/^\d*\.?\d*$/),this.specialKeys=["Backspace","Tab","End","Home","ArrowLeft","ArrowRight","Del","Delete"]}
1onKeyDown(d){if(-1!==this.specialKeys.indexOf(d.key))return;if("."===d.key)return void(this.el.nativeElement.value.includes(".")&&d.preventDefault());/\d/.test(d.key)||d.preventDefault();const e=this.el.nativeElement.value,l=this.el.nativeElement.selectionStart,_=[e.slice(0,l),d.key,e.slice(l)].join("");_&&!String(_).match(this.regex)&&d.preventDefault()}}return(P=h).\u0275fac=function(d){return new(d||P)(n.rXU(n.aKT))},P.\u0275dir=n.FsC({type:P,selectors:[["","appDecimalAmount",""]],hostBindings:function(d,e){1&d&&n.bIt("keydown",function(_){return e.onKeyDown(_)})}}),h})()},18545:(_e,ie,g)=>{"use strict";g.d(ie,{m:()=>G});var n=g(54438),o=g(345);let G=(()=>{var P;class h{constructor(d){this.sanitizer=d}transform(d,e){switch(e){case"html":return this.sanitizer.bypassSecurityTrustHtml(d);case"url":return this.sanitizer.bypassSecurityTrustUrl(d);default:throw new Error(`Invalid safe type specified: ${e}`)}}}return(P=h).\u0275fac=function(d){return new(d||P)(n.rXU(o.up,16))},P.\u0275pipe=n.EJ8({name:"safe",type:P,pure:!0}),h})()},93391:(_e,ie,g)=>{"use strict";g.d(ie,{C:()=>h});var n=g(54438),o=g(60177),G=g(84341);const P=a=>({transition:a});let h=(()=>{var a;class d{constructor(){this.selected=!1,this.disabled=!1,this.loaded=!1,this.changeT=new n.bkB}ngAfterViewInit(){setTimeout(()=>{this.loaded=!0},100)}ngOnInit(){}changeToggle(){setTimeout(()=>{this.changeT.emit(this.selected)},200)}}return(a=d).\u0275fac=function(l){return new(l||a)},a.\u0275cmp=n.VBU({type:a,selectors:[["toggle-switch"]],inputs:{selected:"selected",disabled:"disabled"},outputs:{changeT:"changeT"},decls:3,vars:5,consts:[[1,"toggle-switch"],["type","checkbox",3,"ngModelChange","click","disabled","ngModel"],[1,"slider",3,"ngClass"]],template:function(l,_){1&l&&(n.j41(0,"label",0)(1,"input",1),n.mxI("ngModelChange",function(S){return n.DH7(_.selected,S)||(_.selected=S),S}),n.bIt("click",function(){return _.changeToggle()}),n.k0s(),n.nrm(2,"div",2),n.k0s()),2&l&&(n.R7$(),n.Y8G("disabled",_.disabled),n.R50("ngModel",_.selected),n.R7$(),n.Y8G("ngClass",n.eq3(3,P,_.loaded)))},dependencies:[o.YU,G.Zm,G.BC,G.vS],styles:['.toggle-switch[_ngcontent-%COMP%]{height:30px;width:56px;display:inline-block;position:relative;margin-bottom:.5rem}.toggle-switch[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{display:none}.toggle-switch[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]{background-color:#fff}.toggle-switch[_ngcontent-%COMP%] input[_ngcontent-%COMP%]:checked + .slider[_ngcontent-%COMP%]:after{transform:translate(26px)}.toggle-switch[_ngcontent-%COMP%] .slider[_ngcontent-%COMP%]{border-radius:20px;position:absolute;left:0;top:0;right:0;bottom:0;background-color:#fff}.toggle-switch[_ngcontent-%COMP%] .slider[_ngcontent-%COMP%]:after{position:absolute;content:"";height:24px;width:24px;background-color:#626adf;left:4px;bottom:3px;border-radius:20px}.toggle-switch[_ngcontent-%COMP%] .transition[_ngcontent-%COMP%]{transition:2s}.toggle-switch[_ngcontent-%COMP%] .transition[_ngcontent-%COMP%]:after{transition:.4s}']}),d})()},80197:function(_e,ie){var g,o;void 0!==(o="function"==typeof(g=function(){"use strict";function P(_,C,S){var x=new XMLHttpRequest;x.open("GET",_),x.responseType="blob",x.onload=function(){l(x.response,C,S)},x.onerror=function(){console.error("could not download file")},x.send()}function h(_){var C=new XMLHttpRequest;C.open("HEAD",_,!1);try{C.send()}catch{}return 200<=C.status&&299>=C.status}function a(_){try{_.dispatchEvent(new MouseEvent("click"))}catch{var C=document.createEvent("MouseEvents");
1C.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),_.dispatchEvent(C)}}var d="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,e=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),l=d.saveAs||("object"!=typeof window||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!e?function(_,C,S){var x=d.URL||d.webkitURL,E=document.createElement("a");E.download=C=C||_.name||"download",E.rel="noopener","string"==typeof _?(E.href=_,E.origin===location.origin?a(E):h(E.href)?P(_,C,S):a(E,E.target="_blank")):(E.href=x.createObjectURL(_),setTimeout(function(){x.revokeObjectURL(E.href)},4e4),setTimeout(function(){a(E)},0))}:"msSaveOrOpenBlob"in navigator?function(_,C,S){if(C=C||_.name||"download","string"!=typeof _)navigator.msSaveOrOpenBlob(function G(_,C){return typeof C>"u"?C={autoBom:!1}:"object"!=typeof C&&(console.warn("Deprecated: Expected third argument to be a object"),C={autoBom:!C}),C.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(_.type)?new Blob(["\ufeff",_],{type:_.type}):_}(_,S),C);else if(h(_))P(_,C,S);else{var x=document.createElement("a");x.href=_,x.target="_blank",setTimeout(function(){a(x)})}}:function(_,C,S,x){if((x=x||open("","_blank"))&&(x.document.title=x.document.body.innerText="downloading..."),"string"==typeof _)return P(_,C,S);var E="application/octet-stream"===_.type,M=/constructor/i.test(d.HTMLElement)||d.safari,R=/CriOS\/[\d]+/.test(navigator.userAgent);if((R||E&&M||e)&&typeof FileReader<"u"){var I=new FileReader;I.onloadend=function(){var u=I.result;u=R?u:u.replace(/^data:[^;]*;/,"data:attachment/file;"),x?x.location.href=u:location=u,x=null},I.readAsDataURL(_)}else{var D=d.URL||d.webkitURL,p=D.createObjectURL(_);x?x.location=p:location.href=p,x=null,setTimeout(function(){D.revokeObjectURL(p)},4e4)}});d.saveAs=l.saveAs=l,_e.exports=l})?g.apply(ie,[]):g)&&(_e.exports=o)},57942:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.FaceReshape=(0,g.util.createClass)(G.BaseFilter,{type:"FaceReshape",fragmentSource:"varying highp vec2 vTexCoord;\nuniform sampler2D uTexture;\nuniform lowp float radiusInput;uniform lowp float centreX;uniform lowp float centreY;uniform lowp float radiusInput2;uniform lowp float centreX2;uniform lowp float centreY2;uniform lowp float width;uniform lowp float height;uniform lowp float alphaVal;uniform lowp float breastMode; mediump vec2 ZoomMotion(lowp float radius,lowp float dist,mediump vec2 textureCoordinateOverlay,lowp float value) { \n lowp float sigma = radius;\n mediump float gaussianValue = (dist * dist) / (2.0 * sigma * sigma);\n lowp float updatedGaussianValue = exp(-gaussianValue);\n lowp float p = 1.0;\n if (dist > radius*0.5){\n p = (radius - dist)/ (radius*0.5) ;\n }\n p = p * p * p;\n textureCoordinateOverlay.x = textureCoordinateOverlay.x+ textureCoordinateOverlay.x*value*p;\n textureCoordinateOverlay.y = textureCoordinateOverlay.y+ textureCoordinateOverlay.y*value*p;\n return textureCoordinateOverlay;\n }\nlowp vec2 bulgeMotion(lowp float radius,lowp float dist,lowp vec2 textureCoordinateOverlay,lowp float value) {\n \n lowp float percent = 1.0 + ((radius - dist) / radius) * value;\n percent = percent * percent*percent;\n textureCoordinateOverlay = textureCoordinateOverlay * percent;\n return textureCoordinateOverlay;\n\n}lowp vec2 pulseMotion(lowp float radiusInput, lowp float centreX,lowp float centreY,highp vec2 textureCoordinateInput,lowp float width,lowp float height,lowp float alphaVal,lowp float breastMode){ lowp vec2 textureCoordinateToUse;\n highp vec2 updatedCenter = vec2(centreX * width , centreY * height); highp float distFactor = height; if(width < height){ distFactor = width; } lowp float dist = distance(updatedCenter, vec2(textureCoordinateInput.x * width, textureCoordinateInput.y * height)) / distFactor; lowp float radius = 1.2 * radiusInput; updatedCenter = vec2(centreX , centreY); if (width > height) {\n radius = 1.4 * width/height * radius;\n } else{ radius = height/width * radius;\n } lowp float value = alphaVal * 2.0; lowp vec2 textureCoordinateModified = vec2(textureCoordinateInput.x, textureCoordinateInput.y); if (dist <= radius) { if(breastMode == 1.0){ // Breast\n textureCoordinateModified = vec2(textureCoordinateInput.x-updatedCenter.x,textureCoordinateInput.y-updatedCenter.y) ;\n textureCoordinateModified = bulgeMotion(radius,dist,textureCoordinateModified,value);\n textureCoordinateModified =vec2(textureCoordinateModified.x+updatedCenter.x,textureCoordinateModified.y+updatedCenter.y);\n return textureCoordinateModified; } else { // head\n mediump vec2 newCoordinate = vec2(textureCoordinateInput.x, textureCoordinateInput.y);\n mediump vec2 centreRatio = vec2(centreX, centreY);\n lowp float distRatio = distance(centreRatio, newCoordinate);\n textureCoordinateModified = vec2(textureCoordinateInput.x - updatedCenter.x, textureCoordinateInput.y - updatedCenter.y);\n textureCoordinateModified = ZoomMotion(radius, dist, textureCoordinateModified, value);\n textureCoordinateModified = vec2(textureCoordinateModified.x + updatedCenter.x, textureCoordinateModified.y + updatedCenter.y); return textureCoordinateModified; } } return textureCoordinateModified;}void main(){ highp vec4 textureColor = texture2D(uTexture, vTexCoord); lowp vec2 updatedTextureCoordinate = pulseMotion(radiusInput,centreX,centreY,vTexCoord,width,height,alphaVal,breastMode);\n if(breastMode==1.0) { updatedTextureCoordinate = pulseMotion(radiusInput2,centreX2,centreY2,updatedTextureCoordinate,width,height,alphaVal,breastMode);\n } gl_FragColor = texture2D(uTexture, updatedTextureCoordinate);\n}\n",breastMode:!1,alphaVal:0,width:1,height:1,centreX2:.5,centreY2:.5,radiusInput2:.5,centreX:.5,centreY:.5,radiusInput:.5,mainParameter:"brightness",applyTo2d:function(h){},getUniformLocations:function(h,a){return{radiusInput:h.getUniformLocation(a,"radiusInput"),centreX:h.getUniformLocation(a,"centreX"),centreY:h.getUniformLocation(a,"centreY"),radiusInput2:h.getUniformLocation(a,"radiusInput2"),centreX2:h.getUniformLocation(a,"centreX2"),centreY2:h.getUniformLocation(a,"centreY2"),width:h.getUniformLocation(a,"width"),height:h.getUniformLocation(a,"height"),alphaVal:h.getUniformLocation(a,"alphaVal"),breastMode:h.getUniformLocation(a,"breastMode")}},sendUniformData:function(h,a){h.uniform1f(a.radiusInput,this.radiusInput),h.uniform1f(a.centreX,this.centreX),h.uniform1f(a.centreY,this.centreY),h.uniform1f(a.radiusInput2,this.radiusInput2),h.uniform1f(a.centreX2,this.centreX2),h.uniform1f(a.centreY2,this.centreY2),h.uniform1f(a.width,this.width),h.uniform1f(a.height,this.height),h.uniform1f(a.alphaVal,this.alphaVal),h.uniform1f(a.breastMode,this.breastMode)}}),g.Image.filters.FaceReshape.fromObject=g.Image.filters.BaseFilter.fromObject}()},65485:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.WaistReshape=(0,g.util.createClass)(G.BaseFilter,{type:"WaistReshape",originx:0,originy:0,rectWidth:1,rectHeight:1,warpScale:0,fragmentSource:"varying highp vec2 vTexCoord;\nuniform sampler2D uTexture;\nuniform lowp float originx;\nuniform lowp float originy;\nuniform lowp float rectWidth;\nuniform lowp float rectHeight;\nuniform lowp float warpScale;\nvoid main()\n{\n lowp vec4 textureColor = texture2D(uTexture, vTexCoord);\n mediump float muY = originy + rectHeight/2.0;\n mediump float mSigmaX = rectWidth/12.0;\n mediump float mSigmaY = rectHeight/6.0;\n if(vTexCoord.x > originx && vTexCoord.x < (originx + rectWidth/2.0) && vTexCoord.y > originy && vTexCoord.y < (originy + rectHeight)) {\n mediump float muX = originx + rectWidth/4.0;\n mediump float gaussianValue = ((vTexCoord.x - muX) * (vTexCoord.x - muX) / (2.0 * mSigmaX * mSigmaX)) + ((vTexCoord.y - muY) * (vTexCoord.y - muY) / (2.0 * mSigmaY * mSigmaY));\n mediump float displacement = -exp(-gaussianValue);\n mediump vec2 textureIndex = vec2(vTexCoord.x - displacement * warpScale, vTexCoord.y);\n lowp vec4 fragmentColor = texture2D(uTexture, textureIndex);\n gl_FragColor = fragmentColor;\n } else if(vTexCoord.x > originx + rectWidth/2.0 && vTexCoord.x < (originx + rectWidth) && vTexCoord.y > originy && vTexCoord.y < (originy + rectHeight)) {\n mediump float muX = originx + 0.75 * rectWidth;\n mediump float gaussianValue = ((vTexCoord.x - muX) * (vTexCoord.x - muX) / (2.0 * mSigmaX * mSigmaX)) + ((vTexCoord.y - muY) * (vTexCoord.y - muY) / (2.0 * mSigmaY * mSigmaY));\n mediump float displacement = exp(-gaussianValue);\n mediump vec2 textureIndex = vec2(vTexCoord.x - displacement * warpScale, vTexCoord.y);\n lowp vec4 fragmentColor = texture2D(uTexture, textureIndex);\n gl_FragColor = fragmentColor;\n } else {\n gl_FragColor = textureColor;\n }\n}\n",applyTo2d:function(h){},getUniformLocations:function(h,a){return{originx:h.getUniformLocation(a,"originx"),originy:h.getUniformLocation(a,"originy"),rectWidth:h.getUniformLocation(a,"rectWidth"),rectHeight:h.getUniformLocation(a,"rectHeight"),warpScale:h.getUniformLocation(a,"warpScale")}},sendUniformData:function(h,a){h.uniform1f(a.originx,this.originx),h.uniform1f(a.originy,this.originy),h.uniform1f(a.rectWidth,this.rectWidth),h.uniform1f(a.rectHeight,this.rectHeight),h.uniform1f(a.warpScale,this.warpScale)}}),g.Image.filters.WaistReshape.fromObject=g.Image.filters.BaseFilter.fromObject}()},16447:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BlurRetouch=(0,g.util.createClass)(G.BaseFilter,{type:"BlurRetouch",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\nhighp vec4 maskColor = texture2D(uTexture, vTexCoord);\nif(maskColor.r > 0.0){\n gl_FragColor = color / total;\n}else{\n gl_FragColor = maskColor;\n}\n}",blur:0,mainParameter:"blur",applyTo:function(h){h.webgl?(this.aspectRatio=h.sourceWidth/h.sourceHeight,h.passes++,this._setupFrameBuffer(h),this.horizontal=!0,this.applyToWebGL(h),this._swapTextures(h),this._setupFrameBuffer(h),this.horizontal=!1,this.applyToWebGL(h),this._swapTextures(h)):this.applyTo2d(h
1)},applyTo2d:function(h){h.imageData=this.simpleBlur(h)},simpleBlur:function(h){var d,e,a=h.filterBackend.resources,l=h.imageData.width,_=h.imageData.height;a.blurLayer1||(a.blurLayer1=g.util.createCanvasElement(),a.blurLayer2=g.util.createCanvasElement()),e=a.blurLayer2,((d=a.blurLayer1).width!==l||d.height!==_)&&(e.width=d.width=l,e.height=d.height=_);var E,M,R,I,C=d.getContext("2d"),S=e.getContext("2d"),x=15,D=.06*this.blur*.5;for(C.putImageData(h.imageData,0,0),S.clearRect(0,0,l,_),I=-x;I<=x;I++)R=D*(M=I/x)*l+(E=(Math.random()-.5)/4),S.globalAlpha=1-Math.abs(M),S.drawImage(d,R,E),C.drawImage(e,0,0),S.globalAlpha=1,S.clearRect(0,0,e.width,e.height);for(I=-x;I<=x;I++)R=D*(M=I/x)*_+(E=(Math.random()-.5)/4),S.globalAlpha=1-Math.abs(M),S.drawImage(d,E,R),C.drawImage(e,0,0),S.globalAlpha=1,S.clearRect(0,0,e.width,e.height);h.ctx.drawImage(d,0,0);var p=h.ctx.getImageData(0,0,d.width,d.height);return C.globalAlpha=1,C.clearRect(0,0,d.width,d.height),p},getUniformLocations:function(h,a){return{delta:h.getUniformLocation(a,"uDelta")}},sendUniformData:function(h,a){var d=this.chooseRightDelta();h.uniform2fv(a.delta,d)},chooseRightDelta:function(){var d,h=1,a=[0,0];return this.horizontal?this.aspectRatio>1&&(h=1/this.aspectRatio):this.aspectRatio<1&&(h=this.aspectRatio),d=h*this.blur*.12,this.horizontal?a[0]=d:a[1]=d,a}}),g.Image.filters.BlurRetouch.fromObject=g.Image.filters.BaseFilter.fromObject}()},683:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BritnessOnMask=(0,g.util.createClass)(G.BaseFilter,{type:"BritnessOnMask",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform float ufilterValue;\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n float weight = maskColor.r;\n highp vec4 adjustedColor = textureColor;\n if(weight > 0.0){\n adjustedColor.rgb += ufilterValue;\n gl_FragColor = adjustedColor * maskColor.r + textureColor * (1.0 - maskColor.r);\n }else{\n gl_FragColor = textureColor;\n }\n}",image:null,filterValue:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){if(this.image){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),d&&a.deleteTexture(d)}},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),ufilterValue:h.getUniformLocation(a,"ufilterValue")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.ufilterValue,this.filterValue)}}),g.Image.filters.BritnessOnMask.fromObject=g.Image.filters.BaseFilter.fromObject}()},63297:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BritnessOnMaskEye=(0,g.util.createClass)(G.BaseFilter,{type:"BritnessOnMaskEye",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform float ufilterValue;\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n float weight = maskColor.r;\n highp vec4 adjustedColor = textureColor;\n if(weight > 0.0){\n if(adjustedColor.a != 0.0)\n adjustedColor = vec4(((adjustedColor.rgb - vec3(0.5)) * ufilterValue + vec3(0.5)), adjustedColor.w);\n gl_FragColor = adjustedColor * maskColor.r + textureColor * (1.0 - maskColor.r);\n }else{\n gl_FragColor = textureColor;\n }\n}",image:null,filterValue:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){if(this.image){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),d&&a.deleteTexture(d)}},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),ufilterValue:h.getUniformLocation(a,"ufilterValue")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.ufilterValue,this.filterValue)}}),g.Image.filters.BritnessOnMaskEye.fromObject=g.Image.filters.BaseFilter.fromObject}()},22046:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BritnessOnMaskTeeth=(0,g.util.createClass)(G.BaseFilter,{type:"BritnessOnMaskTeeth",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform float ufilterValue;\nconst mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n highp vec4 adjustedColor = textureColor;\n lowp float luminance = dot(textureColor.rgb, luminanceWeighting); \n lowp float minVal = textureColor.r < textureColor.g ? ((textureColor.r < textureColor.b)?textureColor.r:textureColor.b) :((textureColor.g < textureColor.b)?textureColor.g:textureColor.b);\n lowp float maxVal = textureColor.r > textureColor.g ? ((textureColor.r > textureColor.b)?textureColor.r:textureColor.b) :((textureColor.g > textureColor.b)?textureColor.g:textureColor.b);\n lowp float maxminRatio = maxVal/minVal;\n float maskWeight = maskColor.r;\n if(maskWeight > 0.0 && maskColor.r > 0.0 && textureColor.r> 0.20 && textureColor.g> 0.20 && textureColor.b > 0.20){ \n //First lower the saturation and then increase the intensity or exposure a bit.. \n lowp vec3 greyScaleColor = vec3(luminance); \n mediump float saturation = (maxminRatio == 0.0) ? 0.30 : 1.0 - 1.0/maxminRatio; \n mediump float updatedSaturation = 1.0 + (saturation - 1.0)*maskWeight; \n mediump vec4 saturationFrag = vec4(mix(greyScaleColor, textureColor.rgb, updatedSaturation), textureColor.w);\n //Now increase the intensity a bit by intensity factor \n if(ufilterValue>0.0){\n mediump vec4 brightnessFrag = vec4(saturationFrag.rgb *(1.0+ufilterValue*maskWeight), textureColor.w);\n adjustedColor = brightnessFrag;\n }\n }\n gl_FragColor=adjustedColor;\n}\n",image:null,filterValue:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){if(this.image){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),d&&a.deleteTexture(d)}},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),ufilterValue:h.getUniformLocation(a,"ufilterValue")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.ufilterValue,this.filterValue)}}),g.Image.filters.BritnessOnMaskTeeth.fromObject=g.Image.filters.BaseFilter.fromObject}()},17314:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.ReTouchMask=(0,g.util.createClass)(G.BaseFilter,{type:"ReTouchMask",fragmentSource:"",red:[],green:[],blue:[],threshold:5,colorCount:1,createFragmentSource(){this.fragmentSource="precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform int red[20];\nuniform int green[20];\nuniform int blue[20];\nuniform float threshold;\nbool distanceData(vec4 color1, vec3 colormatch){\n float dr = abs((color1.r*255.0) - colormatch.x);\n float dg = abs((color1.g*255.0) - colormatch.y);\n float db = abs((color1.b*255.0) - colormatch.z);\n return dr<=threshold&&dg<=threshold&&db<=threshold;\n}\nvoid main() {\n vec4 texColor = texture2D(uTexture, vTexCoord);\n float match = 0.0;\n";for(let h=0;h<this.colorCount;h++)this.fragmentSource+=` if (distanceData(texColor, vec3(red[${h}],green[${h}],blue[${h}]))) {\n match = 1.0;\n }\n`;this.fragmentSource+=" gl_FragColor = vec4(vec3(match), 1.0); // Output black or white\n}\n"},applyTo2d:function(h){if(0!==this.myParameter){var e,l=h.imageData.data.length;for(e=0;e<l;e+=4);}},getUniformLocations:function(h,a){return{red:h.getUniformLocation(a,"red"),green:h.getUniformLocation(a,"green"),blue:h.getUniformLocation(a,"blue"),threshold:h.getUniformLocation(a,"threshold")}},sendUniformData:function(h,a){h.uniform1iv(a.red,this.red),h.uniform1iv(a.green,this.green),h.uniform1iv(a.blue,this.blue),h.uniform1f(a.threshold,this.threshold)}}),g.Image.filters.ReTouchMask.fromObject=g.Image.filters.BaseFilter.fromObject}()},49868:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.ReTouchMaskSkin=(0,g.util.createClass)(G.BaseFilter,{type:"ReTouchMaskSkin",fragmentSource:"",red:[],green:[],blue:[],threshold:5,colorCount:1,createFragmentSource(){this.fragmentSource="precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform int red[20];\nuniform int green[20];\nuniform int blue[20];\nuniform float threshold;\nbool distanceData(vec4 color1, vec3 colormatch){\n float dr = abs((color1.r*255.0) - colormatch.x);\n float dg = abs((color1.g*255.0) - colormatch.y);\n float db = abs((color1.b*255.0) - colormatch.z);\n return dr<=threshold&&dg<=threshold&&db<=threshold;\n}\nvoid main() {\n vec4 texColor = texture2D(uTexture, vTexCoord);\n float match = 0.0;\n";for(let h=0;h<this.colorCount;h++)this.fragmentSource+=` if (distanceData(texColor, vec3(red[${h}],green[${h}],blue[${h}]))) {\n match = 1.0;\n }\n`;this.fragmentSource+=" gl_FragColor = vec4(vec3(match), 1.0); // Output black or white\n}\n"},applyTo2d:function(h){if(0!==this.myParameter){var e,l=h.imageData.data.length;for(e=0;e<l;e+=4);}},getUniformLocations:function(h,a){return{red:h.getUniformLocation(a,"red"),green:h.getUniformLocation(a,"green"),blue:h.getUniformLocation(a,"blue"),threshold:h.getUniformLocation(a,"threshold")}},sendUniformData:function(h,a){h.uniform1iv(a.red,this.red),h.uniform1iv(a.green,this.green),h.uniform1iv(a.blue,this.blue),h.uniform1f(a.threshold,this.threshold)}}),g.Image.filters.ReTouchMaskSkin.fromObject=g.Image.filters.BaseFilter.fromObject}()},31611:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.ReTouchMaskTeeth=(0,g.util.createClass)(G.BaseFilter,{type:"ReTouchMaskTeeth",fragmentSource:"",red:[],green:[],blue:[],threshold:5,colorCount:1,createFragmentSource(){this.fragmentSource="precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform int red[20];\nuniform int green[20];\nuniform int blue[20];\nuniform float threshold;\nbool distanceData(vec4 color1, vec3 colormatch){\n float dr = abs((color1.r*255.0) - colormatch.x);\n float dg = abs((color1.g*255.0) - colormatch.y);\n float db = abs((color1.b*255.0) - colormatch.z);\n return dr<=threshold&&dg<=threshold&&db<=threshold;\n}\nvoid main() {\n vec4 texColor = texture2D(uTexture, vTexCoord);\n float match = 0.0;\n";for(let h=0;h<this.colorCount;h++)this.fragmentSource+=` if (distanceData(texColor, vec3(red[${h}],green[${h}],blue[${h}]))) {\n match = 1.0;\n }\n`;this.fragmentSource+=" gl_FragColor = vec4(vec3(match), 1.0); // Output black or white\n}\n"},applyTo2d:function(h){if(0!==this.myParameter){var e,l=h.imageData.data.length;for(e=0;e<l;e+=4);}},getUniformLocations:function(h,a){return{red:h.getUniformLocation(a,"red"),green:h.getUniformLocation(a,"green"),blue:h.getUniformLocation(a,"blue"),threshold:h.getUniformLocation(a,"threshold")}},sendUniformData:function(h,a){h.uniform1iv(a.red,this.red),h.uniform1iv(a.green,this.green),h.uniform1iv(a.blue,this.blue),h.uniform1f(a.threshold,this.threshold)}}),g.Image.filters.ReTouchMaskTeeth.fromObject=g.Image.filters.BaseFilter.fromObject}()},44953:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.ShadeOnMask=(0,g.util.createClass)(G.BaseFilter,{type:"ShadeOnMask",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform highp vec4 mixColor;\nuniform highp float alpha;uniform highp float colorShadeOption;const mediump vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n highp vec4 adjustedColor = textureColor;\n float weight = maskColor.r;\n if(colorShadeOption == 2.0){\n mediump vec4 base = adjustedColor;\n mediump float alphaDivisor = base.a + step(base.a, 0.0);\n mediump vec4 softlight = vec4(base * (mixColor.a * (base / alphaDivisor) + (2.0 * mixColor * (1.0 - (base / alphaDivisor)))) + mixColor * (1.0 - base.a) + base * (1.0 - mixColor.a));\n adjustedColor = softlight;\n adjustedColor=vec4(( alpha * adjustedColor.rgb) + ((1.0 - alpha) * textureColor.rgb),1.0); \n; adjustedColor=( weight * adjustedColor) + ((1.0 - weight) * textureColor);\n }\n if(colorShadeOption == 1.0){ mediump float alphaDivisor = adjustedColor.a + step(adjustedColor.a, 0.0);\n mediump vec4 softlight = vec4(adjustedColor * (mixColor.a * (adjustedColor / alphaDivisor) + (2.0 * mixColor * (1.0 - (adjustedColor / alphaDivisor)))) + mixColor * (1.0 - adjustedColor.a) + adjustedColor * (1.0 - mixColor.a));\n adjustedColor = softlight;\n adjustedColor=( mixColor.a * adjustedColor) + ((1.0 - mixColor.a) * textureColor); \n; adjustedColor=( weight * adjustedColor) + ((1.0 - weight) * textureColor);\n textureColor = adjustedColor;\n }\n gl_FragColor = adjustedColor;\n}",image:null,colorShadeOption:2,alpha:1,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){if(this.image){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1)}},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),mixColor:h.getUniformLocation(a,"mixColor"),alpha:h.getUniformLocation(a,"alpha"),colorShadeOption:h.getUniformLocation(a,"colorShadeOption")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform4f(a.mixColor,...this.mixColor),h.uniform1f(a.alpha,this.alpha),h.uniform1f(a.colorShadeOption,this.colorShadeOption)}}),g.Image.filters.ShadeOnMask.fromObject=g.Image.filters.BaseFilter.fromObject}()},30872:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var o=g.Image.filters;o.ShadeOnMaskNew=(0,g.util.createClass)(o.BaseFilter,{type:"ShadeOnMaskNew",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform highp vec4 mixColor;\nuniform highp float alpha;\nvec3 rgb2hsv(vec3 c)\n{\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n}\n// All components are in the range [0\u20261], including hue.\nvec3 hsv2rgb(vec3 c)\n{\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n highp vec4 adjustedColor = textureColor;\n float weight = maskColor.r;\n if (weight > 0.0) {\n if (mixColor.r == 0.0 && mixColor.g == 0.0 && mixColor.b == 0.0) {\n float intensity = alpha * 0.6;\n adjustedColor = vec4(textureColor.rgb * (1.0 - weight * intensity), textureColor.a);\n } else {\n vec3 originalHSV = rgb2hsv(textureColor.rgb);\n vec3 resultHSV = vec3(mixColor.x, mixColor.y, originalHSV.z);\n vec3 resultRGB = hsv2rgb(resultHSV);\n vec4 outColor = vec4(resultRGB, 1.0);\n outColor = vec4(outColor.rgb * alpha + textureColor.rgb * (1.0 - alpha), 1.0);\n adjustedColor = mix(textureColor, outColor, weight);\n }\n }\n gl_FragColor = adjustedColor;\n}",image:null,alpha:1,retrieveShader:function(P){var h=this.type+"_"+this.mode,a=this.fragmentSource[this.mode];return P.programCache.hasOwnProperty(h)||(P.programCache[h]=this.createProgram(P.context,a)),P.programCache[h]},applyToWebGL:function(P){if(this.image){var h=P.context,a=this.createTexture(P.filterBackend,this.image);this.bindAdditionalTexture(h,a,h.TEXTURE1),this.callSuper("applyToWebGL",P),this.unbindAdditionalTexture(h,h.TEXTURE1),a&&h.deleteTexture(a)}},createTexture:function(P,h){return 1===this.cleanCacheEverytime?P.getUnCachedTexture(h):P.getCachedTexture(h.cacheKey,h)},applyTo2d:function(P){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(P,h){return{uTransformMatrix:P.getUniformLocation(h,"uTransformMatrix"),uImage:P.getUniformLocation(h,"uImage"),mixColor:P.getUniformLocation(h,"mixColor"),alpha:P.getUniformLocation(h,"alpha")}},sendUniformData:function(P,h){var a=this.calculateMatrix();P.uniform1i(h.uImage,1),P.uniformMatrix3fv(h.uTransformMatrix,!1,a),P.uniform4f(h.mixColor,this.mixColor[0],this.mixColor[1],this.mixColor[2],this.mixColor[3]),P.uniform1f(h.alpha,this.alpha)}}),g.Image.filters.ShadeOnMaskNew.fromObject=g.Image.filters.BaseFilter.fromObject}()},86535:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var o=g.Image.filters;o.SkinAdjustment=(0,g.util.createClass)(o.BaseFilter,{type:"SkinAdjustment",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform sampler2D toneCurveTexture;\nconst mediump mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.596, -0.274, -0.322, 0.212, -0.523, 0.311);\nconst mediump mat3 YIQtoRGB = mat3(1.0, 0.956, 0.621, 1.0, -0.272, -0.647, 1.0, -1.105, 1.702);\nconst lowp vec3 warmFilter = vec3(0.93, 0.54, 0.0);\nuniform highp float exposure;\nuniform lowp float adztOn;\nuniform lowp float brightness;\nuniform lowp float contrast;\nuniform lowp float temperature;\nuniform lowp float tint;\nuniform lowp float intensity;\nuniform highp float shadows;\nuniform highp float highlights;\nconst highp vec3 luminanceWeighting = vec3(0.3, 0.3, 0.3);\nuniform mediump vec3 levelMinimum;\nuniform mediump vec3 levelMiddle;\nuniform mediump vec3 levelMaximum;\nuniform mediump vec3 minOutput;\nuniform mediump vec3 maxOutput;\nuniform mediump mat4 colorMatrix;\nuniform highp float smoothness;\nuniform highp float sharpness;\nuniform sampler2D blurMaskTexture;\nvoid main() {\nhighp vec4 textureColor = texture2D(uTexture, vTexCoord);\nhighp vec4 maskColor = texture2D(uImage, vTexCoord2);\nhighp vec4 blurColor = texture2D(blurMaskTexture, vTexCoord);\nhighp vec4 toneCurve = textureColor;\nfloat weight = maskColor.r;\n\nif(weight > 0.0){\n //sharpness and smoothness\n float detail = sharpness * (1.0 - smoothness);\n toneCurve = vec4(mix(blurColor.rgb, toneCurve.rgb, detail), toneCurve.a);\n\n // shadow and highlight\n if(shadows != 0.0 || highlights != 1.0){\n highp float luminance = dot(toneCurve.rgb, luminanceWeighting);\n highp float shadow = clamp((pow(luminance, 1.0/(shadows+1.0)) + (-0.76)*pow(luminance, 2.0/(shadows+1.0))) - luminance, 0.0, 1.0);\n highp float highlight = clamp((1.0 - (pow(1.0-luminance, 1.0/(2.0-highlights)) + (-0.8)*pow(1.0-luminance, 2.0/(2.0-highlights)))) - luminance, -1.0, 0.0);\n highp float denom = max(luminance, 1e-3);\n highp vec3 result = (luminance + shadow + highlight) * (toneCurve.rgb / denom);\n toneCurve = vec4(result.rgb, toneCurve.a);\n }\n\n // gamma\n toneCurve = vec4( mix(minOutput, maxOutput, pow(min(max(toneCurve.rgb -levelMinimum, vec3(0.0)) / (levelMaximum - levelMinimum ), vec3(1.0)), 1.0 /levelMiddle)), toneCurve.a);\n\n // warmth\nmediump vec3 yiq = RGBtoYIQ * toneCurve.rgb; //adjusting tint\nyiq.b = clamp(yiq.b + tint*0.5226*0.1, -0.5226, 0.5226);\nlowp vec3 rgb = YIQtoRGB * yiq;\nlowp vec3 processed = vec3(\n(rgb.r < 0.5 ? (2.0 * rgb.r * warmFilter.r) : (1.0 - 2.0 * (1.0 - rgb.r) * (1.0 - warmFilter.r))), //adjusting temperature\n(rgb.g < 0.5 ? (2.0 * rgb.g * warmFilter.g) : (1.0 - 2.0 * (1.0 - rgb.g) * (1.0 - warmFilter.g))),\n(rgb.b < 0.5 ? (2.0 * rgb.b * warmFilter.b) : (1.0 - 2.0 * (1.0 - rgb.b) * (1.0 - warmFilter.b))));\ntoneCurve = vec4(mix(rgb, processed, temperature), toneCurve.a);\n\ngl_FragColor = textureColor * (1.0 - weight) + toneCurve * weight;\n}\nelse{\ngl_FragColor = textureColor;\n}\n}",image:null,adjustment:null,adztOn:0,smoothness:0,sharpness:0,blurImage:null,retrieveShader:function(P){var h=this.type+"_"+this.mode,a=this.fragmentSource[this.mode];return P.programCache.hasOwnProperty(h)||(P.programCache[h]=this.createProgram(P.context,a)),P.programCache[h]},applyToWebGL:function(P){var h=P.context,a=this.createTexture(P.filterBackend,this.image);this.bindAdditionalTexture(h,a,h.TEXTURE1);var d=this.createTexture(P.filterBackend,this.blurImage);this.bindAdditionalTexture(h,d,h.TEXTURE3),this.callSuper("applyToWebGL",P),this.unbindAdditionalTexture(h,h.TEXTURE1),this.unbindAdditionalTexture(h,h.TEXTURE3),a&&h.deleteTexture(a),d&&h.deleteTexture(d)},createTexture:function(P,h){return 1===this.cleanCacheEverytime?P.getUnCachedTexture(h):P.getCachedTexture(h.cacheKey,h)},applyTo2d:function(P){if(0!==this.adjustment.brightness){var d,a=P.imageData.data,e=a.length,l=Math.round(255*this.adjustment.brightness);for(d=0;d<e;d+=4)a[d]=a[d]+l,a[d+1]=a[d+1]+l,a[d+2]=a[d+2]+l}},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(P,h){return{uTransformMatrix:P.getUniformLocation(h,"uTransformMatrix"),uImage:P.getUniformLocation(h,"uImage"),adztOn:P.getUniformLocation(h,"adztOn"),brightness:P.getUniformLocation(h,"brightness"),exposure:P.getUniformLocation(h,"exposure"),contrast:P.getUniformLocation(h,"contrast"),temperature:P.getUniformLocation(h,"temperature"),tint:P.getUniformLocation(h,"tint"),intensity:P.getUniformLocation(h,"intensity"),shadows:P.getUniformLocation(h,"shadows"),highlights:P.getUniformLocation(h,"highlights"),levelMinimum:P.getUniformLocation(h,"levelMinimum"),levelMiddle:P.getUniformLocation(h,"levelMiddle"),levelMaximum:P.getUniformLocation(h,"levelMaximum"),minOutput:P.getUniformLocation(h,"minOutput"),maxOutput:P.getUniformLocation(h,"maxOutput"),colorMatrix:P.getUniformLocation(h,"colorMatrix"),blurMaskTexture:P.getUniformLocation(h,"blurMaskTexture"),smoothness:P.getUniformLocation(h,"smoothness"),sharpness:P.getUniformLocation(h,"sharpness")}},sendUniformData:function(P,h){var a=this.calculateMatrix();P.uniform1i(h.uImage,1),P.uniformMatrix3fv(h.uTransformMatrix,!1,a),P.uniform1f(h.adztOn,this.adztOn),P.uniform1f(h.brightness,this.adjustment.brightness),P.uniform1f(h.exposure,this.adjustment.exposure),P.uniform1f(h.contrast,this.adjustment.contrast),P.uniform1f(h.temperature,this.adjustment.temperature),P.uniform1f(h.tint,this.adjustment.tint),P.uniform1f(h.intensity,this.adjustment.hasOwnProperty("intensity")?this.adjustment.intensity:1),P.uniform1f(h.shadows,this.adjustment.shadows),P.uniform1f(h.highlights,this.adjustment.highlights),P.uniform3f(h.levelMinimum,this.adjustment.min[0],this.adjustment.min[1],this.adjustment.min[2]),P.uniform3f(h.levelMiddle,this.adjustment.mid[0],this.adjustment.mid[
11],this.adjustment.mid[2]),P.uniform3f(h.levelMaximum,this.adjustment.max[0],this.adjustment.max[1],this.adjustment.max[2]),P.uniform3f(h.minOutput,this.adjustment.minOutput[0],this.adjustment.minOutput[1],this.adjustment.minOutput[2]),P.uniform3f(h.maxOutput,this.adjustment.maxOutput[0],this.adjustment.maxOutput[1],this.adjustment.maxOutput[2]),P.uniformMatrix4fv(h.colorMatrix,!1,this.adjustment.colorMatrix),P.uniform1i(h.blurMaskTexture,3),P.uniform1f(h.smoothness,this.smoothness),P.uniform1f(h.sharpness,this.sharpness)}}),g.Image.filters.SkinAdjustment.fromObject=g.Image.filters.BaseFilter.fromObject}()},54777:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.Adjustment=(0,g.util.createClass)(G.BaseFilter,{type:"Adjustment",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform sampler2D toneCurveTexture;\nconst mediump mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.596, -0.274, -0.322, 0.212, -0.523, 0.311);\nconst mediump mat3 YIQtoRGB = mat3(1.0, 0.956, 0.621, 1.0, -0.272, -0.647, 1.0, -1.105, 1.702);\nconst lowp vec3 warmFilter = vec3(0.93, 0.54, 0.0);\nuniform highp float exposure;\nuniform lowp float adztOn;\nuniform lowp float brightness;\nuniform lowp float contrast;\nuniform lowp float temperature;\nuniform lowp float tint;\nuniform lowp float intensity;\nuniform highp float shadows;\nuniform highp float highlights;\nconst highp vec3 luminanceWeighting = vec3(0.3, 0.3, 0.3);\nuniform mediump vec3 levelMinimum;\nuniform mediump vec3 levelMiddle;\nuniform mediump vec3 levelMaximum;\nuniform mediump vec3 minOutput;\nuniform mediump vec3 maxOutput;\nuniform mediump mat4 colorMatrix;\nvoid main() {\nhighp vec4 textureColor = texture2D(uTexture, vTexCoord);\nhighp vec4 maskColor = texture2D(uImage, vTexCoord2);\nhighp vec4 toneCurve = textureColor;\nfloat weight = maskColor.r;\n\nif(weight>0.0 || adztOn != 1.0){\n // tone curve\n lowp float redCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.r, 0.0)).r;\n lowp float greenCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.g, 0.0)).g;\n lowp float blueCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.b, 0.0)).b;\n toneCurve = vec4(redCurveValue, greenCurveValue, blueCurveValue, toneCurve.a);\n\n // shadow and highlight\n if(shadows != 0.0 || highlights != 1.0){\n highp float luminance = dot(toneCurve.rgb, luminanceWeighting);\n highp float shadow = clamp((pow(luminance, 1.0/(shadows+1.0)) + (-0.76)*pow(luminance, 2.0/(shadows+1.0))) - luminance, 0.0, 1.0);\n highp float highlight = clamp((1.0 - (pow(1.0-luminance, 1.0/(2.0-highlights)) + (-0.8)*pow(1.0-luminance, 2.0/(2.0-highlights)))) - luminance, -1.0, 0.0);\n highp vec3 result = vec3(0.0, 0.0, 0.0) + ((luminance + shadow + highlight) - 0.0) * ((toneCurve.rgb - vec3(0.0, 0.0, 0.0))/(luminance - 0.0));\n toneCurve = vec4(result.rgb, toneCurve.a);\n }\n\n // brightness\n if(toneCurve.a != 0.0)\n toneCurve = vec4((toneCurve.rgb + vec3(brightness)), toneCurve.w);\n\n // exposure\n toneCurve = vec4(toneCurve.rgb * pow(2.0, exposure), toneCurve.w);\n\n // contrast\n if(toneCurve.a != 0.0)\n toneCurve = vec4(((toneCurve.rgb - vec3(0.5)) * contrast + vec3(0.5)), toneCurve.w);\n\n // gamma\n toneCurve = vec4( mix(minOutput, maxOutput, pow(min(max(toneCurve.rgb -levelMinimum, vec3(0.0)) / (levelMaximum - levelMinimum ), vec3(1.0)), 1.0 /levelMiddle)), toneCurve.a);\n\n // warmth\nmediump vec3 yiq = RGBtoYIQ * toneCurve.rgb; //adjusting tint\nyiq.b = clamp(yiq.b + tint*0.5226*0.1, -0.5226, 0.5226);\nlowp vec3 rgb = YIQtoRGB * yiq;\nlowp vec3 processed = vec3(\n(rgb.r < 0.5 ? (2.0 * rgb.r * warmFilter.r) : (1.0 - 2.0 * (1.0 - rgb.r) * (1.0 - warmFilter.r))), //adjusting temperature\n(rgb.g < 0.5 ? (2.0 * rgb.g * warmFilter.g) : (1.0 - 2.0 * (1.0 - rgb.g) * (1.0 - warmFilter.g))),\n(rgb.b < 0.5 ? (2.0 * rgb.b *
1warmFilter.b) : (1.0 - 2.0 * (1.0 - rgb.b) * (1.0 - warmFilter.b))));\ntoneCurve = vec4(mix(rgb, processed, temperature), toneCurve.a);\n\n // hue\n toneCurve = toneCurve * colorMatrix;\n toneCurve = (intensity * toneCurve) + ((1.0 - intensity) * textureColor);\nif(adztOn == 1.0){\ngl_FragColor = textureColor * (1.0 - weight) + toneCurve * weight;\n}else if(adztOn == 2.0){\ngl_FragColor = textureColor * weight + toneCurve * (1.0-weight);\n}else{gl_FragColor = toneCurve;\n}}else{\n gl_FragColor = toneCurve;\n}\n}",image:null,adjustment:null,adztOn:0,toneCurveByteArray:new Uint8Array(1024),retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1);var e=h.filterBackend.getUnCachedToneCurveTexture(256,1);if(a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,e),this.adjustment.redCurve.length>=256&&this.adjustment.greenCurve.length>=256&&this.adjustment.blueCurve.length>=256&&this.adjustment.rgbCompositeCurve.length>=256){for(let l=0;l<256;l++)this.toneCurveByteArray[4*l+2]=255&Math.min(Math.max(l+this.adjustment.blueCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l+1]=255&Math.min(Math.max(l+this.adjustment.greenCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l]=255&Math.min(Math.max(l+this.adjustment.redCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l+3]=255;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,256,1,0,a.RGBA,a.UNSIGNED_BYTE,this.toneCurveByteArray)}this.bindAdditionalTexture(a,e,a.TEXTURE2),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE2),a.deleteTexture(d),a.deleteTexture(e)},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){if(0!==this.adjustment.brightness){var e,d=h.imageData.data,l=d.length,_=Math.round(255*this.adjutsment.brightness);for(e=0;e<l;e+=4)d[e]=d[e]+_,d[e+1]=d[e+1]+_,d[e+2]=d[e+2]+_}},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),toneCurveTexture:h.getUniformLocation(a,"toneCurveTexture"),adztOn:h.getUniformLocation(a,"adztOn"),brightness:h.getUniformLocation(a,"brightness"),exposure:h.getUniformLocation(a,"exposure"),contrast:h.getUniformLocation(a,"contrast"),temperature:h.getUniformLocation(a,"temperature"),tint:h.getUniformLocation(a,"tint"),intensity:h.getUniformLocation(a,"intensity"),shadows:h.getUniformLocation(a,"shadows"),highlights:h.getUniformLocation(a,"highlights"),levelMinimum:h.getUniformLocation(a,"levelMinimum"),levelMiddle:h.getUniformLocation(a,"levelMiddle"),levelMaximum:h.getUniformLocation(a,"levelMaximum"),minOutput:h.getUniformLocation(a,"minOutput"),maxOutput:h.getUniformLocation(a,"maxOutput"),colorMatrix:h.getUniformLocation(a,"colorMatrix")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniform1i(a.toneCurveTexture,2),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.adztOn,this.adztOn),h.uniform1f(a.brightness,this.adjustment.brightness),h.uniform1f(a.exposure,this.adjustment.exposure),h.uniform1f(a.contrast,this.adjustment.contrast),h.uniform1f(a.temperature,this.adjustment.temperature),h.uniform1f(a.tint,this.adjustment.tint),h.uniform1f(a.intensity,this.adjustment.hasOwnProperty("intensity")?this.adjustment.intensity:1),h.uniform1f(a.shadows,this.adjustment.shadows),h.uniform1f(a.highlights,this.adjustment.highlights),h.uniform3f(a.levelMinimum,this.adjustment.min[0],this.adjustment.min[1],this.adjustment.min[2]),h.uniform3f(a.levelMiddle,this.adjustment.mid[0],this.adjustment.mid[1],this.adjustment.mid[2]),h.uniform3f(a.levelMaximum,this.adjustment.max[0],this.adjustment.max[1],this.adjustment.max[2]),h.uniform3f(a.minOutput,this.adjustment.minOutput[0],this.adjustment.minOutput[1],this.adjustment.minOutput[2]),h.uniform3f(a.maxOutput,this.adjustment.maxOutput[0],this.adjustment.maxOutput[1],this.adjustment.maxOutput[2]),h.uniformMatrix4fv(a.colorMatrix,!1,this.adjustment.colorMatrix)}}),g.Image.filters.Adjustment.fromObject=g.Image.filters.BaseFilter.fromObject}()},42716:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BlurFilterAuto=(0,g.util.createClass)(G.BaseFilter,{type:"BlurFilterAuto",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform sampler2D oTexture;\nuniform vec2 uDelta;\nuniform float applyMask;varying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nif(applyMask == 0.0){ vec4 color = vec4(0.0);\n float total = 0.0;\n float offset = random(v3offset);\n for (float t = -nSamples; t <= nSamples; t++) {\n float percent = (t + offset - 0.5) / nSamples;\n float weight = 1.0 - abs(percent);\n color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\n total += weight;\n }\n gl_FragColor = color/total;}else{ highp vec4 maskColor = texture2D(uImage, vTexCoord);\n highp vec4 blurColor = texture2D(uTexture, vTexCoord);\n highp vec4 actualColor = texture2D(oTexture, vTexCoord);\n highp float weight = 1.0 - maskColor.r; gl_FragColor = blurColor * weight + actualColor * (1.0 - weight);}}",image:null,blur:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){this.aspectRatio=h.sourceWidth/h.sourceHeight;var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.bindAdditionalTexture(a,h.originalTexture,a.TEXTURE2),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE2)},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),oTexture:h.getUniformLocation(a,"oTexture"),applyMask:h.getUniformLocation(a,"applyMask"),delta:h.getUniformLocation(a,"uDelta")}},applyTo:function(h){h.webgl?(this.aspectRatio=h.sourceWidth/h.sourceHeight,h.passes++,this._setupFrameBuffer(h),this.applyMask=!1,this.horizontal=!0,this.applyToWebGL(h),this._swapTextures(h),h.passes++,this._setupFrameBuffer(h),this.horizontal=!1,this.applyToWebGL(h),this._swapTextures(h),this._setupFrameBuffer(h),this.applyMask=!0,this.applyToWebGL(h),this._swapTextures(h)):this.applyTo2d(h)},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniform1i(a.oTexture,2),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.applyMask,this.applyMask?1:0);var e=this.chooseRightDelta();h.uniform2fv(a.delta,e)},chooseRightDelta:function(){var d,h=1,a=[0,0];return this.horizontal?this.aspectRatio>1&&(h=1/this.aspectRatio):this.aspectRatio<1&&(h=this.aspectRatio),d=h*this.blur*.12,this.horizontal?a[0]=d:a[1]=d,a}}),g.Image.filters.BlurFilter.fromObject=g.Image.filters.BaseFilter.fromObject}()},23585:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BlurFilter=(0,g.util.createClass)(G.BaseFilter,{type:"BlurFilter",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform sampler2D oTexture;\nuniform vec2 uDelta;\nuniform float applyMask;varying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nif(applyMask == 0.0){ vec4 color = vec4(0.0);\n float total = 0.0;\n float offset = random(v3offset);\n for (float t = -nSamples; t <= nSamples; t++) {\n float percent = (t + offset - 0.5) / nSamples;\n float weight = 1.0 - abs(percent);\n color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\n total += weight;\n }\n gl_FragColor = color/total;}else{ highp vec4 maskColor = texture2D(uImage, vTexCoord);\n highp vec4 blurColor = texture2D(uTexture, vTexCoord);\n highp vec4 actualColor = texture2D(oTexture, vTexCoord);\n gl_FragColor = blurColor * maskColor.r + actualColor * (1.0 - maskColor.r);}}",image:null,blur:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){this.aspectRatio=h.sourceWidth/h.sourceHeight;var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.bindAdditionalTexture(a,h.originalTexture,a.TEXTURE2),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE2)},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),oTexture:h.getUniformLocation(a,"oTexture"),applyMask:h.getUniformLocation(a,"applyMask"),delta:h.getUniformLocation(a,"uDelta")}},applyTo:function(h){h.webgl?(this.aspectRatio=h.sourceWidth/h.sourceHeight,h.passes++,this._setupFrameBuffer(h),this.applyMask=!1,this.horizontal=!0,this.applyToWebGL(h),this._swapTextures(h),h.passes++,this._setupFrameBuffer(h),this.horizontal=!1,this.applyToWebGL(h),this._swapTextures(h),this._setupFrameBuffer(h),this.applyMask=!0,this.applyToWebGL(h),this._swapTextures(h)):this.applyTo2d(h)},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniform1i(a.oTexture,2),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.applyMask,this.applyMask?1:0);var e=this.chooseRightDelta();h.uniform2fv(a.delta,e)},chooseRightDelta:function(){var d,h=1,a=[0,0];return this.horizontal?this.aspectRatio>1&&(h=1/this.aspectRatio):this.aspectRatio<1&&(h=this.aspectRatio),d=h*this.blur*.12,this.horizontal?a[0]=d:a[1]=d,a}}),g.Image.filters.BlurFilter.fromObject=g.Image.filters.BaseFilter.fromObject}()},99486:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.BrushAdjustment=(0,g.util.createClass)(G.BaseFilter,{type:"BrushAdjustment",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
1\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform sampler2D toneCurveTexture;\nconst mediump mat3 RGBtoYIQ = mat3(0.299, 0.587, 0.114, 0.596, -0.274, -0.322, 0.212, -0.523, 0.311);\nconst mediump mat3 YIQtoRGB = mat3(1.0, 0.956, 0.621, 1.0, -0.272, -0.647, 1.0, -1.105, 1.702);\nconst lowp vec3 warmFilter = vec3(0.93, 0.54, 0.0);\nuniform highp float exposure;\nuniform lowp float brightness;\nuniform lowp float contrast;\nuniform lowp float temperature;\nuniform lowp float tint;\nuniform lowp float intensity;\nuniform mediump vec3 levelMinimum;\nuniform mediump vec3 levelMiddle;\nuniform mediump vec3 levelMaximum;\nuniform mediump vec3 minOutput;\nuniform mediump vec3 maxOutput;\nuniform mediump mat4 colorMatrix;\nvoid main() {\nhighp vec4 textureColor = texture2D(uTexture, vTexCoord);\nhighp vec4 maskColor = texture2D(uImage, vTexCoord2);\n highp vec4 toneCurve = textureColor;\n\n // tone curve\n lowp float redCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.r, 0.0)).r;\n lowp float greenCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.g, 0.0)).g;\n lowp float blueCurveValue = texture2D(toneCurveTexture, vec2(toneCurve.b, 0.0)).b;\n toneCurve = vec4(redCurveValue, greenCurveValue, blueCurveValue, toneCurve.a);\n\n // brightness\n if(toneCurve.a != 0.0)\n toneCurve = vec4((toneCurve.rgb + vec3(brightness)), toneCurve.w);\n\n // exposure\n toneCurve = vec4(toneCurve.rgb * pow(2.0, exposure), toneCurve.w);\n\n // contrast\n if(toneCurve.a != 0.0)\n toneCurve = vec4(((toneCurve.rgb - vec3(0.5)) * contrast + vec3(0.5)), toneCurve.w);\n\n // gamma\n toneCurve = vec4( mix(minOutput, maxOutput, pow(min(max(toneCurve.rgb -levelMinimum, vec3(0.0)) / (levelMaximum - levelMinimum ), vec3(1.0)), 1.0 /levelMiddle)), toneCurve.a);\n\n // warmth\nmediump vec3 yiq = RGBtoYIQ * toneCurve.rgb; //adjusting tint\nyiq.b = clamp(yiq.b + tint*0.5226*0.1, -0.5226, 0.5226);\nlowp vec3 rgb = YIQtoRGB * yiq;\nlowp vec3 processed = vec3(\n(rgb.r < 0.5 ? (2.0 * rgb.r * warmFilter.r) : (1.0 - 2.0 * (1.0 - rgb.r) * (1.0 - warmFilter.r))), //adjusting temperature\n(rgb.g < 0.5 ? (2.0 * rgb.g * warmFilter.g) : (1.0 - 2.0 * (1.0 - rgb.g) * (1.0 - warmFilter.g))),\n(rgb.b < 0.5 ? (2.0 * rgb.b * warmFilter.b) : (1.0 - 2.0 * (1.0 - rgb.b) * (1.0 - warmFilter.b))));\ntoneCurve = vec4(mix(rgb, processed, temperature), toneCurve.a);\n\n // hue\n toneCurve = toneCurve * colorMatrix;\nfloat weight = maskColor.r;\ngl_FragColor = textureColor * (1.0 - weight) + toneCurve * weight;\n}",image:null,adjusment:null,toneCurveByteArray:new Uint8Array(1024),retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1);var e=h.filterBackend.getUnCachedToneCurveTexture(256,1);if(a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,e),this.adjustment.redCurve.length>=256&&this.adjustment.greenCurve.length>=256&&this.adjustment.blueCurve.length>=256&&this.adjustment.rgbCompositeCurve.length>=256){for(let l=0;l<256;l++)this.toneCurveByteArray[4*l+2]=255&Math.min(Math.max(l+this.adjustment.blueCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l+1]=255&Math.min(Math.max(l+this.adjustment.greenCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l]=255&Math.min(Math.max(l+this.adjustment.redCurve[l]+this.adjustment.rgbCompositeCurve[l],0),255),this.toneCurveByteArray[4*l+3]=255;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,256,1,0,a.RGBA,a.UNSIGNED_BYTE,this.toneCurveByteArray)}this.bindAdditionalTexture(a,e,a.TEXTURE2),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE2)},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){if(0!==this.adjusment.brightness){var e,d=h.imageData.data,l=d.length,_=Math.round(255*this.adjusment.brightness);for(e=0;e<l;e+=4)d[e]=d[e]+_,d[e+1]=d[e+1]+_,d[e+2]=d[e+2]+_}},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),toneCurveTexture:h.getUniformLocation(a,"toneCurveTexture"),brightness:h.getUniformLocation(a,"brightness"),exposure:h.getUniformLocation(a,"exposure"),contrast:h.getUniformLocation(a,"contrast"),temperature:h.getUniformLocation(a,"temperature"),tint:h.getUniformLocation(a,"tint"),intensity:h.getUniformLocation(a,"intensity"),levelMinimum:h.getUniformLocation(a,"levelMinimum"),levelMiddle:h.getUniformLocation(a,"levelMiddle"),levelMaximum:h.getUniformLocation(a,"levelMaximum"),minOutput:h.getUniformLocation(a,"minOutput"),maxOutput:h.getUniformLocation(a,"maxOutput"),colorMatrix:h.getUniformLocation(a,"colorMatrix")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniform1i(a.toneCurveTexture,2),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.brightness,this.adjustment.brightness),h.uniform1f(a.exposure,this.adjustment.exposure),h.uniform1f(a.contrast,this.adjustment.contrast),h.uniform1f(a.temperature,this.adjustment.temperature),h.uniform1f(a.tint,this.adjustment.tint),h.uniform1f(a.intensity,1),h.uniform3f(a.levelMinimum,this.adjustment.min[0],this.adjustment.min[1],this.adjustment.min[2]),h.uniform3f(a.levelMiddle,this.adjustment.mid[0],this.adjustment.mid[
11],this.adjustment.mid[2]),h.uniform3f(a.levelMaximum,this.adjustment.max[0],this.adjustment.max[1],this.adjustment.max[2]),h.uniform3f(a.minOutput,this.adjustment.minOutput[0],this.adjustment.minOutput[1],this.adjustment.minOutput[2]),h.uniform3f(a.maxOutput,this.adjustment.maxOutput[0],this.adjustment.maxOutput[1],this.adjustment.maxOutput[2]),h.uniformMatrix4fv(a.colorMatrix,!1,this.adjustment.colorMatrix)}}),g.Image.filters.BrushAdjustment.fromObject=g.Image.filters.BaseFilter.fromObject}()},93988:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.SilhouetteFilter=(0,g.util.createClass)(G.BaseFilter,{type:"SilhouetteFilter",cleanCacheEverytime:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 overlayColor;\nuniform float opacity;\nuniform float transparentBG;\nuniform lowp float uExposure;\nvoid main() {\n highp vec4 textureColor = texture2D(uTexture, vTexCoord);\n highp vec4 maskColor = texture2D(uImage, vTexCoord2);\n float weight = maskColor.r;\n if(weight > 0.0){ weight = weight * opacity; if(transparentBG==0.0){\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * weight + (vec4(textureColor.rgb * pow(2.0, uExposure), textureColor.w))*(1.0 - weight);\n }else{\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * weight; } }else{ if(transparentBG==0.0){\n gl_FragColor = vec4(textureColor.rgb * pow(2.0, uExposure), textureColor.w); }
1else{\n textureColor.a = weight;\n gl_FragColor = textureColor; } }}",image:null,adjusment:null,overlayColor:"1.0, 0.0, 0.0, 1.0",opacity:1,transparentBG:!0,exposure:0,retrieveShader:function(h){var a=this.type+"_"+this.mode,d=this.fragmentSource[this.mode];return h.programCache.hasOwnProperty(a)||(h.programCache[a]=this.createProgram(h.context,d)),h.programCache[a]},applyToWebGL:function(h){if(this.image){var a=h.context,d=this.createTexture(h.filterBackend,this.image);this.bindAdditionalTexture(a,d,a.TEXTURE1),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1)}},createTexture:function(h,a){return 1===this.cleanCacheEverytime?h.getUnCachedTexture(a):h.getCachedTexture(a.cacheKey,a)},applyTo2d:function(h){},calculateMatrix:function(){return[1,0,0,0,1,0,0,0,1]},getUniformLocations:function(h,a){return{uTransformMatrix:h.getUniformLocation(a,"uTransformMatrix"),uImage:h.getUniformLocation(a,"uImage"),overlayColor:h.getUniformLocation(a,"overlayColor"),opacity:h.getUniformLocation(a,"opacity"),transparentBG:h.getUniformLocation(a,"transparentBG"),uExposure:h.getUniformLocation(a,"uExposure")}},sendUniformData:function(h,a){var d=this.calculateMatrix();h.uniform1i(a.uImage,1),h.uniformMatrix3fv(a.uTransformMatrix,!1,d),h.uniform1f(a.overlayColor,this.overlayColor),h.uniform1f(a.opacity,this.opacity),h.uniform1f(a.transparentBG,this.transparentBG),h.uniform1f(a.uExposure,this.exposure)}}),g.Image.filters.SilhouetteFilter.fromObject=g.Image.filters.BaseFilter.fromObject}()},37535:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.TriangleMaskWarp=(0,g.util.createClass)(G.BaseFilter,{type:"TriangleMaskWarp",maskImage:null,triLUTImage:null,triLUTArray:null,triCount:0,isAnimating:1,_triLUTTexture:null,imageWidth:1,imageHeight:1,fragmentSource:"precision highp float;\nvarying highp vec2 vTexCoord;\nuniform sampler2D uTexture; // original image (unit 2)\nuniform sampler2D inputImageTexture2; // mask: per-pixel tri id (unit 1)\nuniform sampler2D toneCurveTexture; // LUT: packed affines (unit 3)\nuniform highp float count; // number of texels along LUT width = triCount*2\nuniform highp float height; // image height (pixels)\nuniform highp float width; // image width (pixels)\nuniform highp float isAnimating;\nint calculate(highp float colorIndex) {\n int val = int(colorIndex);\n highp float diff = colorIndex - float(val);\n if (diff >= 0.5) { val = val + 1; }\n return val;\n}\nvoid main() {\n highp vec4 baseColor = texture2D(uTexture, vTexCoord);
1\n highp vec4 idColor = texture2D(inputImageTexture2, vTexCoord);\n if (isAnimating != 1.0) {\n gl_FragColor = baseColor;\n return;\n }\n if (count <= 1.0) {\n gl_FragColor = baseColor;\n return;\n }\n // If R==0.0, treat as 'no triangle' \u2192 passthrough.\n if (idColor.r == 0.0) {\n gl_FragColor = baseColor;\n return;\n }\n // Decode triangle index from RGB (your existing scheme)\n highp float rIdx = (255.0 * idColor.r) - 1.0;\n int val = calculate(rIdx);\n if (val == 254) {\n highp float gIdx = 255.0 * idColor.g;\n val = calculate(rIdx + gIdx);\n if (val == 254 + 255) {\n highp float bIdx = 255.0 * idColor.b;\n val = calculate(rIdx + gIdx + bIdx);\n }\n }\n // Each triangle uses TWO texels in the LUT (RGB each).\n // count = triCount * 2 (total texels along X)\n highp float texelW = 1.0 / count;\n highp float slot = float(val) * 2.0; // first texel index for this triangle\n highp float x0 = (slot + 0.5) * texelW; // center of texel 0\n highp float x1 = (slot + 1.5) * texelW; // center of texel 1\n // Our LUT is 1 pixel tall \u2192 sample at y=0.5\n highp vec4 t0 = texture2D(toneCurveTexture, vec2(x0, 0.5));\n highp vec4 t1 = texture2D(toneCurveTexture, vec2(x1, 0.5));\n highp float m00 = t0.r, m01 = t0.g, tx = t0.b;\n highp float m10 = t1.r, m11 = t1.g, ty = t1.b;\n // Apply affine in pixel space (your math):\n highp vec2 uv = vTexCoord;\n highp vec2 p = vec2(uv.x * width, uv.y * height);\n highp vec2 q;\n q.x = (m00 * p.x + m01 * p.y + tx) / width;\n q.y = (m10 * p.x + m11 * p.y + ty) / height;\n // Bilinear sample from original at q (pixel-correct)\n highp vec2 qp = vec2(q.x * width - 0.5, q.y * height - 0.5);\n highp vec2 ixy = floor(qp);
1\n highp vec2 fxy = fract(qp);\n highp vec2 p00 = (ixy + vec2(0.5, 0.5)) / vec2(width, height);\n highp vec2 p10 = (ixy + vec2(1.5, 0.5)) / vec2(width, height);\n highp vec2 p01 = (ixy + vec2(0.5, 1.5)) / vec2(width, height);\n highp vec2 p11 = (ixy + vec2(1.5, 1.5)) / vec2(width, height);\n highp vec4 row1 = mix(texture2D(uTexture, p00), texture2D(uTexture, p10), fxy.x);\n highp vec4 row2 = mix(texture2D(uTexture, p01), texture2D(uTexture, p11), fxy.x);\n gl_FragColor = mix(row1, row2, fxy.y);\n}\n",initialize:function(h){this.maskImage=(h=h||{}).maskImage||null,this.triLUTImage=h.triLUTImage||null,this.triLUTArray=h.triLUTArray||null,this.triCount=h.triCount||0,this.isAnimating=null!=h.isAnimating?h.isAnimating:1,this.imageWidth=h.imageWidth||1,this.imageHeight=h.imageHeight||1},getUniformLocations:function(h,a){return{inputImageTexture2:h.getUniformLocation(a,"inputImageTexture2"),toneCurveTexture:h.getUniformLocation(a,"toneCurveTexture"),count:h.getUniformLocation(a,"count"),width:h.getUniformLocation(a,"width"),height:h.getUniformLocation(a,"height"),isAnimating:h.getUniformLocation(a,"isAnimating")}},applyToWebGL:function(h){var a=h.context,d=h.filterBackend;if(this.maskImage){var e=this.createTexture(d,this.maskImage);this.bindAdditionalTexture(a,e,a.TEXTURE1),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}if(this.triLUTArray&&this.triCount>0){this._triLUTTexture||(this._triLUTTexture=a.createTexture());for(var l=2*this.triCount,C=new Float32Array(8*this.triCount),S=0;S<this.triCount;S++){var x=6*S,E=8*S,R=this.triLUTArray[x+1],I=this.triLUTArray[x+2],D=this.triLUTArray[x+3],p=this.triLUTArray[x+4],u=this.triLUTArray[x+5];C[E+0]=this.triLUTArray[x+0],C[E+1]=R,C[E+2]=I,C[E+3]=0,C[E+4]=D,C[E+5]=p,C[E+6]=u,C[E+7]=0}a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,this._triLUTTexture),a.pixelStorei(a.UNPACK_ALIGNMENT,1);var m=typeof WebGL2RenderingContext<"u"&&a instanceof WebGL2RenderingContext;a.texImage2D(a.TEXTURE_2D,0,m?a.RGBA32F:a.RGBA,l,1,0,a.RGBA,a.FLOAT,C),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.bindAdditionalTexture(a,this._triLUTTexture,a.TEXTURE3)}else if(this.triLUTImage){var k=this.createTexture(d,this.triLUTImage);this.bindAdditionalTexture(a,k,a.TEXTURE3)}this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE3),typeof e<"u"&&e&&a.deleteTexture(e),typeof k<"u"&&k&&a.deleteTexture(k)},createTexture:function(h,a){return h.getUnCachedTexture(a)},sendUniformData:function(h,a){h.uniform1i(a.inputImageTexture2,1),h.uniform1i(a.toneCurveTexture,3),h.uniform1f(a.count,Math.max(1,2*this.triCount)),h.uniform1f(a.width,this.imageWidth||1),h.uniform1f(a.height,this.imageHeight||1),h.uniform1f(a.isAnimating,this.isAnimating?1:0)}}),g.Image.filters.TriangleMaskWarp.fromObject=g.Image.filters.BaseFilter.fromObject}()},31284:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.TriangleMaskWarpByte=(0,g.util.createClass)(G.BaseFilter,{type:"TriangleMaskWarpByte",maskImage:null,triLUTImage:null,triLUTArray:null,triCount:0,isAnimating:1,_triLUTTexture:null,imageWidth:1,imageHeight:1,_range:4,fragmentSource:"precision highp float;\nprecision mediump int;\nvarying highp vec2 vTexCoord;\nuniform sampler2D uTexture;\nuniform sampler2D inputImageTexture2;\nuniform sampler2D toneCurveTexture;\nuniform highp float count;\nuniform highp float height;\nuniform highp float width;\nuniform highp float isAnimating;\nuniform highp float uRange;\nint calculate(highp float colorIndex) {\n int val = int(colorIndex);\n highp float diff = colorIndex - float(val);\n if (diff >= 0.5) { val = val + 1; }\n return val;\n}
1\nhighp float decodePair(highp vec2 rg, highp float range){\n // rg in [0,1]; original encoding: scaled = t*255; hi=floor(scaled); lo=round(frac(scaled)*255)\n highp float t = rg.x + (rg.y / 255.0);\n return t * (2.0 * range) - range;\n}\nvoid main(){\n highp vec4 baseColor = texture2D(uTexture, vTexCoord);\n if (isAnimating != 1.0) { gl_FragColor = baseColor; return; }\n if (count <= 1.0) { gl_FragColor = baseColor; return; }\n highp vec4 idColor = texture2D(inputImageTexture2, vTexCoord);\n if (idColor.r < (0.5/255.0)) { gl_FragColor = baseColor; return; }\n highp float rIdx = (255.0 * idColor.r) - 1.0;\n int val = calculate(rIdx);\n if (val == 254) {\n highp float gIdx = 255.0 * idColor.g;\n val = calculate(rIdx + gIdx);\n if (val == 254 + 255) {\n highp float bIdx = 255.0 * idColor.b;\n val = calculate(rIdx + gIdx + bIdx);\n }\n }\n highp float maxTri = count / 3.0;\n if (float(val) < 0.0 || float(val) >= maxTri) { gl_FragColor = baseColor; return; }\n highp float texelW = 1.0 / count;\n highp float slot = float(val) * 3.0;\n highp float x0 = (slot + 0.5) * texelW;\n highp float x1 = (slot + 1.5) * texelW;\n highp float x2 = (slot + 2.5) * texelW;\n highp vec4 t0 = texture2D(toneCurveTexture, vec2(x0, 0.5));\n highp vec4 t1 = texture2D(toneCurveTexture, vec2(x1, 0.5));\n highp vec4 t2 = texture2D(toneCurveTexture, vec2(x2, 0.5));\n highp float m00 = decodePair(t0.rg, uRange);\n highp float m01 = decodePair(t0.ba, uRange);\n highp float txN = decodePair(t1.rg, uRange);\n highp float m10 = decodePair(t1.ba, uRange);\n highp float m11 = decodePair(t2.rg, uRange);\n highp float tyN = decodePair(t2.ba, uRange);\n highp vec2 uv = vTexCoord;\n highp vec2 p = vec2(uv.x * width, uv.y * height);\n highp vec2 q;\n q.x = (m00 * p.x + m01 * p.y) / width + txN;\n q.y = (m10 * p.x + m11 * p.y) / height + tyN;\n q = clamp(q, vec2(0.0), vec2(1.0));\n highp vec2 qp = vec2(q.x * width - 0.5, q.y * height - 0.5);\n highp vec2 ixy = floor(qp);
1\n highp vec2 fxy = fract(qp);\n highp vec2 p00 = (ixy + vec2(0.5, 0.5)) / vec2(width, height);\n highp vec2 p10 = (ixy + vec2(1.5, 0.5)) / vec2(width, height);\n highp vec2 p01 = (ixy + vec2(0.5, 1.5)) / vec2(width, height);\n highp vec2 p11 = (ixy + vec2(1.5, 1.5)) / vec2(width, height);\n highp vec4 row1 = mix(texture2D(uTexture, p00), texture2D(uTexture, p10), fxy.x);\n highp vec4 row2 = mix(texture2D(uTexture, p01), texture2D(uTexture, p11), fxy.x);\n gl_FragColor = mix(row1, row2, fxy.y);\n}\n",initialize:function(h){this.maskImage=(h=h||{}).maskImage||null,this.triLUTArray=h.triLUTArray||null,this.triLUTImage=h.triLUTImage||null,this.triCount=h.triCount||0,this.isAnimating=null!=h.isAnimating?h.isAnimating:1,this.imageWidth=h.imageWidth||1,this.imageHeight=h.imageHeight||1,this._range=null!=h.range?h.range:4},getUniformLocations:function(h,a){return{inputImageTexture2:h.getUniformLocation(a,"inputImageTexture2"),toneCurveTexture:h.getUniformLocation(a,"toneCurveTexture"),count:h.getUniformLocation(a,"count"),width:h.getUniformLocation(a,"width"),height:h.getUniformLocation(a,"height"),isAnimating:h.getUniformLocation(a,"isAnimating"),uRange:h.getUniformLocation(a,"uRange")}},_encodeToPair:function(h,a){var d=(h+a)/(2*a);d<0?d=0:d>1&&(d=1);var e=255*d,l=Math.floor(e);return[l,Math.round(255*(e-l))]},applyToWebGL:function(h){var a=h.context,d=h.filterBackend;if(this.maskImage){var e=this.createTexture(d,this.maskImage);this.bindAdditionalTexture(a,e,a.TEXTURE1),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}if(this.triLUTArray&&this.triCount>0){this._triLUTTexture||(this._triLUTTexture=a.createTexture());for(var l=3*this.triCount,C=new Uint8Array(12*this.triCount),S=this._range,x=this.imageWidth||1,E=this.imageHeight||1,M=0;M<this.triCount;M++){var R=6*M,I=12*M,p=this.triLUTArray[R+1],u=this.triLUTArray[R+2]/x,m=this.triLUTArray[R+3],b=this.triLUTArray[R+4],k=this.triLUTArray[R+5]/E,A=this._encodeToPair(this.triLUTArray[R+0],S),B=this._encodeToPair(p,S),y=this._encodeToPair(u,S),O=this._encodeToPair(m,S),w=this._encodeToPair(b,S),j=this._encodeToPair(k,S);C[I+0]=A[0],C[I+1]=A[1],C[I+2]=B[0],C[I+3]=B[1],C[I+4]=y[0],C[I+5]=y[1],C[I+6]=O[0],C[I+7]=O[1],C[I+8]=w[0],C[I+9]=w[1],C[I+10]=j[0],C[I+11]=j[1]}a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,this._triLUTTexture),a.pixelStorei(a.UNPACK_ALIGNMENT,1),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,l,1,0,a.RGBA,a.UNSIGNED_BYTE,C),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.bindAdditionalTexture(a,this._triLUTTexture,a.TEXTURE3)}else if(this.triLUTImage){var L=this.createTexture(d,this.triLUTImage);this.bindAdditionalTexture(a,L,a.TEXTURE3),a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,L),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE3)},createTexture:function(h,a){return h.getUnCachedTexture(a)},sendUniformData:function(h,a){h.uniform1i(a.inputImageTexture2,1),h.uniform1i(a.toneCurveTexture,3),h.uniform1f(a.count,Math.max(1,3*this.triCount)),h.uniform1f(a.width,this.imageWidth||1),h.uniform1f(a.height,this.imageHeight||1),h.uniform1f(a.isAnimating,this.isAnimating?1:0),h.uniform1f(a.uRange,this._range||4)}}),g.Image.filters.TriangleMaskWarpByte.fromObject=g.Image.filters.BaseFilter.fromObject}()},786:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.TriangleMaskWarpHalf=(0,g.util.createClass)(G.BaseFilter,{type:"TriangleMaskWarpHalf",maskImage:null,triLUTArray:null,triCount:0,isAnimating:1,_triLUTTexture:null,imageWidth:1,imageHeight:1,fragmentSource:"precision highp float;\nvarying highp vec2 vTexCoord;\nuniform sampler2D uTexture; // original image (unit 2)\nuniform sampler2D inputImageTexture2; // mask: per-pixel tri id (unit 1)\nuniform sampler2D toneCurveTexture; // LUT: packed affines (unit 3)\nuniform highp float count; // number of texels along LUT width = triCount*2\nuniform highp float height; // image height (pixels)\nuniform highp float width; // image width (pixels)\nuniform highp float isAnimating;\nint calculate(highp float colorIndex) {\n int val = int(colorIndex);
1\n highp float diff = colorIndex - float(val);\n if (diff >= 0.5) { val = val + 1; }\n return val;\n}\nvoid main() {\n highp vec4 baseColor = texture2D(uTexture, vTexCoord);\n highp vec4 idColor = texture2D(inputImageTexture2, vTexCoord);\n if (isAnimating != 1.0) {\n gl_FragColor = baseColor;\n return;\n }\n if (count <= 1.0) {\n gl_FragColor = baseColor;\n return;\n }\n if (idColor.r == 0.0) {\n gl_FragColor = baseColor;\n return;\n }\n highp float rIdx = (255.0 * idColor.r) - 1.0;\n int val = calculate(rIdx);\n if (val == 254) {\n highp float gIdx = 255.0 * idColor.g;\n val = calculate(rIdx + gIdx);\n if (val == 254 + 255) {\n highp float bIdx = 255.0 * idColor.b;\n val = calculate(rIdx + gIdx + bIdx);\n }\n }\n highp float texelW = 1.0 / count;\n highp float slot = float(val) * 2.0;\n highp float x0 = (slot + 0.5) * texelW;\n highp float x1 = (slot + 1.5) * texelW;\n highp vec4 t0 = texture2D(toneCurveTexture, vec2(x0, 0.5));\n highp vec4 t1 = texture2D(toneCurveTexture, vec2(x1, 0.5));\n highp float m00 = t0.r, m01 = t0.g, tx = t0.b;\n highp float m10 = t1.r, m11 = t1.g, ty = t1.b;\n highp vec2 uv = vTexCoord;\n highp vec2 p = vec2(uv.x * width, uv.y * height);\n highp vec2 q;\n q.x = (m00 * p.x + m01 * p.y + tx) / width;\n q.y = (m10 * p.x + m11 * p.y + ty) / height;\n highp vec2 qp = vec2(q.x * width - 0.5, q.y * height - 0.5);\n highp vec2 ixy = floor(qp);
1\n highp vec2 fxy = fract(qp);\n highp vec2 p00 = (ixy + vec2(0.5, 0.5)) / vec2(width, height);\n highp vec2 p10 = (ixy + vec2(1.5, 0.5)) / vec2(width, height);\n highp vec2 p01 = (ixy + vec2(0.5, 1.5)) / vec2(width, height);\n highp vec2 p11 = (ixy + vec2(1.5, 1.5)) / vec2(width, height);\n highp vec4 row1 = mix(texture2D(uTexture, p00), texture2D(uTexture, p10), fxy.x);\n highp vec4 row2 = mix(texture2D(uTexture, p01), texture2D(uTexture, p11), fxy.x);\n gl_FragColor = mix(row1, row2, fxy.y);\n}\n",initialize:function(h){this.maskImage=(h=h||{}).maskImage||null,this.triLUTArray=h.triLUTArray||null,this.triCount=h.triCount||0,this.isAnimating=null!=h.isAnimating?h.isAnimating:1,this.imageWidth=h.imageWidth||1,this.imageHeight=h.imageHeight||1},getUniformLocations:function(h,a){return{inputImageTexture2:h.getUniformLocation(a,"inputImageTexture2"),toneCurveTexture:h.getUniformLocation(a,"toneCurveTexture"),count:h.getUniformLocation(a,"count"),width:h.getUniformLocation(a,"width"),height:h.getUniformLocation(a,"height"),isAnimating:h.getUniformLocation(a,"isAnimating")}},_f32_to_f16:function(h){var a=new Float32Array(1),d=new Uint32Array(a.buffer);a[0]=h;var e=d[0],l=e>>>31&1,_=e>>>23&255,C=8388607&e;return 65535&(255===_?l<<15|31744|(C?512:0):_>112?(_-=112)>=31?l<<15|31744:l<<15|_<<10|C>>>13:_>=103?l<<15|(C|=8388608)>>>126-_+13:l<<15)},applyToWebGL:function(h){var a=h.context;if(this.maskImage){var e=this.createTexture(h.filterBackend,this.maskImage);this.bindAdditionalTexture(a,e,a.TEXTURE1),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE)}if(this.triLUTArray&&this.triCount>0){var l=a.getExtension("OES_texture_half_float");l||console.warn("OES_texture_half_float not supported."),this._triLUTTexture||(this._triLUTTexture=a.createTexture());for(var _=2*this.triCount,S=new Uint16Array(8*this.triCount),x=0;x<this.triCount;x++){var E=6*x,M=8*x,I=this.triLUTArray[E+1],D=this.triLUTArray[E+2],p=this.triLUTArray[E+3],u=this.triLUTArray[E+4],m=this.triLUTArray[E+5];S[M+0]=this._f32_to_f16(this.triLUTArray[E+0]),S[M+1]=this._f32_to_f16(I),S[M+2]=this._f32_to_f16(D),S[M+3]=this._f32_to_f16(0),S[M+4]=this._f32_to_f16(p),S[M+5]=this._f32_to_f16(u),S[M+6]=this._f32_to_f16(m),S[M+7]=this._f32_to_f16(0)}a.activeTexture(a.TEXTURE3),a.bindTexture(a.TEXTURE_2D,this._triLUTTexture),a.pixelStorei(a.UNPACK_ALIGNMENT,1),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,_,1,0,a.RGBA,l?l.HALF_FLOAT_OES:a.UNSIGNED_BYTE,S),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),this.bindAdditionalTexture(a,this._triLUTTexture,a.TEXTURE3)}this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE1),this.unbindAdditionalTexture(a,a.TEXTURE3)},createTexture:function(h,a){return h.getUnCachedTexture(a)},sendUniformData:function(h,a){h.uniform1i(a.inputImageTexture2,1),h.uniform1i(a.toneCurveTexture,3),h.uniform1f(a.count,Math.max(1,2*this.triCount)),h.uniform1f(a.width,this.imageWidth||1),h.uniform1f(a.height,this.imageHeight||1),h.uniform1f(a.isAnimating,this.isAnimating?1:0)}}),g.Image.filters.TriangleMaskWarpHalf.fromObject=g.Image.filters.BaseFilter.fromObject}()},74972:(_e,ie)=>{var g=window.fabric;!function(){"use strict";var G=g.Image.filters;G.TriangleWarpFilter=(0,g.util.createClass)(G.BaseFilter,{type:"TriangleWarpFilter",triangles:[],fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D oTexture;\nuniform vec2 uSrcA;\nuniform vec2 uSrcB;\nuniform vec2 uSrcC;\nuniform vec2 uDstA;\nuniform vec2 uDstB;\nuniform vec2 uDstC;\nvarying vec2 vTexCoord;\nfloat edge(vec2 a, vec2 b, vec2 p){\n return (p.x - a.x) * (b.y - a.y) - (p.y - a.y) * (b.x - a.x);\n}\nbool pointInTriangle(vec2 p, vec2 a, vec2 b, vec2 c){\n float w1 = edge(a, b, p);\n float w2 = edge(b, c, p);\n float w3 = edge(c, a, p);\n bool hasNeg = (w1 < 0.0) || (w2 < 0.0) || (w3 < 0.0);\n bool hasPos = (w1 > 0.0) || (w2 > 0.0) || (w3 > 0.0);\n return !(hasNeg && hasPos);\n}\nvec3 barycentric(vec2 p, vec2 a, vec2 b, vec2 c){\n vec2 v0 = b - a;\n vec2 v1 = c - a;\n vec2 v2 = p - a;\n float d00 = dot(v0, v0);\n float d01 = dot(v0, v1);\n float d11 = dot(v1, v1);\n float d20 = dot(v2, v0);\n float d21 = dot(v2, v1);\n float denom = d00 * d11 - d01 * d01;\n // protect from degenerate\n if (abs(denom) < 1e-8) { return vec3(1.0, 0.0, 0.0); }\n float v = (d11 * d20 - d01 * d21) / denom;\n float w = (d00 * d21 - d01 * d20) / denom;\n float u = 1.0 - v - w;\n return vec3(u, v, w);\n}\nvoid main(){\n // Outside triangle: copy original image pixel so background stays opaque\n if (!pointInTriangle(vTexCoord, uDstA, uDstB, uDstC)) {\n gl_FragColor = texture2D(oTexture, vTexCoord);\n return;\n }\n vec3 bc = barycentric(vTexCoord, uDstA, uDstB, uDstC);\n vec2 src = bc.x * uSrcA + bc.y * uSrcB + bc.z * uSrcC;\n vec4 col = texture2D(oTexture, src);\n gl_FragColor = col;\n}\n",initialize:function(h){this.triangles=(h=h||{}).triangles||[]},getUniformLocations:function(h,a){return{uSrcA:h.getUniformLocation(a,"uSrcA"),uSrcB:h.getUniformLocation(a,"uSrcB"),uSrcC:h.getUniformLocation(a,"uSrcC"),uDstA:h.getUniformLocation(a,"uDstA"),uDstB:h.getUniformLocation(a,"uDstB"),uDstC:h.getUniformLocation(a,"uDstC"),oTexture:h.getUniformLocation(a,"oTexture")}},applyToWebGL:function(h){var a=h.context;this.bindAdditionalTexture(a,h.originalTexture,a.TEXTURE2),this.callSuper("applyToWebGL",h),this.unbindAdditionalTexture(a,a.TEXTURE2)},applyTo:function(h){if(h.webgl&&this.triangles&&0!==this.triangles.length)for(var a=0;a<this.triangles.length;a++)this._triangleIndex=a,h.passes++,this._setupFrameBuffer(h),this.applyToWebGL(h),this._swapTextures(h)},sendUniformData:function(h,a){var d=this.triangles[this._triangleIndex]||{},e=d.srcA||{x:0,y:0},l=d.srcB||{x:0,y:0},_=d.srcC||{x:0,y:0},C=d.dstA||{x:0,y:0},S=d.dstB||{x:0,y:0},x=d.dstC||{x:0,y:0};h.uniform2f(a.uSrcA,e.x,e.y),h.uniform2f(a.uSrcB,l.x,l.y),h.uniform2f(a.uSrcC,_.x,_.y),h.uniform2f(a.uDstA,C.x,C.y),h.uniform2f(a.uDstB,S.x,S.y),h.uniform2f(a.uDst
1C,x.x,x.y),h.uniform1i(a.oTexture,2)}}),g.Image.filters.TriangleWarpFilter.fromObject=g.Image.filters.BaseFilter.fromObject}()},19338:(_e,ie,g)=>{"use strict";g.d(ie,{d1:()=>h,di:()=>a});var n=g(54438);const o=["slider"];let h=(()=>{var d;class e{set style(_){this.slider?this.slider.getElement().setAttribute("style",_):this.initialStyle=_}set value(_){this.slider?this.slider.setValue(_):this.initialOptions.value=_}set min(_){this.changeAttribute("min",_)}set max(_){this.changeAttribute("max",_)}set step(_){this.changeAttribute("step",_)}set precision(_){this.changeAttribute("precision",_)}set orientation(_){this.changeAttribute("orientation",_)}set range(_){this.changeAttribute("range",_)}set selection(_){this.changeAttribute("selection",_)}set tooltip(_){this.changeAttribute("tooltip",_)}set tooltipSplit(_){this.changeAttribute("tooltip_split",_)}set tooltipPosition(_){this.changeAttribute("tooltip_position",_)}set handle(_){this.changeAttribute("handle",_)}set reversed(_){this.changeAttribute("reversed",_)}set rtl(_){this.changeAttribute("rtl",_)}set enabled(_){this.changeAttribute("enabled",_)}set naturalArrowKeys(_){this.changeAttribute("natural_arrow_keys",_)}set ticks(_){this.changeAttribute("ticks",_)}set ticksPositions(_){this.changeAttribute("ticks_positions",_)}set ticksLabels(_){this.changeAttribute("ticks_labels",_)}set ticksSnapBounds(_){this.changeAttribute("ticks_snap_bounds",_)}set ticksTooltip(_){this.changeAttribute("ticks_tooltip",_)}set scale(_){this.changeAttribute("scale",_)}set labelledBy(_){this.changeAttribute("labelledby",_)}set rangeHighlights(_){this.changeAttribute("rangeHighlights",_)}set formatter(_){this.changeAttribute("formatter",_)}set lockToTicks(_){this.changeAttribute("lock_to_ticks",_)}constructor(){this.initialOptions={},this.valueChange=new n.bkB,this.slide=new n.bkB,this.slideStart=new n.bkB,this.slideStop=new n.bkB,this.change=new n.bkB}addChangeListeners(){this.slider.on("slide",_=>{this.slide.emit(_)}),this.slider.on("slideStart",_=>{this.slideStart.emit(_)}),this.slider.on("slideStop",_=>{this.slideStop.emit(_)}),this.slider.on("change",_=>{this.change.emit(_),this.valueChange.emit(_.newValue)})}prepareSlider(){this.addChangeListeners(),this.slider.getElement().setAttribute("style",this.initialStyle)}changeAttribute(_,C){this.slider?(this.slider.setAttribute(_,C),this.slider.refresh(),this.prepareSlider()):this.initialOptions[_]=C}ngOnInit(){let _;this.initialOptions.value&&(_=this.initialOptions.value,delete this.initialOptions.value),this.slider=new Slider(this.sliderElement.nativeElement,this.initialOptions),_&&this.slider.setValue(_),this.prepareSlider()}}return(d=e).\u0275fac=function(_){return new(_||d)},d.\u0275cmp=n.VBU({type:d,selectors:[["mv-slider"]],viewQuery:function(_,C){if(1&_&&n.GBs(o,7),2&_){let S;n.mGM(S=n.lsd())&&(C.sliderElement=S.first)}},inputs:{style:"style",value:"value",min:"min",max:"max",step:"step",precision:"precision",orientation:"orientation",range:"range",selection:"selection",tooltip:"tooltip",tooltipSplit:"tooltipSplit",tooltipPosition:"tooltipPosition",handle:"handle",reversed:"reversed",rtl:"rtl",enabled:"enabled",naturalArrowKeys:"naturalArrowKeys",ticks:"ticks",ticksPositions:"ticksPositions",ticksLabels:"ticksLabels",ticksSnapBounds:"ticksSnapBounds",ticksTooltip:"ticksTooltip",scale:"scale",labelledBy:"labelledBy",rangeHighlights:"rangeHighlights",formatter:"formatter",lockToTicks:"lockToTicks"},outputs:{valueChange:"valueChange",slide:"slide",slideStart:"slideStart",slideStop:"slideStop",change:"change"},decls:2,vars:0,consts:[["slider",""]],template:function(_,C){1&_&&n.nrm(0,"input",null,0)}}),e})(),a=(()=>{var d;class e{}return(d=e).\u0275fac=function(_){return new(_||d)},d.\u0275mod=n.$C({type:d}),d.\u0275inj=n.G2t({}),e})()}
1,85188:(_e,ie,g)=>{"use strict";g.d(ie,{Zr:()=>x,mB:()=>R});var n=g(10467),o=g(54438),G=g(60177),P=g(84341);const h=new o.nKC("ngx-mask config"),a=new o.nKC("new ngx-mask config"),d=new o.nKC("initial ngx-mask config"),e={suffix:"",prefix:"",thousandSeparator:" ",decimalMarker:[".",","],clearIfNotMatch:!1,showTemplate:!1,showMaskTyped:!1,placeHolderCharacter:"_",dropSpecialCharacters:!0,hiddenInput:void 0,shownMaskExpression:"",separatorLimit:"",allowNegativeNumbers:!1,validation:!0,specialCharacters:["-","/","(",")",".",":"," ","+",",","@","[","]",'"',"'"],leadZeroDateTime:!1,apm:!1,leadZero:!1,keepCharacterPositions:!1,triggerOnMaskChange:!1,inputTransformFn:I=>I,outputTransformFn:I=>I,maskFilled:new o.bkB,patterns:{0:{pattern:new RegExp("\\d")},9:{pattern:new RegExp("\\d"),optional:!0},X:{pattern:new RegExp("\\d"),symbol:"*"},A:{pattern:new RegExp("[a-zA-Z0-9]")},S:{pattern:new RegExp("[a-zA-Z]")},U:{pattern:new RegExp("[A-Z]")},L:{pattern:new RegExp("[a-z]")},d:{pattern:new RegExp("\\d")},m:{pattern:new RegExp("\\d")},M:{pattern:new RegExp("\\d")},H:{pattern:new RegExp("\\d")},h:{pattern:new RegExp("\\d")},s:{pattern:new RegExp("\\d")}}},l=["Hh:m0:s0","Hh:m0","m0:s0"],_=["percent","Hh","s0","m0","separator","d0/M0/0000","d0/M0","d0","M0"];let C=(()=>{class I{constructor(p){this._config=p,this._shift=new Set,this.plusOnePosition=!1,this.maskExpression="",this.actualValue="",this.showKeepCharacterExp="",this.shownMaskExpression="",this.deletedSpecialCharacter=!1,this._formatWithSeparators=(u,m,b,k)=>{let A=[],B="";if(Array.isArray(b)){const L=new RegExp(b.map(U=>"[\\^$.|?*+()".indexOf(U)>=0?`\\${U}`:U).join("|"));A=u.split(L),B=u.match(L)?.[0]??""}else A=u.split(b),B=b;const y=A.length>1?`${B}${A[1]}`:"";let O=A[0]??"";const w=this.separatorLimit.replace(/\s/g,"");w&&+w&&(O="-"===O[0]?`-${O.slice(1,O.length).slice(0,w.length)}`:O.slice(0,w.length));const j=/(\d+)(\d{3})/;for(;m&&j.test(O);)O=O.replace(j,"$1"+m+"$2");return void 0===k?O+y:0===k?O:O+y.substring(0,k+1)},this.percentage=u=>{const m=u.replace(",","."),b=Number(m);return!isNaN(b)&&b>=0&&b<=100},this.getPrecision=u=>{const m=u.split(".");return m.length>1?Number(m[m.length-1]):1/0},this.checkAndRemoveSuffix=u=>{for(let m=this.suffix?.length-1;m>=0;m--){const b=this.suffix.substring(m,this.suffix?.length);if(u.includes(b)&&m!==this.suffix?.length-1&&(m-1<0||!u.includes(this.suffix.substring(m-1,this.suffix?.length))))return u.replace(b,"")}return u},this.checkInputPrecision=(u,m,b)=>{if(m<1/0){if(Array.isArray(b)){const y=b.find(O=>O!==this.thousandSeparator);b=y||b[0]}const k=new RegExp(this._charToRegExpExpression(b)+`\\d{${m}}.*$`),A=u.match(k),B=(A&&A[0]?.length)??0;B-1>m&&(u=u.substring(0,u.length-(B-1-m))),0===m&&this._compareOrIncludes(u[u.length-1],b,this.thousandSeparator)&&(u=u.substring(0,u.length-1))}return u},this.dropSpecialCharacters=this._config.dropSpecialCharacters,this.hiddenInput=this._config.hiddenInput,this.clearIfNotMatch=this._config.clearIfNotMatch,this.specialCharacters=this._config.specialCharacters,this.patterns=this._config.patterns,this.prefix=this._config.prefix,this.suffix=this._config.suffix,this.thousandSeparator=this._config.thousandSeparator,this.decimalMarker=this._config.decimalMarker,this.showMaskTyped=this._config.showMaskTyped,this.placeHolderCharacter=this._config.placeHolderCharacter,this.validation=this._config.validation,this.separatorLimit=this._config.separatorLimit,this.allowNegativeNumbers=this._config.allowNegativeNumbers,this.leadZeroDateTime=this._config.leadZeroDateTime,this.leadZero=this._config.leadZero,this.apm=this._config.apm,this.inputTransformFn=this._config.inputTransformFn,this.outputTransformFn=this._config.outputTransformFn,this.keepCharacterPositions=this._config.keepCharacterPositions}applyMaskWithPattern(p,u){const[m,b]=u;return this.customPattern=b,this.applyMask(p,m)}applyMask(p,u,m=0,b=!1,k=!1,A=()=>{}){if(!u||"string"!=typeof p)return"";let B=0,y="",O=!1,w=!1,j=1,L=!1;p.slice(0,this.prefix.length)===this.prefix&&(p=p.slice(this.prefix.length,p.length)),this.suffix&&p?.length>0&&(p=this.checkAndRemoveSuffix(p)),"("===p&&this.prefix&&(p="");const U=p.toString().split("");
1if(this.allowNegativeNumbers&&"-"===p.slice(B,B+1)&&(y+=p.slice(B,B+1)),"IP"===u){const K=p.split(".");this.ipError=this._validIP(K),u="099.099.099.099"}const z=[];for(let K=0;K<p.length;K++)p[K]?.match("\\d")&&z.push(p[K]??"");if("CPF_CNPJ"===u&&(this.cpfCnpjError=11!==z.length&&14!==z.length,u=z.length>11?"00.000.000/0000-00":"000.000.000-00"),u.startsWith("percent")){if(p.match("[a-z]|[A-Z]")||p.match(/[-!$%^&*()_+|~=`{}\[\]:";'<>?,\/.]/)&&!k){p=this._stripToDecimal(p);const X=this.getPrecision(u);p=this.checkInputPrecision(p,X,this.decimalMarker)}const K="string"==typeof this.decimalMarker?this.decimalMarker:".";if(p.indexOf(K)>0&&!this.percentage(p.substring(0,p.indexOf(K)))){let X=p.substring(0,p.indexOf(K)-1);this.allowNegativeNumbers&&"-"===p.slice(B,B+1)&&!k&&(X=p.substring(0,p.indexOf(K))),p=`${X}${p.substring(p.indexOf(K),p.length)}`}let W="";W=this.allowNegativeNumbers&&"-"===p.slice(B,B+1)?p.slice(B+1,B+p.length):p,y=this.percentage(W)?this._splitPercentZero(p):this._splitPercentZero(p.substring(0,p.length-1))}else if(u.startsWith("separator")){(p.match("[w\u0430-\u044f\u0410-\u042f]")||p.match("[\u0401\u0451\u0410-\u044f]")||p.match("[a-z]|[A-Z]")||p.match(/[-@#!$%\\^&*()_\xa3\xac'+|~=`{}\]:";<>.?/]/)||p.match("[^A-Za-z0-9,]"))&&(p=this._stripToDecimal(p));const K=this.getPrecision(u),W=Array.isArray(this.decimalMarker)?".":this.decimalMarker;0===K?p=this.allowNegativeNumbers?p.length>2&&"-"===p[0]&&"0"===p[1]&&p[2]!==this.thousandSeparator&&","!==p[2]&&"."!==p[2]?"-"+p.slice(2,p.length):"0"===p[0]&&p.length>1&&p[1]!==this.thousandSeparator&&","!==p[1]&&"."!==p[1]?p.slice(1,p.length):p:p.length>1&&"0"===p[0]&&p[1]!==this.thousandSeparator&&","!==p[1]&&"."!==p[1]?p.slice(1,p.length):p:(p[0]===W&&p.length>1&&(p="0"+p.slice(0,p.length+1),this.plusOnePosition=!0),"0"===p[0]&&p[1]!==W&&p[1]!==this.thousandSeparator&&(p=p.length>1?p.slice(0,1)+W+p.slice(1,p.length+1):p,this.plusOnePosition=!0),this.allowNegativeNumbers&&"-"===p[0]&&(p[1]===W||"0"===p[1])&&(p=p[1]===W&&p.length>2?p.slice(0,1)+"0"+p.slice(1,p.length):"0"===p[1]&&p.length>2&&p[2]!==W?p.slice(0,2)+W+p.slice(2,p.length):p,this.plusOnePosition=!0)),k&&("0"===p[0]&&p[1]===this.decimalMarker&&("0"===p[m]||p[m]===this.decimalMarker)&&(p=p.slice(2,p.length)),"-"===p[0]&&"0"===p[1]&&p[2]===this.decimalMarker&&("0"===p[m]||p[m]===this.decimalMarker)&&(p="-"+p.slice(3,p.length)),p=this._compareOrIncludes(p[p.length-1],this.decimalMarker,this.thousandSeparator)?p.slice(0,p.length-1):p);const X=this._charToRegExpExpression(this.thousandSeparator);let F='@#!$%^&*()_+|~=`{}\\[\\]:\\s,\\.";<>?\\/'.replace(X,"");if(Array.isArray(this.decimalMarker))for(const Ne of this.decimalMarker)F=F.replace(this._charToRegExpExpression(Ne),"");else F=F.replace(this._charToRegExpExpression(this.decimalMarker),"");const V=new RegExp("["+F+"]");p.match(V)&&(p=p.substring(0,p.length-1));const le=(p=this.checkInputPrecision(p,K,this.decimalMarker)).replace(new RegExp(X,"g"),"");y=this._formatWithSeparators(le,this.thousandSeparator,this.decimalMarker,K);const fe=y.indexOf(",")-p.indexOf(","),Ce=y.length-p.length;if(Ce>0&&y[m]!==this.thousandSeparator){w=!0;let Ne=0;do{this._shift.add(m+Ne),Ne++}while(Ne<Ce)}else y[m-1]===this.decimalMarker||-4===Ce||-3===Ce||","===y[m]?(this._shift.clear(),this._shift.add(m-1)):0!==fe&&m>0&&!(y.indexOf(",")>=m&&m>3)||!(y.indexOf(".")>=m&&m>3)&&Ce<=0?(this._shift.clear(),w=!0,j=Ce,this._shift.add(m+=Ce)):this._shift.clear()}else for(let K=0,W=U[0];K<U.length&&B!==u.length;K++,W=U[K]??""){const X="*"in this.patterns;if(this._checkSymbolMask(W,u[B]??"")&&"?"===u[B+1])y+=W,B+=2;else if("*"===u[B+1]&&O&&this._checkSymbolMask(W,u[B+2]??""))y+=W,B+=3,O=!1;else if(this._checkSymbolMask(W,u[B]??"")&&"*"===u[B+1]&&!X)y+=W,O=!0;else if("?"===u[B+1]&&this._checkSymbolMask(W,u[B+2]??""))y+=W,B+=3;
1else if(this._checkSymbolMask(W,u[B]??"")){if("H"===u[B]&&(this.apm?Number(W)>9:Number(W)>2)){m=this.leadZeroDateTime?m:m+1,B+=1,this._shiftStep(u,B,U.length),K--,this.leadZeroDateTime&&(y+="0");continue}if("h"===u[B]&&(this.apm?1===y.length&&Number(y)>1||"1"===y&&Number(W)>2||1===p.slice(B-1,B).length&&Number(p.slice(B-1,B))>2||"1"===p.slice(B-1,B)&&Number(W)>2:"2"===y&&Number(W)>3||("2"===y.slice(B-2,B)||"2"===y.slice(B-3,B)||"2"===y.slice(B-4,B)||"2"===y.slice(B-1,B))&&Number(W)>3&&B>10)){m+=1,B+=1,K--;continue}if(("m"===u[B]||"s"===u[B])&&Number(W)>5){m=this.leadZeroDateTime?m:m+1,B+=1,this._shiftStep(u,B,U.length),K--,this.leadZeroDateTime&&(y+="0");continue}const F=31,V=p[B],le=p[B+1],fe=p[B+2],Ce=p[B-1],Ne=p[B-2],Ze=p[B-3],de=p.slice(B-3,B-1),Ie=p.slice(B-1,B+1),ue=p.slice(B,B+2),ge=p.slice(B-2,B);if("d"===u[B]){const be="M0"===u.slice(0,2),ye="M0"===u.slice(0,2)&&this.specialCharacters.includes(Ne);if(Number(W)>3&&this.leadZeroDateTime||!be&&(Number(ue)>F||Number(Ie)>F||this.specialCharacters.includes(le))||(ye?Number(Ie)>F||!this.specialCharacters.includes(V)&&this.specialCharacters.includes(fe)||this.specialCharacters.includes(V):Number(ue)>F||this.specialCharacters.includes(le))){m=this.leadZeroDateTime?m:m+1,B+=1,this._shiftStep(u,B,U.length),K--,this.leadZeroDateTime&&(y+="0");continue}}if("M"===u[B]){const ye=0===B&&(Number(W)>2||Number(ue)>12||this.specialCharacters.includes(le)),Ve=u.slice(B+2,B+3),ot=de.includes(Ve)&&(this.specialCharacters.includes(Ne)&&Number(Ie)>12&&!this.specialCharacters.includes(V)||this.specialCharacters.includes(V)||this.specialCharacters.includes(Ze)&&Number(ge)>12&&!this.specialCharacters.includes(Ce)||this.specialCharacters.includes(Ce)),ct=Number(de)<=F&&!this.specialCharacters.includes(de)&&this.specialCharacters.includes(Ce)&&(Number(ue)>12||this.specialCharacters.includes(le)),pe=Number(ue)>12&&5===B||this.specialCharacters.includes(le)&&5===B,rt=Number(de)>F&&!this.specialCharacters.includes(de)&&!this.specialCharacters.includes(ge)&&Number(ge)>12,he=Number(de)<=F&&!this.specialCharacters.includes(de)&&!this.specialCharacters.includes(Ce)&&Number(Ie)>12;if(Number(W)>1&&this.leadZeroDateTime||ye||ot||he||rt||ct||pe&&!this.leadZeroDateTime){m=this.leadZeroDateTime?m:m+1,B+=1,this._shiftStep(u,B,U.length),K--,this.leadZeroDateTime&&(y+="0");continue}}y+=W,B++}else" "===W&&" "===u[B]||"/"===W&&"/"===u[B]?(y+=W,B++):-1!==this.specialCharacters.indexOf(u[B]??"")?(y+=u[B],B++,this._shiftStep(u,B,U.length),K--):"9"===u[B]&&this.showMaskTyped?this._shiftStep(u,B,U.length):this.patterns[u[B]??""]&&this.patterns[u[B]??""]?.optional?(U[B]&&"099.099.099.099"!==u&&"000.000.000-00"!==u&&"00.000.000/0000-00"!==u&&!u.match(/^9+\.0+$/)&&!this.patterns[u[B]??""]?.optional&&(y+=U[B]),u.includes("9*")&&u.includes("0*")&&B++,B++,K--):"*"===this.maskExpression[B+1]&&this._findSpecialChar(this.maskExpression[B+2]??"")&&this._findSpecialChar(W)===this.maskExpression[B+2]&&O||"?"===this.maskExpression[B+1]&&this._findSpecialChar(this.maskExpression[B+2]??"")&&this._findSpecialChar(W)===this.maskExpression[B+2]&&O?(B+=3,y+=W):this.showMaskTyped&&this.specialCharacters.indexOf(W)<0&&W!==this.placeHolderCharacter&&1===this.placeHolderCharacter.length&&(L=!0)}y.length+1===u.length&&-1!==this.specialCharacters.indexOf(u[u.length-1]??"")&&(y+=u[u.length-1]);let Z=m+1;for(;this._shift.has(Z);)j++,Z++;let $=b&&!u.startsWith("separator")?B:this._shift.has(m)?j:0;L&&$--,A($,w),j<0&&this._shift.clear();let Y=!1;k&&(Y=U.every(K=>this.specialCharacters.includes(K)));let Q=`${this.prefix}${Y?"":y}${this.showMaskTyped?"":this.suffix}`;if(0===y.length&&(Q=this.dropSpecialCharacters?`${y}`:`${this.prefix}${y}`),y.includes("-")&&this.prefix&&this.allowNegativeNumbers){if(k&&"-"===y)return"";Q=`-${this.prefix}${y.split("-").join("")}${this.suffix}`}return Q}_findDropSpecialChar(p){return Array.isArray(this.dropSpecialCharacters)?this.dropSpecialCharacters.find(u=>u===p):this._findSpecialChar(p)}_findSpecialChar(p){return this.specialCharacters.find(u=>u===p)}_checkSymbolMask(p,u){return this.patterns=this.customPattern?this.customPattern:this.patterns,(this.patterns[u]?.pattern&&this.patterns[u]?.pattern.test(p))??!1}_stripToDecimal(p){return p.split("").filter((u,m)=>{const b="string"==typeof this.decimalMarker?u===this.decimalMarker:this.decimalMarker.includes(u);return u.match("^-?\\d")||u===this.thousandSeparator||b||"-"===u&&0===m&&this.allowNegativeNumbers}).join("")}_charToRegExpExpression(p){return p&&(" "===p?"\\s":"[\\^$.|?*+()".indexOf(p)>=0?`\\${p}`:p)}_shiftStep(p,u,m){const b=/[*?]/g.test(p.slice(0,u))?m:u;this._shift.add(b+this.prefix.length||0)}_compareOrIncludes(p,u,m){return Array.isArray(u)?u.filter(b=>b!==m).includes(p):p===u}_validIP(p){return!(4===p.length&&!p.some((u,m)=>p.length!==m+1?""===u||Number(u)>255:""===u||Number(u.substring(0,3))>
1255))}_splitPercentZero(p){const u=p.indexOf("string"==typeof this.decimalMarker?this.decimalMarker:".");if(-1===u){const m=parseInt(p,10);return isNaN(m)?"":m.toString()}{const m=parseInt(p.substring(0,u),10),b=p.substring(u+1),k=isNaN(m)?"":m.toString();return""===k?"":k+("string"==typeof this.decimalMarker?this.decimalMarker:".")+b}}}return I.\u0275fac=function(p){return new(p||I)(o.KVO(h))},I.\u0275prov=o.jDH({token:I,factory:I.\u0275fac}),I})(),S=(()=>{class I extends C{constructor(p,u,m,b){super(u),this.document=p,this._config=u,this._elementRef=m,this._renderer=b,this.isNumberValue=!1,this.maskIsShown="",this.selStart=null,this.selEnd=null,this.writingValue=!1,this.maskChanged=!1,this._maskExpressionArray=[],this.triggerOnMaskChange=!1,this._emitValue=!1,this._previousValue="",this._currentValue="",this.onChange=k=>{}}applyMask(p,u,m=0,b=!1,k=!1,A=()=>{}){if(!u)return p!==this.actualValue?this.actualValue:p;if(this.maskIsShown=this.showMaskTyped?this.showMaskInInput():"","IP"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(p||"#")),"CPF_CNPJ"===this.maskExpression&&this.showMaskTyped&&(this.maskIsShown=this.showMaskInInput(p||"#")),!p&&this.showMaskTyped)return this.formControlResult(this.prefix),this.prefix+this.maskIsShown+this.suffix;const B=p&&"number"==typeof this.selStart?p[this.selStart]??"":"";let y="";if(void 0!==this.hiddenInput&&!this.writingValue){let L=p&&1===p.length?p.split(""):this.actualValue.split("");"object"==typeof this.selStart&&"object"==typeof this.selEnd?(this.selStart=Number(this.selStart),this.selEnd=Number(this.selEnd)):""!==p&&L.length?"number"==typeof this.selStart&&"number"==typeof this.selEnd&&(p.length>L.length?L.splice(this.selStart,0,B):p.length<L.length&&(L.length-p.length==1?L.splice(k?this.selStart-1:p.length-1,1):L.splice(this.selStart,this.selEnd-this.selStart))):L=[],this.showMaskTyped&&(this.hiddenInput||(p=this.removeMask(p))),y=this.actualValue.length&&L.length<=p.length?this.shiftTypedSymbols(L.join("")):p}if(b&&(this.hiddenInput||!this.hiddenInput)&&(y=p),k&&-1!==this.specialCharacters.indexOf(this.maskExpression[m]??"")&&this.showMaskTyped&&(y=this._currentValue),this.deletedSpecialCharacter&&m&&(this.specialCharacters.includes(this.actualValue.slice(m,m+1))?m+=1:"M0"!==u.slice(m-1,m+1)&&(m-=2),this.deletedSpecialCharacter=!1),this.showMaskTyped&&1===this.placeHolderCharacter.length&&!this.leadZeroDateTime&&(p=this.removeMask(p)),y=this.maskChanged?p:y&&y.length?y:p,this.showMaskTyped&&this.keepCharacterPositions&&this.actualValue&&!b){const L=this.dropSpecialCharacters?this.removeMask(this.actualValue):this.actualValue;return this.formControlResult(L),this.actualValue?this.actualValue:this.prefix+this.maskIsShown+this.suffix}const O=super.applyMask(y,u,m,b,k,A);if(this.actualValue=this.getActualValue(O),"."===this.thousandSeparator&&"."===this.decimalMarker&&(this.decimalMarker=","),this.maskExpression.startsWith("separator")&&!0===this.dropSpecialCharacters&&(this.specialCharacters=this.specialCharacters.filter(L=>!this._compareOrIncludes(L,this.decimalMarker,this.thousandSeparator))),(O||""===O)&&(this._previousValue=this._currentValue,this._currentValue=O,this._emitValue=this._previousValue!==this._currentValue||this.maskChanged||this._previousValue===this._currentValue&&b),this._emitValue&&this.formControlResult(O),!this.showMaskTyped||this.showMaskTyped&&this.hiddenInput)return this.hiddenInput?k?this.hideInput(O,this.maskExpression):this.hideInput(O,this.maskExpression)+this.maskIsShown.slice(O.length):O;const w=O.length,j=this.prefix+this.maskIsShown+this.suffix;if(this.maskExpression.includes("H")){const L=this._numberSkipedSymbols(O);return O+j.slice(w+L)}return"IP"===this.maskExpression||"CPF_CNPJ"===this.maskExpression?O+j:O+j.slice(w)}_numberSkipedSymbols(p){const u=/(^|\D)(\d\D)/g;let m=u.exec(p),b=0;for(;null!=m;)b+=1,m=u.exec(p);return b}applyValueChanges(p,u,m,b=()=>{}){const k=this._elementRef?.nativeElement;k&&(k.value=this.applyMask(k.value,this.maskExpression,p,u,m,b),k!==this._getActiveElement()&&this.clearIfNotMatchFn())}hideInput(p,u){return p.split("").map((m,b)=>this.patterns&&this.patterns[u[b]??""]&&this.patterns[u[b]??""]?.symbol?this.patterns[u[b]??""]?.symbol
1:m).join("")}getActualValue(p){const u=p.split("").filter((m,b)=>{const k=this.maskExpression[b]??"";return this._checkSymbolMask(m,k)||this.specialCharacters.includes(k)&&m===k});return u.join("")===p?u.join(""):p}shiftTypedSymbols(p){let u="";return(p&&p.split("").map((b,k)=>{if(this.specialCharacters.includes(p[k+1]??"")&&p[k+1]!==this.maskExpression[k+1])return u=b,p[k+1];if(u.length){const A=u;return u="",A}return b})||[]).join("")}numberToString(p){return!p&&0!==p||this.maskExpression.startsWith("separator")&&(this.leadZero||!this.dropSpecialCharacters)||this.maskExpression.startsWith("separator")&&this.separatorLimit.length>14&&String(p).length>14?String(p):Number(p).toLocaleString("fullwide",{useGrouping:!1,maximumFractionDigits:20}).replace("/-/","-")}showMaskInInput(p){if(this.showMaskTyped&&this.shownMaskExpression){if(this.maskExpression.length!==this.shownMaskExpression.length)throw new Error("Mask expression must match mask placeholder length");return this.shownMaskExpression}if(this.showMaskTyped){if(p){if("IP"===this.maskExpression)return this._checkForIp(p);if("CPF_CNPJ"===this.maskExpression)return this._checkForCpfCnpj(p)}return this.placeHolderCharacter.length===this.maskExpression.length?this.placeHolderCharacter:this.maskExpression.replace(/\w/g,this.placeHolderCharacter)}return""}clearIfNotMatchFn(){const p=this._elementRef?.nativeElement;p&&this.clearIfNotMatch&&this.prefix.length+this.maskExpression.length+this.suffix.length!==p.value.replace(this.placeHolderCharacter,"").length&&(this.formElementProperty=["value",""],this.applyMask("",this.maskExpression))}set formElementProperty([p,u]){!this._renderer||!this._elementRef||Promise.resolve().then(()=>this._renderer?.setProperty(this._elementRef?.nativeElement,p,u))}checkDropSpecialCharAmount(p){return p.split("").filter(m=>this._findDropSpecialChar(m)).length}removeMask(p){return this._removeMask(this._removeSuffix(this._removePrefix(p)),this.specialCharacters.concat("_").concat(this.placeHolderCharacter))}_checkForIp(p){if("#"===p)return`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`;const u=[];for(let m=0;m<p.length;m++){const b=p[m]??"";b&&b.match("\\d")&&u.push(b)}return u.length<=3?`${this.placeHolderCharacter}.${this.placeHolderCharacter}.${this.placeHolderCharacter}`:u.length>3&&u.length<=6?`${this.placeHolderCharacter}.${this.placeHolderCharacter}`:u.length>6&&u.length<=9?this.placeHolderCharacter:""}_checkForCpfCnpj(p){const u=`${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`,m=`${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}.${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}/${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}${this.placeHolderCharacter}-${this.placeHolderCharacter}${this.placeHolderCharacter}`;if("#"===p)return u;const b=[];for(let k=0;k<p.length;k++){const A=p[k]??"";A&&A.match("\\d")&&b.push(A)}return b.length<=3?u.slice(b.length,u.length):b.length>3&&b.length<=6?u.slice(b.length+1,u.length):b.length>6&&b.length<=9?u.slice(b.length+2,u.length):b.length>9&&b.length<11?u.slice(b.length+3,u.length):11===b.length?"":12===b.length?m.slice(17===p.length?16:15,m.length):b.length>12&&b.length<=14?m.slice(b.length+4,m.length):""}_getActiveElement(p=this.document){const u=p?.activeElement?.shadowRoot;return u?.activeElement?this._getActiveElement(u):p.activeElement}formControlResult(p){if(this.writingValue||!this.triggerOnMaskChange&&this.maskChanged)return this.maskChanged&&this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbols(this._removeSuffix(this._removePrefix(p)))))),void(this.maskChanged=!1);Array.isArray(this.dropSpecialCharacters)?this.onChange(this.outputTransformFn(this._toNumber(this._checkSymbol
1s(this._removeMask(this._removeSuffix(this._removePrefix(p)),this.dropSpecialCharacters))))):this.onChange(this.outputTransformFn(this._toNumber(this.dropSpecialCharacters||!this.dropSpecialCharacters&&this.prefix===p?this._checkSymbols(this._removeSuffix(this._removePrefix(p))):p)))}_toNumber(p){if(!this.isNumberValue||""===p||this.maskExpression.startsWith("separator")&&(this.leadZero||!this.dropSpecialCharacters))return p;if(String(p).length>16&&this.separatorLimit.length>14)return String(p);const u=Number(p);if(this.maskExpression.startsWith("separator")&&Number.isNaN(u)){const m=String(p).replace(",",".");return Number(m)}return Number.isNaN(u)?p:u}_removeMask(p,u){return this.maskExpression.startsWith("percent")&&p.includes(".")?p:p&&p.replace(this._regExpForRemove(u),"")}_removePrefix(p){return this.prefix?p&&p.replace(this.prefix,""):p}_removeSuffix(p){return this.suffix?p&&p.replace(this.suffix,""):p}_retrieveSeparatorValue(p){let u=Array.isArray(this.dropSpecialCharacters)?this.specialCharacters.filter(m=>this.dropSpecialCharacters.includes(m)):this.specialCharacters;return!this.deletedSpecialCharacter&&this._checkPatternForSpace()&&p.includes(" ")&&this.maskExpression.includes("*")&&(u=u.filter(m=>" "!==m)),this._removeMask(p,u)}_regExpForRemove(p){return new RegExp(p.map(u=>`\\${u}`).join("|"),"gi")}_replaceDecimalMarkerToDot(p){const u=Array.isArray(this.decimalMarker)?this.decimalMarker:[this.decimalMarker];return p.replace(this._regExpForRemove(u),".")}_checkSymbols(p){if(""===p)return p;this.maskExpression.startsWith("percent")&&","===this.decimalMarker&&(p=p.replace(",","."));const u=this._retrieveSeparatorPrecision(this.maskExpression),m=this._replaceDecimalMarkerToDot(this._retrieveSeparatorValue(p));return this.isNumberValue&&u?p===this.decimalMarker?null:this.separatorLimit.length>14?String(m):this._checkPrecision(this.maskExpression,m):m}_checkPatternForSpace(){for(const p in this.patterns)if(this.patterns[p]&&this.patterns[p]?.hasOwnProperty("pattern")){const u=this.patterns[p]?.pattern.toString(),m=this.patterns[p]?.pattern;if(u?.includes(" ")&&m?.test(this.maskExpression))return!0}return!1}_retrieveSeparatorPrecision(p){const u=p.match(new RegExp("^separator\\.([^d]*)"));return u?Number(u[1]):null}_checkPrecision(p,u){const m=p.slice(10,11);return p.indexOf("2")>0||this.leadZero&&Number(m)>1?(","===this.decimalMarker&&this.leadZero&&(u=u.replace(",",".")),this.leadZero?Number(u).toFixed(Number(m)):Number(u).toFixed(2)):this.numberToString(u)}_repeatPatternSymbols(p){return p.match(/{[0-9]+}/)&&p.split("").reduce((u,m,b)=>{if(this._start="{"===m?b:this._start,"}"!==m)return this._findSpecialChar(m)?u+m:u;this._end=b;const k=Number(p.slice(this._start+1,this._end)),A=new Array(k+1).join(p[this._start-1]);if(p.slice(0,this._start).length>1&&p.includes("S")){const B=p.slice(0,this._start-1);return B.includes("{")?u+A:B+u+A}return u+A},"")||p}currentLocaleDecimalMarker(){return 1.1.toLocaleString().substring(1,2)}}return I.\u0275fac=function(p){return new(p||I)(o.KVO(G.qQ),o.KVO(h),o.KVO(o.aKT,8),o.KVO(o.sFG,8))},I.\u0275prov=o.jDH({token:I,factory:I.\u0275fac}),I})(),x=(()=>{class I{constructor(p,u,m){this.document=p,this._config=u,this._maskService=m,this.maskExpression="",this.specialCharacters=[],this.patterns={},this.prefix="",this.suffix="",this.thousandSeparator=" ",this.decimalMarker=".",this.dropSpecialCharacters=null,this.hiddenInput=null,this.showMaskTyped=null,this.placeHolderCharacter=null,this.shownMaskExpression=null,this.showTemplate=null,this.clearIfNotMatch=null,this.validation=null,this.separatorLimit=null,this.allowNegativeNumbers=null,this.leadZeroDateTime=null,this.leadZero=null,this.triggerOnMaskChange=null,this.apm=null,this.inputTransformFn=null,this.outputTransformFn=null,this.keepCharacterPositions=null,this.maskFilled=new o.bkB,this._maskValue="",this._isFocused=!1,this._position=null,this._maskExpressionArray=[],this._justPasted=!1,this._isComposing=!1,this.onChange=b=>{},this.onTouch=()=>{}}ngOnChanges(p){const{maskExpression:u,specialCharacters:m,patterns:b,prefix:k,suffix:A,thousandSeparator:B,decimalMarker:y,dropSpecialCharacters:O,hiddenInput:w,showMaskTyped:j,placeHolderCharacter:L,shownMaskExpression:U,showTemplate:z,clearIfNotMatch:Z,validation:$,separatorLimit:Y,allowNegativeNumbers:Q,leadZeroDateTime:K,leadZero:W,triggerOnMaskChange:X,apm:F,inputTransformFn:V,outputTransformFn:le,keepCharacterPositions:fe}=p;if(u&&(u.currentValue!==u.previousValue&&!u.firstChange&&(this._maskService.maskChanged=!0),u.currentValue&&u.currentValue.split("||").length>1?(this._maskExpressionArray=u.currentValue.split("||").sort((Ce,Ne)=>Ce.length-Ne.length),this._setMask()):(this._maskExpressionArray=[],this._maskValue=u.currentValue||"",this._maskService.maskExpression=this._maskValue)),m){if(!m.currentValue||!Array.isArray(m.currentValue))return;this._maskService.specialCharacters=m.currentValue||[]}Q&&(this._maskService.allowNegativeNumbers=Q.currentValue,this._maskService.allowNegativeNumbers&&(this._maskService.specialCharacters=this._maskService.specialCharacters.filter(Ce=>"-"!==Ce))),b&&b.currentValue&&(this._maskService.patterns=b.currentValue),F&&F.currentValue&&(this._maskService.apm=F.currentValue),k&&(this._maskService.prefix=k.currentValue),A&&(this._maskService.suffix=A.currentValue),B&&(this._maskService.thousandSeparator=B.currentValue),y&&(this._maskService.decimalMarker=y.currentValue),O&&(this._maskService.dropSpecialCharacters=O.currentValue),w&&(this._maskService.hiddenInput=w.currentValue),j&&(this._maskService.showMaskTyped=j.currentValue,!1===j.previousValue&&!0===j.currentValue&&this._isFocused&&requestAnimationFrame(()=>
1{this._maskService._elementRef?.nativeElement.click()})),L&&(this._maskService.placeHolderCharacter=L.currentValue),U&&(this._maskService.shownMaskExpression=U.currentValue),z&&(this._maskService.showTemplate=z.currentValue),Z&&(this._maskService.clearIfNotMatch=Z.currentValue),$&&(this._maskService.validation=$.currentValue),Y&&(this._maskService.separatorLimit=Y.currentValue),K&&(this._maskService.leadZeroDateTime=K.currentValue),W&&(this._maskService.leadZero=W.currentValue),X&&(this._maskService.triggerOnMaskChange=X.currentValue),V&&(this._maskService.inputTransformFn=V.currentValue),le&&(this._maskService.outputTransformFn=le.currentValue),fe&&(this._maskService.keepCharacterPositions=fe.currentValue),this._applyMask()}validate({value:p}){if(!this._maskService.validation||!this._maskValue)return null;if(this._maskService.ipError)return this._createValidationError(p);if(this._maskService.cpfCnpjError)return this._createValidationError(p);if(this._maskValue.startsWith("separator")||_.includes(this._maskValue)||this._maskService.clearIfNotMatch)return null;if(l.includes(this._maskValue))return this._validateTime(p);if(p&&p.toString().length>=1){let u=0;if(this._maskValue.startsWith("percent"))return null;for(const m in this._maskService.patterns)if(this._maskService.patterns[m]?.optional&&(this._maskValue.indexOf(m)!==this._maskValue.lastIndexOf(m)?u+=this._maskValue.split("").filter(k=>k===m).join("").length:-1!==this._maskValue.indexOf(m)&&u++,-1!==this._maskValue.indexOf(m)&&p.toString().length>=this._maskValue.indexOf(m)||u===this._maskValue.length))return null;if(1===this._maskValue.indexOf("{")&&p.toString().length===this._maskValue.length+Number((this._maskValue.split("{")[1]??"").split("}")[0])-4)return null;if(this._maskValue.indexOf("*")>1&&p.toString().length<this._maskValue.indexOf("*")||this._maskValue.indexOf("?")>1&&p.toString().length<this._maskValue.indexOf("?")||1===this._maskValue.indexOf("{"))return this._createValidationError(p);if(-1===this._maskValue.indexOf("*")||-1===this._maskValue.indexOf("?")){p="number"==typeof p?String(p):p;const m=this._maskValue.split("*"),b=this._maskService.dropSpecialCharacters?this._maskValue.length-this._maskService.checkDropSpecialCharAmount(this._maskValue)-u:this.prefix?this._maskValue.length+this.prefix.length-u:this._maskValue.length-u;if(1===m.length&&p.toString().length<b)return this._createValidationError(p);if(m.length>1){const k=m[m.length-1];if(k&&this._maskService.specialCharacters.includes(k[0])&&String(p).includes(k[0]??"")&&!this.dropSpecialCharacters){const A=p.split(k[0]);return A[A.length-1].length===k.length-1?null:this._createValidationError(p)}return(k&&!this._maskService.specialCharacters.includes(k[0])||!k||this._maskService.dropSpecialCharacters)&&p.length>=b-1?null:this._createValidationError(p)}}if(1===this._maskValue.indexOf("*")||1===this._maskValue.indexOf("?"))return null}return p&&this.maskFilled.emit(),null}onPaste(){this._justPasted=!0}onFocus(){this._isFocused=!0}onModelChange(p){(""===p||null==p)&&this._maskService.actualValue&&(this._maskService.actualValue=this._maskService.getActualValue(""))}onInput(p){if(this._isComposing)return;const u=p.target,m=this._maskService.inputTransformFn(u.value);if("number"!==u.type)if("string"==typeof m||"number"==typeof m){if(u.value=m.toString(),this._inputValue=u.value,this._setMask(),!this._maskValue)return void this.onChange(u.value);let b=1===u.selectionStart?u.selectionStart+this._maskService.prefix.length:u.selectionStart;if(this.showMaskTyped&&this.keepCharacterPositions&&1===this._maskService.placeHolderCharacter.length){const y=u.value.slice(b-1,b),O=this.prefix.length,w=this._maskService._checkSymbolMask(y,this._maskService.maskExpression[b-1-O]??""),j=this._maskService._checkSymbolMask(y,this._maskService.maskExpression[b+1-O]??""),L=this._maskService.selStart===this._maskService.selEnd,U=Number(this._maskService.selStart)-O,z=Number(this._maskService.selEnd)-O;if("Backspace"===this._code)if(L){if(!this._maskService.specialCharacters.includes(this._maskService.maskExpression.slice(b-this.prefix.length,b+1-this.prefix.length))&&L)if(1===U&&this.prefix)this._maskService.actualValue=this.prefix+this._maskService.placeHolderCharacter+u.value.split(this.prefix).join("").split(this.suffix
1).join("")+this.suffix,b-=1;else{const Z=u.value.substring(0,b),$=u.value.substring(b);this._maskService.actualValue=Z+this._maskService.placeHolderCharacter+$}}else this._maskService.actualValue=this._maskService.selStart===O?this.prefix+this._maskService.maskIsShown.slice(0,z)+this._inputValue.split(this.prefix).join(""):this._maskService.selStart===this._maskService.maskIsShown.length+O?this._inputValue+this._maskService.maskIsShown.slice(U,z):this.prefix+this._inputValue.split(this.prefix).join("").slice(0,U)+this._maskService.maskIsShown.slice(U,z)+this._maskService.actualValue.slice(z+O,this._maskService.maskIsShown.length+O)+this.suffix;"Backspace"!==this._code&&(w||j||!L?this._maskService.specialCharacters.includes(u.value.slice(b,b+1))&&j&&!this._maskService.specialCharacters.includes(u.value.slice(b+1,b+2))?(this._maskService.actualValue=u.value.slice(0,b-1)+u.value.slice(b,b+1)+y+u.value.slice(b+2),b+=1):w?this._maskService.actualValue=1===u.value.length&&1===b?this.prefix+y+this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)+this.suffix:u.value.slice(0,b-1)+y+u.value.slice(b+1).split(this.suffix).join("")+this.suffix:this.prefix&&1===u.value.length&&b-O==1&&this._maskService._checkSymbolMask(u.value,this._maskService.maskExpression[b-1-O]??"")&&(this._maskService.actualValue=this.prefix+u.value+this._maskService.maskIsShown.slice(1,this._maskService.maskIsShown.length)+this.suffix):b=Number(u.selectionStart)-1)}let k=0,A=!1;if("Delete"===this._code&&(this._maskService.deletedSpecialCharacter=!0),this._inputValue.length>=this._maskService.maskExpression.length-1&&"Backspace"!==this._code&&"d0/M0/0000"===this._maskService.maskExpression&&b<10){const y=this._inputValue.slice(b-1,b);u.value=this._inputValue.slice(0,b-1)+y+this._inputValue.slice(b+1)}if("d0/M0/0000"===this._maskService.maskExpression&&this.leadZeroDateTime&&(b<3&&Number(u.value)>31&&Number(u.value)<40||5===b&&Number(u.value.slice(3,5))>12)&&(b+=2),"Hh:m0:s0"===this._maskService.maskExpression&&this.apm&&(this._justPasted&&"00"===u.value.slice(0,2)&&(u.value=u.value.slice(1,2)+u.value.slice(2,u.value.length)),u.value="00"===u.value?"0":u.value),this._maskService.applyValueChanges(b,this._justPasted,"Backspace"===this._code||"Delete"===this._code,(y,O)=>{this._justPasted=!1,k=y,A=O}),this._getActiveElement()!==u)return;this._maskService.plusOnePosition&&(b+=1,this._maskService.plusOnePosition=!1),this._maskExpressionArray.length&&(b="Backspace"===this._code?this.specialCharacters.includes(this._inputValue.slice(b-1,b))?b-1:b:1===u.selectionStart?u.selectionStart+this._maskService.prefix.length:u.selectionStart),this._position=1===this._position&&1===this._inputValue.length?null:this._position;let B=this._position?this._inputValue.length+b+k:b+("Backspace"!==this._code||A?k:0);B>this._getActualInputLength()&&(B=u.value===this._maskService.decimalMarker&&1===u.value.length?this._getActualInputLength()+1:this._getActualInputLength()),B<0&&(B=0),u.setSelectionRange(B,B),this._position=null}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof m);else{if(!this._maskValue)return void this.onChange(u.value);this._maskService.applyValueChanges(u.value.length,this._justPasted,"Backspace"===this._code||"Delete"===this._code)}}onCompositionStart(){this._isComposing=!0}onCompositionEnd(p){this._isComposing=!1,this._justPasted=!0,this.onInput(p)}onBlur(p){if(this._maskValue){const u=p.target;if(this.leadZero&&u.value.length>0&&"string"==typeof this.decimalMarker){const m=this._maskService.maskExpression,b=Number(this._maskService.maskExpression.slice(m.length-1,m.length));if(b>1){u.value=this.suffix?u.value.split(this.suffix).join(""):u.value;const k=u.value.split(this.decimalMarker)[1];u.value=u.value.includes(this.decimalMarker)?u.value+"0".repeat(b-k.length)+this.suffix:u.value+this.decimalMarker+"0".repeat(b)+this.suffix,this._maskService.actualValue=u.value}}this._maskService.clearIfNotMatchFn()}this._isFocused=!1,this.onTouch()}onClick(p){if(!this._maskValue)return;const u=p.target;null!==u&&null!==u.selectionStart&&u.selectionStart===u.selectionEnd&&u.selectionStart>this._maskService.prefix.length&&38!==p.keyCode&&this._maskService.showMaskTyped&&!this.keepCharacterPositions&&(this._maskService.maskIsShown=this._maskService.showMaskInInput(),u.setSelectionRange&&this._maskService.prefix+this._maskService.maskIsShown===u.value?(u.focu
1s(),u.setSelectionRange(0,0)):u.selectionStart>this._maskService.actualValue.length&&u.setSelectionRange(this._maskService.actualValue.length,this._maskService.actualValue.length));const k=u&&(u.value===this._maskService.prefix?this._maskService.prefix+this._maskService.maskIsShown:u.value);u&&u.value!==k&&(u.value=k),u&&"number"!==u.type&&(u.selectionStart||u.selectionEnd)<=this._maskService.prefix.length?u.selectionStart=this._maskService.prefix.length:u&&u.selectionEnd>this._getActualInputLength()&&(u.selectionEnd=this._getActualInputLength())}onKeyDown(p){if(!this._maskValue)return;if(this._isComposing)return void("Enter"===p.key&&this.onCompositionEnd(p));this._code=p.code?p.code:p.key;const u=p.target;if(this._inputValue=u.value,this._setMask(),"number"!==u.type){if("ArrowUp"===p.key&&p.preventDefault(),"ArrowLeft"===p.key||"Backspace"===p.key||"Delete"===p.key){if("Backspace"===p.key&&0===u.value.length&&(u.selectionStart=u.selectionEnd),"Backspace"===p.key&&0!==u.selectionStart)if(this.specialCharacters=this.specialCharacters?.length?this.specialCharacters:this._config.specialCharacters,this.prefix.length>1&&u.selectionStart<=this.prefix.length)u.setSelectionRange(this.prefix.length,u.selectionEnd);else if(this._inputValue.length!==u.selectionStart&&1!==u.selectionStart)for(;this.specialCharacters.includes((this._inputValue[u.selectionStart-1]??"").toString())&&(this.prefix.length>=1&&u.selectionStart>this.prefix.length||0===this.prefix.length);)u.setSelectionRange(u.selectionStart-1,u.selectionEnd);this.checkSelectionOnDeletion(u),this._maskService.prefix.length&&u.selectionStart<=this._maskService.prefix.length&&u.selectionEnd<=this._maskService.prefix.length&&p.preventDefault(),"Backspace"===p.key&&!u.readOnly&&0===u.selectionStart&&u.selectionEnd===u.value.length&&0!==u.value.length&&(this._position=this._maskService.prefix?this._maskService.prefix.length:0,this._maskService.applyMask(this._maskService.prefix,this._maskService.maskExpression,this._position))}this.suffix&&this.suffix.length>1&&this._inputValue.length-this.suffix.length<u.selectionStart?u.setSelectionRange(this._inputValue.length-this.suffix.length,this._inputValue.length):("KeyA"===p.code&&p.ctrlKey||"KeyA"===p.code&&p.metaKey)&&(u.setSelectionRange(0,this._getActualInputLength()),p.preventDefault()),this._maskService.selStart=u.selectionStart,this._maskService.selEnd=u.selectionEnd}}writeValue(p){var u=this;return(0,n.A)(function*(){if("object"==typeof p&&null!==p&&"value"in p&&("disable"in p&&u.setDisabledState(!!p.disable),p=p.value),null!==p&&(p=u.inputTransformFn?u.inputTransformFn(p):p),"string"==typeof p||"number"==typeof p||null==p){(null==p||""===p)&&(u._maskService._currentValue="",u._maskService._previousValue="");let m=p;if("number"==typeof m||u._maskValue.startsWith("separator")){m=String(m);const b=u._maskService.currentLocaleDecimalMarker();Array.isArray(u._maskService.decimalMarker)||(m=u._maskService.decimalMarker!==b?m.replace(b,u._maskService.decimalMarker):m),u._maskService.leadZero&&m&&u.maskExpression&&!1!==u.dropSpecialCharacters&&(m=u._maskService._checkPrecision(u._maskService.maskExpression,m)),","===u._maskService.decimalMarker&&(m=m.toString().replace(".",",")),u.maskExpression?.startsWith("separator")&&u.leadZero&&requestAnimationFrame(()=>{u._maskService.applyMask(m?.toString()??"",u._maskService.maskExpression)}),u._maskService.isNumberValue=!0}"string"!=typeof m&&(m=""),u._inputValue=m,u._setMask(),m&&u._maskService.maskExpression||u._maskService.maskExpression&&(u._maskService.prefix||u._maskService.showMaskTyped)?("function"!=typeof u.inputTransformFn&&(u._maskService.writingValue=!0),u._maskService.formElementProperty=["value",u._maskService.applyMask(m,u._maskService.maskExpression)],"function"!=typeof u.inputTransformFn&&(u._maskService.writingValue=!1)):u._maskService.formElementProperty=["value",m],u._inputValue=m}else console.warn("Ngx-mask writeValue work with string | number, your current value:",typeof p)})()}registerOnChange(p){this._maskService.onChange=this.onChange=p}registerOnTouched(p){this.onTouch=p}_getActiveElement(p=this.document){const u=p?.activeElement?.shadowRoot;return u?.activeElement?this._getActiveElement(u):p.activeElement}checkSelectionOnDeletion(p){p.selectionStart=Math.min(Math.max(this.prefix.length,p.selectionStart),this._inputValue.length-this.suffix.length),p.selectionEnd=Math.min(Math.max(this.prefix.length,p.selectionEnd),this._inputValue.length-this.suffix.length)}setDisabledState(p){this._maskService.formElementProperty=["disabled",p]}
1_applyMask(){this._maskService.maskExpression=this._maskService._repeatPatternSymbols(this._maskValue||""),this._maskService.formElementProperty=["value",this._maskService.applyMask(this._inputValue,this._maskService.maskExpression)]}_validateTime(p){const u=this._maskValue.split("").filter(m=>":"!==m).length;return p&&(0==+(p[p.length-1]??-1)&&p.length<u||p.length<=u-2)?this._createValidationError(p):null}_getActualInputLength(){return this._maskService.actualValue.length||this._maskService.actualValue.length+this._maskService.prefix.length}_createValidationError(p){return{mask:{requiredMask:this._maskValue,actualValue:p}}}_setMask(){this._maskExpressionArray.some(p=>{if(p.split("").some(m=>this._maskService.specialCharacters.includes(m))&&this._inputValue&&!p.includes("S")||p.includes("{")){const m=this._maskService.removeMask(this._inputValue)?.length<=this._maskService.removeMask(p)?.length;if(m)return this._maskValue=this.maskExpression=this._maskService.maskExpression=p.includes("{")?this._maskService._repeatPatternSymbols(p):p,m;{const b=this._maskExpressionArray[this._maskExpressionArray.length-1]??"";this._maskValue=this.maskExpression=this._maskService.maskExpression=b.includes("{")?this._maskService._repeatPatternSymbols(b):b}}else{const m=this._maskService.removeMask(this._inputValue)?.split("").every((b,k)=>{const A=p.charAt(k);return this._maskService._checkSymbolMask(b,A)});if(m)return this._maskValue=this.maskExpression=this._maskService.maskExpression=p,m}})}}return I.\u0275fac=function(p){return new(p||I)(o.rXU(G.qQ),o.rXU(h),o.rXU(S))},I.\u0275dir=o.FsC({type:I,selectors:[["input","mask",""],["textarea","mask",""]],hostBindings:function(p,u){1&p&&o.bIt("paste",function(){return u.onPaste()})("focus",function(b){return u.onFocus(b)})("ngModelChange",function(b){return u.onModelChange(b)})("input",function(b){return u.onInput(b)})("compositionstart",function(b){return u.onCompositionStart(b)})("compositionend",function(b){return u.onCompositionEnd(b)})("blur",function(b){return u.onBlur(b)})("click",function(b){return u.onClick(b)})("keydown",function(b){return u.onKeyDown(b)})},inputs:{maskExpression:[0,"mask","maskExpression"],specialCharacters:"specialCharacters",patterns:"patterns",prefix:"prefix",suffix:"suffix",thousandSeparator:"thousandSeparator",decimalMarker:"decimalMarker",dropSpecialCharacters:"dropSpecialCharacters",hiddenInput:"hiddenInput",showMaskTyped:"showMaskTyped",placeHolderCharacter:"placeHolderCharacter",shownMaskExpression:"shownMaskExpression",showTemplate:"showTemplate",clearIfNotMatch:"clearIfNotMatch",validation:"validation",separatorLimit:"separatorLimit",allowNegativeNumbers:"allowNegativeNumbers",leadZeroDateTime:"leadZeroDateTime",leadZero:"leadZero",triggerOnMaskChange:"triggerOnMaskChange",apm:"apm",inputTransformFn:"inputTransformFn",outputTransformFn:"outputTransformFn",keepCharacterPositions:"keepCharacterPositions"},outputs:{maskFilled:"maskFilled"},exportAs:["mask","ngxMask"],features:[o.Jv_([{provide:P.kq,useExisting:(0,o.Rfq)(()=>I),multi:!0},{provide:P.cz,useExisting:(0,o.Rfq)(()=>I),multi:!0},S]),o.OA$]}),I})();function M(I,D){return D instanceof Function?{...I,...D()}:{...I,...D}}let R=(()=>{class I{static forRoot(p){return{ngModule:I,providers:[{provide:a,useValue:p},{provide:d,useValue:e},{provide:h,useFactory:M,deps:[d,a]},S]}}static forChild(){return{ngModule:I}}}return I.\u0275fac=function(p){return new(p||I)},I.\u0275mod=o.$C({type:I}),I.\u0275inj=o.G2t({}),I})()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.