PageSourceSearch

https://chatreal.ai/assets/page-B9FRnCXl.js

js chatreal.ai collected 2026-10-05 11:54:09 UTC 51,343 bytes, 1 lines download raw bytes

1import{r as p,W as ft,ao as ve,h as Ct,k as K,I as b,c9 as we,a as ge,j as e,T as C,en as _t,eo as He,ep as Ye,eq as xt,er as vt,B as G,p as Y,ad as wt,es as bt,et as Fe,y as Pe,a2 as xe,eu as Nt,R as de,s as M,ev as Et,S as be,e as te,$ as It,i as St,ew as z,ex as jt,ey as At,q as yt,bN as E,aH as Dt,aI as Rt,aJ as Mt,aK as Pt,aL as Tt,ez as Ot,eA as at,eB as nt,aO as Lt,E as Z,a0 as Ut,bA as st,cs as je,eC as A,eD as Bt,bU as rt,v as kt,w as ze,cS as Ge,x as $t,X as Ht,cL as Yt,eE as Ft,l as it,eF as zt,eG as Gt,eH as fe,eI as Kt,eJ as Wt,eK as Xt,D as ot,t as Te,eL as Vt,em as qt,eM as Ke,eN as We,eO as Qt,br as Xe,bP as Zt,cE as lt,an as ct,c as Jt,d as ea,aG as ta,bI as aa,eP as Ae,eQ as na,eR as sa,eS as q,eT as Ce,A as ra,eU as Ve,u as ia,eV as oa,eW as la,bx as dt,by as ht,eX as ca}from"./index-CYr6wd_Y.js";import{u as ut}from"./useUsers-BkVG4DE1.js";import{N as _e}from"./NextUiInput-B_j8uZeQ.js";import{T as ue,S as da}from"./types-DVk5YbwB.js";import{i as Oe}from"./isAuth-Csqt4WTY.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"d1dbfda60133a6b8c02b2c96e17d36cdc2923821"};var t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="f5bc3bc8-76ad-442f-85bc-bcec948f1996",r._sentryDebugIdIdentifier="sentry-dbid-f5bc3bc8-76ad-442f-85bc-bcec948f1996")}catch{}})();const ha="_container_ah2k7_1",ua="_activeComponent_ah2k7_5",ma="_expandedContent_ah2k7_10",ye={container:ha,activeComponent:ua,expandedContent:ma},ga="_character_1tkqb_1",pa="_top_1tkqb_5",fa="_characterName_1tkqb_9",Ca="_topIcon_1tkqb_17",_a="_icon_1tkqb_21",xa="_dropdown_1tkqb_25",va="_dropdownContent_1tkqb_29",wa="_dropdownItem_1tkqb_33",ba="_pcIcon_1tkqb_37",Na="_characterImage_1tkqb_41",Ea="_bottom_1tkqb_49",Ia="_chatIcon_1tkqb_53",L={character:ga,top:pa,characterName:fa,topIcon:Ca,icon:_a,dropdown:xa,dropdownContent:va,dropdownItem:wa,pcIcon:ba,characterImage:Na,bottom:Ea,chatIcon:Ia},Sa=({character:r})=>{const[t,a]=p.useState(!1),{isMobile:i}=ft(),{setShowModal:n,setModalContent:s}=ve(),{deleteCharacterMutation:d}=Ct(),{t:u}=K([b.MY_ACCOUNT,b.COMMON]),{getDeleteDefaultCharacterModalConfig:l,getDeleteCharacterConfirmationModalConfig:o,getCantDeleteReplicaModalConfig:h}=we(),{localizedNavigate:c}=ge(),g=r?.canDelete??!0,m=()=>{!r.is_default&&g&&d({id:r._id,handleSuccess:()=>{M.success(u(be.DELETE_CHARACTER,{ns:b.COMMON}))},handleError:()=>{M.error(Et)}})},w=()=>{c({location:{pathname:`/${de.CHARACTER_INFO.PATHNAME}/${r?._id}`}})},j=()=>{c({location:{pathname:`/${de.CHAT.PATHNAME}/${r?._id}`}})},R=()=>{w()},y=()=>{if(!g){n(!0),s(h({onConfirm:()=>{n(!1)},onDiscard:()=>{n(!1)}}));return}if(r?.is_default){n(!0),s(l({onConfirm:()=>{n(!1)},onDiscard:()=>{n(!1)}}));return}n(!0),s(o({onConfirm:()=>{m(),n(!1)},onDiscard:()=>n(!1)}))},k=()=>{j()};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:L.character,children:[e.jsxs("div",{className:L.top,children:[e.jsxs("div",{className:L.characterName,children:[e.jsxs(C,{variant:"body-md",children:[r?.characterName," "]}),e.jsx(_t,{fill:"yellow",size:25,className:`${r?.is_default?"":"hidden"}`})]}),e.jsxs("div",{className:L.topIcon,children:[e.jsx(He,{className:`${L.icon} ${L.pcIcon}`,size:20,onClick:R}),e.jsx(Ye,{className:`${L.icon} ${L.pcIcon}`,size:20,onClick:y}),i&&e.jsxs(xt,{className:L.dropdown,classNames:{content:L.dropdownContent},isOpen:t,onOpenChange:O=>a(O),triggerScaleOnOpen:!1,children:[e.jsx(vt,{children:e.jsx(G,{variant:Y.CHIP,leftIcon:e.jsx(wt,{size:20}),onPress:()=>a(O=>!O)})}),e.jsxs(bt,{"aria-label":"Static Actions",children:[e.jsx(Fe,{onPress:R,className:Pe,children:e.jsxs("div",{className:L.dropdownItem,children:[e.jsx(He,{})," ",e.jsx(C,{variant:"label-md",children:u("myCompanion.actions.edit")})]})},"edit"),e.jsx(Fe,{className:Pe,onPress:y,children:e.jsxs("div",{className:L.dropdownItem,children:[e.jsx(Ye,{})," ",e.jsx(C,{variant:"label-md",children:u("myCompanion.actions.delete")})]})},"delete")]})]})]})]}),e.jsx("div",{className:L.characterImage,children:e.jsx("img",{src:xe(r.imageUrl),alt:r.characterName,loading:"lazy"})}),e.jsx("div",{className:L.bottom,children:e.jsx(Nt,{className:L.chatIcon,onClick:k})})]})})},ja="_companionContainer_1n588_1",Aa="_gridContainer_1n588_5",ya="_btn_1n588_9",De={companionContainer:ja,gridContainer:Aa,btn:ya},Da=()=>{const r=te(It),t=te(h=>h.user.defaultCharacter),{checkCanAccessUnlimitedCharacterCreation:a}=yt(),{localizedNavigate:i}=ge(),{showCreateCharacterRateLimitPopUp:n}=St(),{t:s}=K([b.MY_ACCOUNT,b.COMMON]),d=()=>
1{if(a()||!t)return At({localizedNavigate:i});n()},u=r.find(h=>h.is_default),l=r.filter(h=>h&&!h.is_default),o=u?[u,...l]:l;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:De.companionContainer,children:e.jsx("div",{className:De.gridContainer,children:o?.map(h=>e.jsx(Sa,{character:h},h._id))})}),e.jsx("div",{className:De.btn,children:e.jsx(G,{variant:Y.PRIMARY,onPress:d,leftIcon:e.jsx(jt,{}),text:s(z.CREATE_GOGO)})})]})},Ra="_container_t2a28_1",Ma="_card_t2a28_5",Pa="_title_t2a28_9",Ta="_divider_t2a28_13",me={container:Ra,card:Ma,title:Pa,divider:Ta},Oa=r=>r==="png"?"image/png":r==="webp"?"image/webp":r==="bmp"?"image/bmp":r==="gif"?"image/gif":"image/jpeg",La=(r,t,a)=>{if(t>0&&a>0)return{width:t,height:a};if(t>0){if(a===0)return{width:t,height:r.naturalHeight};const i=r.naturalWidth/t;return{width:t,height:Math.round((r.naturalHeight/i+Number.EPSILON)*100)/100}}if(a>0){if(t===0)return{width:r.naturalWidth,height:a};const i=r.naturalHeight/a;return{width:Math.round((r.naturalWidth/i+Number.EPSILON)*100)/100,height:a}}return{width:r.naturalWidth,height:r.naturalHeight}},Ua=(r,t=100,a=0,i=0,n=null)=>{if(!(r instanceof Blob))throw new TypeError(`Expected blob or file! ${typeof r} given!`);if(a<0||i<0)throw new RangeError("Invalid width or height value!");if(t<=0)throw new RangeError("Quality must be higher than 0!");return new Promise(s=>{const d=n?Oa(n):r.type,u=t<1?t:t/100,l=new FileReader;l.readAsDataURL(r),l.onload=()=>{const o=new Image;o.src=l.result,o.onload=()=>{const h=document.createElement("canvas"),c=La(o,a,i);h.width=c.width,h.height=c.height,h.getContext("2d").drawImage(o,0,0,h.width,h.height),h.toBlob(g=>s(new Blob([g],{type:d})),d,u)}}})},Ba=(r,t=100,a=0,i=0,n=null)=>fetch(r).then(s=>s.blob()).then(s=>Ua(s,t,a,i,n)).catch(s=>{throw new Error("Failed to fetch. Image might be protected. See Cross Origin Resource Sharing. Error: "+s)}),ka=r=>new Promise(t=>{const a=new FileReader;a.readAsDataURL(r),a.onloadend=i=>t(i.target.result)}),$a="_imageCropperModal_swrk0_1",Ha="_imageCropper_label_swrk0_5",Ya="_avatar_swrk0_9",Fa="_nameAvatar_swrk0_13",za="_imageCropZone_ReactCrop_swrk0_17",Ga="_imageCropperModal_buttons_swrk0_21",re={imageCropperModal:$a,imageCropper_label:Ha,avatar:Ya,nameAvatar:Fa,imageCropZone_ReactCrop:za,imageCropperModal_buttons:Ga};var Le={x:0,y:0,width:0,height:0,unit:"px"},ie=(r,t,a)=>Math.min(Math.max(r,t),a),Ka=(...r)=>r.filter(t=>t&&typeof t=="string").join(" "),qe=(r,t)=>r===t||r.width===t.width&&r.height===t.height&&r.x===t.x&&r.y===t.y&&r.unit===t.unit;function Wa(r,t,a,i){let n=X(r,a,i);return r.width&&(n.height=n.width/t),r.height&&(n.width=n.height*t),n.y+n.height>i&&(n.height=i-n.y,n.width=n.height*t),n.x+n.width>a&&(n.width=a-n.x,n.height=n.width/t),r.unit==="%"?ae(n,a,i):n}function Xa(r,t,a){let i=X(r,t,a);return i.x=(t-i.width)/2,i.y=(a-i.height)/2,r.unit==="%"?ae(i,t,a):i}function ae(r,t,a){return r.unit==="%"?{...Le,...r,unit:"%"}:{unit:"%",x:r.x?r.x/t*100:0,y:r.y?r.y/a*100:0,width:r.width?r.width/t*100:0,height:r.height?r.height/a*100:0}}function X(r,t,a){return!r.unit||r.unit==="px"?{...Le,...r,unit:"px"}:{unit:"px",x:r.x?r.x*t/100:0,y:r.y?r.y*a/100:0,width:r.width?r.width*t/100:0,height:r.height?r.height*a/100:0}}function Qe(r,t,a,i,n,s=0,d=0,u=i,l=n){let o={...r},h=Math.min(s,i),c=Math.min(d,n),g=Math.min(u,i),m=Math.min(l,n);t&&(t>1?(h=d?d*t:h,c=h/t,g=u*t):(c=s?s/t:c,h=c*t,m=l/t)),o.y<0&&(o.height=Math.max(o.height+o.y,c),o.y=0),o.x<0&&(o.width=Math.max(o.width+o.x,h),o.x=0);let w=i-(o.x+o.width);w<0&&(o.x=Math.min(o.x,i-h),o.width+=w);let j=n-(o.y+o.height);if(j<0&&(o.y=Math.min(o.y,n-c),o.height+=j),o.width<h&&((a==="sw"||a=="nw")&&(o.x-=h-o.width),o.width=h),o.height<c&&((a==="nw"||a=="ne")&&(o.y-=c-o.height),o.height=c),o.width>g&&((a==="sw"||a=="nw")&&(o.x-=g-o.width),o.width=g),o.height>m&&((a==="nw"||a=="ne")&&(o.y-=m-o.height),o.height=m),t){let R=o.width/o.height;if(R<t){let y=Math.max(o.width/t,c);(a==="nw"||a=="ne")&&(o.y-=y-o.height),o.height=y}else if(R>t){let y=Math.max(o.height*t,h);(a==="sw"||a=="nw")&&(o.x-=y-o.width),o.width=y}}return o}function Va(r,t,a,i){let n={...r};return t==="ArrowLeft"?i==="nw"?(n.x-=a,n.y-=a,n.width+=a,n.height+=a):i==="w"?(n.x-=a,n.width+=a):i==="sw"?(n.x-=a,n.width+=a,n.height+=a):i==="ne"?(n.y+=a,n.width-=a,n.height-=a):i==="e"?n.width-=a:i==="se"&&(n.width-=a,n.height-=a):t==="ArrowRight"&&(i==="nw"?(n.x+=a,n.y+=a,n.width-=a,n.height-=a):i==="w"?(n.x+=a,n.width-=a):i==="sw"?(n.x+=a,n.width-=a,n.height-=a):i==="ne"?(n.y-=a,n.width+=a,n.height+=a):i==="e"?n.width+=a:i==="se"&&(n.width+=a,n.height+=a)),t==="ArrowUp"?i==="nw"?(n.x-=a,n.y-=a,n.width+=a,n.height+=a):i==="n"?(n.y-=a,n.height+=a):i==="ne"?(n.y-=a,n.width+=a,n.height+=a):i==="sw"?(n.x+=a,n.width-=a,n.height-=a):i==="s"?n.height-=a:i==="se"&&(n.width-=a,n.height-=a):t==="ArrowDown"&&(i==="nw"?(n.x+=a,n.y+=a,n.width-=a,n.height-=a):i==="n"?(n.y+=a,n.height-=a):i==="ne"?(n.y+=a,n.width-=a,n.height-=a):i==="sw"?(n.x-=a,n.width+=a,n.height+=a):i==="s"?n.height+=a:i==="se"&&(n.width+=a,n.height+=a)),n}var oe={capture:!0,passive:!1},qa=0,Qa=class W extends p.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=p.createRef();mediaRef=p.createRef();resizeObserver;initChangeCalled=!1;instanceId=`rc-${qa++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let t=this.mediaRef.current;if(!t)return{x:0,y:0,width:0,height:0};let{x:a,y:i,width:n,height:s}=t.getBoundingClientRect();return{x:a,y:i,width:n,height:s}}componentDidUpdate(t){let{crop:a,onComplete:i}=this.props;if(i&&!t.crop&&a){let{width:n,height:s}=this.getBox();n&&s&&i(X(a,n,s),ae(a,n,s))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,oe),this.document.addEventListener("pointerup",this.onDocPointerDone,oe),this.document.addEventListener("pointercancel",this.onDocPointerDone,oe),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,oe),this.document.removeEventListener("pointerup",this.onDocPointerDone,oe),this.document.removeEventListener("pointercancel",this.onDocPointerDone,oe),!1)}onCropPointerDown=t=>{let{crop:a,disabled:i}=this.props,n=this.getBox();if(!a)return;let s=X(a,n.width,n.height);if(i)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let d=t.target.dataset.ord,u=!!d,l=t.clientX,o=t.clientY,h=s.x,c=s.y;if(d){let g=t.clientX-n.x,m=t.clientY-n.y,w=0,j=0;d==="ne"||d=="e"?(w=g-(s.x+s.width),j=m-s.y,h=s.x,c=s.y+s.height):d==="se"||d==="s"?(w=g-(s.x+s.width),j=m-(s.y+s.height),h=s.x,c=s.y):d==="sw"||d=="w"?(w=g-s.x,j=m-(s.y+s.height),h=s.x+s.width,c=s.y):(d==="nw"||d=="n")&&(w=g-s.x,j=m-s.y,h=s.x+s.width,c=s.y+s.height),l=h+n.x+w,o=c+n.y+j}this.evData={startClientX:l,startClientY:o,startCropX:h,startCropY:c,clientX:t.clientX,clientY:t.clientY,isResize:u,ord:d},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=t=>{let{crop:a,disabled:i,locked:n,keepSelection:s,onChange:d}=this.props,u=this.getBox();if(i||n||s&&a)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let l=t.clientX-u.x,o=t.clientY-u.y,h={unit:"px",x:l,y:o,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:l,startCropY:o,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,d(X(h,u.width,u.height),ae(h,u.width,u.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=t=>{let{crop:a,disabled:i,onChange:n,onDragStart:s}=this.props,d=this.getBox();if(i||!a||!this.mouseDownOnCrop)return;t.cancelable&&t.preventDefault(),this.dragStarted||(this.dragStarted=!0,s&&s(t));let{evData:u}=this;u.clientX=t.clientX,u.clientY=t.clientY;let l;l=u.isResize?this.resizeCrop():this.dragCrop(),qe(a,l)||n(X(l,d.width,d.height),ae(l,d.width,d.height))};onComponentKeyDown=t=>{let{crop:a,disabled:i,onChange:n,onComplete:s}=this.props;if(i)return;let d=t.key,u=!1;if(!a)return;let l=this.getBox(),o=this.makePixelCrop(l),h=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?W.nudgeStepLarge:t.shiftKey?W.nudgeStepMedium:W.nudgeStep;if(d==="ArrowLeft"?(o.x-=h,u=!0):d==="ArrowRight"?(o.x+=h,u=!0):d==="ArrowUp"?(o.y-=h,u=!0):d==="ArrowDown"&&(o.y+=h,u=!0),u){t.cancelable&&t.preventDefault(),o.x=ie(o.x,0,l.width-o.width),o.y=ie(o.y,0,l.height-o.height);
1let c=X(o,l.width,l.height),g=ae(o,l.width,l.height);n(c,g),s&&s(c,g)}};onHandlerKeyDown=(t,a)=>{let{aspect:i=0,crop:n,disabled:s,minWidth:d=0,minHeight:u=0,maxWidth:l,maxHeight:o,onChange:h,onComplete:c}=this.props,g=this.getBox();if(s||!n)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;let m=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?W.nudgeStepLarge:t.shiftKey?W.nudgeStepMedium:W.nudgeStep,w=Qe(Va(X(n,g.width,g.height),t.key,m,a),i,a,g.width,g.height,d,u,l,o);if(!qe(n,w)){let j=ae(w,g.width,g.height);h(w,j),c&&c(w,j)}};onDocPointerDone=t=>{let{crop:a,disabled:i,onComplete:n,onDragEnd:s}=this.props,d=this.getBox();this.unbindDocMove(),!(i||!a)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,s&&s(t),n&&n(X(a,d.width,d.height),ae(a,d.width,d.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:t}=this.props;if(t)return{top:`${t.y}${t.unit}`,left:`${t.x}${t.unit}`,width:`${t.width}${t.unit}`,height:`${t.height}${t.unit}`}}dragCrop(){let{evData:t}=this,a=this.getBox(),i=this.makePixelCrop(a),n=t.clientX-t.startClientX,s=t.clientY-t.startClientY;return i.x=ie(t.startCropX+n,0,a.width-i.width),i.y=ie(t.startCropY+s,0,a.height-i.height),i}getPointRegion(t,a,i,n){let{evData:s}=this,d=s.clientX-t.x,u=s.clientY-t.y,l;l=n&&a?a==="nw"||a==="n"||a==="ne":u<s.startCropY;let o;return o=i&&a?a==="nw"||a==="w"||a==="sw":d<s.startCropX,o?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(t,a,i=0,n=0){let s=Math.min(i,t.width),d=Math.min(n,t.height);return!a||!s&&!d?[s,d]:a>1?s?[s,s/a]:[d*a,d]:d?[d*a,d]:[s,s/a]}resizeCrop(){let{evData:t}=this,{aspect:a=0,maxWidth:i,maxHeight:n}=this.props,s=this.getBox(),[d,u]=this.resolveMinDimensions(s,a,this.props.minWidth,this.props.minHeight),l=this.makePixelCrop(s),o=this.getPointRegion(s,t.ord,d,u),h=t.ord||o,c=t.clientX-t.startClientX,g=t.clientY-t.startClientY;(d&&h==="nw"||h==="w"||h==="sw")&&(c=Math.min(c,-d)),(u&&h==="nw"||h==="n"||h==="ne")&&(g=Math.min(g,-u));let m={unit:"px",x:0,y:0,width:0,height:0};o==="ne"?(m.x=t.startCropX,m.width=c,a?(m.height=m.width/a,m.y=t.startCropY-m.height):(m.height=Math.abs(g),m.y=t.startCropY-m.height)):o==="se"?(m.x=t.startCropX,m.y=t.startCropY,m.width=c,a?m.height=m.width/a:m.height=g):o==="sw"?(m.x=t.startCropX+c,m.y=t.startCropY,m.width=Math.abs(c),a?m.height=m.width/a:m.height=g):o==="nw"&&(m.x=t.startCropX+c,m.width=Math.abs(c),a?(m.height=m.width/a,m.y=t.startCropY-m.height):(m.height=Math.abs(g),m.y=t.startCropY+g));let w=Qe(m,a,o,s.width,s.height,d,u,i,n);return a||W.xyOrds.indexOf(h)>-1?l=w:W.xOrds.indexOf(h)>-1?(l.x=w.x,l.width=w.width):W.yOrds.indexOf(h)>-1&&(l.y=w.y,l.height=w.height),l.x=ie(l.x,0,s.width-l.width),l.y=ie(l.y,0,s.height-l.height),l}renderCropSelection(){let{ariaLabels:t=W.defaultProps.ariaLabels,disabled:a,locked:i,renderSelectionAddon:n,ruleOfThirds:s,crop:d}=this.props,u=this.getCropStyle();if(d)return E.createElement("div",{style:u,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!a&&!i&&E.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},E.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),E.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),E.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),E.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"nw"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"n"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"ne"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"e"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"se"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"s"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"sw"),role:"button"}),E.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:l=>this.onHandlerKeyDown(l,"w"),role:"button"})),n&&E.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:l=>l.stopPropagation()},n(this.state)),s&&E.createElement(E.Fragment,null,E.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),E.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){return X({...Le,...this.props.crop||{}},t.width,t.height)}render(){let{aspect:t,children:a,circularCrop:i,className:n,crop:s,disabled:d,locked:u,style:l,ruleOfThirds:o}=this.props,{cropIsActive:h,newCropIsBeingDrawn:c}=this.state,g=s?this.renderCropSelection():null,m=Ka("ReactCrop",n,h&&"ReactCrop--active",d&&"ReactCrop--disabled",u&&"ReactCrop--locked",c&&"ReactCrop--new-crop",s&&t&&"ReactCrop--fixed-aspect",s&&i&&"ReactCrop--circular-crop",s&&o&&"ReactCrop--rule-of-thirds",!this.dragStarted&&s&&!s.width&&!s.height&&"ReactCrop--invisible-crop",i&&"ReactCrop--no-animate");return E.createElement("div",{ref:this.componentRef,className:m,style:l},E.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},a),s?E.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},E.createElement("defs",null,E.createElement("mask",{id:`hole-${this.instanceId}`},E.createElement("rect",{width:"100%",height:"100%",fill:"white"}),i?E.createElement("ellipse",{cx:`${s.x+s.width/2}${s.unit}`,cy:`${s.y+s.height/2}${s.unit}`,rx:`${s.width/2}${s.unit}`,ry:`${s.height/2}${s.unit}`,fill:"black"}):E.createElement("rect",{x:`${s.x}${s.unit}`,y:`${s.y}${s.unit}`,width:`${s.width}${s.unit}`,height:`${s.height}${s.unit}`,fill:"black"}))),E.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,g)}};const Za=({image:r,canvas:t,crop:a})=>{const i=t.getContext("2d");if(!i)throw new Error("No 2d context");
1const n=window.devicePixelRatio,s=r.naturalWidth/r.width,d=r.naturalHeight/r.height;t.width=Math.floor(a.width*s*n),t.height=Math.floor(a.height*d*n),i.scale(n,n),i.imageSmoothingQuality="high",i.save();const u=a.x*s,l=a.y*d;i.translate(-u,-l),i.drawImage(r,0,0,r.naturalWidth,r.naturalHeight,0,0,r.naturalWidth,r.naturalHeight),i.restore()},Ja=({showImageCropperModal:r,setShowImageCropperModal:t,invalidImageValidator:a,onSave:i,MIN_CROP_WIDTH:n=25,CROP_ASPECT_RATIO:s=1,onImageChange:d})=>{const[u,l]=p.useState(""),[o,h]=p.useState(!1),[c,g]=p.useState(),m=p.useRef(null),w=p.useRef(null),j=te(_=>_.user.user),R=te(_=>_.user.authUser),{t:y}=K([b.MY_ACCOUNT,b.COMMON]),k=_=>{const x=_.target.files[0];if(!x)return;const I=new FileReader;I.addEventListener("load",()=>{const U=new Image,v=I.result?.toString()||"";U.src=v,U.addEventListener("load",J=>{const{naturalWidth:ee,naturalHeight:ne}=J.currentTarget;if(ee<n||ne<n)return M.error(y(Z.IMAGE_IS_SMALL)),l("")}),l(v)}),I.readAsDataURL(x)},O=_=>{const{naturalWidth:x,naturalHeight:I}=_.currentTarget;if(x<n||I<n){l("");return}const U=Xa(Wa({unit:"%",width:n},s,x,I),x,I);g(U)},F=async()=>{h(!0),await Promise.all([Za({image:m.current,canvas:w.current,crop:X(c,m.current.width,m.current.height)})]);const _=w.current.toDataURL();await i(_),l(""),h(!1)},D=()=>{t(!1),l(""),h(!1)};return e.jsxs(e.Fragment,{children:[c&&e.jsx("canvas",{id:"imageCropper_canvas",style:{display:"none"},ref:w}),e.jsx(Dt,{disableAnimation:!0,"aria-labelledby":"image-cropper-modal",isOpen:r,classNames:Lt(),placement:"center",onOpenChange:_=>{_||D()},children:e.jsx(Rt,{children:e.jsxs(e.Fragment,{children:[e.jsx(Mt,{children:e.jsx("div",{className:Pt.modalHeaderContent,children:e.jsx(C,{as:"p",variant:"body-xl",align:"center",color:"textWhite",children:y("basicDetails.form.image.label")})})}),e.jsx(Tt,{children:r&&e.jsxs("div",{className:re.imageCropperModal,children:[e.jsx("input",{type:"file",id:"profile",name:"profile",className:"hidden",accept:"image/png, image/jpeg",onChange:_=>{a&&!a(_)&&k(_),d?.(_)}}),u?e.jsx(Qa,{crop:c,onChange:(_,x)=>g(x),keepSelection:!0,circularCrop:!0,className:re.imageCropZone_ReactCrop,aspect:s,minWidth:n,style:{maxWidth:"90%",maxHeight:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:e.jsx("img",{ref:m,src:u,alt:"upload",onLoad:_=>{O(_)},width:"100%",height:"100%"})}):e.jsxs(e.Fragment,{children:[e.jsx(Ot,{className:re.avatar,src:xe(j?.profileImage)||R?.avatar,fallback:e.jsx(at,{name:j?.name||nt,size:"200",className:re.nameAvatar})}),e.jsx("label",{htmlFor:"profile",className:re.imageCropper_label,children:e.jsx(C,{variant:"body-md",children:y("basicDetails.form.image.upload")})})]}),e.jsx("div",{className:re.imageCropperModal_buttons,children:u&&e.jsx(G,{variant:Y.PRIMARY,isDisabled:!u,isLoading:o,onPress:()=>{F()},text:y(z.UPDATE)})})]})})]})})})]})},en="_menu_18wn5_1",tn="_menuRow_18wn5_5",an="_menuText_18wn5_9",nn="_menuSubtitle_18wn5_13",sn="_menuAction_18wn5_17",rn="_chevron_18wn5_21",on="_chevronOpen_18wn5_25",ln="_advancedSection_18wn5_29",cn="_advancedToggle_18wn5_33",dn="_advancedPanel_18wn5_37",hn="_advancedPanelClosed_18wn5_41",un="_advancedPanelOpen_18wn5_45",mn="_advancedPanelInner_18wn5_49",gn="_logoutDivider_18wn5_53",T={menu:en,menuRow:tn,menuText:an,menuSubtitle:nn,menuAction:sn,chevron:rn,chevronOpen:on,advancedSection:ln,advancedToggle:cn,advancedPanel:dn,advancedPanelClosed:hn,advancedPanelOpen:un,advancedPanelInner:mn,logoutDivider:gn},Re=({title:r,description:t,onClick:a,endContent:i})=>e.jsxs("div",{className:T.menuRow,onClick:a,children:[e.jsxs("span",{className:T.menuText,children:[e.jsx(C,{variant:"body-sm",children:r}),t?e.jsx("span",{className:T.menuSubtitle,children:e.jsx(C,{variant:"label-sm",color:"textGray600",children:t})}):null]}),i]}),pn=()=>{const{t:r}=K([b.MY_ACCOUNT,b.COMMON]),{setShowModal:t,setModalContent:a}=ve(),{getLogOutModalConfig:i}=we(),{handleLogout:n}=Ut(),[,s]=st(),[d,u]=p.useState(!1),l=h=>{s({section:h})},o=()=>{t(!0),a(i({onConfirm:()=>{n(),t(!1)},onDiscard:()=>t(!1)}))};return e.jsxs("div",{className:T.menu,children:[e.jsx(Re,{title:r("routes.refer.title",{ns:b.COMMON}),description:r("refer.heading"),onClick:()=>l(A.REFER_AND_EARN.KEY),endContent:e.jsx(je,{size:20,className:T.chevron})}),e.jsxs("div",{className:T.advancedSection,children:[e.jsxs("div",{className:T.advancedToggle,onClick:()=>u(h=>!h),"aria-expanded":d,children:[e.jsx(C,{variant:"body-md",children:r("basicDetail
1s.advanced")}),e.jsx(Bt,{size:24,className:`${T.chevron} ${d?T.chevronOpen:""}`})]}),e.jsx("div",{className:`${T.advancedPanel} ${d?T.advancedPanelOpen:T.advancedPanelClosed}`,children:e.jsx("div",{className:T.advancedPanelInner,children:e.jsx(Re,{title:r("basicDetails.deleteAccountRow.title"),description:r("basicDetails.deleteAccountRow.description"),onClick:()=>l(A.DELETE.KEY),endContent:e.jsx(je,{size:20,className:T.chevron})})})})]}),e.jsx("div",{className:T.logoutDivider}),e.jsx(Re,{title:r("basicDetails.logoutRow.title"),description:r("basicDetails.logoutRow.description"),onClick:o,endContent:e.jsxs("div",{className:T.menuAction,children:[e.jsx(C,{variant:"label-md",children:r("basicDetails.logoutRow.action")}),e.jsx(je,{size:20})]})})]})},fn="_form_1all9_1",Cn="_labelSpan_1all9_5",_n="_fieldMain_1all9_9",xn="_fieldInputWrapper_1all9_13",vn="_fieldInput_1all9_13",wn="_fieldInputDisabled_1all9_21",bn="_fieldLabel_1all9_25",Nn="_emailField_1all9_29",En="_ageField_1all9_33",In="_selectItem_1all9_38",Sn="_saveButton_1all9_42",B={form:fn,labelSpan:Cn,fieldMain:_n,fieldInputWrapper:xn,fieldInput:vn,fieldInputDisabled:wn,fieldLabel:bn,emailField:Nn,ageField:En,selectItem:In,saveButton:Sn},Me={mainWrapper:B.fieldMain,inputWrapper:B.fieldInputWrapper,input:B.fieldInput,label:B.fieldLabel},jn={...ze,label:B.fieldLabel,trigger:`${ze.trigger} z-0 !rounded-lg`,base:"w-full gap-2"},An=({closeSideBar:r,name:t,age:a,gender:i,email:n,error:s,onUpdateForm:d,onSave:u,isLoading:l,isDisabled:o})=>{const{t:h}=K([b.MY_ACCOUNT,b.COMMON]);return e.jsxs("form",{className:B.form,children:[e.jsx(_e,{label:e.jsxs("span",{className:B.labelSpan,children:[e.jsx(C,{variant:"label-lg",children:h("basicDetails.form.Name")}),e.jsx(C,{variant:"label-md",color:"textRed600",children:"*"})]}),type:"text",name:"name",id:"name",className:"z-0",classNames:Me,placeholder:"Name",variant:"bordered","aria-label":"name",isInvalid:s.name!=="",errorMessage:s.name,value:t,maxLength:rt.MAX_LENGTH+1,onClick:()=>r(!0),onChange:c=>{d(c.target.name,c.target.value)},autoComplete:"Off"}),e.jsx("div",{className:B.emailField,children:e.jsx(_e,{label:e.jsxs("span",{className:B.labelSpan,children:[e.jsx(C,{variant:"label-lg",children:h("basicDetails.form.Email")}),e.jsx(C,{variant:"label-md",color:"textRed600",children:"*"})]}),type:"email",name:"email",id:"email",className:"z-0",classNames:{...Me,input:`${B.fieldInput} ${B.fieldInputDisabled}`},"aria-label":"email",isDisabled:!0,value:n,autoComplete:"Off"})}),e.jsx(_e,{label:e.jsx(C,{variant:"label-lg",children:h("basicDetails.form.Age")}),type:"number",name:"age",id:"age",className:`z-0 ${B.ageField}`,classNames:Me,variant:"bordered","aria-label":"age",isInvalid:s.age!=="",errorMessage:s.age,value:a?.toString(),placeholder:"Age",onChange:c=>{d(c.target.name,c.target.value)},onClick:()=>r(!0)}),e.jsx(kt,{label:e.jsx(C,{variant:"label-lg",children:h("basicDetails.form.Gender")}),"aria-label":"Gender",size:"lg",name:"gender",id:"gender",onChange:c=>{d(c.target.name,c.target.value)},labelPlacement:"outside",selectedKeys:i?new Set([i.charAt(0).toUpperCase()+i.slice(1).toLowerCase()]):new Set,placeholder:"Select Gender",variant:"bordered",isInvalid:s.gender!=="",errorMessage:s.gender,classNames:jn,className:`${s.gender!==""?B.selectItem:""} w-full`,children:[Ge.MALE,Ge.FEMALE].map(c=>e.jsx($t,{value:c,textValue:c,className:Pe,children:e.jsx(C,{variant:"label-md",color:"textWhite",children:c})},c))}),e.jsx("div",{className:B.saveButton,children:e.jsx(G,{variant:Y.WHITE,size:Ht.MD,onPress:u,isLoading:l,isDisabled:o,text:h(z.SAVE)})})]})},yn="_profileSection_1wi9l_1",Dn="_profilePic_1wi9l_5",Rn="_profileHint_1wi9l_9",Mn="_camera_1wi9l_13",Pn="_cameraIcon_1wi9l_17",Tn="_avatarWrapper_1wi9l_21",On="_avatarImage_1wi9l_25",Ln="_avatarFallback_1wi9l_29",Un="_avatarSkeleton_1wi9l_33",Bn="_avatarHidden_1wi9l_37",kn="_avatarVisible_1wi9l_41",$={profileSection:yn,profilePic:Dn,profileHint:Rn,camera:Mn,cameraIcon:Pn,avatarWrapper:Tn,avatarImage:On,avatarFallback:Ln,avatarSkeleton:Un,avatarHidden:Bn,avatarVisible:kn},$n=({profileImage:r,uploadedImageSrc:t,isImageLoaded:a,onImageLoaded:i,userName:n,fallbackSrc:s,onClick:d})=>{const{t:u}=K(b.MY_ACCOUNT);return e.jsxs("div",{className:$.profileSection,children:[e.jsxs("div",{className:$.profilePic,onClick:d,children:[r?e.jsxs("div",{className:$.avatarWrapper,children:[e.jsx(Yt,{className:`${$.avatarSkeleton} ${a?$.avatarHidden:$.avatarVisible}`}),e.jsx("img",{src:t,alt:"Profile Picture",className:`${$.avatarImage} ${a?$.avatarVisible:$.avatarHidden}`,id:"nextImageProfile",onLoad:i,onError:i})]}):e.jsx(at,{name:n,size:"100%",className:$.avatarFallback,src:s}),e.jsx("div",{className:$.camera,children:e.jsx(Ft,{className:$.cameraIcon})})]}),e.jsx("span",{className:$.profileHint,children:e.jsx(C,{variant:"body-sm",color:"textGray600",align:"center",children:u("basicDetail
1s.choosePicture")})})]})},Hn={"image/jpg":".jpg","image/jpeg":".jpeg","image/png":".png"},V={PROFILE_IMAGE:"profileImage",UPDATE_PROFILE_IMAGE:"updateProfileImage",LOCALE:"locale",NAME:"name",AGE:"age",GENDER:"gender"},Ze=15e3,Yn=({closeSideBar:r})=>{const t=te(f=>f.user.user),a=te(f=>f.user.authUser),{updateUser:i,isUpdatingUser:n}=ut(),{setShowModal:s,setModalContent:d}=ve(),{getGenderChangeModalConfig:u,getSaveChangesConfirmationModalConfig:l}=we(),[o,h]=p.useState(!1),[c,g]=p.useState({name:"",age:"",gender:"",locale:""}),[m,w]=p.useState(!1),[j,R]=p.useState(!1),{name:y,age:k,gender:O,email:F,profileImage:D}=t||{},[_,x]=p.useState({name:y,age:k,gender:O,email:F,profileImage:D,updateProfileImage:null}),[I,U]=p.useState(!1),{t:v}=K([b.MY_ACCOUNT,b.COMMON]);p.useEffect(()=>{t&&t.imageGenType&&x(f=>({...f,imageGenType:t.imageGenType}))},[t?.imageGenType]),p.useEffect(()=>{t&&x(f=>({...f,profileImage:t.profileImage}))},[t?.profileImage]),p.useEffect(()=>{R(!1)},[_.profileImage]),p.useEffect(()=>{if(!t)return;const{name:f,age:S,gender:se,locale:Ue}=c||{},Be=f||S||se||Ue,Se=_.name!==t?.name,ke=_.age!==t?.age,gt=_.gender!==t?.gender,pt=_?.profileImage!==t?.profileImage,$e=m&&!Be&&(Se||ke||gt||pt);$e!==o&&h($e)},[c,_,m,t,o]);const J=(f=null)=>{_[V.UPDATE_PROFILE_IMAGE]=f},ee=(f,S)=>{if(!(!f||S===void 0||S===null)){if(f===V.PROFILE_IMAGE&&J(!0),f===V.GENDER){if(!S||S===_.gender)return;s(!0),d(u({onConfirm:()=>{ne(V.GENDER,S),s(!1)},onDiscard:()=>{s(!1)}}));return}ne(f,S)}},ne=(f,S)=>{x(se=>({...se,[f]:S})),g(se=>({...se,[f]:Ne(f,S)})),m||w(!0)};function Ne(f,S){return f===V.NAME&&Gt(S)?fe.USER_NAME_REQ:f===V.NAME&&S.length>rt.MAX_LENGTH?v(Z.USER_NAME_TOO_LONG):f===V.AGE&&Kt(S)?fe.USER_AGE:f===V.GENDER&&Wt(S)?fe.GENDER:f===V.LOCALE&&Xt(S)?fe.LOCALE:""}const he=()=>{const f=_.profileImage;if(typeof f=="string")return f.startsWith("data")||f.startsWith("https")||f.startsWith("http")?f:xe(f);try{return URL.createObjectURL(f)}catch(S){return it.error("Error in generating uploaded image URL",{error:S}),zt}},Ee=async f=>{const Se=await Ba(f,80,0,0,"webp");return await ka(Se)},pe=()=>{c.name||c.age||!t?._id||i({userId:t._id,formData:{..._},handleSuccess:()=>{J(),w(!1),M.success(v(be.UPDATE_PROFILE,{ns:b.COMMON}))},handleError:()=>{x(f=>({...f,profileImage:t.profileImage})),J(null),M.error(v(Z.UPDATE_USER,{ns:b.COMMON}))}})},P=async f=>{const S=await Ee(f);ee(V.PROFILE_IMAGE,S),U(!1)},Ie=f=>{const S=f.target.files[0];return S?Hn[S.type]?S.size/1024>Ze?(M.error(`${v(Z.FILE_BIG)} than ${Ze/1e3} MB`),f.target.value="",!0):!1:(M.error(v(Z.INVALID_TYPE)),f.target.value="",!0):(M.error(v(Z.UPLOAD_FILE)),!0)},mt=()=>{s(!0),d(l({onConfirm:()=>{pe(),s(!1)},onDiscard:()=>s(!1)}))};return e.jsxs("div",{className:me.container,children:[e.jsx(Ja,{showImageCropperModal:I,setShowImageCropperModal:U,invalidImageValidator:Ie,onSave:P}),e.jsxs("div",{className:me.card,children:[e.jsx("div",{className:me.title,children:e.jsx(C,{as:"h1",variant:"heading-sm-bold",children:v("basicDetails.title")})}),e.jsx($n,{profileImage:_.profileImage,uploadedImageSrc:he(),isImageLoaded:j,onImageLoaded:()=>R(!0),userName:t?.name||nt,fallbackSrc:t?.profileImage?xe(t.profileImage):a?.avatar,onClick:()=>U(!0)}),e.jsx("div",{className:me.divider}),e.jsx(An,{closeSideBar:r,name:_.name,age:_.age,gender:_.gender,email:t?.email,error:c,onUpdateForm:ee,onSave:mt,isLoading:n,isDisabled:!o}),e.jsx("div",{className:me.divider}),e.jsx(pn,{})]})]})},Fn="_container_1j3j4_1",zn="_row_1j3j4_5",Gn="_referBgImage_1j3j4_9",Kn="_referCardContainer_1j3j4_13",Wn="_cardHeadingContainer_1j3j4_17",Xn="_cardHeading_1j3j4_17",Vn="_cardSubHeading_1j3j4_25",qn="_coinImage_1j3j4_29",Qn="_coinText_1j3j4_33",Zn="_rewardsContainer_1j3j4_37",Jn="_rewardSubContainer_1j3j4_41",es="_referCard_1j3j4_13",ts="_referCardBody_1j3j4_49",as="_referCardInputContainer_1j3j4_53",ns="_referCardInput_1j3j4_53",ss="_referCardInputHeading_1j3j4_61",rs="_copyIcon_1j3j4_65",is="_redeemCardInputContainer_1j3j4_69",os="_redeemCardHeader_1j3j4_73",ls="_redeemCardBody_1j3j4_77",N={container:Fn,row:zn,referBgImage:Gn,referCardContainer:Kn,cardHeadingContainer:Wn,c
1ardHeading:Xn,cardSubHeading:Vn,coinImage:qn,coinText:Qn,rewardsContainer:Zn,rewardSubContainer:Jn,referCard:es,referCardBody:ts,referCardInputContainer:as,referCardInput:ns,referCardInputHeading:ss,copyIcon:rs,redeemCardInputContainer:is,redeemCardHeader:os,redeemCardBody:ls},cs=()=>{const[r,t]=p.useState(!0),a=te(v=>v.user.user),[i,n]=p.useState(!1),[s,d]=p.useState(ue.INVITE),[u,l]=p.useState(!1),[o,h]=p.useState(""),[c,g]=p.useState(""),[m,w]=p.useState(""),[j,R]=p.useState(!1),[y,k]=p.useState(!1),[O,F]=p.useState(null),{verifyReferralCode:D}=ot(),{localizedNavigate:_}=ge(),{t:x}=K([b.MY_ACCOUNT,b.COMMON]),I=async(v,J)=>{try{await navigator.clipboard.writeText(v),M.success(J||x("customToast.copiedToClipboard",{ns:b.COMMON}))}catch(ee){M.error(ee?.message||x("errors.failedToCopy"))}};p.useEffect(()=>{a?.referral_code&&(h(`${window.location.origin}/invite/${a?.referral_code}`),g(a?.referral_code),t(!1))},[a]);const U=async()=>{k(!0);try{const v=await D(m,a?.kid||"");l(v?.data?.isValid),v?.data?.isValid&&(M.success(x("customToast.referralCodeAppliedSuccessfully",{ns:b.COMMON})),setTimeout(()=>{_({location:{pathname:`/${de.SUBSCRIPTION.PATHNAME}`,search:"?prevPath=refer"}})},2e3))}catch(v){F(v?.message||x("errors.somethingWentWrong")),R(!0)}finally{k(!1)}};return e.jsx(e.Fragment,{children:r?e.jsx("div",{className:N.container,children:e.jsx(Te,{size:"lg",color:"primary"})}):e.jsxs("div",{className:N.container,children:[e.jsxs("div",{className:N.row,children:[e.jsx("img",{className:N.referBgImage,src:"/images/referImg.webp",alt:"Refer friends"}),e.jsxs("div",{className:N.referCardContainer,children:[e.jsxs("div",{className:N.cardHeadingContainer,children:[e.jsx("div",{className:N.cardHeading,children:e.jsx(C,{as:"h2",variant:"heading-md",children:x("refer.heading")})}),e.jsx("div",{className:N.cardSubHeading,children:e.jsx(C,{as:"h6",variant:"body-lg",children:x("refer.subHeading")})})]}),e.jsxs("div",{className:N.rewardsContainer,children:[e.jsxs("div",{className:N.rewardSubContainer,children:[e.jsxs("div",{className:N.coinText,children:[e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.youReceive")})," "," "]}),e.jsx("img",{className:N.coinImage,src:"/images/Coin.png",alt:"Coin",loading:"lazy"}),e.jsxs("div",{className:N.coinText,children:[" ",e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.coins",{coins:10})})]})]}),e.jsxs("div",{className:N.rewardSubContainer,children:[e.jsxs("div",{className:N.coinText,children:[e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.friendsReceive")})," "," "]}),e.jsx("img",{className:N.coinImage,src:"/images/Coin.png",alt:"Coin",loading:"lazy"}),e.jsxs("div",{className:N.coinText,children:[" ",e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.coins",{coins:10})})]})]})]}),e.jsxs("div",{className:[N.referCard].join(" "),children:[e.jsx("div",{className:"w-full flex flex-row justify-center",children:e.jsxs(Vt,{"aria-label":"Options",defaultSelectedKey:"",className:"w-full",variant:"underlined",onSelectionChange:v=>d(v),classNames:{cursor:"bg-overlay-highlight",tabContent:"group-data-[selected=true]:text-content-highlight",base:"*:w-[100%] *:flex-row *:justify-evenly md:mt-4 max-xsm:mt-0",tab:`w-min ${qt.bodyLg}`},children:[e.jsx(Ke,{title:x("refer.inviteFriends")},ue.INVITE),e.jsx(Ke,{title:x("refer.redeemCode")},ue.REDEEM)]})}),s===ue.INVITE&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:N.referCardBody,children:[e.jsxs("div",{className:N.referCardInputContainer,children:[e.jsx("div",{className:N.referCardInputHeading,children:e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.invitationCode")})}),e.jsxs("div",{className:N.referCardInput,children:[e.jsx("div",{children:e.jsx(C,{variant:"body-md",children:c})}),e.jsx(We,{className:N.copyIcon,size:20,onClick:()=>{I(c,"Referral Code Copied")}})]})]}),e.jsxs("div",{className:N.referCardInputContainer,children:[e.jsx("div",{className:N.referCardInputHeading,children:e.jsx(C,{variant:"body-lg",b:!0,children:x("refer.invitationLink")})}),e.jsxs("div",{className:N.referCardInput,children:[e.jsx("div",{className:"flex flex-nowrap max-xsm:w-[300px] mr-4 pr-4 text-nowrap overflow-x-scroll scrollbar-hide",children:e.jsx(C,{as:"span",variant:"body-md",children:o})}),e.jsx("div",{children:e.jsx(We,{className:N.copyIcon,size:20,onClick:()=>{I(o,x("refer.inviteLinkCopied"))}})})]})]}),e.jsx(G,{variant:Y.PRIMARY,onPress:()=>n(!0),text:x("refer.inviteFriendsNow")})]})}),s===ue.REDEEM&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:N.redeemCardHeader,children:e.jsx(C,{as:"h1",variant:"heading-lg",align:"center",children:x("refer.redeem.heading")})}),e.jsxs("div",{className:N.redeemCardBody,children:[e.jsxs("div",{className:N.redeemCardInputContainer,children:[e.jsx(C,{variant:"body-lg",b:!0,align:"center",children:x("refer.redeem.subHeading")}),e.jsx("div",{className:"w-full mt-4",children:e.jsx(_e,{errorMessage:O,value:m,isInvalid:O?.length>0,onChange:v=>{w(v.target.value),F(""),R(!1)},endContent:O?e.jsx("div",{className:"cursor-pointer",onClick:()=>{w(""),F(""),R(!1)},children:e.jsx(Qt,{color:Xe.red,size:24})}):u&&e.jsx(Zt,{color:Xe.green,size:24}),classNames:{inputWrapper:"!rounded-md",base:"*:w-full *:hover:bg-transparent"},placeholder:x("refer.redeem.placeholder")})})]}),e.jsx(G,{variant:Y.PRIMARY,isDisabled:m?.length<3||j||y,isLoading:y,onPress:()=>{U()},text:x("refer.redeem.applyCode")})]}),e.jsxs("div",{className:"w-[70%] max-xsm:w-[90%] max-xsm:mt-auto text-center text-md mt-4",children:[e.jsxs(C,{variant:"body-md",children:[x("refer.redeem.dontHaveReferralCode")," "]}),e.jsx(lt,{className:"text-content-highlight underline",to:"/subscribe?prevPath=refer",children:e.jsx(C,{variant:"body-md",color:"textPrimary",u:!0,children:x("refer.redeem.here")})})]})]})]})]})]}),e.jsx(da,{visible:i,setShowShare:n,shareUrl:o,shareMessage:"Join me on the app and earn rewards together!",title:"Invite Friends",instructions:"Share this link with your friends to invite them to the app"})]})})},ds=Oe(cs),hs="_container_6i2r7_1",us="_subContainer_6i2r7_5",ms="_subDiv_6i2r7_9",gs="_title_6i2r7_13",ps="_value_6i2r7_17",fs="_actionButton_6i2r7_21",Cs="_disableButton_6i2r7_25",Q={container:hs,subContainer:us,subDiv:ms,title:gs,value:ps,actionButton:fs,disableButton:Cs},_s="subscription.noSubscription",xs="subscription.expiredSubscription",le=({title:r,value:t})=>{const{t:a}=K(b.COMMON);return e.jsxs("div",{className:Q.subDiv,children:[e.jsx("div",{className:Q.title,children:e.jsxs(C,{variant:"heading-xs",b:!0,children:[" ",r||a("subscription.titles.na","N/A")," "]})}),e.jsx("div",{className:Q.value,children:e.jsxs(C,{variant:"body-md",children:[" ",t||a("subscription.titles.na","N/A")," "]})})]})},Je=r=>{if(!r)return"";try{return sa(new Date(r*1e3),"MMMM do, yyyy")}catch(t){return it.error("Format Date",{error:t}),r}},vs=({platform:r,price:t,plan:a,currency:i},n)=>{if(!t||!a)return"";if(r===q.COINS)return`${t} ${n("subscription.coins","Coins")}`;let s=(i||"$")+" ";const d=r===q.IOS?1:100;return typeof t=="number"&&(s+=`${t/d}`),q.STRIPE===r?Ce.yearly.includes(a)?(s+=" /year",s):Ce.monthly.includes(a)?(s+=` ${n("subscription.perMonth","/month")}`,s):(s+=` ${n("subscription.perQuarter","/quarter")}`,s):(s=`${i||"$"} `,typeof t=="number"&&(s+=t.toFixed(2)),Ce.yearly.includes(a)?(s+=" /year",s):Ce.monthly.includes(a)?(s+=` ${n("subscription.perMonth","/month")}`,s):(s+=` ${n("subscription.perQuarter","/quarter")}`,s))},ws=()=>{const{GetActiveSubscriptionPlan:r,CancelSubscription:t}=ot(),{getCancelSubscriptionConfirmationModalConfig:a,getCancelSubscriptionOnGooglePlayModalConfig:i,getCancelSubscriptionOnApplePlayModalConfig:n,getCannotCancelNonWebSubscriptionModalConfig:s,getCancelSubscriptionModalConfig:d}=we(),u=te(P=>P.user.user),{subscriptionPlan:l}=ct(),o=Jt(),{lng:h}=ea(),{setShowModal:c,setModalContent:g}=ve(),[m,w]=p.useState(!1),[j,R]=p.useState(!1),[y,k]=p.useState(!1),[O,F]=p.useState(!0),{logEvent:D}=ta(),[_,x]=p.useState(_s),[I,U]=p.useState({}),{t:v}=K([b.MY_ACCOUNT,b.COMMON]),{localizedNavigate:J}=ge(),ee=p.useCallback(()=>{const P=u?.subscriptionPlan?.name?A.SUBSCRIPTION.KEY:A.BASIC_DETAILS.KEY,Ie=h?`/${h}`:"";J({location:{pathname:`/${de.SUBSCRIPTION.PATHNAME}`,search:`?prevPath=${Ie}/${de.MY_ACCOUNT.PATHNAME}?section=${P}`},options:{replace:!0}})},[u?.subscriptionPlan?.name,h,o]),ne=()=>{D({eventName:ra.UPGRADE_SUBSCRIPTION}),ee()},Ne=()=>{c(!0),g(s({onConfirm:()=>c(!1),onDiscard:()=>c(!1)}))},he=()=>{if(k(!0),!!I){if(I?.platform===q.GOOGLE_PLAY||I?.platform===q.APPLE_PLAY)return Ne();t().then(()=>{M.success(v(be.CANCEL_SUBSCRIPTION,{ns:b.COMMON})),U(P=>({...P,status:Ve.CANCELLED,coins:{...P.coins,status:Ve.CANCELLED}})),r().then(P=>{U(P),P?.status!==Ae.ACTIVE.toLowerCase()&&R(!0)}).catch(()=>{M.error(v(Z.GET_SUBSCRIPTION_PLAN))})}).catch(()=>M.error(Z.CANCEL_SUBSCRIPTION)).finally(()=>k(!1))}},Ee=()=>{const P=I?.platform;if(P)switch(P){case q.GOOGLE_PLAY:{c(!0),g(i({onConfirm:()=>c(!1),onDiscard:()=>c(!1)}));break}case q.APPLE_PLAY:{c(!0),g(n({onConfirm:()=>c(!1),onDiscard:()=>c(!1)}));break}case q.STRIPE:{c(!0),g(a({onConfirm:()=>{he(),c(!1)},onDiscard:()=>c(!1)}));break}case q.PAYPAL:{c(!0),g(a({onConfirm:()=>{he(),c(!1)},onDiscard:()=>c(!1)}));break}case q.COINS:{c(!0),g(a({onConfirm:()=>{he(),c(!1)},onDiscard:()=>c(!1)}));break}default:c(!0),g(d({onConfirm:()=>c(!1),onDiscard:()=>c(!1)}))}},pe=p.useCallback(()=>{l===aa.PREMIUM_PRO_YEARLY&&w(!0)},[l]);return p.useEffect(()=>{pe()},[l,pe]),p.useEffect(()=>{if(u?.subscriptionPlan&&!u?.subscriptionPlan?.name){ee();return}if(u?.subscriptionPlan&&!u?.subscriptionPlan?.isActive&&u.subscriptionPlan?.name){x(xs),F(!1);return}r().then(P=>{U(P),P?.status!==Ae.ACTIVE.toLowerCase()&&R(!0)}).catch(()=>{M.error(v(Z.GET_SUBSCRIPTION_PLAN))}).finally(()=>F(!1))},[u]),O?e.jsx("div",{className:"flex flex-row justify-center items-center h-full",children:e.jsx(Te,{size:"lg"})}):e.jsx("div",{className:Q.container,children:u?.subscriptionPlan?.isActive?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:Q.subContainer,children:[e.jsx(le,{title:v("subscription.titles.Subscription"),value:na[I?.subscription]?.title}
1),e.jsx(le,{title:v("subscription.titles.Status"),value:I?.status}),e.jsx(le,{title:v("subscription.titles.Purchased On"),value:Je(I.created)}),e.jsx(le,{title:I?.status===Ae.CANCELLED.toLowerCase()?v("subscription.titles.Active Till"):v("subscription.titles.Renewal Date"),value:Je(I.renewalDate)}),e.jsx(le,{title:v("subscription.titles.Platform"),value:I?.platform}),e.jsx(le,{title:v("subscription.titles.Amount Paid"),value:vs({platform:I.platform,price:I.amount,plan:I.subscription,currency:I?.currency?.toUpperCase()},v)}),e.jsxs("div",{className:Q.subDiv,children:[e.jsx("div",{className:Q.title,children:e.jsxs(C,{variant:"label-lg",b:!0,children:[" ",v("subscription.titles.Actions")," "]})}),e.jsx("div",{className:[Q.value,Q.actionButton,j?Q.disableButton:""].join(" "),onClick:()=>{j||Ee()},children:y?e.jsx(Te,{size:"md"}):e.jsxs(C,{variant:"body-md",children:[" ",v(z.CANCEL)," "]})})]})]}),e.jsx(G,{variant:Y.PRIMARY,isDisabled:m,onPress:ne,text:v(z.UPGRADE_NOW)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(C,{variant:"heading-xl",b:!0,children:[" ",v(_)," "]}),e.jsx(G,{variant:Y.PRIMARY,onPress:ne,text:v(z.BOY_NOW)})]})})},bs="_container_fze10_1",Ns="_row_fze10_5",Es="_referBgImage_fze10_9",Is="_deleteButtons_container_fze10_13",Ss="_rightContainer_fze10_17",js="_rightContainer_heading_fze10_21",As="_rightContainer_heading_content_fze10_25",ys="_rightContainer_description_fze10_29",Ds="_reasonButtonWrapper_fze10_33",H={container:bs,row:Ns,referBgImage:Es,deleteButtons_container:Is,rightContainer:Ss,rightContainer_heading:js,right
1Container_heading_content:As,rightContainer_description:ys,reasonButtonWrapper:Ds},et=[{reasonCode:"UNCLEAR_VALUE",reason:"deleteAccount.reasons.UNCLEAR_PURPOSE"},{reasonCode:"STARTING_NEW_ACCOUNT",reason:"deleteAccount.reasons.NEW_ACCOUNT"},{reasonCode:"PRIVACY_CONCERNS",reason:"deleteAccount.reasons.PRIVACY_CONCERNS"},{reasonCode:"EXPECTED_MORE",reason:"deleteAccount.reasons.EXPECTED_MORE"},{reasonCode:"OTHER",reason:"deleteAccount.reasons.OTHER"}],Rs="deleteAccount.selectReasonHeading",tt=10,Ms=()=>{const[r,t]=p.useState(null),[a,i]=p.useState(!1),[n,s]=p.useState(!1),[d,u]=p.useState(tt),l=p.useRef(null),{deleteUser:o}=ut(),{localizedNavigate:h}=ge(),{logOut:c}=ia(),{t:g}=K(b.MY_ACCOUNT),m=async()=>{await c(),localStorage.clear()},w=()=>{if(!a){h({location:{pathname:"/"}});return}return j()},j=()=>{i(!1),s(!1),u(tt),l.current&&clearInterval(l.current)},R=()=>{if(!r){M.error(g(Rs));return}i(!0),y()},y=()=>{l.current=setInterval(()=>{u(D=>D-1)},1e3)},k=D=>{if(!D||D>0)return;l.current&&clearInterval(l.current),s(!0);const _=et.find(x=>x.reasonCode===r);o({reasonCode:_?.reasonCode??"OTHER",reason:g(_?.reason??"",{lng:oa}),handleSuccess:async()=>{M.success(g(be.DELETE_USER,{ns:b.COMMON})),s(!1),i(!1),u(10),await m()},handleError:()=>{M.error(g(Z.DELETE_USER,{ns:b.COMMON})),s(!1),i(!1),u(10)}})};p.useEffect(()=>{k(d)},[d]);const O=()=>n?`${g(z.DELETE)}`:a?`${g(z.DELETE)} (${d})`:`${g(z.DELETE)}`,F=D=>{a||n||r===D||t(D)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:H.rightContainer_heading,children:e.jsx("div",{className:H.rightContainer_heading_content,children:e.jsx(C,{as:"h1",variant:"heading-xl",children:g("deleteAccount.feedback.question",{ns:b.MY_ACCOUNT})})})}),et?.map(D=>e.jsx("div",{className:H.reasonButtonWrapper,children:e.jsx(G,{variant:D.reasonCode===r?Y.PRIMARY:Y.SECONDARY,onPress:()=>{F(D.reasonCode)},fullWidth:!0,text:g(D.reason)})},D.reasonCode)),e.jsxs("div",{className:H.deleteButtons_container,children:[e.jsx(G,{variant:Y.PRIMARY,onPress:w,isDisabled:n,text:g(a?z.CANCEL:z.BACK_TO_HOME)}),e.jsx(G,{variant:Y.STROKED,isLoading:n,isDisabled:n||a,onPress:R,text:O()})]})]})},Ps=`/${de.MY_ACCOUNT.PATHNAME}?section=${A.SUBSCRIPTION.KEY}`,Ts=({user:r,onDelete:t})=>{const{subscribed:a}=ct(),{t:i}=K([b.MY_ACCOUNT,b.COMMON]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:H.rightContainer_heading,children:e.jsx("div",{className:H.rightContainer_heading_content,children:e.jsx(C,{as:"h1",variant:"heading-xl",children:e.jsx(la,{i18nKey:"deleteAccount.heading",values:{name:r?.name||":( "},components:{1:e.jsx(C,{as:"span",variant:"heading-xl"}),br:e.jsx("br",{})},ns:b.MY_ACCOUNT})})})}),e.jsx("div",{className:H.rightContainer_description,children:e.jsx(C,{as:"p",variant:"body-md",b:!0,children:i("deleteAccount.de
1scription")})}),a?e.jsx("div",{className:H.rightContainer_description,children:e.jsxs(C,{as:"p",variant:"body-md",b:!0,children:[i("deleteAccount.cancelSubscription.title"),e.jsx(lt,{to:Ps,children:e.jsx(C,{variant:"body-md",color:"textPrimary",u:!0,b:!0,children:i("deleteAccount.cancelSubscription.link")})}),i("deleteAccount.cancelSubscription.subtitle")]})}):e.jsx(e.Fragment,{}),e.jsx(G,{variant:Y.STROKED,onPress:t,text:i(z.CONTINUE)})]})},Os=()=>{const[r,t]=p.useState(1),a=te(i=>i.user.user);return e.jsxs("div",{className:H.container,children:[e.jsx(dt,{pageKey:ht.DELETE_ACCOUNT}),e.jsxs("div",{className:H.row,children:[e.jsx("img",{className:H.referBgImage,src:"/images/referImg.webp",alt:"Delete Account"}),e.jsx("div",{className:H.rightContainer,children:e.jsx("div",{className:H.rightContainer,children:r===1?e.jsx(Ts,{user:a,onDelete:()=>t(2)}):e.jsx(Ms,{})})})]})]})},Ls=Oe(Os),ce={BASIC_DETAILS:A.BASIC_DETAILS,SUBSCRIPTION:A.SUBSCRIPTION,MY_COMPANIONS:A.MY_COMPANIONS,REFER_AND_EARN:A.REFER_AND_EARN,DELETE:A.DELETE},Us=()=>{const[r]=st(),[t,a]=p.useState(ce.BASIC_DETAILS),[i,n]=p.useState(!1),s=p.useCallback(l=>{n(l!==void 0?!!l:!i)},[i]),d=p.useMemo(()=>new Map([[ce.BASIC_DETAILS.TITLE,e.jsx(Yn,{closeSideBar:s},A.BASIC_DETAILS.KEY)],[ce.SUBSCRIPTION.TITLE,e.jsx(ws,{},A.SUBSCRIPTION.KEY)],[ce.MY_COMPANIONS.TITLE,e.jsx(Da,{},A.MY_COMPANIONS.KEY)],[ce.REFER_AND_EARN.TITLE,e.jsx(ds,{},A.REFER_AND_EARN.KEY)],[ce.DELETE.TITLE,e.jsx(Ls,{},A.DELETE.KEY)]]),[s]),u=p.useCallback(l=>{let o=t;switch(l){case A.SUBSCRIPTION.KEY:o=A.SUBSCRIPTION;break;case A.MY_COMPANIONS.KEY:o=A.MY_COMPANIONS;break;case A.REFER_AND_EARN.KEY:o=A.REFER_AND_EARN;break;case A.DELETE.KEY:o=A.DELETE;break;default:o=A.BASIC_DETAILS}if(o!==t){if(a(o),l===A.SUBSCRIPTION.KEY||!l)return;localStorage.setItem(ca,l)}},[t]);return p.useEffect(()=>{const l=r.get("section");u(l)},[u,r]),e.jsxs("div",{className:ye.container,children:[e.jsx(dt,{pageKey:ht.MY_ACCOUNT}),e.jsx("div",{className:`${ye.activeComponent} ${i?ye.expandedContent:""}`,children:d.get(t.TITLE)})]})},Fs=Oe(Us);export{Fs as default};

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.