1import{a as Ye,b as Ze,c as Qe,k as at,n as ot}from"./chunk-TV4TJWQZ.js";import{k as it}from"./chunk-STNFFWJM.js";import"./chunk-WZ4AZOOU.js";import"./chunk-5YVIAMO3.js";import{b as Xe}from"./chunk-WDX75O73.js";import{a as oe,e as Ke,f as Ge,g as Je,h as $e,i as et,m as tt}from"./chunk-ZM4G45VJ.js";import{a as ie}from"./chunk-VXXGCG3D.js";import{a as ae}from"./chunk-ZYG53WLM.js";import{b as V}from"./chunk-QAZFE7LR.js";import{$a as He,$b as Be,Aa as Ue,Da as N,H as Ee,Ha as B,Kb as xe,La as de,Mb as I,Na as X,Nb as _e,O as me,Oa as Y,Ob as De,Ta as f,U as ke,Ua as l,Ub as Ne,Va as c,Wa as x,Wb as ee,Y as P,_a as We,a as C,aa as h,b as F,ba as m,bb as W,db as g,f as y,fb as p,ha as z,i as Oe,ia as Ve,jb as ge,jc as te,kb as ue,lb as fe,nb as j,o as $,ob as q,oc as je,pc as qe,q as pe,qa as Ae,rb as v,sa as Fe,sb as Le,u as U,ua as u,wb as O,x as he,xb as E,yb as k}from"./chunk-DMOAUQEG.js";var xt=["wrapper"],_t=["sourceImage"];function Ct(n,e){if(n&1){let o=W();l(0,"img",5,0),g("load",function(){h(o);let a=p();return m(a.imageLoadedInView())})("mousedown",function(a){h(o);let i=p();return m(i.startMove(a,i.moveTypes.Drag))})("touchstart",function(a){h(o);let i=p();return m(i.startMove(a,i.moveTypes.Drag))})("error",function(a){h(o);let i=p();return m(i.loadImageError(a))}),c()}if(n&2){let o=e.ngIf,t=p();j("visibility",t.imageVisible?"visible":"hidden")("transform",t.safeTransformStyle()),q("ngx-ic-draggable",!t.disabled&&t.allowMoveImage),f("src",o,Ae),de("alt",t.imageAltText)}}function yt(n,e){if(n&1){let o=W();We(0),l(1,"span",9),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"topleft"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"topleft"))}),x(2,"span",10),c(),l(3,"span",11),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"topright"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"topright"))}),x(4,"span",10),c(),l(5,"span",12),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottomright"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottomright"))}),x(6,"span",10),c(),l(7,"span",13),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottomleft"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottomleft"))}),x(8,"span",10),c(),l(9,"span",14),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"top"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"top"))}),c(),l(10,"span",15),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"top"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"top"))}),x(11,"span",10),c(),l(12,"span",16),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"right"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"right"))}),c(),l(13,"span",17),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"right"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"right"))}),x(14,"span",10),c(),l(15,"span",18),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottom"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottom"))}),c(),l(16,"span",19),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottom"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"bottom"))}),x(17,"span",10),c(),l(18,"span",20),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"left"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"left"))}),c(),l(19,"span",21),g("mousedown",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"left"))})("touchstart",function(a){h(o);let i=p(2);return m(i.startMove(a,i.moveTypes.Resize,"left"))}),x(20,"span",10),c(),He()}}function Mt(n,e){if(n&1){let o=W();l(0,"div",6),g("keydown",function(a){h(o);let i=p();return m(i.keyboardAccess(a))}),l(1,"div",7),g("mousedown",function(a){h(o);let i=p();return m(i.startMove(a,i.moveTypes.Move))})("touchstart",function(a){h(o);let i=p();return m(i.startMove(a,i.moveTypes.Move))}),c(),B(2,yt,21,0,"ng-container",8),c()}if(n&2){let o=p();j("top",o.state.cropper().y1,"px")("left",o.state.cropper().x1,"px")("width",o.state.cropper().x2-o.state.cropper().x1,"px")("height",o.state.cropper().y2-o.state.cropper().y1,"px")("margin-left",o.state.options.alignImage==="center"?o.marginLeft:null)("visibility",o.imageVisible?"visible":"hidden"),q("ngx-ic-round",o.state.options.roundCropper),de("aria-label",o.state.options.cropperFrameAriaLabel),u(2),f("ngIf",!o.state.options.hideResizeSquares&&!(o.state.options.cropperStaticWidth&&o.state.options.cropperStaticHeight))}}function Z(n,e,o){return n=wt(n,e),ne(n,e,o)}function wt(n,e){let o=n.x2-n.x1,t=n.y2-n.y1,a=n.x1+o/2,i=n.y1+t/2;
1e.options.cropperStaticHeight&&e.options.cropperStaticWidth?(o=e.maxSize().width>e.options.cropperStaticWidth?e.options.cropperStaticWidth:e.maxSize().width,t=e.maxSize().height>e.options.cropperStaticHeight?e.options.cropperStaticHeight:e.maxSize().height):(o=Math.max(e.cropperScaledMinWidth,Math.min(o,e.cropperScaledMaxWidth,e.maxSize().width)),t=Math.max(e.cropperScaledMinHeight,Math.min(t,e.cropperScaledMaxHeight,e.maxSize().height)),e.options.maintainAspectRatio&&(e.maxSize().width/e.options.aspectRatio<e.maxSize().height?t=o/e.options.aspectRatio:o=t*e.options.aspectRatio));let s=a-o/2,r=s+o,d=i-t/2,_=d+t;return{x1:s,x2:r,y1:d,y2:_}}function ne(n,e,o=!1){return n.x1<0&&(n=F(C({},n),{x1:0,x2:n.x2-(o?n.x1:0)})),n.y1<0&&(n=F(C({},n),{y2:n.y2-(o?n.y1:0),y1:0})),n.x2>e.maxSize().width&&(n=F(C({},n),{x1:n.x1-(o?n.x2-e.maxSize().width:0),x2:e.maxSize().width})),n.y2>e.maxSize().height&&(n=F(C({},n),{y1:n.y1-(o?n.y2-e.maxSize().height:0),y2:e.maxSize().height})),n}function vt(n,e){let o=re(n)-e.clientX,t=se(n)-e.clientY;return{x1:e.cropper.x1+o,y1:e.cropper.y1+t,x2:e.cropper.x2+o,y2:e.cropper.y2+t}}function nt(n,e,o){let t=C({},o.cropper()),a=re(n)-e.clientX,i=se(n)-e.clientY;switch(e.position){case"left":t.x1=Math.min(Math.max(e.cropper.x1+a,t.x2-o.cropperScaledMaxWidth),t.x2-o.cropperScaledMinWidth);break;case"topleft":t.x1=Math.min(Math.max(e.cropper.x1+a,t.x2-o.cropperScaledMaxWidth),t.x2-o.cropperScaledMinWidth),t.y1=Math.min(Math.max(e.cropper.y1+i,t.y2-o.cropperScaledMaxHeight),t.y2-o.cropperScaledMinHeight);break;case"top":t.y1=Math.min(Math.max(e.cropper.y1+i,t.y2-o.cropperScaledMaxHeight),t.y2-o.cropperScaledMinHeight);break;case"topright":t.x2=Math.max(Math.min(e.cropper.x2+a,t.x1+o.cropperScaledMaxWidth),t.x1+o.cropperScaledMinWidth),t.y1=Math.min(Math.max(e.cropper.y1+i,t.y2-o.cropperScaledMaxHeight),t.y2-o.cropperScaledMinHeight);break;case"right":t.x2=Math.max(Math.min(e.cropper.x2+a,t.x1+o.cropperScaledMaxWidth),t.x1+o.cropperScaledMinWidth);break;case"bottomright":t.x2=Math.max(Math.min(e.cropper.x2+a,t.x1+o.cropperScaledMaxWidth),t.x1+o.cropperScaledMinWidth),t.y2=Math.max(Math.min(e.cropper.y2+i,t.y1+o.cropperScaledMaxHeight),t.y1+o.cropperScaledMinHeight);break;case"bottom":t.y2=Math.max(Math.min(e.cropper.y2+i,t.y1+o.cropperScaledMaxHeight),t.y1+o.cropperScaledMinHeight);break;case"bottomleft":t.x1=Math.min(Math.max(e.cropper.x1+a,t.x2-o.cropperScaledMaxWidth),t.x2-o.cropperScaledMinWidth),t.y2=Math.max(Math.min(e.cropper.y2+i,t.y1+o.cropperScaledMaxHeight),t.y1+o.cropperScaledMinHeight);break;case"center":let s="scale"in n?n.scale:1,r=Math.min(Math.max(o.cropperScaledMinWidth,Math.abs(e.cropper.x2-e.cropper.x1)*s),o.cropperScaledMaxWidth),d=Math.min(Math.max(o.cropperScaledMinHeight,Math.abs(e.cropper.y2-e.cropper.y1)*s),o.cropperScaledMaxHeight);t.x1=e.clientX-r/2,t.x2=e.clientX+r/2,t.y1=e.clientY-d/2,t.y2=e.clientY+d/2,t.x1<0?(t.x2-=t.x1,t.x1=0):t.x2>o.maxSize().width&&(t.x1-=t.x2-o.maxSize().width,t.x2=o.maxSize().width),t.y1<0?(t.y2-=t.y1,t.y1=0):t.y2>o.maxSize().height&&(t.y1-=t.y2-o.maxSize().height,t.y2=o.maxSize().height);break}return o.options.maintainAspectRatio?bt(e.position,t,o):t}function bt(n,e,o){e=C({},e);let t=0,a=0;switch(n){case"top":e.x2=e.x1+(e.y2-e.y1)*o.options.aspectRatio,t=Math.max(e.x2-o.maxSize().width,0),a=Math.max(0-e.y1,0),(t>0||a>0)&&(e.x2-=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y1+=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"bottom":e.x2=e.x1+(e.y2-e.y1)*o.options.aspectRatio,t=Math.max(e.x2-o.maxSize().width,0),a=Math.max(e.y2-o.maxSize().height,0),(t>0||a>0)&&(e.x2-=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y2-=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"topleft":e.y1=e.y2-(e.x2-e.x1)/o.options.aspectRatio,t=Math.max(0-e.x1,0),a=Math.max(0-e.y1,0),(t>0||a>0)&&(e.x1+=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y1+=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"topright":e.y1=e.y2-(e.x2-e.x1)/o.options.aspectRatio,t=Math.max(e.x2-o.maxSize().width,0),a=Math.max(0-e.y1,0),(t>0||a>0)&&(e.x2-=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y1+=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"right":case"bottomright":e.y2=e.y1+(e.x2-e.x1)/o.options.aspectRatio,t=Math.max(e.x2-o.maxSize().width,0),a=Math.max(e.y2-o.maxSize().height,0),(t>0||a>0)&&(e.x2-=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y2-=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"left":case"bottomleft":e.y2=e.y1+(e.x2-e.x1)/o.options.aspectRatio,t=Math.max(0-e.x1,0),a=Math.max(e.y2-o.maxSize().height,0),(t>0||a>0)&&(e.x1+=a*o.options.aspectRatio>t?a*o.options.aspectRatio:t,e.y2-=a*o.options.aspectRatio>t?a:t/o.options.aspectRatio);break;case"center":e.x2=e.x1+(e.y2-e.y1)*o.options.aspectRatio,e.y2=e.y1+(e.x2-e.x1)/o.options.aspectRatio;let i=Math.max(0-e.x1,0),s=Math.max(e.x2-o.maxSize().width,0),r=Math.max(e.y2-o.maxSize().height,0),d=Math.max(0-e.y1,0);(i>0||s>0||r>0||d>0)&&(e.x1+=r*o.options.aspectRatio>
1i?r*o.options.aspectRatio:i,e.x2-=d*o.options.aspectRatio>s?d*o.options.aspectRatio:s,e.y1+=d*o.options.aspectRatio>s?d:s/o.options.aspectRatio,e.y2-=r*o.options.aspectRatio>i?r:i/o.options.aspectRatio);break}return e}function re(n){return"touches"in n&&n.touches[0]?n.touches[0].clientX:"clientX"in n?n.clientX:0}function se(n){return"touches"in n&&n.touches[0]?n.touches[0].clientY:"clientX"in n?n.clientY:0}var Ce=class{constructor(){this.cropper=z({x1:0,x2:0,y1:0,y2:0}),this.maxSize=z({width:0,height:0}),this.transform={},this.options={format:"png",output:"blob",autoCrop:!0,maintainAspectRatio:!0,aspectRatio:1,resetCropOnAspectRatioChange:!0,resizeToWidth:0,resizeToHeight:0,cropperMinWidth:0,cropperMinHeight:0,cropperMaxHeight:0,cropperMaxWidth:0,cropperStaticWidth:0,cropperStaticHeight:0,canvasRotation:0,roundCropper:!1,onlyScaleDown:!1,imageQuality:92,backgroundColor:void 0,containWithinAspectRatio:!1,hideResizeSquares:!1,alignImage:"center",cropperFrameAriaLabel:void 0,checkImageType:!0},this.cropperScaledMinWidth=20,this.cropperScaledMinHeight=20,this.cropperScaledMaxWidth=20,this.cropperScaledMaxHeight=20,this.stepSize=3}setOptionsFromChanges(e){e.options?.currentValue&&this.setOptions(e.options.currentValue);let o=Object.entries(e).filter(([t])=>t in this.options).reduce((t,[a,i])=>F(C({},t),{[a]:i.currentValue}),{});Object.keys(o).length>0&&this.setOptions(o)}setOptions(e){if(this.options=C(C({},this.options),e||{}),this.validateOptions(),!this.loadedImage?.transformed.image.complete||!this.maxSize)return;let o=!1;this.options.maintainAspectRatio&&e.aspectRatio||"maintainAspectRatio"in e?(this.setCropperScaledMinSize(),this.setCropperScaledMaxSize(),this.options.maintainAspectRatio&&(this.options.resetCropOnAspectRatioChange||!this.aspectRatioIsCorrect())&&(this.cropper.set(this.maxSizeCropperPosition()),o=!0)):((e.cropperMinWidth||e.cropperMinHeight)&&(this.setCropperScaledMinSize(),o=!0),(e.cropperMaxWidth||e.cropperMaxHeight)&&(this.setCropperScaledMaxSize(),o=!0),(e.cropperStaticWidth||e.cropperStaticHeight)&&(o=!0)),o&&this.cropper.update(t=>Z(t,this,!1))}validateOptions(){if(this.options.maintainAspectRatio&&!this.options.aspectRatio)throw new Error("`aspectRatio` should > 0 when `maintainAspectRatio` is enabled")}setMaxSize(e,o){this.maxSize.set({width:e,height:o}),this.setCropperScaledMinSize(),this.setCropperScaledMaxSize()}setCropperScaledMinSize(){this.loadedImage?.transformed.size?(this.setCropperScaledMinWidth(),this.setCropperScaledMinHeight()):(this.cropperScaledMinWidth=20,this.cropperScaledMinHeight=20)}setCropperScaledMinWidth(){this.cropperScaledMinWidth=this.options.cropperMinWidth>0?Math.max(20,this.options.cropperMinWidth/this.loadedImage.transformed.size.width*this.maxSize().width):20}setCropperScaledMinHeight(){this.options.maintainAspectRatio?this.cropperScaledMinHeight=Math.max(20,this.cropperScaledMinWidth/this.options.aspectRatio):this.options.cropperMinHeight>0?this.cropperScaledMinHeight=Math.max(20,this.options.cropperMinHeight/this.loadedImage.transformed.size.height*this.maxSize().height):this.cropperScaledMinHeight=20}setCropperScaledMaxSize(){if(this.loadedImage?.transformed.size){let e=this.loadedImage.transformed.size.width/this.maxSize().width;this.cropperScaledMaxWidth=this.options.cropperMaxWidth>20?this.options.cropperMaxWidth/e:this.maxSize().width,this.cropperScaledMaxHeight=this.options.cropperMaxHeight>20?this.options.cropperMaxHeight/e:this.maxSize().height,this.options.maintainAspectRatio&&(this.cropperScaledMaxWidth>this.cropperScaledMaxHeight*this.options.aspectRatio?this.cropperScaledMaxWidth=this.cropperScaledMaxHeight*this.options.aspectRatio:this.cropperScaledMaxWidth<this.cropperScaledMaxHeight*this.options.aspectRatio&&(this.cropperScaledMaxHeight=this.cropperScaledMaxWidth/this.options.aspectRatio))}else this.cropperScaledMaxWidth=this.maxSize().width,this.cropperScaledMaxHeight=this.maxSize().height}equalsCropperPosition(e){let o=this.cropper();return o==null&&e==null||o!=null&&e!=null&&o.x1.toFixed(3)===e.x1.toFixed(3)&&o.y1.toFixed(3)===e.y1.toFixed(3)&&o.x2.toFixed(3)===e.x2.toFixed(3)&&o.y2.toFixed(3)===e.y2.toFixed(3)}equalsTransformTranslate(e){return(this.transform.translateH??0)===(e.translateH??0)&&(this.transform.translateV??0)===(e.translateV??0)}equalsTransform(e){return this.equalsTransformTranslate(e)&&(this.transform.scale??1)===(e.scale??1)&&(this.transform.rotate??0)===(e.rotate??0)&&(this.transform.flipH??!1)===(e.flipH??!1)&&(this.transform.flipV??!1)===(e.flipV??!1)}aspectRatioIsCorrect(){let e=this.cropper();return(e.x2-e.x1)/(e.y2-e.y1)===this.options.aspectRatio}resizeCropperPosition(e){(e.width!==this.maxSize().width||e.height!==this.maxSize().height)&&this.cropper.update(o=>({x1:o.x1*this.maxSize().width/e.width,x2:o.x2*this.maxSize().width/e.width,y1:o.y1*this.maxSize().height/e.he
1ight,y2:o.y2*this.maxSize().height/e.height}))}maxSizeCropperPosition(){return{x1:0,y1:0,x2:this.maxSize().width,y2:this.maxSize().height}}toCropInput(){return{cropper:this.cropper(),maxSize:this.maxSize(),transform:this.transform,loadedImage:this.loadedImage,options:C({},this.options)}}},b=(function(n){return n.Drag="drag",n.Move="move",n.Resize="resize",n.Pinch="pinch",n})(b||{});function zt(n,e,o){let t=n.width,a=n.height;e=Math.round(e),o=Math.round(o);let i=t/e,s=a/o,r=Math.ceil(i/2),d=Math.ceil(s/2),_=n.getContext("2d");if(_){let A=_.getImageData(0,0,t,a),S=_.createImageData(e,o),M=A.data,w=S.data;for(let R=0;R<o;R++)for(let H=0;H<e;H++){let Q=(H+R*e)*4,mt=R*s,T=0,K=0,be=0,ze=0,Ie=0,Se=0,Re=0,dt=Math.floor(H*i),gt=Math.floor(R*s),le=Math.ceil((H+1)*i),ce=Math.ceil((R+1)*s);le=Math.min(le,t),ce=Math.min(ce,a);for(let G=gt;G<ce;G++){let Te=Math.abs(mt-G)/d,ut=H*i,ft=Te*Te;for(let J=dt;J<le;J++){let Pe=Math.abs(ut-J)/r,L=Math.sqrt(ft+Pe*Pe);if(L>=1)continue;T=2*L*L*L-3*L*L+1;let D=4*(J+G*t);Re+=T*M[D+3],be+=T,M[D+3]<255&&(T=T*M[D+3]/250),ze+=T*M[D],Ie+=T*M[D+1],Se+=T*M[D+2],K+=T}}w[Q]=ze/K,w[Q+1]=Ie/K,w[Q+2]=Se/K,w[Q+3]=Re/be}n.width=e,n.height=o,_.putImageData(S,0,0)}}function rt(n,e){return n/100*e}var ye=class{crop(e,o){let t=this.getImagePosition(e),a=t.x2-t.x1,i=t.y2-t.y1,s=document.createElement("canvas");s.width=a,s.height=i;let r=s.getContext("2d");if(!r)return null;e.options?.backgroundColor!=null&&(r.fillStyle=e.options.backgroundColor,r.fillRect(0,0,a,i));let d=(e.transform?.scale||1)*(e.transform?.flipH?-1:1),_=(e.transform?.scale||1)*(e.transform?.flipV?-1:1),{translateH:A,translateV:S}=this.getCanvasTranslate(e),M=e.loadedImage.transformed;r.setTransform(d,0,0,_,M.size.width/2+A,M.size.height/2+S),r.translate(-t.x1/d,-t.y1/_),r.rotate((e.transform?.rotate||0)*Math.PI/180),r.drawImage(M.image,-M.size.width/2,-M.size.height/2);let w={width:a,height:i,imagePosition:t,cropperPosition:C({},e.cropper)};e.options?.containWithinAspectRatio&&(w.offsetImagePosition=this.getOffsetImagePosition(e));let R=this.getResizeRatio(a,i,e.options);return R!==1&&(w.width=Math.round(a*R),w.height=e.options?.maintainAspectRatio?Math.round(w.width/(e.options?.aspectRatio??1)):Math.round(i*R),zt(s,w.width,w.height)),o==="blob"?this.cropToBlob(w,s,e):(w.base64=s.toDataURL("image/"+(e.options?.format??"png"),this.getQuality(e.options)),w)}cropToBlob(e,o,t){return y(this,null,function*(){return e.blob=yield new Promise(a=>o.toBlob(a,"image/"+(t.options?.format??"png"),this.getQuality(t.options))),e.blob&&(e.objectUrl=URL.createObjectURL(e.blob)),e})}getCanvasTranslate(e){if(e.transform?.translateUnit==="px"){let o=this.getRatio(e);return{translateH:(e.transform?.translateH||0)*o,translateV:(e.transform?.translateV||0)*o}}else return{translateH:e.transform?.translateH?rt(e.transform.translateH,e.loadedImage.transformed.size.width):0,translateV:e.transform?.translateV?rt(e.transform.translateV,e.loadedImage.transformed.size.height):0}}getRatio(e){return e.loadedImage.transformed.size.width/e.maxSize.width}getImagePosition(e){let o=this.getRatio(e),t={x1:Math.round(e.cropper.x1*o),y1:Math.round(e.cropper.y1*o),x2:Math.round(e.cropper.x2*o),y2:Math.round(e.cropper.y2*o)};return e.options?.containWithinAspectRatio||(t.x1=Math.max(t.x1,0),t.y1=Math.max(t.y1,0),t.x2=Math.min(t.x2,e.loadedImage.transformed.size.width),t.y2=Math.min(t.y2,e.loadedImage.transformed.size.height)),t}getOffsetImagePosition(e){let o=(e.options?.canvasRotation??0)+e.loadedImage.exifTransform.rotate,t=this.getRatio(e),a,i;o%2?(a=(e.loadedImage.transformed.size.width-e.loadedImage.original.size.height)/2,i=(e.loadedImage.transformed.size.height-e.loadedImage.original.size.width)/2):(a=(e.loadedImage.transformed.size.width-e.loadedImage.original.size.width)/2,i=(e.loadedImage.transformed.size.height-e.loadedImage.original.size.height)/2);let s=e.cropper,r={x1:Math.round(s.x1*t)-a,y1:Math.round(s.y1*t)-i,x2:Math.round(s.x2*t)-a,y2:Math.round(s.y2*t)-i};return e.options?.containWithinAspectRatio||(r.x1=Math.max(r.x1,0),r.y1=Math.max(r.y1,0),r.x2=Math.min(r.x2,e.loadedImage.transformed.size.width),r.y2=Math.min(r.y2,e.loadedImage.transformed.size.height)),r}getResizeRatio(e,o,t){let a=new Array;t?.resizeToWidth&&t.resizeToWidth>0&&a.push(t.resizeToWidth/e),t?.resizeToHeight&&t.resizeToHeight>0&&a.push(t.resizeToHeight/o);let i=a.length===0?1:Math.min(...a);return i>1&&!t?.onlyScaleDown?i:Math.min(i,1)}getQuality(e){return Math.min(1,Math.max(0,(e?.imageQuality??92)/100))}},It=[new Uint8Array([255,216,255,225,0,34,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,1,1,18,0,3,0,0,0,1,0,6,0,0,0,0,0,0,255,219,0,132,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255,192,0,17,8,0,1,0,2,3,1,17,0,2,17,1,3,17,1,255,196,0,74,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,16,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,218,0,12,3,1,0,2,17,3,17,0,63,0,63,240,127,255,217])],St=URL.createObjectURL(new Blob(It,{type:"image/jpeg"}));function Rt(){return new Promise(n=>{let e=new Image;e.onload=()=>{let o=e.width===1&&e.height===2;n(o)},e.src=St})}function Tt(n){switch(typeof n=="object"&&(n=Pt(n)),n){case 2:return{rotate:0,flip:!0};case 3:return{rotate:2,flip:!1};case 4:return{rotate:2,flip:!0};case 5:return{rotate:1,flip:!0};case 6:return{rotate:1,flip:!1};case 7:return{rotate:3,flip:!0};case 8:return{rotate:3,flip:!1};default:return{rotate:0,flip:!1}}}function Pt(n){let e=new DataView(n);if(e.getUint16(0,!1)!==65496)return-2;let o=e.byteLength,t=2;for(;t<o;){if(e.getUint16(t+2,!1)<=8)return-1;let a=e.getUint16(t,!1);if(t+=2,a==65505){if(e.getUint32(t+=2,!1)!==1165519206)return-1;let i=e.getUint16(t+=6,!1)==18761;t+=e.getUint32(t+4,i);let s=e.getUint16(t,i);t+=2;
1for(let r=0;r<s;r++)if(e.getUint16(t+r*12,i)==274)return e.getUint16(t+r*12+8,i)}else{if((a&65280)!==65280)break;t+=e.getUint16(t,!1)}}return-1}var Me=class{constructor(){this.autoRotateSupported=Rt()}loadImageFile(e,o){return y(this,null,function*(){let t=yield e.arrayBuffer();return o.checkImageType?yield this.checkImageTypeAndLoadImageFromArrayBuffer(t,e.type,o):yield this.loadImageFromArrayBuffer(t,o)})}checkImageTypeAndLoadImageFromArrayBuffer(e,o,t){return this.isValidImageType(o)?this.loadImageFromArrayBuffer(e,t,o):Promise.reject(new Error("Invalid image type"))}isValidImageType(e){return/image\/(png|jpg|jpeg|heic|bmp|gif|tiff|svg|webp|x-icon|vnd.microsoft.icon|avif)/.test(e)}loadImageFromURL(e,o){return y(this,null,function*(){let a=yield(yield fetch(e)).blob(),i=yield a.arrayBuffer();return yield this.loadImageFromArrayBuffer(i,o,a.type)})}loadBase64Image(e,o){let t=this.base64ToArrayBuffer(e);return this.loadImageFromArrayBuffer(t,o)}base64ToArrayBuffer(e){e=e.replace(/^data:([^;]+);base64,/gmi,"");let o=atob(e),t=o.length,a=new Uint8Array(t);for(let i=0;i<t;i++)a[i]=o.charCodeAt(i);return a.buffer}loadImageFromArrayBuffer(e,o,t){return y(this,null,function*(){let a=yield new Promise((i,s)=>y(this,null,function*(){try{let r=new Blob([e],t?{type:t}:void 0),d=URL.createObjectURL(r),_=new Image,S=t==="image/svg+xml"?yield this.getSvgImageSize(r):void 0;_.onload=()=>i({originalImage:_,originalImageSize:S,originalObjectUrl:d,originalArrayBuffer:e}),_.onerror=s,_.src=d}catch(r){s(r)}}));return yield this.transformImageFromArrayBuffer(a,o,a.originalImageSize!=null)})}getSvgImageSize(e){return y(this,null,function*(){let a=new DOMParser().parseFromString(yield e.text(),"image/svg+xml").querySelector("svg");if(!a)throw Error("Failed to parse SVG image");let i=a.getAttribute("width"),s=a.getAttribute("height");if(i&&s)return null;let r=a.getAttribute("viewBox")||a.getAttribute("viewbox");if(r){let d=r.split(" ");return{width:+d[2],height:+d[3]}}throw Error("Failed to load SVG image. SVG must have width + height or viewBox definition.")})}transformImageFromArrayBuffer(e,o,t=!1){return y(this,null,function*(){let a=yield this.autoRotateSupported,i=Tt(a?-1:e.originalArrayBuffer);if(!e.originalImage||!e.originalImage.complete)return Promise.reject(new Error("No image loaded"));let s={original:{objectUrl:e.originalObjectUrl,image:e.originalImage,size:e.originalImageSize??{width:e.originalImage.naturalWidth,height:e.originalImage.naturalHeight}},exifTransform:i};return this.transformLoadedImage(s,o,t)})}transformLoadedImage(e,o,t=!1){return y(this,null,function*(){let a=(o.canvasRotation??0)+e.exifTransform.rotate,i=e.original.size;if(!t&&a===0&&!e.exifTransform.flip&&!o.containWithinAspectRatio)return{original:{objectUrl:e.original.objectUrl,image:e.original.image,size:C({},i)},transformed:{objectUrl:e.original.objectUrl,image:e.original.image,size:C({},i)},exifTransform:e.exifTransform};let s=this.getTransformedSize(i,e.exifTransform,o),r=document.createElement("canvas");r.width=s.width,r.height=s.height;let d=r.getContext("2d");d?.setTransform(e.exifTransform.flip?-1:1,0,0,1,r.width/2,r.height/2),d?.rotate(Math.PI*(a/2)),d?.drawImage(e.original.image,-i.width/2,-i.height/2);let _=yield new Promise(M=>r.toBlob(M,"image/"+(o.format??"png")));if(!_)throw new Error("Failed to get Blob for transformed image.");let A=URL.createObjectURL(_),S=yield this.loadImageFromObjectUrl(A);return{original:{objectUrl:e.original.objectUrl,image:e.original.image,size:C({},i)},transformed:{objectUrl:A,image:S,size:{width:S.width,height:S.height}},exifTransform:e.exifTransform}})}loadImageFromObjectUrl(e){return new Promise((o,t)=>{let a=new Image;a.onload=()=>o(a),a.onerror=t,a.src=e})}getTransformedSize(e,o,t){let a=(t.canvasRotation??0)+o.rotate;if(t.containWithinAspectRatio)if(a%2){let i=e.width*(t.aspectRatio??1),s=e.height/(t.aspectRatio??1);return{width:Math.max(e.height,i),height:Math.max(e.width,s)}}else{let i=e.height*(t.aspectRatio??1),s=e.width/(t.aspectRatio??1);return{width:Math.max(e.width,i),height:Math.max(e.height,s)}}return a%2?{height:e.width,width:e.height}:{width:e.width,height:e.height}}};function Ot(n){switch(n){case"ArrowUp":return"top";case"ArrowRight":return"right";case"ArrowDown":return"bottom";case"ArrowLeft":default:return"left"}}function Et(n){switch(n){case"ArrowUp":return"bottom";case"ArrowRight":return"left";case"ArrowDown":return"top";case"ArrowLeft":default:return"right"}}function kt(n,e){switch(n){case"ArrowUp":return{clientX:0,clientY:e*-1};case"ArrowRight":return{clientX:e,clientY:0};case"ArrowDown":return{clientX:0,clientY:e};case"ArrowLeft":default:return{clientX:e*-1,clientY:0}}}var st=(()=>{let e=class e{get alignImageStyle(){return this.state.options.alignImage}constructor(t){this.sanitizer=t,this.pinchStart$=new Oe,this.cropService=new ye,this.loadImageService=new Me,this.setImageMaxSizeRetries=0,this.resizedWhileHidden=!1,this.moveTypes=b,this.state=new Ce,this.safeImgDataUrl=z(void 0),this.safeTransformStyle=z(void 0),this.marginLeft="0px",this.imageVisible=!1,this.allowMoveImage=!1,this.checkImageType=!0,this.disabled=!1,this.hidden=!1,this.imageCropped=I(),this.startCropImage=I(),this.imageLoaded=I(),this.cropperReady=I(),this.loadImageFailed=I(),this.transformChange=I(),this.cropperChange=I(),this.reset()}ngOnInit(){this.state.stepSize=this.initialStepSize||this.state.stepSize}ngOnChanges(t){let a=this.state.cropper(),i=this.state.transform,s=this.state.options.backgroundColor;if(this.state.setOptionsFromChanges(t),this.onChangesInputImage(t),t.transform&&this.transform&&(this.state.transform=this.transform,this.setCssTransform()),!this.state.loadedImage?.transformed.image.complete||!this.state.maxSize)return;if(this.containWithinAspectRatio&&t.aspectRatio||t.containWithinAspectRatio||t.canvasRotation){this.loadImageService.transformLoadedImage(this.state.loadedImage,this.state.options).then(d=>this.setLoadedImage(d)).catch(d=>this.loadImageError(d));return}t.cropper&&this.cropper&&this.state.cropper.set(Z(this.cropper,this.state,!0));let r=!this.state.equalsCropperPosition(a);r&&(!this.cropper||!this.state.equalsCropperPosition(this.cropper))&&this.cropperChange.emit(this.state.cropper()),(r||!this.state.equalsTransform(i)||this.state.options.backgroundColor!==s)&&this.doAutoCrop(),t.hidden&&this.resizedWhileHidden&&!this.hidden&&setTimeout(()=>{this.onResize(),this.resizedWhileHidden=!1})}onChangesInputImage(t){(t.imageChangedEvent||t.imageURL||t.imageBase64||t.imageFile)&&this.reset(),t.imageChangedEvent&&this.isValidImageChangedEvent()&&this.loadImageFile(this.imageChangedEvent.target.files[0]),t.imageURL&&this.imageURL&&this.loadImageFromURL(this.imageURL),t.imageBase64&&this.imageBase64&&this.loadBase64Image(this.imageBase64),t.imageFile&&this.imageFile&&this.loadImageFile(this.imageFile)}isValidImageChangedEvent(){let t=this.imageChangedEvent?.target?.files;return t instanceof FileList&&t.length>0}reset(){this.state.loadedImage=void 0,this.state.maxSize.set({width:0,height:0}),this.imageVisible=!1}loadImageFile(t){this.loadImageService.loadImageFile(t,this.state.options).then(a=>
1this.setLoadedImage(a)).catch(a=>this.loadImageError(a))}loadBase64Image(t){this.loadImageService.loadBase64Image(t,this.state.options).then(a=>this.setLoadedImage(a)).catch(a=>this.loadImageError(a))}loadImageFromURL(t){this.loadImageService.loadImageFromURL(t,this.state.options).then(a=>this.setLoadedImage(a)).catch(a=>this.loadImageError(a))}setLoadedImage(t){this.state.loadedImage=t,this.safeImgDataUrl.set(this.sanitizer.bypassSecurityTrustResourceUrl(t.transformed.objectUrl))}loadImageError(t){console.error(t),this.loadImageFailed.emit()}setCssTransform(){let t=this.state.transform?.translateUnit||"%";this.safeTransformStyle.set(this.sanitizer.bypassSecurityTrustStyle(`translate(${this.state.transform.translateH||0}${t}, ${this.state.transform.translateV||0}${t}) scaleX(`+(this.state.transform.scale||1)*(this.state.transform.flipH?-1:1)+") scaleY("+(this.state.transform.scale||1)*(this.state.transform.flipV?-1:1)+") rotate("+(this.state.transform.rotate||0)+"deg)"))}imageLoadedInView(){this.state.loadedImage!=null&&(this.imageLoaded.emit(this.state.loadedImage),this.setImageMaxSizeRetries=0,setTimeout(()=>this.checkImageMaxSizeRecursively()))}checkImageMaxSizeRecursively(){this.setImageMaxSizeRetries>40?this.loadImageFailed.emit():this.sourceImageLoaded()?(this.setMaxSize(),this.cropper&&(!this.maintainAspectRatio||this.state.aspectRatioIsCorrect())?(this.state.cropper.set(Z(this.cropper,this.state,!0)),this.emitCropperPositionChange(this.cropper)):(this.state.cropper.set(Z(this.state.maxSizeCropperPosition(),this.state,!0)),this.cropperChange.emit(this.state.cropper())),this.imageVisible=!0,this.cropperReady.emit(this.state.maxSize()),this.doAutoCrop()):(this.setImageMaxSizeRetries++,setTimeout(()=>this.checkImageMaxSizeRecursively(),50))}sourceImageLoaded(){return this.sourceImage?.nativeElement?.offsetWidth>1}onResize(){if(this.state.loadedImage)if(this.hidden)this.resizedWhileHidden=!0;else{let t=this.state.maxSize();this.setMaxSize(),this.state.resizeCropperPosition(t)}}keyboardAccess(t){this.changeKeyboardStepSize(t),this.keyboardMoveCropper(t)}changeKeyboardStepSize(t){let a=+t.key;a>=1&&a<=9&&(this.state.stepSize=a)}keyboardMoveCropper(t){if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(t.key))return;let i=t.shiftKey?b.Resize:b.Move,s=t.altKey?Et(t.key):Ot(t.key),r=kt(t.key,this.state.stepSize);t.preventDefault(),t.stopPropagation(),this.moveStart={type:i,position:s,clientX:0,clientY:0,transform:this.state.transform,cropper:this.state.cropper()},this.handleMouseMove(r),this.handleMouseUp()}startMove(t,a,i=null){this.disabled||this.moveStart&&this.moveStart.type===b.Pinch||a===b.Drag&&!this.allowMoveImage||("preventDefault"in t&&t.preventDefault(),this.moveStart={type:a,position:i,clientX:re(t),clientY:se(t),transform:this.state.transform,cropper:this.state.cropper()},this.initMouseMove())}initMouseMove(){he(U(document,"mousemove"),U(document,"touchmove")).pipe(me(he(U(document,"mouseup"),U(document,"touchend"),this.pinchStart$).pipe(Ee()))).subscribe({next:t=>this.handleMouseMove(t),complete:()=>this.handleMouseUp()})}handleMouseMove(t){if(this.moveStart){if("stopPropagation"in t&&t.stopPropagation(),"preventDefault"in t&&t.preventDefault(),this.moveStart.type===b.Move)this.state.cropper.set(ne(vt(t,this.moveStart),this.state,!0));else if(this.moveStart.type===b.Resize)!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(ne(nt(t,this.moveStart,this.state),this.state,!1));else if(this.moveStart.type===b.Drag){let a=re(t)-this.moveStart.clientX,i=se(t)-this.moveStart.clientY;this.state.transform=F(C({},this.state.transform),{translateH:(this.moveStart.transform?.translateH||0)+a,translateV:(this.moveStart.transform?.translateV||0)+i}),this.setCssTransform()}}}handleMouseUp(){!this.moveStart||this.moveStart.type===b.Pinch||((!this.state.equalsCropperPosition(this.moveStart.cropper)||this.moveStart.transform&&!this.state.equalsTransform(this.moveStart.transform))&&(this.moveStart.type===b.Drag?this.transformChange.emit(this.state.transform):this.cropperChange.emit(this.state.cropper()),this.doAutoCrop()),this.moveStart=void 0)}startPinch(t){if(this.disabled||!this.sourceImageLoaded()||t.touches.length<2)return;"preventDefault"in t&&t.preventDefault();let a=this.state.cropper();this.moveStart={type:b.Pinch,position:"center",clientX:a.x1+(a.x2-a.x1)/2,clientY:a.y1+(a.y2-a.y1)/2,cropper:a},this.initPinch()}initPinch(){this.pinchStart$.next(),U(document,"touchmove").pipe(me(U(document,"touchend"))).subscribe({next:t=>
1this.handlePinchMove(t),complete:()=>this.handlePinchStop()})}handlePinchMove(t){this.moveStart&&(t.preventDefault&&t.preventDefault(),this.moveStart.type===b.Pinch&&!this.cropperStaticWidth&&!this.cropperStaticHeight&&this.state.cropper.set(ne(nt(t,this.moveStart,this.state),this.state,!1)))}handlePinchStop(){this.moveStart&&(this.state.equalsCropperPosition(this.moveStart.cropper)||(this.emitCropperPositionChange(this.moveStart.cropper),this.doAutoCrop()),this.moveStart=void 0)}setMaxSize(){if(this.sourceImage){let t=getComputedStyle(this.sourceImage.nativeElement);this.state.setMaxSize(parseFloat(t.width),parseFloat(t.height)),this.marginLeft=this.sanitizer.bypassSecurityTrustStyle("calc(50% - "+this.state.maxSize().width/2+"px)")}}emitCropperPositionChange(t){this.state.equalsCropperPosition(t)||this.cropperChange.emit(this.state.cropper())}doAutoCrop(){this.state.options.autoCrop&&this.crop()}crop(t=this.state.options.output){if(this.state.loadedImage?.transformed?.image!=null){if(this.startCropImage.emit(),t==="blob")return this.cropToBlob();if(t==="base64")return this.cropToBase64()}return null}cropToBlob(){return new Promise((t,a)=>y(this,null,function*(){let i=yield this.cropService.crop(this.state.toCropInput(),"blob");i?(this.imageCropped.emit(i),t(i)):a("Crop image failed")}))}cropToBase64(){let t=this.cropService.crop(this.state.toCropInput(),"base64");return t?(this.imageCropped.emit(t),t):null}resetCropperPosition(){this.state.cropper.set(Z(this.state.maxSizeCropperPosition(),this.state,!0)),this.cropperChange.emit(this.state.cropper())}ngOnDestroy(){this.pinchStart$.complete()}};e.\u0275fac=function(a){return new(a||e)(Ue(qe))},e.\u0275cmp=N({type:e,selectors:[["image-cropper"]],viewQuery:function(a,i){if(a&1&&(ge(xt,7),ge(_t,5)),a&2){let s;ue(s=fe())&&(i.wrapper=s.first),ue(s=fe())&&(i.sourceImage=s.first)}},hostVars:6,hostBindings:function(a,i){a&1&&g("resize",function(){return i.onResize()},Fe),a&2&&(j("text-align",i.alignImageStyle),q("disabled",i.disabled)("ngx-ic-hidden",i.hidden))},inputs:{imageChangedEvent:"imageChangedEvent",imageURL:"imageURL",imageBase64:"imageBase64",imageFile:"imageFile",imageAltText:"imageAltText",options:"options",cropperFrameAriaLabel:"cropperFrameAriaLabel",output:"output",format:"format",autoCrop:"autoCrop",cropper:"cropper",transform:"transform",maintainAspectRatio:"maintainAspectRatio",aspectRatio:"aspectRatio",resetCropOnAspectRatioChange:"resetCropOnAspectRatioChange",resizeToWidth:"resizeToWidth",resizeToHeight:"resizeToHeight",cropperMinWidth:"cropperMinWidth",cropperMinHeight:"cropperMinHeight",cropperMaxHeight:"cropperMaxHeight",cropperMaxWidth:"cropperMaxWidth",cropperStaticWidth:"cropperStaticWidth",cropperStaticHeight:"cropperStaticHeight",canvasRotation:"canvasRotation",initialStepSize:"initialStepSize",roundCropper:"roundCropper",onlyScaleDown:"onlyScaleDown",imageQuality:"imageQuality",backgroundColor:"backgroundColor",containWithinAspectRatio:"containWithinAspectRatio",hideResizeSquares:"hideResizeSquares",allowMoveImage:"allowMoveImage",checkImageType:"checkImageType",alignImage:"alignImage",disabled:"disabled",hidden:"hidden"},outputs:{imageCropped:"imageCropped",startCropImage:"startCropImage",imageLoaded:"imageLoaded",cropperReady:"cropperReady",loadImageFailed:"loadImageFailed",transformChange:"transformChange",cropperChange:"cropperChange"},features:[Ve],decls:4,vars:10,consts:[["sourceImage",""],[3,"touchstart"],["class","ngx-ic-source-image","role","presentation",3,"src","visibility","transform","ngx-ic-draggable","load","mousedown","touchstart","error",4,"ngIf"],[1,"ngx-ic-overlay"],["class","ngx-ic-cropper","tabindex","0",3,"ngx-ic-round","top","left","width","height","margin-left","visibility","keydown",4,"ngIf"],["role","presentation",1,"ngx-ic-source-image",3,"load","mousedown","touchstart","error","src"],["tabindex","0",1,"ngx-ic-cropper",3,"keydown"],["role","presentation",1,"ngx-ic-move",3,"mousedown","touchstart"],[4,"ngIf"],["role","presentation",1,"ngx-ic-resize","ngx-ic-topleft",3,"mousedown","touchstart"],[1,"ngx-ic-square"],["role","presentation",1,"ngx-ic-resize","ngx-ic-topright",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize","ngx-ic-bottomright",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize","ngx-ic-bottomleft",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-top",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-top",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-right",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-right",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-bottom",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-bottom",3,"mousedown","touchstart"],["role","presentation",1,"ngx-ic-resize-bar","ngx-ic-left",3,"mousedown","touchstart"],[1,"ngx-ic-resize","ngx-ic-left",3,"mousedown","touchstart"]],template:function(a,i){a&1&&(l(0,"div",1),g("touchstart",function(r){return i.startPinch(r)}),B(1,Ct,2,8,"img",2),x(2,"div",3),B(3,Mt,3,16,"div",4),c()),a&2&&(j("background",i.imageVisible&&i.state.options.backgroundColor),u(),f("ngIf",i.safeImgDataUrl()),u(),j("width",i.state.maxSize().width||0,"px")("height",i.state.maxSize().height||0,"px")("margin-left",i.state.options.alignImage==="center"?i.marginLeft:null),u(),f("ngIf",i.imageVisible))},dependencies:[ee],styles:['[_nghost-%COMP%]{display:flex;position:relative;width:100%;max-width:100%;max-height:100%;overflow:hidden;padding:5px;text-align:center}[_nghost-%COMP%] > div[_ngcontent-%COMP%]{width:100%;position:relative}[_nghost-%COMP%] > div[_ngcontent-%COMP%] img.ngx-ic-source-image[_ngcontent-%COMP%]{display:inline;max-width:100%;max-height:100%;transform-origin:center}[_nghost-%COMP%] > div[_ngcontent-%COMP%] img.ngx-ic-source-image.ngx-ic-draggable[_ngcontent-%COMP%]{user-drag:none;-webkit-user-drag:none;user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;cursor:grab}[_nghost-%COMP%] .ngx-ic-overlay[_ngcontent-%COMP%]{position:absolute;pointer-events:none;touch-action:none;
1outline:var(--cropper-overlay-color, white) solid 100vw;top:0;left:0}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]{position:absolute;display:flex;color:var(--cropper-color, #53535C);background:transparent;outline:var(--cropper-outline-color, rgba(255, 255, 255, .3)) solid 100vw;touch-action:none}@media (orientation: portrait){[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]{outline-width:100vh}}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:after{position:absolute;content:"";inset:0;pointer-events:none;border:dashed 1px;opacity:.75;color:inherit;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{width:100%;cursor:move;border:var(--cropper-border, 1px solid rgba(255, 255, 255, .5))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:hover .ngx-ic-move[_ngcontent-%COMP%]{border:var(--cropper-hover-border, var(--cropper-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:focus .ngx-ic-move[_ngcontent-%COMP%]{border:var(--cropper-focus-border, 2px solid dodgerblue)}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%]:focus .ngx-ic-resize[_ngcontent-%COMP%] .ngx-ic-square[_ngcontent-%COMP%]{background:var(--cropper-resize-square-focus-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-focus-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%]{position:absolute;display:inline-block;line-height:6px;padding:8px;opacity:.85;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%] .ngx-ic-square[_ngcontent-%COMP%]{display:inline-block;width:6px;height:6px;box-sizing:content-box;background:var(--cropper-resize-square-bg, #53535C);border:var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%]:hover .ngx-ic-square[_ngcontent-%COMP%]{background:var(--cropper-resize-square-hover-bg, var(--cropper-resize-square-bg, #53535C));border:var(--cropper-resize-square-hover-border, var(--cropper-resize-square-border, 1px solid rgba(255, 255, 255, .5)))}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-topleft[_ngcontent-%COMP%]{top:-12px;left:-12px;cursor:nwse-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-top[_ngcontent-%COMP%]{top:-12px;left:calc(50% - 12px);cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-topright[_ngcontent-%COMP%]{top:-12px;right:-12px;cursor:nesw-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-right[_ngcontent-%COMP%]{top:calc(50% - 12px);right:-12px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottomright[_ngcontent-%COMP%]{bottom:-12px;right:-12px;cursor:nwse-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottom[_ngcontent-%COMP%]{bottom:-12px;left:calc(50% - 12px);cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-bottomleft[_ngcontent-%COMP%]{bottom:-12px;left:-12px;cursor:nesw-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize.ngx-ic-left[_ngcontent-%COMP%]{top:calc(50% - 12px);left:-12px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar[_ngcontent-%COMP%]{position:absolute;z-index:1}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-top[_ngcontent-%COMP%]{top:-11px;left:11px;width:calc(100% - 22px);height:22px;cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-right[_ngcontent-%COMP%]{top:11px;right:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-bottom[_ngcontent-%COMP%]{bottom:-11px;left:11px;width:calc(100% - 22px);height:22px;
1cursor:ns-resize}[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar.ngx-ic-left[_ngcontent-%COMP%]{top:11px;left:-11px;height:calc(100% - 22px);width:22px;cursor:ew-resize}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]{outline-color:transparent}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]:after{border-radius:100%;box-shadow:0 0 0 100vw var(--cropper-outline-color, rgba(255, 255, 255, .3))}@media (orientation: portrait){[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%]:after{box-shadow:0 0 0 100vh var(--cropper-outline-color, rgba(255, 255, 255, .3))}}[_nghost-%COMP%] .ngx-ic-cropper.ngx-ic-round[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{border-radius:100%}.disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize[_ngcontent-%COMP%], .disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-resize-bar[_ngcontent-%COMP%], .disabled[_nghost-%COMP%] .ngx-ic-cropper[_ngcontent-%COMP%] .ngx-ic-move[_ngcontent-%COMP%]{display:none}.ngx-ic-hidden[_nghost-%COMP%]{display:none}'],changeDetection:0});let n=e;return n})();function Vt(n,e){n&1&&(l(0,"p",9),v(1," Nu am putut \xEEnc\u0103rca imaginea. \xCEncearc\u0103 un alt fi\u0219ier. "),c())}var lt=1,ct=3,ve=.1,pt=(()=>{let e=class e{constructor(){this.file=_e.required(),this.saving=_e(!1),this.save=I(),this.cancelled=I(),this.minZoom=lt,this.maxZoom=ct,this.zoomStep=ve,this.scale=z(1),this.ready=z(!1),this.loadError=z(!1),this.transform=xe(()=>({scale:this.scale()})),this.croppedBlob=null,this.canSave=xe(()=>
1this.ready()&&!this.loadError())}onImageCropped(t){this.croppedBlob=t.blob??null}onCropperReady(){this.ready.set(!0)}onLoadFailed(){this.loadError.set(!0)}onZoomInput(t){this.setZoom(Number(t))}zoomIn(){this.setZoom(this.scale()+ve)}zoomOut(){this.setZoom(this.scale()-ve)}confirm(){!this.croppedBlob||!this.canSave()||this.saving()||this.save.emit(this.croppedBlob)}cancel(){this.saving()||this.cancelled.emit()}setZoom(t){let a=Math.min(ct,Math.max(lt,Number(t.toFixed(2))));this.scale.set(a)}};e.\u0275fac=function(a){return new(a||e)},e.\u0275cmp=N({type:e,selectors:[["app-avatar-upload-modal"]],inputs:{file:[1,"file"],saving:[1,"saving"]},outputs:{save:"save",cancelled:"cancelled"},decls:25,vars:23,consts:[["role","dialog","aria-modal","true","aria-label","Editeaz\u0103 fotografia de profil","cdkTrapFocus","",1,"fixed","inset-0","z-1000","flex","items-center","justify-center","p-4",3,"cdkTrapFocusAutoCapture"],["type","button","aria-label","\xCEnchide",1,"absolute","inset-0","bg-black/50",3,"click"],[1,"relative","z-10","flex","max-h-[calc(100dvh-2rem)]","w-full","max-w-md","flex-col","gap-3","overflow-hidden","rounded-2xl","bg-cFFFFFA","p-4","shadow-xl","sm:p-5","md:p-6"],[1,"flex","shrink-0","items-start","justify-between","gap-3"],[1,"min-w-0"],[1,"font-onest","text-base","font-semibold","text-gray-900"],[1,"mt-1","font-onest","text-xs","text-gray-500"],["type","button","aria-label","\xCEnchide",1,"shrink-0","rounded-full","p-1","text-gray-400","hover:text-gray-600",3,"click","disabled"],["name","x-mark","type","outline",1,"h-5","w-5"],[1,"shrink-0","font-onest","text-sm","text-red-600"],[1,"avatar-cropper-shell","min-h-0","flex-1","overflow-hidden","rounded-xl","bg-gray-900/5"],["output","blob","format","png",1,"avatar-cropper","block","h-full","w-full",3,"imageCropped","cropperReady","loadImageFailed","imageFile","maintainAspectRatio","aspectRatio","roundCropper","resizeToWidth","onlyScaleDown","transform","backgroundColor"],[1,"flex","shrink-0","items-center","gap-3"],["type","button","aria-label","Mic\u0219oreaz\u0103",1,"rounded-full","p-2","text-gray-500","hover:text-gray-800","disabled:opacity-40",3,"click","disabled"],["name","minus","type","outline",1,"h-4","w-4"],["type","range","aria-label","Nivel de zoom",1,"h-1","flex-1","cursor-pointer","accent-gray-900",3,"input","min","max","step","value","disabled"],["type","button","aria-label","M\u0103re\u0219te",1,"rounded-full","p-2","text-gray-500","hover:text-gray-800","disabled:opacity-40",3,"click","disabled"],["name","plus","type","outline",1,"h-4","w-4"],[1,"flex","shrink-0","flex-row","gap-2"],[1,"min-w-0","flex-1"],["type","button","variant","secondary","color","gray","size","md","label","Anuleaz\u0103",1,"w-full",3,"click","rounded","disabled"],["type","button","variant","primary","color","gray","size","md",1,"w-full",3,"click","rounded","label","disabled"]],template:function(a,i){a&1&&(l(0,"div",0)(1,"button",1),g("click",function(){return i.cancel()}),c(),l(2,"div",2)(3,"div",3)(4,"div",4)(5,"h2",5),v(6,"Fotografie profil"),c(),l(7,"p",6),v(8," Pozi\u021Bioneaz\u0103 \u0219i m\u0103re\u0219te imaginea, apoi salveaz\u0103. "),c()(),l(9,"button",7),g("click",function(){return i.cancel()}),x(10,"app-icon",8),c()(),X(11,Vt,2,0,"p",9),l(12,"div",10)(13,"image-cropper",11),g("imageCropped",function(r){return i.onImageCropped(r)})("cropperReady",function(){return i.onCropperReady()})("loadImageFailed",function(){return i.onLoadFailed()}),c()(),l(14,"div",12)(15,"button",13),g("click",function(){return i.zoomOut()}),x(16,"app-icon",14),c(),l(17,"input",15),g("input",function(r){return i.onZoomInput(r.target.value)}),c(),l(18,"button",16),g("click",function(){return i.zoomIn()}),x(19,"app-icon",17),c()(),l(20,"div",18)(21,"div",19)(22,"app-button",20),g("click",function(){return i.cancel()}),c()(),l(23,"div",19)(24,"app-button",21),g("click",function(){return i.confirm()}),c()()()()()),a&2&&(f("cdkTrapFocusAutoCapture",!0),u(9),f("disabled",i.saving()),u(2),Y(i.loadError()?11:-1),u(2),f("imageFile",i.file())("maintainAspectRatio",!0)("aspectRatio",1)("roundCropper",!0)("resizeToWidth",512)("onlyScaleDown",!0)("transform",i.transform())("backgroundColor","#ffffff"),u(2),f("disabled",!i.canSave()||i.scale()<=i.minZoom||i.saving()),u(2),f("min",i.minZoom)("max",i.maxZoom)("step",i.zoomStep)("value",i.scale())("disabled",!i.canSave()||i.saving()),u(),f("disabled",!i.canSave()||i.scale()>=i.maxZoom||i.saving()),u(4),f("rounded",!0)("disabled",i.saving()),u(2),f("rounded",!0)("label",i.saving()?"Se salveaz\u0103...":"Salveaz\u0103")("disabled",!i.canSave()||i.saving()))},dependencies:[Ze,Ye,st,oe,ae],styles:["[_nghost-%COMP%]{display:contents}.avatar-cropper-shell[_ngcontent-%COMP%]{max-height:min(42dvh,20rem)}.avatar-cropper-shell[_ngcontent-%COMP%] image-cropper, .avatar-cropper-shell[_ngcontent-%COMP%] .cropper, .avatar-cropper-shell[_ngcontent-%COMP%] .source-image{max-height:min(42dvh,20rem)!important}.avatar-cropper-shell[_ngcontent-%COMP%] .cropper{max-width:100%}"],changeDetection:0});let n=e;return n})();var ht=(()=>{let e=class e{constructor(){this.httpClient=P(te)}upload(t){let a=new FormData;return a.append("file",t,"avatar.webp"),this.httpClient.post(V.apiEndpoint+"/auth/avatar",a,V.getHttpOptions(!0)).pipe(pe(i=>i?.data?.avatarUrl??""))}remove(){return this.httpClient.delete(V.apiEndpoint+"/auth/avatar",V.getHttpOptions()).pipe(pe(()=>{}))}};e.\u0275fac=function(a){return new(a||e)},e.\u0275prov=ke({token:e,factory:e.\u0275fac,providedIn:"root"});let n=e;return n})();function At(n,e){if(n&1){let o=W();l(0,"button",32),g("click",function(){h(o);let a=p();return m(a.removePhoto())}),v(1," Elimin\u0103 "),c()}if(n&2){let o=p();f("disabled",o.isUploadingPhoto())}}function Ft(n,e){if(n&1&&(l(0,"p",33),x(1,"app-icon",34),l(2,"span"),v(3),c()()),n&2){let o=p();f("ngClass",o.saveMessageType==="success"?"text-green-600":"text-red-600"),u(),f("name",o.saveMessageType==="success"?"check-circle":"x-circle"),u(2),Le(o.saveMessage)}}function Ut(n,e){if(n&1){let o=W();l(0,"app-avatar-upload-modal",35),g("save",function(a){h(o);let i=p();return m(i.onAvatarCropped(a))})("cancelled",function(){h(o);let a=p();return m(a.closeCropper())}),c()}if(n&2){let o=p();f("file",e)("saving",o.isUploadingPhoto())}}var ki=(()=>{let e=class e{constructor(){this.principal=P(Xe),this.httpClient=P(te),this.cdr=P(De),this.avatarService=P(ht),this.title=P(je),this.profilePhoto=P(at),this.cropFile=z(null),this.isUploadingPhoto=z(!1),this.login="",this.firstName="",this.lastName="",this.email="",this.currentPassword="",this.newPassword="",this.confirmPassword="",this.saveMessage="",this.isSavingSettings=!1,this.layoutUser=null,this.saveMessageType=null,this.emailError=!1,this.passwordMismatchError=!1,this.isSaving=!1,this.lastValidEmail="",this.initialProfileSnapshot={login:"",firstName:"",lastName:"",email:""}}ngOnInit(){return y(this,null,function*(){this.title.setTitle("Laziar | Set\u0103ri"),yield this.loadUserData()})}loadUserData(t=!1){return y(this,null,function*(){let a=yield this.principal.getUserValue(t),i=this.resolveEmail(a?.email??""),s=a?.firstName??"",r=a?.lastName??"",d=a?.login??a?.username??this.deriveLogin(i);a?.avatarUrl&&this.profilePhoto.setUrl(a.avatarUrl),this.login=d??"",this.firstName=s,this.lastName=r,this.email=i,this.layoutUser={name:`${s} ${r}`.trim()||i,email:i,firstName:s,lastName:r},this.initialProfileSnapshot={login:this.login,firstName:this.firstName,lastName:this.lastName,email:this.email},this.cdr.markForCheck()})}deriveLogin(t){return(t??"").split("@")[0]?.trim()||""}onPhotoSelected(t){let a=t.target,i=a?.files?.[0];a&&(a.value=""),i&&(this.saveMessage="",this.saveMessageType=null,this.cropFile.set(i))}closeCropper(){this.isUploadingPhoto()||this.cropFile.set(null)}removePhoto(){return y(this,null,function*(){if(!(this.isUploadingPhoto()||!this.profilePhoto.profilePhotoUrl())){this.isUploadingPhoto.set(!0),this.saveMessage="",this.saveMessageType=null;try{yield $(this.avatarService.remove()),this.profilePhoto.clear(),this.saveMessage="Fotografia de profil a fost eliminat\u
10103.",this.saveMessageType="success"}catch(t){ie.handleError()(t),this.saveMessage="Nu am putut elimina fotografia. \xCEncearc\u0103 din nou mai t\xE2rziu.",this.saveMessageType="error"}finally{this.isUploadingPhoto.set(!1),this.cdr.markForCheck()}}})}onAvatarCropped(t){return y(this,null,function*(){this.isUploadingPhoto.set(!0),this.saveMessage="",this.saveMessageType=null;try{let a=yield $(this.avatarService.upload(t));this.profilePhoto.setUrl(a||URL.createObjectURL(t)),this.saveMessage="Fotografia de profil a fost actualizat\u0103.",this.saveMessageType="success",this.cropFile.set(null)}catch(a){ie.handleError()(a),this.saveMessage="Nu am putut \xEEnc\u0103rca fotografia. \xCEncearc\u0103 din nou mai t\xE2rziu.",this.saveMessageType="error"}finally{this.isUploadingPhoto.set(!1),this.cdr.markForCheck()}})}saveSettings(){if(this.hasChanges){if(this.emailError=!1,this.passwordMismatchError=!1,this.newPassword&&this.newPassword!==this.confirmPassword){this.passwordMismatchError=!0,this.saveMessage="Parola nou\u0103 \u0219i confirmarea nu coincid.",this.saveMessageType="error";return}this.persistProfile()}}get hasChanges(){let t=this.login!==this.initialProfileSnapshot.login||this.firstName!==this.initialProfileSnapshot.firstName||this.lastName!==this.initialProfileSnapshot.lastName||this.email!==this.initialProfileSnapshot.email,a=!!(this.currentPassword||this.newPassword||this.confirmPassword);return t||a}persistProfile(){return y(this,null,function*(){try{this.isSaving=!0,this.isSavingSettings=!0,this.saveMessage="";let t=this.resolveEmail(this.email);if(!this.isValidEmail(t)){this.emailError=!0,this.saveMessage="Introdu un e-mail valid (ex: [email protected]).",this.saveMessageType="error";return}this.email=t,yield $(this.httpClient.patch(V.apiEndpoint+"/auth",{email:t,firstName:this.firstName.trim(),lastName:this.lastName.trim(),phone:null,address:null},V.getHttpOptions())),this.saveMessage="Set\u0103rile au fost actualizate cu succes.",this.saveMessageType="success",yield this.loadUserData(!0)}catch(t){ie.handleError()(t),this.saveMessage="Nu am putut salva modific\u0103rile. \xCEncearc\u0103 din nou mai t\xE2rziu.",this.saveMessageType="error",this.cdr.markForCheck()}finally{this.isSaving=!1,this.isSavingSettings=!1,this.cdr.markForCheck()}})}isValidEmail(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test((t??"").trim())}resolveEmail(t){let a=(t??"").trim();return this.isValidEmail(a)?(this.lastValidEmail=a,a):this.isValidEmail(this.lastValidEmail)?this.lastValidEmail:a}};e.\u0275fac=function(a){return new(a||e)},e.\u0275cmp=N({type:e,selectors:[["app-settings"]],decls:44,vars:30,consts:[[3,"mainFullWidth","mockUser"],["layout-main","",1,"flex","h-full","min-h-0","flex-col"],[1,"relative","min-h-0","flex-1"],[1,"absolute","inset-0","overflow-y-auto","overscroll-y-contain","no-scrollbar","[scrollbar-gutter:stable]"],[1,"px-5","pt-6","pb-4","md:px-8","d1200:px-0","d1200:pt-10","border-b","border-gray-100"],[1,"font-onest","text-xl","font-bold","leading-7","-tracking-[0.5px]","text-gray-900","d1200:text-2xl","d1200:leading-8","d1200:-tracking-[0.6px]"],[1,"mt-2","max-w-2xl","font-onest","text-sm","font-normal","leading-5","-tracking-[0.21px]","text-gray-600"],[1,"px-5","py-8","md:px-8","d1200:px-0","d1200:py-10","d1200:max-w-680","flex","flex-col","gap-8",3,"ngSubmit"],[1,"rounded-xl","border","border-gray-100","p-5","md:p-6","bg-cFFFFFA"],[1,"font-onest","text-base","font-semibold","text-gray-900"],[1,"mt-4","flex","items-center","gap-4"],["size","xl",3,"imgUrl","firstName","lastName"],[1,"flex","flex-col","gap-1"],[1,"flex","items-center","gap-2"],["for","settings-photo",1,"inline-flex","h-10","cursor-pointer","items-center","justify-center","rounded-full","border","border-gray-200","px-4","font-onest","text-sm","font-medium","text-gray-700","transition-colors","hover:bg-gray-50","select-none"],["type","button",1,"inline-flex","h-10","items-center","justify-center","rounded-full","px-4","font-onest","text-sm","font-medium","text-red-600","transition-colors","hover:bg-red-50","disabled:opacity-50",3,"disabled"],[1,"font-onest","text-xs","text-gray-400"],["
1id","settings-photo","type","file","accept","image/*",1,"hidden",3,"change"],[1,"mt-4","grid","grid-cols-1","gap-4"],["type","text","size","lg","name","settings-login","label","Login","placeholder","Introdu login",3,"ngModelChange","disabled","ngModel"],[1,"grid","grid-cols-1","md:grid-cols-2","gap-4"],["type","text","size","lg","name","settings-firstname","label","Prenume","placeholder","Prenume",3,"ngModelChange","ngModel"],["type","text","size","lg","name","settings-lastname","label","Nume","placeholder","Nume",3,"ngModelChange","ngModel"],["type","email","size","lg","name","settings-email","label","E-mail","placeholder","[email protected]","autocomplete","email",3,"ngModelChange","error","disabled","ngModel"],["type","password","size","lg","name","settings-current-password","label","Parola curent\u0103","placeholder","Introdu parola curent\u0103","autocomplete","current-password",3,"ngModelChange","disabled","ngModel"],["type","password","size","lg","name","settings-new-password","label","Parola nou\u0103","placeholder","Introdu parola nou\u0103","autocomplete","new-password",3,"ngModelChange","error","disabled","ngModel"],["type","password","size","lg","name","settings-confirm-password","label","Confirm\u0103 parola nou\u0103","placeholder","Reintrodu parola nou\u0103","autocomplete","new-password",3,"ngModelChange","error","disabled","ngModel"],[1,"flex","flex-col","gap-3"],["role","status","aria-live","polite"],["class","flex items-center gap-2 font-onest text-sm",3,"ngClass",4,"ngIf"],["type","submit","variant","primary","color","gray","size","md","label","Salveaz\u0103 modific\u0103rile",1,"w-full","md:w-auto",3,"rounded","label","disabled"],[3,"file","saving"],["type","button",1,"inline-flex","h-10","items-center","justify-center","rounded-full","px-4","font-onest","text-sm","font-medium","text-red-600","transition-colors","hover:bg-red-50","disabled:opacity-50",3,"click","disabled"],[1,"flex","items-center","gap-2","font-onest","text-sm",3,"ngClass"],["type","outline","aria-hidden","true",1,"h-4","w-4","shrink-0",3,"name"],[3,"save","cancelled","file","saving"]],template:function(a,i){if(a&1&&(l(0,"app-layout",0)(1,"section",1)(2,"div",2)(3,"div",3)(4,"header",4)(5,"h1",5),v(6," Set\u0103ri "),c(),l(7,"p",6),v(8," Actualizeaz\u0103 fotografia, loginul, numele, e-mailul \u0219i parola contului t\u0103u. "),c()(),l(9,"form",7),g("ngSubmit",function(){return i.saveSettings()}),l(10,"section",8)(11,"h2",9),v(12,"Fotografie profil"),c(),l(13,"div",10),x(14,"app-avatar",11),l(15,"div",12)(16,"div",13)(17,"label",14),v(18," Schimb\u0103 foto "),c(),X(19,At,2,1,"button",15),c(),l(20,"span",16),v(21,"PNG, JPG sau WebP, p\xE2n\u0103 la 10MB."),c()(),l(22,"input",17),g("change",function(r){return i.onPhotoSelected(r)}),c()()(),l(23,"section",8)(24,"h2",9),v(25,"Profil"),c(),l(26,"div",18)(27,"app-input-field",19),k("ngModelChange",function(r){return E(i.login,r)||(i.login=r),r}),c(),l(28,"div",20)(29,"app-input-field",21),k("ngModelChange",function(r){return E(i.firstName,r)||(i.firstName=r),r}),c(),l(30,"app-input-field",22),k("ngModelChange",function(r){return E(i.lastName,r)||(i.lastName=r),r}),c()(),l(31,"app-input-field",23),k("ngModelChange",function(r){return E(i.email,r)||(i.email=r),r}),c()()(),l(32,"section",8)(33,"h2",9),v(34,"Schimbare parol\u0103"),c(),l(35,"div",18)(36,"app-input-field",24),k("ngModelChange",function(r){return E(i.currentPassword,r)||(i.currentPassword=r),r}),c(),l(37,"app-input-field",25),k("ngModelChange",function(r){return E(i.newPassword,r)||(i.newPassword=r),r}),c(),l(38,"app-input-field",26),k("ngModelChange",function(r){return E(i.confirmPassword,r)||(i.confirmPassword=r),r}),c()()(),l(39,"div",27)(40,"div",28),B(41,Ft,4,3,"p",29),c(),x(42,"app-button",30),c()()()()()(),X(43,Ut,1,2,"app-avatar-upload-modal",31)),a&2){let s;f("mainFullWidth",!0)("mockUser",i.layoutUser),u(14),f("imgUrl",i.profilePhoto.profilePhotoUrl())("firstName",i.firstName)("lastName",i.lastName),u(3),q("pointer-events-none",i.isUploadingPhoto())("opacity-50",i.isUploadingPhoto()),u(2),Y(i.profilePhoto.profilePhotoUrl()?19:-1),u(8),f("disabled",!0),O("ngModel",i.login),u(2),O("ngModel",i.firstName),u(),O("ngModel",i.lastName),u(),f("error",i.emailError)("disabled",!0),O("ngModel",i.email),u(5),f("disabled",!0),O("ngModel",i.currentPassword),u(),f("error",i.passwordMismatchError)("disabled",!0),O("ngModel",i.newPassword),u(),f("error",i.passwordMismatchError)("disabled",!0),O("ngModel",i.confirmPassword),u(3),f("ngIf",i.saveMessage),u(),f("rounded",!0)("label",i.isSavingSettings?"Se salveaz\u0103...":"Salveaz\u0103 modific\u0103rile")("disabled",i.isSavingSettings),u(
1),Y((s=i.cropFile())?43:-1,s)}},dependencies:[Be,Ne,ee,tt,et,Ke,Ge,$e,Je,ot,Qe,it,oe,ae,pt],encapsulation:2,changeDetection:0});let n=e;return n})();export{ki as SettingsComponent};
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.