1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[102,8149,7302],{92772:function(e,t,r){var a=r(57437),n=r(2265),l=r(76975),o=r(29501),i=r(31691),s=r(50290),d=r(33833),c=r(23996),u=r(53024),m=r(46387),p=r(2323),h=r(1899),x=r(70203),v=r(22577),y=r(69459);t.Z=e=>{let{name:t,label:r,icon:b,iconType:f="iconify",options:g,disabled:w,required:j=!1,error:Z,helperText:S,searchText:k,setSearchText:C,handleSelect:A,value:I,onChange:N,defaultValue:F,usePlaceholder:P=!1,placeholder:W,static:R=!1,removeIconMenu:O=!1,chevronIcon:D}=e,M=(0,i.Z)(),z=(0,o.Gc)(),[E,V]=n.useState(!1),[B,q]=n.useState(""),T=z&&t?!!z.getValues(t):!!I||!!F,G=()=>Array.isArray(g)?"string"==typeof g[0]?g.map(e=>(0,a.jsxs)(s.Z,{value:e,sx:{display:"flex",alignItems:"center",gap:"8px"},children:[O?"":b&&K(),e]},e)):Array.isArray(g[0])?g.map(e=>{let[t,r]=e;return(0,a.jsxs)(s.Z,{value:t,sx:{display:"flex",alignItems:"center",gap:"8px"},children:[O?"":b&&K(),r]},t)}):g.map(e=>(0,a.jsxs)(s.Z,{value:e.key,sx:{display:"flex",alignItems:"center",gap:"8px"},children:[O?"":b&&K(),e.label]},e.key)):null,_=e=>{if(Array.isArray(g)){if("string"==typeof g[0])return e;if(Array.isArray(g[0])){let t=g.find(t=>{let[r]=t;return r===e});return t?t[1]:e}let t=g.find(t=>t.key===e);return t?t.label:e}return e},L=e=>{let t=e.target.value;C?C(t):q(t)},U=!0===R||"icon"===R,H=!0===R||"label"===R,K=()=>b?"iconify"===f?(0,a.jsx)(l.Z,{icon:b,sx:{color:M.palette.primary.light,width:24,height:24}}):(0,a.jsx)("img",{src:b,alt:"icon",style:{width:"24px",height:"24px"}}):null,Y=e=>(0,a.jsxs)(d.Z,{...e||{},id:t,labelId:t?"".concat(t,"-label"):void 0,onChange:N||A||(null==e?void 0:e.onChange),value:I||(null==e?void 0:e.value),defaultValue:F,fullWidth:!0,displayEmpty:!0,disabled:w,IconComponent:D?e=>(0,a.jsx)(c.Z,{position:"end",sx:{pointerEvents:"none",mr:1},children:(0,a.jsx)(l.Z,{icon:D,sx:{color:M.palette.primary.light,width:24,height:24}})}):void 0,input:(0,a.jsx)(u.Z,{label:r,notched:!0,sx:{"& .MuiSelect-select":{paddingTop:"16.5px",paddingBottom:"16.5px"},...U&&b&&{paddingLeft:"40px"},...D&&{"& .MuiSelect-select":{paddingRight:"14px"}}}}),renderValue:e=>e||H?_(e):(0,a.jsx)(m.Z,{color:"textSecondary",children:W||(P?r:"")}),MenuProps:{PaperProps:{sx:{maxHeight:{xs:263,sm:326},width:250}},autoFocus:!1},onFocus:()=>V(!0),onBlur:()=>V(!1),startAdornment:b&&U&&(0,a.jsx)(c.Z,{position:"start",sx:{position:"absolute",left:"10px"},children:K()}),children:[(void 0!==k||C)&&(0,a.jsx)(p.Z,{children:(0,a.jsx)(u.Z,{size:"small",autoFocus:!0,placeholder:"Search ".concat(r||""),fullWidth:!0,startAdornment:(0,a.jsx)(c.Z,{position:"start",children:(0,a.jsx)(l.Z,{icon:"eva:search-fill",width:24,sx:{color:"text.disabled"}})}),value:void 0!==k?k:B,onChange:L,onKeyDown:e=>{"Escape"!==e.key&&e.stopPropagation()},sx:{"&::placeholder":{color:M.palette.text.disabled}}})}),G()]});return(0,a.jsx)(h.Z,{children:(0,a.jsxs)(x.Z,{variant:"outlined",fullWidth:!0,sx:{background:"#0A0F18",borderRadius:1,"& .MuiOutlinedInput-root":{borderRadius:1,"& fieldset":{borderColor:E?"white":"transparent"},"&:hover fieldset":{borderColor:E?"white":"transparent"},"&.Mui-focused fieldset":{borderColor:"white"}}},error:!!Z,children:[r&&(0,a.jsxs)(v.Z,{id:t?"".concat(t,"-label"):void 0,htmlFor:t,shrink:H||E||T,sx:{color:T||E?"#FFFFFF":"#9CA3AF",display:"flex",alignItems:"center",zIndex:1,transition:"all 0.2s ease-out",...H&&{transform:"translate(14px, -9px) scale(0.75)","&.MuiInputLabel-shrink":{transform:"translate(14px, -9px) scale(0.75)"},"&::before":{content:'""',display:"block",position:"absolute",top:"0",right:"-0.2em",left:"-0.2em",height:"100%",backgroundColor:"transparent",zIndex:-1}}},children:[!E&&!T&&!U&&K(),r,j&&(0,a.jsx)(m.Z,{component:"span",variant:"inherit",sx:{color:"#ed4263",marginLeft:"2px",verticalAlign:"top"},children:"*"})]}),t&&z?(0,a.jsx)(o.Qr,{name:t,control:z.control,defaultValue:F,render:e=>{let{field:t}=e;return Y(t)}}):Y(),Z&&(0,a.jsx)(y.Z,{sx:{color:"#ba3619"},children:S})]})})}},47302:function(e,t,r){r.r(t),r.d(t,{default:function(){return l}});var a=r(57437),n=r(29501);function l(e){let{children:t,onSubmit:r,methods:l}=e;return(0,a.jsx)(n.RV,{...l,children:(0,a.jsx)("form",{onSubmit:r,children:t})})}},11417:function(e,t,r){r.d(t,{a:function(){return d},Z:function(){return a.default}});var a=r(47302),n=r(57437);r(2265);var l=r(29501),o=r(1899),i=r(89051),s=r(12713);function d(e){let{name:t,helperText:r,type:a,tooltip:d,handleTooltipClose:c,open:u,labelInput:m,boxStyles:p,maxLength:h,...x}=e,{control:v}=(0,l.Gc)(),y=p||{width:"100%"};return(0,n.jsx)(l.Qr,{name:t,control:v,render:e=>{let{field:l,fieldState:{error:p}}=e,v={...x.inputProps,autoComplete:"new-password",...h?{maxLength:h}:{}},b=m?(0,n.jsxs)(o.Z,{sx:y,children:[m,(0,n.jsx)(s.Z,{...l,id:t,fullWidth:!0,type:a,value:"number"===a&&0===l.value?"":l.value,onChange:e=>
1{"number"===a?l.onChange(Number(e.target.value)):l.onChange(e.target.value)},error:!!p,helperText:p?p.message:r,...x,inputProps:v})]}):(0,n.jsx)(s.Z,{...l,id:t,fullWidth:!0,type:a,value:"number"===a&&0===l.value?"":l.value,onChange:e=>{"number"===a?l.onChange(Number(e.target.value)):l.onChange(e.target.value)},error:!!p,helperText:p?p.message:r,...x,inputProps:{...x.inputProps,autoComplete:"new-password"}});return d?(0,n.jsx)(i.Z,{placement:"top-start",title:d,PopperProps:{disablePortal:!0},onClose:c,open:u,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,arrow:!0,children:b}):b}})}},33900:function(e,t,r){r.d(t,{K:function(){return i},m:function(){return o}});var a=r(16593),n=r(45345),l=r(55447);let o=e=>{let t="".concat(l.Hv.banks.banksByChannel).concat(e),r=async()=>(await l.ZP.get(t)).data;return(0,a.a)({queryKey:["GetBanksByChannel",t,e],queryFn:r,placeholderData:n.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:!1})},i=(e,t)=>{let{currency:r,code:o}=e,i="".concat(l.Hv.banks.banks,"?currencyCode=").concat(r,"&countryCode=").concat(o,"&limit=500"),s=async()=>(await l.ZP.get(i)).data;return(0,a.a)({queryKey:["GetBanks",i],queryFn:s,enabled:t,placeholderData:n.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0})}},42552:function(e,t,r){r.d(t,{G:function(){return i}});var a=r(16593),n=r(45345),l=r(49931),o=r(55447);let i=e=>{let{filter:t,populate:r,locale:i}=e,s=(0,l.Aj)(o.Hv.cms.getFooter,{filter:t,populate:r,locale:i});return(0,a.a)({queryKey:["getCMSFooter",s.toString()],queryFn:()=>(0,l.p0)(s.toString(),"footer"),placeholderData:n.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0})}},67352:function(e,t,r){r.d(t,{J:function(){return s}});var a=r(43577),n=r(2265),l=r(55447),o=r(16593),i=r(45345);let s=(e,t)=>{if(!["fiat","crypto",""].includes(e))throw Error('Invalid currency type. Must be "fiat", "crypto" or empty string');let r=(0,n.useMemo)(()=>"".concat(l.Hv.wallet.getChannelByCurrency,"/").concat(e,"/").concat(t),[e,t]),s=(0,n.useCallback)(async()=>{try{return(await l.ZP.get(r)).data}catch(r){if(r instanceof a.d7){var e,t;throw Error((null===(t=r.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.message)||"Failed to fetch currency data")}throw r}},[r]);return(0,o.a)({queryKey:["useGetChannelAvailableByCurrency",e],queryFn:s,placeholderData:i.Wk,refetchOnMount:!1,refetchOnWindowFocus:!1})}},17947:function(e,t,r){r.d(t,{BQ:function(){return s},DU:function(){return i},OS:function(){return c},W0:function(){return d},_y:function(){return m},lb:function(){return u}});var a=r(2265),n=r(16593),l=r(45345),o=r(55447);let i=(e,t)=>{let{fetchURL:r}=e;return(0,n.a)({queryKey:["getBankCardPaymentAddress",r],queryFn:async()=>{try{return(await o.ZP.get(r)).data}catch(e){throw"string"==typeof e?e:e.message}},enabled:t,placeholderData:l.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0})},s=(e,t)=>{let{fetchURL:r}=e;return(0,n.a)({queryKey:["getCryptoPaymentAddress",r],queryFn:async()=>{try{return(await o.ZP.get(r)).data}catch(e){throw"string"==typeof e?e:e.message}},enabled:t,placeholderData:l.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0})},d=e=>{let{page:t,limit:r,filters:i,authenticated:s}=e,d=(0,a.useMemo)(()=>{let e=new URL("".concat("https://api.xyes.com/api/v1"+o.Hv.gameRecord.getGameRecordByUser));return e.searchParams.append("page","".concat(t+1)),e.searchParams.append("limit",r.toString()),e.searchParams.append("search",i.search),e.searchParams.append("filters",i.filters),e.toString()},[t,r,i.search,i.filters]);return(0,n.a)({queryKey:["useGetGameRecordByUser",t,r,i.search,i.filters],queryFn:async()=>(await o.ZP.get(d)).data,placeholderData:l.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:s})},c=e=>{let{page:t,limit:r,filters:l,authenticated:i,enabled:s=!0}=e,d=(0,a.useMemo)(()=>{let e=new URL("".concat("https://api.xyes.com/api/v1"+o.Hv.transactions.getUserTransactionRecords));return e.searchParams.append("page","".concat(t+1)),e.searchParams.append("limit",r.toString()),l.filters&&e.searchParams.append("filters",l.filters),e.toString()},[t,r,l.filters]);return(0,n.a)({queryKey:["useGetFinancialRecordsByUser",t,r,l.filters],queryFn:async()=>(await o.ZP.get(d)).data,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:i&&s})},u=e=>{let{page:t,limit:r,filters:l,authenticated:i,enabled:s=!0}=e,d=(0,a.useMemo)(()=>{let e=new URL("".concat("https://api.xyes.com/api/v1"+o.Hv.games.bonusRecords));return e.searchParams.append("page","".concat(t+1)),e.searchParams.append("limit",r.toString()),l.filters&&e.searchParams.append("filters",l.filters),e.toString()},[t,r,l.filters]);return(0,n.a)({queryKey:["useGetBonusRecordsByUser",t,r,l.filters],queryFn:async()=>(await o.ZP.get(d)).data,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:i&&s})},m=e=>{let{authenticated:t}=e,r=(0,a.useMemo)(()=>"".concat("https://api.xyes.com/api/v1"+o.Hv.gameRecord.getAllGameCategories),[]);return(0,n.a)({queryKey:["useGetAllGameCategories"],queryFn:async()=>(await o.ZP.get(r)).data,placeholderData:l.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:t})}},77456:function(e,t,r){var a=r(2265),n=r(99376),l=r(20418),o=r(43161);t.Z=()=>{let e=(0,n.useRouter)(),{getLink:t}=(0,o.m)(),{loading:r,authenticated:i}=(0,l.E)();(0,a.useEffect)(()=>
1{!r&&(i||e.push(t("/?modal=auth&tab=1")))},[r,i,e,t])}},78312:function(e,t,r){r.r(t),r.d(t,{default:function(){return $}});var a=r(57437),n=r(82559),l=r.n(n),o=r(43577),i=r(60033),s=r(68575),d=r(20418),c=r(48116);let u=(e,t,r)=>{let a=r*parseFloat(e.usdRate),n=parseFloat(t.usdRate);return 0===n||1e-10>Math.abs(n)?0:Number((a/n).toFixed(6))};var m=r(55447),p=r(16593),h=r(45345);let x=()=>(0,p.a)({queryKey:["cryptoData"],queryFn:async()=>(await m.ZP.get(m.Hv.wallet.getAllCurrenciesList)).data.data.cryptos,placeholderData:h.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0,staleTime:3e5,retry:2}),v=()=>{let{data:e=[]}=x();return{swapCrypto:(t,r,a)=>{let n=e.find(e=>e.symbol===t),l=e.find(e=>e.symbol===r);return n&&l?u(n,l,a):null},getCryptoInfo:t=>e.find(e=>e.symbol===t)}};var y=r(51786),b=r(2265);let f=()=>{let{data:e=[]}=x(),t=t=>{let r=e.find(e=>e.symbol===t);if(!r||"string"!=typeof r.usdRate)return null;let a=parseFloat(r.usdRate);return l()(a)||0===a?null:1/a};return{isValidSwapAmount:(e,r)=>{let a=t(e);return null!==a&&r>=a},getCryptoInfo:t=>e.find(e=>e.symbol===t),getMinimumSwapAmount:t}};var g=r(8149),w=r(1899),j=r(46387),Z=r(73053),S=r(85860),k=r(92566),C=r(97312),A=r(89414),I=r(44811),N=e=>{let{sendCurrencyExchange:t,getCurrencyExchange:r,exchangeRate:n,swapFee:l,sendCurrency:o,setAgreed:s,isButtonDisabled:d,isSubmitting:c,onSendSwap:u,buttonText:m,BUTTON_COLOR_DISABLED:p}=e,{t:h}=(0,i.i)(),{refetch:v}=x(),[y,f]=(0,b.useState)(100),[N,F]=(0,b.useState)(!0);(0,b.useEffect)(()=>{s(N)},[N,s]),(0,b.useEffect)(()=>{let e=()=>{v(),f(100)};e();let t=setInterval(e,3e4),r=setInterval(()=>{f(e=>e<=0?100:e-1)},300);return()=>{clearInterval(t),clearInterval(r)}},[v]);let P={display:"flex",justifyContent:"space-between",alignItems:"center",py:1},W={color:"orange"};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(w.Z,{sx:{bgcolor:"grey.600",p:2,borderRadius:2,mb:2},children:[(0,a.jsxs)(w.Z,{sx:P,children:[(0,a.jsx)(j.Z,{variant:"body2",children:h("wallet.cryptoSwap.rate")}),(0,a.jsxs)(w.Z,{sx:{textAlign:"right",display:"flex",alignItems:"center"},children:[(0,a.jsxs)(w.Z,{sx:{position:"relative",display:"inline-flex"},children:[(0,a.jsx)(Z.Z,{variant:"determinate",value:100,size:15,thickness:5,sx:{color:"grey.500"}}),(0,a.jsx)(Z.Z,{variant:"determinate",value:y,size:15,thickness:5,sx:{color:"orange",position:"absolute",left:0}})]}),(0,a.jsxs)(j.Z,{variant:"body2",sx:{ml:1},children:["1 ",(0,a.jsx)("span",{style:W,children:t})," â"," ",(0,g.q)(n)," ",(0,a.jsx)("span",{style:W,children:r})]})]})]}),(0,a.jsxs)(w.Z,{sx:P,children:[(0,a.jsx)(j.Z,{variant:"body2",children:h("wallet.cryptoSwap.swapFee")}),(0,a.jsxs)(j.Z,{variant:"body2",sx:{textAlign:"right"},children:[(0,g.q)(l)," ",o]})]})]}),(0,a.jsx)(S.Z,{control:(0,a.jsx)(k.Z,{checked:N,onChange:e=>F(e.target.checked),sx:{color:"grey.500","&.Mui-checked":{color:"primary.main"}}}),label:(0,a.jsxs)(j.Z,{variant:"body2",children:[h("wallet.cryptoSwap.termsFirst")," ",(0,a.jsx)(C.Z,{href:"#",color:"primary",children:h("wallet.cryptoSwap.termsnSecond")})]}),sx:{mb:2}}),(0,a.jsx)(A.ZP,{container:!0,component:"main",spacing:1,justifyContent:"center",children:(0,a.jsx)(I.Z,{disabled:d||c,onClick:u,color:"inherit",size:"small",type:"submit",variant:"header",sx:{p:2,"&:disabled":{bgcolor:p}},children:c?h("wallet.cryptoSwap.submitting"):m})})]})},F=r(76975),P=r(34422),W=r(68720),R=r(16210),O=r(33833),D=r(31691),M=r(82156),z=r(19643),E=r(12713),V=r(23996),B=r(50290),q=r(85147);let T=P.Z_().test("is-decimal","Please enter a valid number",e=>!e||/^\d*\.?\d*$/.test(e)),G=(0,R.ZP)(O.Z)(e=>{let{theme:t}=e;return{"& .MuiSelect-select":{display:"flex",alignItems:"center",padding:t.spacing(1),paddingRight:t.spacing(4),[t.breakpoints.down("sm")]:{fontSize:"0.875rem"}},"& .MuiSelect-icon":{pointerEvents:"none",right:t.spacing(1)}}}),_=(e,t)=>
1e.label.toLowerCase().includes(t.toLowerCase())||e.value.toLowerCase().includes(t.toLowerCase());var L=e=>{let{label:t,balanceLabel:r,currency:n,onCurrencyChange:l,currencyOptions:o,showMaxButton:s=!0,amount:d,onAmountChange:u}=e,{t:m}=(0,i.i)(),p=(0,b.useRef)(null),[h,x]=(0,b.useState)(0),[v,y]=(0,b.useState)(""),[f,g]=(0,b.useState)(!1),[,Z]=(0,b.useState)(null),k=(0,D.Z)(),C=(0,M.Z)(k.breakpoints.down("md"));(0,b.useEffect)(()=>{p.current&&x(p.current.offsetWidth)},[]);let A=o.find(e=>e.value===n),N=(0,b.useMemo)(()=>o.filter(e=>{let t=_(e,v),r=!f||parseFloat(e.balance)>0;return t&&r}),[o,v,f]);return(0,a.jsxs)(w.Z,{mb:3,children:[(0,a.jsxs)(z.Z,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"flex-start",sm:"center"},mb:1,spacing:1,children:[(0,a.jsx)(j.Z,{variant:"body2",children:t}),(0,a.jsxs)(j.Z,{variant:"body2",color:"text.secondary",children:[r,":"," ",(0,a.jsx)(j.Z,{component:"span",variant:"body2",sx:{color:"white",fontWeight:"bold"},children:(0,c.dN)(Number(null==A?void 0:A.balance),"crypto/")})," ",null==A?void 0:A.label]})]}),(0,a.jsxs)(w.Z,{ref:p,display:"flex",bgcolor:"grey.900",borderRadius:1,position:"relative",children:[(0,a.jsxs)(G,{value:n,onChange:e=>{let t=o.find(t=>t.value===e.target.value);t&&l(t.value,t._id,t.coinId),u("")},sx:{bgcolor:"grey.700",borderTopRightRadius:0,borderBottomRightRadius:0,"& .MuiOutlinedInput-notchedOutline":{border:"none"},flexGrow:0,minWidth:C?"100px":"120px"},MenuProps:{anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{width:"".concat(h,"px")},sx:{maxHeight:"300px",overflowY:"auto","&::-webkit-scrollbar":{width:"8px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#888",borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:"#555"}}},MenuListProps:{sx:{padding:0}}},renderValue:e=>(0,a.jsxs)(w.Z,{display:"flex",alignItems:"center",children:[(0,a.jsx)("img",{src:null==A?void 0:A.icon,alt:null==A?void 0:A.label,width:C?"20":"24",height:C?"20":"24",style:{marginRight:3}}),(0,a.jsx)(j.Z,{variant:C?"body2":"body1",children:null==A?void 0:A.label})]}),onClose:()=>y(""),children:[(0,a.jsx)(w.Z,{sx:{position:"sticky",top:-5,bgcolor:"background.paper",zIndex:2},children:(0,a.jsx)(E.Z,{size:"small",placeholder:m("wallet.typeToSearch"),fullWidth:!0,InputProps:{startAdornment:(0,a.jsx)(V.Z,{position:"start",children:(0,a.jsx)(W.JO,{icon:"eva:search-fill",width:24,style:{color:"text.disabled"}})})},sx:{p:1},value:v,onChange:e=>y(e.target.value),onKeyDown:e=>{"Escape"!==e.key&&e.stopPropagation()}})}),N.map(e=>(0,a.jsx)(B.Z,{value:e.value,children:(0,a.jsxs)(w.Z,{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",children:[(0,a.jsxs)(w.Z,{display:"flex",alignItems:"center",children:[(0,a.jsx)("img",{src:e.icon,alt:e.label,width:"24",height:"24",style:{marginRight:8}}),(0,a.jsx)(j.Z,{children:e.label})]}),(0,a.jsx)(j.Z,{variant:"body2",color:"text.secondary",children:(0,c.dN)(Number(e.balance),"crypto/")})]})},e.value)),(0,a.jsx)(w.Z,{sx:{position:"sticky",bottom:-5,bgcolor:"background.paper",zIndex:1,borderRadius:"10px"},children:(0,a.jsx)(S.Z,{control:(0,a.jsx)(q.Z,{sx:{ml:2},checked:f,onChange:e=>g(e.target.checked),name:"hideZeroBalances"}),label:"Hide 0 balances"})})]}),(0,a.jsx)(E.Z,{placeholder:"Amount",variant:"outlined",value:d,onChange:e=>{let{value:t}=e.target;try{T.validateSync(t),Z(null),u(t)}catch(e){e instanceof P.p8&&Z(e.message)}},sx:{flexGrow:1,"& .MuiOutlinedInput-root":{"& fieldset":{border:"none",borderRadius:"0 4px 4px 0"},"&:hover fieldset":{border:"none",borderRadius:"0 4px 4px 0"},"&.Mui-focused fieldset":{border:"none",borderRadius:"0 4px 4px 0"},borderRadius:"0 4px 4px 0"},"& .MuiInputBase-input":{fontSize:C?"0.875rem":"inherit"}}}),s&&(0,a.jsx)(I.Z,{variant:"contained",onClick:()=>{A&&u(A.balance)},sx:{bgcolor:"grey.500",borderTopLeftRadius:0,borderBottomLeftRadius:0,"&:hover":{bgcolor:"grey.600"},minWidth:C?"60px":"auto",fontSize:C?"0.75rem":"0.875rem"},children:m("wallet.cryptoSwap.max")})]})]})},U=r(95576),H=e=>{let{sendCurrency:t,getCurrency:r,sendAmount:n,getAmount:l,currencyOptions:o,conversionError:s,onCurrencyChange:d,onAmountChange:c,onSwap:u,PRIMARY_LIGHT:m}=e,{t:p}=(0,i.i)();return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{label:p("You send"),balanceLabel:p("Your balance"),currency:t,onCurrencyChange:e=>d(e,!0),currencyOptions:o,amount:n,onAmountChange:e=>c(e,"send")}),(0,a.jsx)(w.Z,{display:"flex",justifyContent:"center",children:(0,a.jsx)(U.Z,{"aria-label":"Change-swap",onClick:u,children:(0,a.jsx)(F.Z,{icon:"solar:round-transfer-vertical-outline",height:30,width:30,color:m})})}),(0,a.jsx)(L,{label:p("You get"),balanceLabel:p("Your balance"),currency:r,onCurrencyChange:e=>d(e,!1),currencyOptions:o,showMaxButton:!1,amount:l,onAmountChange:e=>c(e,"get")}),s&&(0,a.jsx)(j.Z,{color:"error",variant:"body2",sx:{mt:1},children:s})]})},K=r(8350),Y=r(19902),$=()=>{let{t:e}=(0,i.i)(),t=(0,D.Z)(),r=(0,M.Z)(t.breakpoints.down("sm")),n=(0,s.v9)(e=>e.userBalance.crypto),{swapCrypto:u,getCryptoInfo:p}=v(),{isValidSwapAmount:h,getMinimumSwapAmount:x}=f(),[g,Z]=(0,b.useState)(!1),S=(0,b.useMemo)(()=>(null==n?void 0:n.map(e=>({value:e.symbol,label:e.symbol,icon:e.cryptoIcon,balance:e.amount,_id:e._id,c
1oinId:e.coinId})))||[],[n]),[k,C]=(0,b.useState)(""),[A,I]=(0,b.useState)(""),[F,P]=(0,b.useState)(""),[W,R]=(0,b.useState)(""),[O,z]=(0,b.useState)(null),[E,V]=(0,b.useState)("0"),[B,q]=(0,b.useState)(""),[T,G]=(0,b.useState)(""),[_,L]=(0,b.useState)(!1),[U,$]=(0,b.useState)("send"),[X,Q]=(0,b.useState)(!1),J=(0,s.v9)(e=>e.user.data),[ee,et]=(0,b.useState)(!1),[er,ea]=(0,b.useState)(""),[en,el]=(0,b.useState)("info"),[eo,ei]=(0,b.useState)(!1),[es,ed]=(0,b.useState)(""),[ec,eu]=(0,b.useState)(""),[em,ep]=(0,b.useState)(e("wallet.cryptoSwap.swap")),[eh,ex]=(0,b.useState)(null),{fetchBalance:ev}=(0,d.E)(),ey=(0,b.useCallback)(e=>e&&eg(e)?(.02*parseFloat(e)).toFixed(8):"0",[]);(0,b.useEffect)(()=>{if(k&&A&&(B||T)){let e=p(k),t=p(A);if(e&&t){if("send"===U&&B){let e=u(k,A,parseFloat(B));null!==e&&G((0,c.dN)(e,"crypto/"))}else if("get"===U&&T){let e=u(A,k,parseFloat(T));if(null!==e){let t=(0,c.dN)(e,"crypto/");q(t),V(ey(t))}}}}},[n,k,A,B,T,U,u,p,ey]),(0,b.useEffect)(()=>{if(S.length>1){let e=S[0],t=S[1];C(e.value),I(t.value),ed(e._id),eu(t._id)}},[S]);let eb=(0,b.useCallback)(()=>{F&&W&&z(u(F,W,1))},[F,W,u]);(0,b.useEffect)(()=>{k&&A&&(P(k),R(A))},[k,A]),(0,b.useEffect)(()=>{eb()},[F,W,eb]);let ef=(0,b.useCallback)(()=>{var t;let r=null===(t=S.find(e=>e.value===k))||void 0===t?void 0:t.balance;if(r&&B){let t=parseFloat(B)>parseFloat(r);Q(t),ep(t?e("wallet.cryptoSwap.insufficientFunds"):e("wallet.cryptoSwap.swap"))}else Q(!1),ep(e("wallet.cryptoSwap.swap"))},[k,B,S,e]),eg=e=>{let t=e.trim();return/^(\d*\.?\d*)$/.test(t)},ew=(0,b.useCallback)(()=>{if(B&&k&&!h(k,parseFloat(B))){if(null!==x(k)){var t;let r=1/parseFloat((null===(t=p(k))||void 0===t?void 0:t.usdRate)||"0");return e("wallet.cryptoSwap.minimumSwapErrorWithEquivalent",{currency:k,equivalentAmount:(0,c.dN)(r,"crypto/")})}return e("wallet.cryptoSwap.minimumSwapErrorGeneric")}return null},[B,k,h,x,p,e]),ej=(0,b.useCallback)(()=>{C(A),I(k),V("0"),q(""),G(""),$("send"),ei(!1),Q(!1)},[A,k]),eZ=(0,b.useCallback)((t,r)=>{$(r),ex(null),Z(!1);let a=t.slice(0,10);if(""===a||"."===a){"send"===r?(q(a),G("")):(G(a),q("")),V("0");return}if(!/^\d*\.?\d*$/.test(a))return;let n=null;if("send"===r){if(q(a),V(ey(a)),a&&!l()(parseFloat(a))){if(null!==(n=u(k,A,parseFloat(a)))){let e=.98*n;G((0,c.dN)(e,"crypto/"))}else ex(e("errors.conversionFailed"))}else G("")}else if(G(a),a&&!l()(parseFloat(a))){if(null!==(n=u(A,k,parseFloat(a)))){let e=n/.98;q((0,c.dN)(e,"crypto/".concat(k))),V(ey((0,c.dN)(e,"crypto/")))}else ex(e("errors.conversionFailed"))}else q(""),V("0");Z(null!==n&&1e-8>Math.abs(n))},[k,A,u,e,ey,.02]),eS=!_||!eg(B)||!eg(T)||X||!!eh||g;(0,b.useEffect)(()=>{ef()},[k,B,ef]);let ek=(0,b.useCallback)(async()=>{var t,r,a;if(!J||!J._id||!B){ea(e("errors.invalidInput")),el("error"),ei(!0);return}let n=S.find(e=>e.value===k),l=S.find(e=>e.value===A);if(!n||!l){ea(e("errors.invalidCurrencySelection")),el("error"),ei(!0);return}if(!_){ea(e("wallet.acceptTerms")),el("error"),ei(!0);return}let i=ew();if(i){ea(i),el("error"),ei(!0);return}et(!0);try{let r=p(k),a=p(A);if(!r||!a)throw Error("Invalid currency selection");let o={userId:J._id,coinFromId:n.coinId,coinToId:l.coinId,amountFrom:Number(parseFloat(B).toFixed(8))},i=await m.ZP.post(m.Hv.wallet.cryptoSwap,o);ea((null===(t=i.data)||void 0===t?void 0:t.message)||e("actions.swapSuccess")),el("success"),ei(!0),ev(),q(""),G(""),V("0"),q("0"),G("0")}catch(t){el("error"),ei(!0),t instanceof o.d7?ea((null===(a=t.response)||void 0===a?void 0:null===(r=a.data)||void 0===r?void 0:r.message)||t.message):ea(t.message||e("errors.anErrorOccurred"))}finally{et(!1)}},[J,B,k,A,S,p,_,e,ev,ew]);if(!n||0===S.length)return(0,a.jsx)(w.Z,{sx:{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",bgcolor:"grey.900"},children:(0,a.jsx)(j.Z,{variant:"h6",color:"common.white",children:e("loading")})});let eC=t.palette.primary.light;return(0,a.jsxs)(w.Z,{sx:{width:"100%",height:"100%",justifyContent:"center",alignItems:"center",bgcolor:"grey.900",px:r?1:3,pb:4},children:[(0,a.jsxs)(w.Z,{children:[(0,a.jsx)(j.Z,{variant:"h2",sx:{pb:{xs:2}},children:e("wallet.cryptoSwap.cryptoSwap")}
1),!r&&(0,a.jsx)(K.Z,{sx:{mt:3,mb:{md:3}},"aria-hidden":!0,orientation:"horizontal",flexItem:!0,variant:"fullWidth"})]}),(0,a.jsx)(y.Z,{message:er,open:eo,setOpen:ei,severity:en}),(0,a.jsxs)(Y.Z,{sx:{width:"100%",p:{sm:0,md:3},bgcolor:{sm:"transparent",md:"grey.800"},color:"common.white"},children:[(0,a.jsx)(H,{sendCurrency:k,getCurrency:A,sendAmount:B,getAmount:T,currencyOptions:S,conversionError:eh,onCurrencyChange:(e,t)=>{let r=S.find(t=>t.value===e);r&&(t?e===A?(C(e),I(k),ed(r._id),eu(es)):(C(e),ed(r._id)):e===k?(I(e),C(A),eu(r._id),ed(ec)):(I(e),eu(r._id))),q(""),G(""),$(t?"send":"get"),ei(!1),Q(!1)},onAmountChange:eZ,onSwap:ej,PRIMARY_LIGHT:eC}),(0,a.jsx)(N,{sendCurrencyExchange:F,getCurrencyExchange:W,exchangeRate:O,swapFee:E,sendCurrency:k,setAgreed:L,isButtonDisabled:eS,isSubmitting:ee,onSendSwap:ek,buttonText:g?e("wallet.cryptoSwap.zeroSwapValue"):em,BUTTON_COLOR_DISABLED:"#494440"})]})]})}},58629:function(e,t,r){r.r(t),r.d(t,{default:function(){return eK}});var a=r(57437),n=r(2265),l=r(60033),o=r(1899),i=r(31691),s=r(71495),d=r(73904),c=r(10207),u=r(46387),m=r(29501),p=r(68575),h=r(78948),x=r(76975),v=r(66798),y=r(16593),b=r(45345),f=r(55447);let g=e=>{let t=(0,n.useMemo)(()=>void 0===e?"".concat(f.Hv.thirdParty.thirdPartyDepositChannel,"?cryptotrading=true"):"".concat(f.Hv.thirdParty.thirdPartyDepositChannel,"?currency=").concat(e),[e]);return(0,y.a)({queryKey:["ThirdPartyChannel",e],queryFn:async()=>(await f.ZP.get(t)).data,placeholderData:b.Wk,refetchOnMount:!1,refetchOnWindowFocus:!1})};var w=r(67352),j=r(99719);let Z=(e,t)=>{let r=(0,n.useMemo)(()=>"".concat(j.fS.wallet.getLastDepositData,"/").concat(e,"/").concat(t),[e,t]);return(0,y.a)({queryKey:["useGetLastDepositDataV2",r,e,t],queryFn:async()=>(await j.ZP.get(r)).data,refetchOnMount:!1,refetchOnWindowFocus:!1,enabled:!!t})},S=(e,t)=>{let r=(0,n.useMemo)(()=>"".concat(f.Hv.wallet.getLastPendigDeposit,"/").concat(e,"/").concat(t),[e,t]),a=!!e&&!!t;return(0,y.a)({queryKey:["useGetLastPendingDeposit",r,e,t],queryFn:async()=>(await j.ZP.get(r)).data,refetchOnMount:!1,refetchOnWindowFocus:!1,enabled:a})};var k=r(16210),C=r(82156),A=r(19643),I=r(97312),N=r(20418),F=r(59062),P=r(73222),W=r(43577),R=r(48116),O=r(57099),D=r(33900),M=r(92772),z=r(95671),E=r(85299),V=r(6809),B=r(20184),q=r(88064),T=r(33460),G=r(19902),_=r(44811),L=r(12713),U=r(23996),H=r(69459),K=r(89414),Y=r(50290),$=r(73053),X=r(36067),Q=r(66274),J=r(43161),ee=r(95576),et=r(8350);let er=(0,k.ZP)(G.Z)(e=>{let{theme:t}=e;return{borderRadius:"8px",border:"1px solid #3f4c5c",padding:t.spacing(t.breakpoints.down("md")?1:4),maxWidth:600,margin:"auto",color:"#fff",backgroundColor:h.y0.selectBG,marginTop:t.spacing(2)}});function ea(e){let{orderId:t,expiryTime:r,depositAmount:i,createdAt:s,method:d,openLink:c,handleReset:m,linkRedirect:p}
1=e,[h,v]=(0,n.useState)(r),{t:y}=(0,l.i)(),b=(0,Q.tv)(),{getLink:f}=(0,J.m)();(0,n.useEffect)(()=>{if(h<=0)return()=>{};let e=setInterval(()=>{v(e=>e-1)},1e3);return()=>clearInterval(e)},[h]);let g=()=>{b.replace(f("account-management/transactions/"))};return(0,a.jsxs)(er,{elevation:3,children:[(0,a.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[(0,a.jsx)(u.Z,{variant:"h4",sx:{mb:0,fontWeight:"bold",color:"#FFAB00",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important"},children:y("deposit.inProgress")}),(0,a.jsx)(ee.Z,{color:"warning",children:(0,a.jsx)(x.Z,{icon:"mdi-light:clock"})})]}),(0,a.jsx)(et.Z,{sx:{my:2,borderColor:"#40C4FF"}}),(0,a.jsxs)(K.ZP,{container:!0,spacing:2,children:[(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#8d98a9",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.paymentMethod")})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",textAlign:"right",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important"},children:d})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#8d98a9",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.orderId")})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsxs)(o.Z,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center"},children:[(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",mr:1,fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:t}),(0,a.jsx)(ee.Z,{size:"small",onClick:()=>{navigator.clipboard.writeText(t)},sx:{color:"#ff7901"},children:(0,a.jsx)(x.Z,{icon:"iconamoon:copy-thin"})})]})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#8d98a9",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.time")})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",textAlign:"right",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important"},children:new Date(s).toLocaleString("en-US",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#8d98a9",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.depositAmount")})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#22c55e",textAlign:"right"},children:i})})]}),(0,a.jsx)(et.Z,{sx:{my:3,borderColor:"#40C4FF"}}),(0,a.jsxs)(A.Z,{direction:"row",gap:1,mt:4,children:[(0,a.jsxs)(_.Z,{variant:"outlinedPrimary",fullWidth:!0,size:"small",onClick:()=>null==c?void 0:c(p),sx:{py:1.5},children:[(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.openDepositLink")}),(0,a.jsx)(x.Z,{icon:"flowbite:arrow-up-right-from-square-outline",sx:{ml:1},color:"#fff"})]}),(0,a.jsx)(_.Z,{variant:"contained",size:"small",onClick:()=>g(),fullWidth:!0,sx:{backgroundColor:"#ff7901","&:hover":{backgroundColor:"#ff7901cc"},py:1.5},children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:y("deposit.completedDeposit")})})]})]})}var en=r(6317),el=r(40257);let eo=[{key:"option1",label:"Option 1"},{key:"option2",label:"Option 2"},{key:"option3",label:"Option 3"},{key:"option4",label:"Option 4"},{key:"option5",label:"Option 5"}];var ei=e=>{var t;let r,s;let{otherFormOptions:d,selectedChannelId:c,isWithdrawChannel:v=!0,selectedChannel:y,currency:b,supportsDecimals:g,setOrderData:w,lastDepositData:j,refetch:Z,setSelectedChannel:S}=e,{data:k}=(0,D.m)(c),{showMessage:I}=(0,X.useSnackbar)(),N=(0,p.v9)(e=>e.user.data),{t:F}=(0,l.i)(),P=(0,i.Z)(),Q=(0,C.Z)(P.breakpoints.down("sm")),[J,ee]=(0,n.use
1State)(),[et,er]=(0,n.useState)(""),{trackClick:ei}=(0,z.T)(),es=d.length>0?["Select amount","Payment Details","Deposit Status"]:["Select amount","Deposit Status"],ed={border:"2px solid",borderColor:(0,q.Fq)(P.palette.grey[500],.32),borderRadius:"8px",width:"100%"},[ec,eu]=(0,n.useState)(0),[em,ep]=(0,n.useState)({}),eh=()=>es.length-1,ex=()=>Object.keys(em).length,ev=()=>ec===eh()-1,ey=()=>ex()===eh(),[eb,ef]=(0,n.useState)(!1),[eg,ew]=(0,n.useState)(!1),ej=()=>{eu(ev()&&!ey()?es.findIndex((e,t)=>!(t in em)):ec+1)},eZ=()=>{em[ec]=!0,ep(em),ej()},eS=()=>{eu(0),ep({})},ek=(0,n.useMemo)(()=>(null==k?void 0:k.data.map(e=>({key:e._id,label:e.bank_name,value:e.bank_code})))||[],[null==k?void 0:k.data]),eC=d.map(e=>({...e,required:!0})),eA=(0,m.cI)({mode:"onChange",defaultValues:{amount:"",bankName:(null===(t=ek[0])||void 0===t?void 0:t.key)||"",accountNumber:"",otherInformation:{...eC.reduce((e,t)=>({...e,[t.label]:""}),{}),...((e,t)=>{let r={};return t.forEach(t=>{let{label:a}=t;Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=String(e[a]))}),r})((null==j?void 0:j.fiatReference.otherInformation)||{},eC)}}}),{handleSubmit:eI,setValue:eN,watch:eF,register:eP,clearErrors:eW,setError:eR,getValues:eO}=eA;(0,n.useEffect)(()=>{ek.length>0&&eN("bankName",ek[0].key)},[ek,eN]);let eD=e=>{switch(e){case"number":return"number";case"file":default:return"text";case"date":return"date";case"dropdown":return"dropdown"}},eM=e=>{window.open(e,"_blank")},ez=async e=>{if(3===es.length&&0===ec){eZ(),ej();return}try{if(v);else{ef(!0);let t={memberId:null==N?void 0:N.memberId,userId:null==N?void 0:N._id.toString(),thirdParty:y.systemNo,returnUrl:el.env.NEXT_PUBLIC_AIPAY_URL,amount:eO("amount"),otherInformation:e.otherInformation||[],currency:b,name:"-"},r="https://api.xyes.com/api/v1"+f.Hv.wallet.fiatDeposit,a=await (0,f.ZP)({method:"post",url:r,data:t});if(200===a.status){eZ();let e=a.data.data.orderData;ef(!1),er(e),ee(a.data.data),I(F("actions.orderCreated"),"success"),eM(e),ei("Purchase","Recharge_Deposit_Success",{value:t.amount,currency:b})}}}catch(e){if(e instanceof W.d7){var t,r;I((null===(r=e.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.message)||e.message,"error")}else I(e.message||F("errors.anErrorOccurred"),"error")}finally{ef(!1)}},eE=()=>{eN("amount",y.limitAmount.finalValue.toString())},eV=()=>{let e=Number(eF("amount")),t=eF("otherInformation"),r=!1;if(0===ec){if(e<y.limitAmount.initialValue||e>y.limitAmount.finalValue||e<0)ew(!0);else if(0===d.length)ez(eF()),ei("Recharge_click","recharge_click");else{if(3===es.length){eZ(),ej();return}eZ()}}
11===ec&&eC&&(eC.forEach(e=>{let a="otherInformation.".concat(e.label),n=(null==t?void 0:t[e.label])||"";e.required&&(!n||""===n.trim())?(eR(a,{type:"manual",message:F("validations.requiredField")}),r=!0):e.regexValue&&!new RegExp(e.regexValue).test(n)?(eR(a,{type:"manual",message:F("validations.invalidFormat")}),r=!0):eW(a)}),r||ez(eF()))};return(0,a.jsx)(o.Z,{children:(0,a.jsx)(m.RV,{...eA,children:(0,a.jsx)(o.Z,{component:"form",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),0===ec&&eI(ez)(e)},children:(0,a.jsx)(o.Z,{sx:{overflowY:"auto",pr:1,mr:-1,"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:v?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{sx:{my:2},children:(0,a.jsx)(M.Z,{static:!0,label:"Bank Name",options:ek,disabled:!1,icon:"guidance:bank",value:eF("bankName"),...eP("bankName",{required:"Bank name is required",onChange:e=>{eN("bankName",e.target.value)}})})}),(0,a.jsx)(o.Z,{sx:{my:2},children:(0,a.jsx)(M.Z,{static:!0,removeIconMenu:!0,chevronIcon:"icon-park:id-card",label:"Account Number",options:eo,disabled:!1,icon:"quill:creditcard",value:eF("accountNumber"),...eP("accountNumber",{required:"Account number is required",onChange:e=>{eN("accountNumber",e.target.value)}})})})]}):(0,a.jsx)(o.Z,{sx:{mb:1},children:(0,a.jsxs)(o.Z,{sx:{width:"100%"},children:[(0,a.jsx)(B.Z,{nonLinear:!0,activeStep:ec,alternativeLabel:!0,children:es.map((e,t)=>(0,a.jsx)(E.Z,{completed:em[t],sx:{},children:(0,a.jsx)(T.Z,{sx:{"& .MuiStepLabel-label":{fontSize:"clamp(2px, 2.9vw, 0.875rem) !important","&.Mui-completed":{color:"primary.main"},"&.Mui-active":{color:"primary.main",fontWeight:"bold"},display:{xs:"none",sm:"none",md:"block"}}},children:e})},e))}),(0,a.jsx)(o.Z,{children:ey()?(0,a.jsxs)(G.Z,{sx:{bgcolor:"transparent",p:.5,mt:2},children:[(0,a.jsx)(o.Z,{sx:{display:"flex",flexDirection:"row"},children:(0,a.jsxs)(_.Z,{size:"small",variant:"headerTerciary",sx:{fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",color:"#fff",border:"#fff",background:h.y0.selectBG,"&:hover":{background:h.y0.selectBG,border:"#fff"}},onClick:()=>{eS(),S(null),Z()},children:[(0,a.jsx)(x.Z,{icon:"lets-icons:back"})," ",F("withdraw.backToPaymentMethod")]})}),J&&(0,a.jsx)(ea,{orderId:J.sysInfo,expiryTime:0,depositAmount:"".concat(J.realityAmountFiat,"\n ").concat(y.availableCurrency),createdAt:J.createdAt,method:null==J?void 0:J.channelName,openLink:()=>eM(et),linkRedirect:et,handleReset:()=>eS()})]}):(0,a.jsxs)(G.Z,{sx:{bgcolor:"rgb(26, 31, 46)",mt:2},children:[(0,a.jsxs)(o.Z,{sx:{maxHeight:"calc(60vh - 200px)",overflowY:"auto",p:2,"&::-webkit-scrollbar":{width:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#888",borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:"#555"}},children:[Q&&(0,a.jsx)(u.Z,{variant:"h2",sx:{mb:1,py:1},children:es[ec]}),0===ec&&(0,a.jsxs)(A.Z,{children:[(0,a.jsx)(u.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:"".concat(F("deposit.depositAmount")," ").concat((r=y.limitAmount.initialValue,s=y.limitAmount.finalValue,"".concat((0,R.dN)(r,"/fiat")," ~ ").concat((0,R.dN)(s,"/fiat")))," ")}),(0,a.jsx)(L.Z,{name:"amount",label:"",type:"number",style:{...ed,marginBottom:"0px !important"},onChange:e=>{let{value:t}=e.target;g?(""===t||/^\d*\.?\d{0,2}$/.test(t))&&eN("amount",t):(""===t||/^[0-9]+$/.test(t))&&eN("amount",t)},value:eF("amount"),required:!0,InputProps:{inputProps:{min:Number(y.limitAmount.initialValue),max:y.limitAmount.finalValue,pattern:g?"^\\d*(\\.\\d{0,2})?$":"^\\d*$"},endAdornment:(0,a.jsx)(U.Z,{position:"end",children:(0,a.jsx)(A.Z,{gap:1,direction:"row",children:(0,a.jsx)(_.Z,{size:"small",variant:"headerTerciary",sx:O.AK,onClick:()=>eE(),children:F("wallet.max")})})})}}),eg&&Number(eF("amount"))<Number(y.limitAmount.initialValue)&&(0,a.jsx)(H.Z,{error:!0,children:F("validations.minAmountMustBe",{min:y.limitAmount.initialValue,symbol:y.availableCurrency})}),eg&&Number(eF("amount"))>Number(y.limitAmount.finalValue)&&(0,a.jsx)(H.Z,{error:!0,children:F("validations.maxAmountMustBe",{max:(0,R.dN)(y.limitAmount.finalValue,"/fiat"),symbol:y.availableCurrency})}),eg&&Number.isNaN(Number(eF("amount")))&&(0,a.jsx)(H.Z,{error:!0,children:F("validations.invalidFormat")}),(0,a.jsx)(o.Z,{mt:4,children:(0,a.jsx)(en.Z,{depositAmount:Number(eF("amount")),currency:y.availableCurrency})})]}),1===ec&&d.length>0&&(0,a.jsx)(K.ZP,{container:!0,spacing:Q?0:1,children:d.map((e,t)=>
1{var r,n,l,i,s,d,c,m,p,h,x,v,y,b,f,g,w,j,Z,S,k,C;let A="otherInformation.".concat(e.label);return(0,a.jsxs)(K.ZP,{item:!0,xs:12,sm:12,children:[(0,a.jsx)(u.Z,{variant:"body2",color:"text.secondary",sx:{textTransform:"capitalize",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",color:(null===(n=eA.formState.errors)||void 0===n?void 0:null===(r=n.otherInformation)||void 0===r?void 0:r[e.label])?"error.main":"text.secondary"},children:F(e.customName)}),(0,a.jsx)(o.Z,{sx:{width:"100%"},children:e.values&&Array.isArray(e.values)&&e.values.length>0?(0,a.jsx)(L.Z,{select:!0,name:A,label:"",value:(null===(l=eA.getValues("otherInformation"))||void 0===l?void 0:l[e.label])||"",error:!!(null===(s=eA.formState.errors)||void 0===s?void 0:null===(i=s.otherInformation)||void 0===i?void 0:i[e.label]),helperText:null===(m=eA.formState.errors)||void 0===m?void 0:null===(c=m.otherInformation)||void 0===c?void 0:null===(d=c[e.label])||void 0===d?void 0:d.message,required:!0,onChange:t=>{let r={...eA.getValues("otherInformation")||{},[e.label]:t.target.value};eA.clearErrors(A),eA.setValue("otherInformation",r,{shouldValidate:!0,shouldDirty:!0})},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{border:(null===(h=eA.formState.errors)||void 0===h?void 0:null===(p=h.otherInformation)||void 0===p?void 0:p[e.label])?"none":"2px solid",borderColor:(0,q.Fq)(P.palette.grey[500],.32),borderRadius:"8px"}},FormHelperTextProps:{sx:{color:(null===(v=eA.formState.errors)||void 0===v?void 0:null===(x=v.otherInformation)||void 0===x?void 0:x[e.label])?"error.main":"text.secondary",marginLeft:0,fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",mt:0}},children:e.values.map(e=>(0,a.jsx)(Y.Z,{value:e.value,children:F(e.key)},e.value))}):(0,a.jsx)(L.Z,{name:A,label:"",value:(null===(y=eA.getValues("otherInformation"))||void 0===y?void 0:y[e.label])||"",type:eD(e.type),error:!!(null===(f=eA.formState.errors)||void 0===f?void 0:null===(b=f.otherInformation)||void 0===b?void 0:b[e.label]),helperText:null===(j=eA.formState.errors)||void 0===j?void 0:null===(w=j.otherInformation)||void 0===w?void 0:null===(g=w[e.label])||void 0===g?void 0:g.message,placeholder:e.warningMessage,required:!0,onChange:t=>{let r={...eA.getValues("otherInformation")||{},[e.label]:t.target.value};e.regexValue&&!new RegExp(e.regexValue).test(t.target.value)?eA.setError(A,{type:"manual",message:F(e.warningMessage)}):eA.clearErrors(A),eA.setValue("otherInformation",r,{shouldValidate:!0,shouldDirty:!0})},inputProps:{min:e.min,max:e.max,pattern:e.regexValue},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{border:(null===(S=eA.formState.errors)||void 0===S?void 0:null===(Z=S.otherInformation)||void 0===Z?void 0:Z[e.label])?"none":"2px solid",borderColor:(0,q.Fq)(P.palette.grey[500],.32),borderRadius:"8px"}},FormHelperTextProps:{sx:{color:(null===(C=eA.formState.errors)||void 0===C?void 0:null===(k=C.otherInformation)||void 0===k?void 0:k[e.label])?"error.main":"text.secondary",marginLeft:0,fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",mt:0}}})})]},t)})})]}),(0,a.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"row",p:2,gap:2},children:[0!==ec&&(0,a.jsx)(_.Z,{color:"inherit",variant:"outlinedSecondary",disabled:0===ec,onClick:()=>{eu(e=>e-1)},sx:{mr:1},children:F("actions.back")}),(0,a.jsx)(o.Z,{sx:{flex:"1 1 auto"}}),(0,a.jsx)(V.Z,{type:"button",onKeyPressCapture:e=>{"Enter"===e.key&&0===ec&&eV()},onClick:()=>eV(),disabled:eb,loading:eb,variant:2===es.length||ec>=1?"header":"headerSecondary",loadingIndicator:(0,a.jsx)($.Z,{color:"primary",size:16}),children:F(2===es.length?"actions.submit":ec?"actions.submit":"actions.next")})]})]})})]})})})})})})},es=r(14616),ed=r(43949),ec=r(87055),eu=r(53431),em=r(67051),ep=r(86247);let eh=(0,k.ZP)(ec.ZP)(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:t.spacing(.5),gap:t.spacing(1),backgroundColor:h.y0.selectBG,border:"1px solid ".concat(h.y0.selectBG),borderRadius:t.shape.borderRadius,width:"100%",maxWidth:"660px",height:"3.375rem",cursor:"pointer",marginBottom:t.spacing(1),"&:hover":{cursor:"pointer",border:"1px solid ".concat(t.palette.orange[900])},position:"relative"}}
1);function ex(e){let{icon:t,name:r,eat:n,isNew:l=!1,channelName:i,amount:s,disabled:d=!1,onClick:c,maintenance:m}=e,{t:p}=(0,ed.$G)();return(0,a.jsxs)(eh,{onClick:c,sx:{opacity:d?.5:1,pointerEvents:d?"none":"auto",position:"relative"},children:[(0,a.jsx)(eu.Z,{sx:{minWidth:{xs:"3.5rem",sm:"3.5rem",md:"4.5rem"},mr:0,justifyContent:"center"},children:(0,a.jsx)("img",{alt:r,src:t||"".concat("https://img.xyes.com/","assets/fallback-2.png"),style:{width:"auto",height:32,marginRight:.5,borderRadius:"0.5rem"}})}),(0,a.jsx)(em.Z,{primary:(0,a.jsx)(u.Z,{variant:"body1",sx:{color:"#FFFFFF",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",fontWeight:500,lineHeight:"1.3125rem"},children:i}),secondary:(0,a.jsxs)(u.Z,{variant:"body2",sx:{color:"#8D98A9",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",lineHeight:"1.125rem"},children:["EAT: ",n," min"]})}),m?(0,a.jsx)(em.Z,{primary:(0,a.jsxs)(A.Z,{direction:"row",alignItems:"center",justifyContent:"flex-end",gap:1,children:[(0,a.jsx)(u.Z,{variant:"body2",sx:{fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",lineHeight:"1rem"},children:p("currentlyUnderMaintenance")}),(0,a.jsx)(x.Z,{icon:"solar:danger-triangle-outline",width:18,height:18})]})}):(0,a.jsx)(ep.Z,{sx:{right:"16px"},children:(0,a.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,a.jsx)(u.Z,{sx:{color:"#8D98A9",fontSize:"clamp(2px, 2.9vw, 0.875rem) !important",fontWeight:500,lineHeight:"1.3125rem",textAlign:"right",width:{xs:"100px",sm:"100px",md:"auto"}},children:s}),(0,a.jsx)(x.Z,{sx:{display:{xs:"none",sm:"none",md:"block"}},icon:"majesticons:info-circle-line",width:18,height:18}),(0,a.jsx)(x.Z,{icon:"solar:alt-arrow-right-linear",width:18,height:18})]})})]})}var ev=r(57824);let ey={color:"error.main",textTransform:"none",display:"block",mt:1,"&:hover":{color:"common.white"}},eb=e=>{let{onClick:t,showAll:r,remainingCount:n}=e;return(0,a.jsx)(_.Z,{size:"small",onClick:t,sx:ey,children:r?"Show Less":n?"Show More (".concat(n," more options)"):"Show More"})},ef=e=>{let{displayChannels:t,selectedCurrency:r,onPaymentMethodSelect:n,lastDepositData:i}=e,s=(e,t)=>"".concat(e.toLocaleString("en-ID")," ~ ").concat(t.toLocaleString("en-ID")),{t:d}=(0,l.i)(),c=[...t].sort((e,t)=>e.maintenance&&!t.maintenance?1:!e.maintenance&&t.maintenance?-1:t.sorted-e.sorted);return(0,a.jsxs)(o.Z,{sx:{borderRadius:"8px",background:h.y0.selectBG},children:[(0,a.jsx)(u.Z,{gutterBottom:!0,sx:{color:"text.secondary",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",fontWeight:600,pt:1,pl:2},children:d("navigation.footer.link.casino.recommended")}),(0,a.jsx)(o.Z,{sx:{background:"#131a28",px:1,py:1,borderRadius:"0px 0px 8px 8px"},children:c.map(e=>(0,a.jsx)(ex,{onClick:()=>!e.disable&&!e.maintenance&&n(e),icon:e.channelIcon,name:e.thirdPartyName,eat:e.arrivalConfirmation,amount:"".concat(s(e.limitAmount.initialValue,e.limitAmount.finalValue)," ").concat(r),isNew:!0,disabled:e.disable||e.maintenance,channelName:e.channelName,maintenance:e.maintenance},e._id))})]})},eg=e=>{let{channels:t,selectedCurrency:r,onPaymentMethodSelect:l,lastDepositData:i}=e,[s,d]=(0,n.useState)(!1),c=s?t:t.slice(0,6),u=t.length-2;return(0,a.jsxs)(es.Z,{sx:{p:0},children:[(0,a.jsx)(o.Z,{sx:{maxHeight:"500px",overflowY:"auto",pr:1,mr:-1,"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,a.jsx)(ef,{displayChannels:c,selectedCurrency:r.symbol,onPaymentMethodSelect:l,lastDepositData:i})}),t.length>6&&(0,a.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center"},children:(0,a.jsx)(eb,{onClick:()=>d(!s),showAll:s,remainingCount:u})})]})};var ew=e=>{var t;let{selectedCurrency:r,selectedChannel:i,onPaymentMethodSelect:s,isWithdrawChannel:d=!0,setOrderData:c,setSelectedChannel:h,lastPendingDeposit:x,isLastDepositLoading:v,refetchLastPendingDeposit:y,isLastDepositError:b,data:g,lastDepositData:w,refetchLastDepositData:j}=e,{onUpdate:Z}=(0,F.K$)(),{showMessage:S}=(0,X.useSnackbar)(),{initialize:k}=(0,N.E)(),C=(0,p.v9)(e=>e.user.data),[,A]=(0,n.useState)(null),{t:I}=(0,l.i)(),W=(0,m.cI)({defaultValues:{bankName:"",accountNumber:""}}
1),R=(0,m.cI)({defaultValues:{inputs:[]}}),O=(0,m.cI)({defaultValues:{dates:[]}}),D=(0,n.useCallback)(async e=>{try{let t=new URL("".concat("https://api.xyes.com/api/v1").concat(f.Hv.configs.updateProfileSettings));await f.ZP.put(t.href,{settings:{navbarCurrency:e}}),Z("currencyType",e)}catch(e){S(e.message||I("errors.anErrorOccurred"),"error")}finally{k()}},[k,Z,S,I]);(0,n.useEffect)(()=>{if(w){let e=w.currency.includes("/")?w.currency.split("/")[1]:w.currency;0===w.depositTime&&e!==(null==C?void 0:C.settings.navbarCurrency)&&D(e)}},[w]),(0,n.useEffect)(()=>{if(i){var e,t;W.reset({bankName:"",accountNumber:""});let r=(null!==(e=null==i?void 0:i.otherInformation)&&void 0!==e?e:[]).filter(e=>"date"!==e.type&&!!e.otherId).map(e=>({id:e.otherId._id,value:"",type:e.type,customName:e.customName,values:e.values})),a=(null!==(t=null==i?void 0:i.otherInformation)&&void 0!==t?t:[]).filter(e=>"date"===e.type&&!!e.otherId).map(e=>({id:e.otherId._id,value:null,type:"date",customName:e.customName}));R.reset({inputs:r}),O.reset({dates:a}),A(null)}},[r,W,R,O,i]);let M=(null==g?void 0:g.ThirdPartyWithdrawChannels)||(null==g?void 0:g.data)||[];return 0===M.length?(0,a.jsx)(u.Z,{color:"grey.500",sx:{py:2,textAlign:"center"},children:I("wallet.noPaymentMethodsAvailableAtThisMoment")}):(0,a.jsx)(o.Z,{sx:{pb:2},children:v?(0,a.jsx)(o.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:{xs:"600px",sm:"600px",md:"auto"}},children:(0,a.jsx)(P.AG,{})}):(0,a.jsx)(a.Fragment,{children:i?(0,a.jsx)(a.Fragment,{children:(()=>{if(!i)return null;let e=(i.otherInformation||[]).map(e=>({id:e.otherId._id||crypto.randomUUID(),type:e.otherId.type.name,min:Number(e.min)||0,max:Number(e.max)||0,regexValue:e.regexValue||"",warningMessage:e.warningMessage||"",customName:e.customName,otherId:e.otherId||"",values:e.values||[],required:e.required||!1,label:e.otherId.label||"",other:e.other||[]}));return(0,a.jsx)(ei,{otherFormOptions:e,selectedChannelId:i._id,isWithdrawChannel:d,selectedChannel:i,currency:r.symbol,supportsDecimals:r.supportsDecimals,setOrderData:c,lastDepositData:w,refetch:()=>{j(),y()},setSelectedChannel:h})})()}):(0,a.jsx)(a.Fragment,{children:b?(0,a.jsx)(eg,{channels:M,selectedCurrency:r,onPaymentMethodSelect:s||(()=>{}),lastDepositData:w}):(0,a.jsx)(a.Fragment,{children:x&&(0,a.jsx)(ev.default,{createdAt:null!==(t=null==x?void 0:x.createdAt)&&void 0!==t?t:"",depositAmount:null==x?void 0:x.realityamount,expiryTime:0,orderId:null==x?void 0:x.billNo,currency:null==x?void 0:x.currency,method:null==x?void 0:x.type,refetch:y,type:"deposit",row:x})})})})})};let ej=(0,k.ZP)(o.Z)(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:h.y0.selectBG,borderRadius:"5px"}}),eZ=(0,k.ZP)(o.Z)(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",justifyContent:"center",padding:"0.5rem",width:"2rem",height:"2rem",background:"rgba(255, 255, 255, 0.1)",borderRadius:"0.375rem",cursor:"pointer","&:hover":{background:"rgba(255, 255, 255, 0.15)"}}});function eS(){let{t:e}=(0,l.i)(),{control:t,setValue:r}=(0,m.cI)(),[s,d]=(0,n.useState)(null),[c,y]=(0,n.useState)(void 0),[b,f]=(0,n.useState)(void 0),[j,k]=(0,n.useState)(null),N=(0,p.v9)(e=>e.user.data),F=(0,n.useRef)(!0),P=(0,i.Z)(),W=(0,C.Z)(P.breakpoints.down("sm")),{data:R}=(0,w.J)("fiat","deposit"),{data:O,isFetching:D,refetch:M,isError:z}=S("fiat",null==c?void 0:c.symbol),{data:E}=g(null==c?void 0:c.symbol),{data:V,refetch:B}=Z("fiat",null==c?void 0:c.symbol),q=()=>{d(null)},T=(0,n.useMemo)(()=>(null==R?void 0:R.data)&&Array.isArray(R.data)?R.data:void 0,[null==R?void 0:R.data]);(0,n.useEffect)(()=>{T&&f(T)},[T]),(0,n.useEffect)(()=>{if(!T||!F.current)return;F.current=!1;let e=localStorage.getItem("selectedCurrency");if((null==V?void 0:V.currency)&&Number(null==N?void 0:N.memberId)===Number(null==V?void 0:V.memberId)){let e=V.currency.includes("/")?V.currency.split("/")[1]:V.currency,t=T.find(t=>t.symbol===e);t&&y(t)}else if(e){let t=T.find(t=>t.symbol===e);t?y(t):T.length>0&&y(T[0])}else T.length>0&&y(T[0])},[T,V,null==N?void 0:N.memberId]);let G=b||[];return 0===G.length?(0,a.jsx)(u.Z,{color:"grey.500",sx:{py:5,textAlign:"center"},children:e("wallet.noPaymentMethodsAvailableAtThisMoment")}):(0,a.jsx)(o.Z,{children:j?(0,a.jsx)(ea,{orderId:j.sysInfo,expiryTime:0,depositAmount:"".concat(j.realityAmountFiat,"\n ").concat(null==c?void 0:c.symbol),createdAt:j.createdAt,method:(null==j?void 0:j.channelName)||""}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A.Z,{gap:1,direction:s?"row":"column",sx:{borderRadius:1,pt:3,pb:1},children:[(0,a.jsx)(A.Z,{width:s?"50%":"100%",children:G.length>0&&(0,a.jsx)(v.u,{name:"symbol",control:t,options:(null==R?void 0:R.data)||[],label:e("wallet.depositCurrency"),getOptionLabel:e=>"".concat(e.symbol," - ").concat(e.fiatCountryOrRegion),isOptionEqualToValue:(e,t)=>
1e.symbol===(null==t?void 0:t.symbol),onChange:e=>{(null==e?void 0:e.symbol)&&(y(e),r("currency",e.symbol),localStorage.setItem("selectedCurrency",e.symbol),e.otherInformation&&r("other",e.otherInformation),s&&q())},showAvatar:!0,avatarKey:"logoUrl",variant:"currency",value:c,isDisableSearch:W,t:e,sx:{backgroundColor:h.y0.selectBG}})}),(0,a.jsx)(A.Z,{direction:"column",width:W?s?"50%":"0%":"50%",children:s&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Z,{component:"label",sx:{textTransform:"capitalize",fontSize:"clamp(2px, 3.4vw, 0.875rem) !important",color:"#b2c0cc",lineHeight:1.2,mt:"4px",mb:"7px"},children:s.thirdPartyName?(0,a.jsx)(a.Fragment,{children:!W&&s.thirdPartyName}):(0,a.jsx)(a.Fragment,{children:e("deposit.choosePaymentMethod")})}),(0,a.jsx)(ej,{children:(0,a.jsxs)(A.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:0,px:1,py:W?1:1.5,width:"100%",height:W?"39px":"52px",children:[(0,a.jsxs)(A.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:1,children:[(0,a.jsx)("img",{alt:s.channelIcon,src:s.channelIcon||"".concat("https://img.xyes.com/","assets/fallback-2.png"),style:{width:"auto",height:32,borderRadius:"0.5rem"}}),(0,a.jsx)(u.Z,{variant:"body1",sx:{display:{xs:"none",sm:"none",md:"block"},fontSize:"clamp(12px, 2.9vw, 0.75rem) !important"},children:s.channelName})]}),(0,a.jsx)(eZ,{onClick:()=>q(),children:(0,a.jsx)(x.Z,{icon:"mingcute:close-line",sx:{color:"#FFFFFF"}})})]})}),(0,a.jsx)(o.Z,{sx:{display:"flex",justifyContent:"flex-end",mt:1},children:(0,a.jsx)(I.Z,{href:"#",color:"secondary",sx:{fontSize:"clamp(10px, 3.1vw, 0.75rem) !important"},children:e("deposit.howToMakeDeposit")})})]})})]}),c&&(0,a.jsx)(ew,{selectedCurrency:c,onPaymentMethodSelect:e=>{d(e)},selectedChannel:s,isWithdrawChannel:!1,setOrderData:k,setSelectedChannel:d,lastPendingDeposit:O,isLastDepositLoading:D,refetchLastPendingDeposit:M,isLastDepositError:z,data:E,lastDepositData:V,refetchLastDepositData:B})]})})}var ek=r(34422),eC=r(35398),eA=r(73842),eI=r(29233),eN=r.n(eI),eF=r(9467),eP=r(67116);let eW=(0,k.ZP)(_.Z)(e=>{let{theme:t,selected:r}=e;return{borderRadius:"8px",padding:"8px 10px",minWidth:"unset",height:"30px",whiteSpace:"nowrap",backgroundColor:h.y0.selectBG,border:r?"1px solid ".concat(t.palette.primary.main):"1px solid ".concat(h.y0.selectBG),color:r?t.palette.primary.main:"inherit","&:hover":{border:r?"1px solid ".concat(t.palette.primary.main):"1px solid ".concat(h.y0.selectBG),backgroundColor:h.y0.selectBG,boxShadow:"0 0 0 0.5px ".concat(h.y0.selectBG)}}}),eR=e=>{let{options:t,onSelect:r,value:l}=e,[i,s]=(0,eF.Z)({align:"start",loop:!1,skipSnaps:!1,dragFree:!0});(0,n.useEffect)(()=>{if(!s||!t||!l)return;let e=t.findIndex(e=>e.symbol===l.symbol);-1!==e&&s.scrollTo(e)},[l,t,s]),(0,n.useEffect)(()=>{if(!s||!t||!l)return;let e=t.findIndex(e=>e.symbol===l.symbol);-1!==e&&setTimeout(()=>{s.scrollTo(e)},100)},[s,t,l]);let d=e=>{r(e)};return(0,a.jsx)(o.Z,{ref:i,sx:{overflow:"hidden",pb:2,pt:1,px:0,ml:"2px",mr:"-16px"},children:(0,a.jsx)(o.Z,{sx:{display:"flex",gap:1,pl:1},children:null==t?void 0:t.map((e,t)=>(0,a.jsx)(o.Z,{sx:{flex:"0 0 auto",minWidth:"fit-content"},children:(0,a.jsxs)(eW,{onClick:()=>d(e),variant:"outlinedPrimary",size:"small",selected:(null==l?void 0:l.symbol)===e.symbol,children:[(0,a.jsx)(eP.Z,{src:e.cryptoIcon,alt:e.symbol,sx:{height:20,width:20,mr:1}}),(0,a.jsx)(u.Z,{sx:{fontSize:"clamp(2px, 0.875rem, 0.875rem) !important",fontWeight:500},children:e.symbol})]})},t))})})},eO=(e,t)=>{let r=(0,n.useMemo)(()=>["useGetRealAddresByCryptoAndNetwork",e,t],[e,t]);return(0,y.a)({queryKey:r,queryFn:async()=>(await f.ZP.post(f.Hv.wallet.getDepositAddress,{chain:t,coinId:e})).data,enabled:!!t&&!!e,staleTime:6e4,gcTime:3e5})};var eD=r(22577),eM=r(33833),ez=r(47080);function eE(){let{t:e}=(0,l.i)(),t=(0,i.Z)(),r=(0,C.Z)(t.breakpoints.down("sm")),s=(0,p.v9)(e=>e.user.data),d=ek.Ry().shape({currency:ek.Z_().required(e("validations.isRequired",{type:e("validations.currency")})),networks:ek.Ry().optional(),cryptoSelected:ek.Ry().nullable(),networkSelected:ek.Ry().nullable()}),{control:c,watch:y,setValue:b}=(0,m.cI)({resolver:(0,eA.X)(d),reValidateMode:"onChange",defaultValues:{currency:"",networks:void 0,cryptoSelected:null,networkSelected:null}}),f=y("cryptoSelected"),g=y("networks"),w=y("networkSelected"),[j,S]=(0,n.use
1State)({value:"",copied:!1}),{data:k,isFetching:I}=Z("crypto",null==f?void 0:f.symbol),N=(0,p.v9)(e=>e.userCurrencies.cryptos),{data:F,isError:W,isFetching:R}=eO((0,n.useMemo)(()=>(null==f?void 0:f.coinId)||null,[null==f?void 0:f.coinId]),(0,n.useMemo)(()=>(null==w?void 0:w.chain)||void 0,[null==w?void 0:w.chain])),O=e=>{S({copied:!0,value:e})};(0,n.useEffect)(()=>{if(N&&N.length>0&&!f){let e=localStorage.getItem("lastUsedCrypto"),t=N[0];if(e){let r=N.find(t=>t.symbol===e);r&&(t=r)}let r=Object.values(t.networks||{}).sort((e,t)=>t.sorted-e.sorted),a=Object.fromEntries(r.map(e=>[e.chain,e]));b("cryptoSelected",t,{shouldValidate:!0}),b("currency",t.symbol,{shouldValidate:!0}),b("networks",a,{shouldValidate:!0}),localStorage.setItem("lastUsedCrypto",t.symbol);let n=r.length>0?r[0]:null;n&&b("networkSelected",n,{shouldValidate:!0})}},[N,f,b]),(0,n.useEffect)(()=>{if(k&&Number(null==s?void 0:s.memberId)===Number(k.memberId)&&g){var e;let t=(null==k?void 0:null===(e=k.orderId)||void 0===e?void 0:e.chain)||"",r=Object.values(g).find(e=>e.chain===t);r&&b("networkSelected",r,{shouldValidate:!0})}},[k,g,null==s?void 0:s.memberId,b]);let D=F||null,M=(null==D?void 0:D.address)?D.address:"",z=M.slice(0,5),E=M.slice(5,M.length-4),V=M.slice(M.length-4);return(0,a.jsx)(A.Z,{direction:"column",spacing:1,sx:{mt:1,mb:2,width:"100%"},children:I?(0,a.jsx)(o.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:r?"600px":"auto"},children:(0,a.jsx)(P.AG,{})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eR,{options:null==N?void 0:N.filter(e=>"XCD"!==e.symbol),onSelect:e=>{var t,r;let a={};e.networks&&(a=Object.fromEntries(Object.values(e.networks).sort((e,t)=>t.sorted-e.sorted).map(e=>[e.chain,e]))),b("networks",a,{shouldValidate:!0});let n=a&&Object.values(a)[0]?Object.values(a)[0]:null;n&&b("networkSelected",n,{shouldValidate:!0});let l=null==N?void 0:N.find(t=>t.symbol===(null==e?void 0:e.symbol));b("cryptoSelected",null!=l?l:null,{shouldValidate:!0}),b("currency",null!==(t=null==l?void 0:l.symbol)&&void 0!==t?t:"",{shouldValidate:!0}),localStorage.setItem("lastUsedCrypto",null!==(r=null==l?void 0:l.symbol)&&void 0!==r?r:"")},value:null!=f?f:void 0}),(0,a.jsxs)(K.ZP,{container:!0,spacing:2,children:[(0,a.jsx)(K.ZP,{item:!0,xs:6,md:6,children:(0,a.jsx)(v.u,{name:"symbol",control:c,options:(null==N?void 0:N.filter(e=>"XCD"!==e.symbol))||[],label:e("wallet.depositCurrency"),getOptionLabel:e=>"".concat(e.symbol),isDisableSearch:r,isOptionEqualToValue:(e,t)=>e.symbol===(null==t?void 0:t.symbol),onChange:e=>{var t,r;let a={};e.networks&&(a=Object.fromEntries(Object.values(e.networks).sort((e,t)=>t.sorted-e.sorted).map(e=>[e.chain,e]))),b("networks",a,{shouldValidate:!0});let n=a&&Object.values(a)[0]?Object.values(a)[0]:null;n&&b("networkSelected",n,{shouldValidate:!0});let l=null==N?void 0:N.find(t=>t.symbol===(null==e?void 0:e.symbol));b("cryptoSelected",null!=l?l:null,{shouldValidate:!0}),b("currency",null!==(t=null==l?void 0:l.symbol)&&void 0!==t?t:"",{shouldValidate:!0}),localStorage.setItem("lastUsedCrypto",null!==(r=null==l?void 0:l.symbol)&&void 0!==r?r:"")},showAvatar:!0,avatarKey:"cryptoIcon",variant:"currency",value:f,t:e,sx:{backgroundColor:h.y0.selectBG,width:"100%"}})}),(0,a.jsx)(K.ZP,{item:!0,xs:6,md:6,children:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eD.Z,{id:"network-label",sx:{textTransform:"capitalize",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",fontWeight:500,color:"#b2c0cc",mb:.5},children:e("wallet.depositNetwork")}),(0,a.jsx)(eM.Z,{labelId:"network-label",id:"network-select",value:(null==w?void 0:w.chain)||"",onChange:e=>{let t=e.target.value;if(g){let e=Object.values(g).find(e=>e.chain===t);b("networkSelected",null!=e?e:null,{shouldValidate:!0})}},renderValue:e=>(0,a.jsx)(A.Z,{direction:"row",spacing:0,children:null==w?void 0:w.chainFullName}),style:{backgroundColor:h.y0.selectBG,height:r?"40px":"auto",width:"100%"},MenuProps:{PaperProps:{style:{maxHeight:300,minHeight:100,overflow:"auto"}}},children:g&&Object.values(g).map(e=>(0,a.jsx)(Y.Z,{value:e.chain,children:e.chainFullName},e._id))})]})})]}),W?(0,a.jsx)(o.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:r?"600px":"auto"},children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:t.palette.error.main},children:e("errors.anErrorOccurred")})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(A.Z,{direction:"row",gap:2,children:[(0,a.jsx)(o.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:f&&(0,a.jsx)(eC.tv,{value:M,bgColor:"#ffffff",fgColor:"#000000",level:"L",style:{borderRadius:10},includeMargin:!0,imageSettings:{src:f.cryptoIcon,x:void 0,y:void 0,height:24,width:24,excavate:!0}})}),(0,a.jsx)(o.Z,{sx:{flex:1,width:{xs:"100%",sm:"50%"},pl:{sm:1},pt:{xs:0,sm:1}},children:(0,a.jsxs)(A.Z,{justifyContent:"flex-start",alignItems:"flex-start",spacing:.5,children:[(0,a.jsx)(u.Z,{variant:"button",sx:{fontSize:"clamp(2px, 0.75rem, 0.875rem) !important",lineHeight:1.2,textAlign:"center",transition:"none",transform:"none"},children:e("wallet.depositAddress")}),R?(0,a.jsx)(ez.Z,{animation:"wave",height:45,sx:{width:"100%",borderRadius:"4px !important",mb:1.5}}
1):(0,a.jsx)(G.Z,{sx:{p:.5,background:"#0e1215",border:"2px solid #1a4151",display:"flex",mb:1,width:"100%"},children:(0,a.jsxs)(u.Z,{sx:{wordBreak:{xs:"break-all",sm:"break-all",md:"break-word"},fontSize:"clamp(2px, .75rem, 0.875rem) !important"},children:[(0,a.jsx)(o.Z,{component:"span",sx:{color:t.palette.primary.light},children:z}),(0,a.jsx)(o.Z,{component:"span",sx:{color:t.palette.grey[400]},children:E}),(0,a.jsx)(o.Z,{component:"span",sx:{color:t.palette.primary.light},children:V})]})}),(0,a.jsx)(eN(),{text:M,onCopy:()=>O(M),children:(0,a.jsxs)(_.Z,{variant:"header",fullWidth:!0,size:"small",children:[(0,a.jsx)(x.Z,{icon:j.copied?"solar:check-circle-line-duotone":"solar:copy-linear"}),e(j.copied?"wallet.copied":"wallet.copy")]})})]})})]}),(0,a.jsx)(o.Z,{sx:{mt:2},children:(0,a.jsx)(en.Z,{})})]})]})})}var eV=r(68651),eB=r(21770),eq=r(11417),eT=r(10601),eG=r(82877),e_=r(92566),eL=r(85860);function eU(){var e;let t,r;let{t:s}=(0,l.i)(),{showMessage:d}=(0,X.useSnackbar)(),c=(0,i.Z)(),y=(0,C.Z)(c.breakpoints.down("sm")),[b,w]=(0,n.useState)(void 0),[j,Z]=(0,n.useState)(!1),[S,k]=(0,n.useState)(null),N=(0,p.v9)(e=>e.userCurrencies),{data:F,isError:D,isFetching:M}=g(void 0),[z,E]=(0,n.useState)([]),[B,q]=(0,n.useState)(null),{data:T}=(0,eG.Xn)({currencyCode:(null==b?void 0:b.symbol)||""}),U=z.map(e=>({...e,availablePaymentMethod:O.fP})),H=(0,n.useMemo)(()=>ek.Ry().shape({fiatSelected:ek.nK().required(s("validations.isRequired",{type:s("validations.fiat")})),cryptoSelected:ek.nK().required(s("validations.isRequired",{type:s("validations.crypto")})),amount:ek.Z_().required(s("validations.isRequired",{type:s("validations.currency")})).test("is-number",s("validations.invalidNumber"),e=>{if(!e)return!1;let t=Number(e);return!Number.isNaN(t)&&Number.isFinite(t)}).test("is-decimal",s("validations.invalidFormat"),e=>!!e&&/^\d+(\.\d{1,2})?$/.test(e)).test("max-amount",s("validations.maxAmountMustBe",{max:(0,R.dN)((null==b?void 0:b.maxAmount)||0,"/fiat"),symbol:null==b?void 0:b.symbol}),e=>null==b||!b.maxAmount||!e||new eV.Z(e).lte(b.maxAmount)).test("min-amount",s("validations.minAmountMustBe",{min:(0,R.dN)((null==b?void 0:b.minAmount)||0,"/fiat"),symbol:null==b?void 0:b.symbol}),function(e){let{fiatSelected:t}=this.parent;return null==t||!t.minAmount||!e||new eV.Z(e).gte(t.minAmount)})}),[s,b]),Y=(0,m.cI)({resolver:(0,eT.X)(H),reValidateMode:"onChange",defaultValues:{amount:"",cryptoAmount:"",fiatSelected:void 0,cryptoSelected:void 0}}),{control:$,watch:Q,setValue:J,trigger:ee}=Y,er=Q("cryptoSelected"),ea=Q("fiatSelected"),en=Q("amount"),el=Q("cryptoAmount"),eo=(0,n.useMemo)(()=>{if(!(null==er?void 0:er.usdRate)||!(null==ea?void 0:ea.usdRate))return new eV.Z(0);try{let e=Number((null==T?void 0:T[er.symbol||0])||0);return new eV.Z(.95*e).dividedBy(new eV.Z(ea.usdRate.toString()))}catch(e){return new eV.Z(0)}},[T,null==er?void 0:er.symbol,null==er?void 0:er.usdRate,null==ea?void 0:ea.usdRate]),ei=(e,t)=>{let r=e.toString();if(void 0===t)return r;let[a,n=""]=r.split(".");return n?"".concat(a,".").concat(n.substring(0,t)):a},es=async(e,t)=>{t.preventDefault(),q(e),J("cryptoAmount",""),J("amount",""),await ee()},ed=async e=>{let t="https://api.xyes.com/api/v1"+f.Hv.wallet.buyCrypto;return(await (0,f.ZP)({method:"post",url:t,data:e})).data},ec=(0,eB.D)({mutationFn:ed,onSuccess:e=>{d(s("actions.orderCreated"),"success"),(0,O.nG)(e.data.orderData),k(e.data.orderData),Z(!1)},onError:e=>{if(e instanceof W.d7){var t,r;d((null===(r=e.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.message)||e.message,"error")}else d(e.message||s("errors.anErrorOccurred"),"error");Z(!1)}}),eu=async e=>{try{var t,r;let e={amount:Q("amount"),cryptoAmount:el,cryptoCurrency:null===(t=Q("cryptoSelected"))||void 0===t?void 0:t.symbol,fiatCurrency:null===(r=Q("fiatSelected"))||void 0===r?void 0:r.symbol,network:"BSC",thirdParty:null==B?void 0:B.systemNo};Z(!0),ec.mutate(e)}catch(e){}};return(0,n.useEffect)(()=>{if(N&&Array.isArray(N.fiats)&&B){let e=localStorage.getItem("selectedCurrency"),t=B.availableFiats?Object.keys(B.availableFiats):[],r=t.length>0?N.fiats.filter(e=>t.includes(e.symbol)).map(e=>{let t=B.availableFiats[e.symbol];return{...e,minAmount:parseFloat(t.min),maxAmount:parseFloat(t.max)}}):N.fiats,a=async e=>{var t,r;J("fiatSelected",e);let a=null!==(r=null===(t=e.minAmount)||void 0===t?void 0:t.toString())&&void 0!==r?r:"";if(J("amount",a,{shouldValidate:!0}),w(e),(null==er?void 0:er.usdRate)&&e.usdRate){let e=Number((null==T?void 0:T[er.symbol||0])||0);J("cryptoAmount",new eV.Z(a).times(Number(.95*e).toString()).decimalPlaces(8,eV.Z.ROUND_DOWN).toString())}await ee("amount")};if(e){let t=r.find(t=>t.symbol===e);if(t){a(t);return}}r.length>0&&a(r[0])}},[N,J,er,B,ee,T]),(0,n.useEffect)(()=>{(null==F?void 0:F.data)&&(E(F.data),F.data.length>0&&q(F.data[0]))},[F]),(0,n.useEffect)(()=>
1{if(ea&&(null==B?void 0:B.availableFiats)){let e=Object.keys(B.availableFiats);if(e.length>0&&!e.includes(ea.symbol)){let t=e[0],r=null==N?void 0:N.fiats.find(e=>e.symbol===t);if(r){let e=B.availableFiats[t],a={...r,minAmount:parseFloat(e.min),maxAmount:parseFloat(e.max)};J("fiatSelected",a),localStorage.setItem("selectedCurrency",a.symbol),J("amount",e.min,{shouldValidate:!0}),ee("amount")}}}},[B,ea,N,J,ee]),(0,n.useEffect)(()=>{if(N&&Array.isArray(N.cryptos)){let e=localStorage.getItem("cryptoSelected"),t=(null==B?void 0:B.availableCurrency.length)>0?N.cryptos.filter(e=>null==B?void 0:B.availableCurrency.includes(e.symbol)):N.cryptos;if(e){let r=t.find(t=>t.symbol===e);if(r){J("cryptoSelected",r);return}}t.length>0&&J("cryptoSelected",t[0])}},[N,J,B]),(0,a.jsx)(a.Fragment,{children:M?(0,a.jsx)(o.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:y?"600px":"auto"},children:(0,a.jsx)(P.AG,{})}):(0,a.jsx)(a.Fragment,{children:D?(0,a.jsx)(u.Z,{color:"grey.500",sx:{py:10,textAlign:"center"},children:s("bonus.noData")}):(0,a.jsxs)(eq.Z,{methods:Y,onSubmit:Y.handleSubmit(eu),children:[(0,a.jsxs)(A.Z,{direction:"row",spacing:1,sx:{mb:1,mt:1,borderRadius:1},children:[(0,a.jsxs)(o.Z,{sx:{width:"100%"},children:[(0,a.jsx)(u.Z,{variant:"h6",sx:{py:1,color:"grey.400"},children:s("wallet.youSend")}),(0,a.jsx)(v.u,{name:"fiat",control:$,options:((null==B?void 0:B.availableFiats)&&Object.keys(B.availableFiats).length>0?null==N?void 0:N.fiats.filter(e=>!e.disable).filter(e=>Object.keys(B.availableFiats).includes(e.symbol)):null==N?void 0:N.fiats.filter(e=>!e.disable))||[],label:"",getOptionLabel:e=>"".concat(e.symbol),isOptionEqualToValue:(e,t)=>e.symbol===(null==t?void 0:t.symbol),onChange:e=>{if(null==e?void 0:e.symbol){var t,r,a,n,l;localStorage.setItem("selectedCurrency",e.symbol);let o=(null==B?void 0:null===(t=B.availableFiats)||void 0===t?void 0:t[e.symbol])?{...e,minAmount:parseFloat(B.availableFiats[e.symbol].min),maxAmount:parseFloat(B.availableFiats[e.symbol].max)}:e;if(w(o),J("fiatSelected",o,{shouldValidate:!0}),J("amount",null!==(l=null!==(n=null===(r=o.minAmount)||void 0===r?void 0:r.toString())&&void 0!==n?n:null===(a=e.minAmount)||void 0===a?void 0:a.toString())&&void 0!==l?l:"",{shouldValidate:!0}),en){let t=new eV.Z((null==er?void 0:er.usdRate)||0).dividedBy(e.usdRate);J("cryptoAmount",ei(new eV.Z(en).times(t),8))}}},showAvatar:!0,avatarKey:"logoUrl",variant:"currency",value:ea,isDisableSearch:y,t:s,sx:{backgroundColor:h.y0.selectBG}})]}),(0,a.jsxs)(o.Z,{sx:{width:"100%"},children:[(0,a.jsxs)(u.Z,{variant:"h6",sx:{py:1,pb:1.5,textAlign:"end",color:"grey.400"},children:[(t=(null==ea?void 0:ea.minAmount)||0,r=(null==ea?void 0:ea.maxAmount)||0,"".concat((0,R.dN)(t,"/fiat")," ~ ").concat((0,R.dN)(r,"/fiat")))," ",null==ea?void 0:ea.symbol]}),(0,a.jsx)(L.Z,{id:"fiat-amount",label:"",variant:"outlined",fullWidth:!0,value:en,error:!!Y.formState.errors.amount,helperText:null===(e=Y.formState.errors.amount)||void 0===e?void 0:e.message,onChange:e=>{let{value:t}=e.target,r=t.split(".");if(r.length>1&&r[1].length>2&&(t="".concat(r[0],".").concat(r[1].substring(0,2))),J("amount",t,{shouldValidate:!0}),t&&eo&&!eo.isZero())try{let e=t.replace(",","."),r=Number((null==T?void 0:T[(null==er?void 0:er.symbol)||0])||0),a=new eV.Z(e).times(Number(.95*r).toString()).decimalPlaces(8,eV.Z.ROUND_DOWN).toString();J("cryptoAmount",a)}catch(e){J("cryptoAmount","")}else J("cryptoAmount","");ee("amount")},sx:{"& .MuiOutlinedInput-root":{height:y?"40px":"auto",color:"grey.400",fontSize:"11px",backgroundColor:h.y0.selectBG,"& input::placeholder":{fontWeight:"bold"}}},inputProps:{min:(null==ea?void 0:ea.minAmount)||0,max:(null==ea?void 0:ea.maxAmount)||Number.MAX_SAFE_INTEGER,type:"number",step:"0.01",inputMode:"decimal",pattern:"^\\d+(\\.\\d{1,2})?$"}})]})]}),(0,a.jsxs)(A.Z,{alignItems:"center",justifyContent:"space-between",direction:"row",children:[(0,a.jsxs)(u.Z,{variant:"h6",sx:{py:1,color:"grey.400"},children:[s("wallet.youReceive")," ","(".concat(s("wallet.estimate"),")")]}),(0,a.jsxs)(u.Z,{variant:"h6",sx:{py:1,pb:1.5,textAlign:"end",color:"grey.400"},children:["1 ",null==ea?void 0:ea.symbol," â"," ",(0,R.dN)(.95*Number(null==T?void 0:T[(null==er?void 0:er.symbol)||0])||0,"crypto/")," ",null==er?void 0:er.symbol]})]}),(0,a.jsxs)(A.Z,{direction:"row",spacing:1,sx:{mb:2,borderRadius:1},children:[(0,a.jsx)(o.Z,{sx:{width:"100%"},children:(0,a.jsx)(v.u,{name:"crypto",control:$,options:((null==B?void 0:B.availableCurrency.length)>0?null==N?void 0:N.cryptos.filter(e=>!e.disable).filter(e=>null==B?void 0:B.availableCurrency.includes(e.symbol)):null==N?void 0:N.cryptos.filter(e=>!e.disable))||[],label:"",getOptionLabel:e=>"".concat(e.symbol," "),isOptionEqualToValue:(e,t)=>
1e.symbol===(null==t?void 0:t.symbol),onChange:e=>{if((null==e?void 0:e.symbol)&&(J("cryptoSelected",e),localStorage.setItem("cryptoSelected",e.symbol),en)){let t=new eV.Z(e.usdRate).dividedBy((null==ea?void 0:ea.usdRate)||1);J("cryptoAmount",ei(new eV.Z(en).times(t),8))}},showAvatar:!0,avatarKey:"cryptoIcon",variant:"currency",value:er,isDisableSearch:y,t:s,sx:{backgroundColor:h.y0.selectBG}})}),(0,a.jsx)(o.Z,{sx:{width:"100%",mt:.5},children:(0,a.jsx)(L.Z,{id:"crypto-amount",label:"",variant:"outlined",fullWidth:!0,value:el,onChange:e=>{let{value:t}=e.target;if(J("cryptoAmount",t),t&&eo&&!eo.isZero())try{let e=new eV.Z(t).dividedBy(Number(null==T?void 0:T[(null==er?void 0:er.symbol)||0]).toString()).decimalPlaces(2,eV.Z.ROUND_DOWN).toString();J("amount",e,{shouldValidate:!0})}catch(e){J("amount","")}else J("amount","",{shouldValidate:!0});ee("cryptoAmount")},sx:{"& .MuiOutlinedInput-root":{height:y?"40px":"auto",color:"grey.400",fontSize:"0.875rem",backgroundColor:h.y0.selectBG,"& input::placeholder":{fontWeight:"bold"}}}})})]}),(0,a.jsx)(A.Z,{alignItems:"center",justifyContent:"space-between",direction:"row",children:(0,a.jsxs)(u.Z,{variant:"body1",sx:{color:"grey.400"},children:["*",s("wallet.theActualReceivedAmountShallPrevail")]})}),(0,a.jsx)(A.Z,{alignItems:"center",justifyContent:"space-between",direction:"row",children:(0,a.jsx)(u.Z,{variant:"h6",sx:{py:1,color:"grey.400"},children:s("withdraw.choosePaymentMethod")})}),(0,a.jsx)(K.ZP,{container:!0,spacing:2,sx:{mb:2},children:U.map(e=>(0,a.jsx)(K.ZP,{item:!0,xs:12,children:(0,a.jsxs)(G.Z,{onClick:t=>es(e,t),sx:{p:1,width:"100%",background:h.y0.selectBG,borderRadius:1,boxShadow:1,display:"flex",justifyContent:"space-between",alignItems:"center",border:(null==B?void 0:B._id)===e._id?"1px solid #fe7801":"none"},children:[(0,a.jsx)(o.Z,{sx:{display:"flex",alignItems:"end"},children:(0,a.jsx)(o.Z,{component:"img",src:e.channelIcon,alt:e._id,sx:{height:24,width:"auto",maxWidth:120,mr:1.5,objectFit:"contain"}})}),(0,a.jsxs)(A.Z,{direction:"row",width:y?"80%":"70%",alignItems:"center",gap:y?1:2,children:[(0,a.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"column",whiteSpace:"nowrap"},children:[(0,a.jsxs)(u.Z,{variant:"body2",sx:{color:"grey.400",alignSelf:"center",writingMode:"horizontal-tb",textOrientation:"mixed"},children:[s("navigation.footer.link.support.support"),":"]}),(0,a.jsxs)(o.Z,{sx:{display:"flex",whiteSpace:"nowrap"},children:[s("wallet.fee")," â 5%"]})]}),(0,a.jsx)(et.Z,{orientation:"vertical",variant:"middle",flexItem:!0}),(0,a.jsx)(o.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1,flexGrow:1,"& > *":{flex:"1 0 auto",maxWidth:"calc(20% - 8px)",display:"flex",justifyContent:"center"}},children:e.availablePaymentMethod.map(e=>(0,a.jsx)(o.Z,{component:"img",src:e.channelIcon,alt:e.channelName,sx:{height:y?20:24,width:"auto",maxWidth:80,minWidth:y?"auto":60,objectFit:"contain",borderRadius:1,border:"1px solid",borderColor:"divider",background:h.y0.buttonOutlinedBG,p:.5}},e.id))})]})]})},e._id))}),(0,a.jsx)(K.ZP,{item:!0,xs:12,sm:12,md:12,sx:{my:2},children:(0,a.jsxs)(G.Z,{sx:{py:1,background:"transparent",border:"none"},children:[(0,a.jsx)(K.ZP,{container:!0,component:"main",spacing:1,alignItems:"center",children:(0,a.jsx)(K.ZP,{item:!0,xs:12,sm:12,md:12,children:(0,a.jsx)(eL.Z,{required:!0,control:(0,a.jsx)(e_.Z,{}),name:"termsAndConditions",label:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(o.Z,{component:"span",sx:{color:c.palette.grey[400]},children:[s("wallet.haveReadAndAgree")," "]}),(0,a.jsx)(I.Z,{underline:"always",color:"text.primary",children:s("wallet.disclaimer")})]})})})}),(0,a.jsx)(A.Z,{direction:"row",width:"100%",mt:1,gap:1,alignItems:"center",children:S?(0,a.jsxs)(A.Z,{direction:"row",width:"100%",gap:1,alignItems:"center",mt:2,children:[(0,a.jsxs)(_.Z,{variant:"outlinedPrimary",fullWidth:!0,size:"small",onClick:()=>null===O.nG||void 0===O.nG?void 0:(0,O.nG)(S),sx:{p:2},children:[(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:s("deposit.openDepositLink")}),(0,a.jsx)(x.Z,{icon:"flowbite:arrow-up-right-from-square-outline",sx:{ml:1},color:"#fff"})]}),(0,a.jsx)(_.Z,{variant:"contained",size:"small",onClick:()=>k(null),fullWidth:!0,sx:{backgroundColor:"#ff7901","&:hover":{backgroundColor:"#ff7901cc"},p:2},children:(0,a.jsx)(u.Z,{variant:"h6",sx:{color:"#fff",fontSize:"clamp(2px, 2.5vw, 0.75rem) !important"},children:s("deposit.completedDeposit")})})]}):(0,a.jsx)(V.Z,{fullWidth:!0,type:"submit",color:"inherit",size:"large",variant:"header",loading:j,disabled:!Y.formState.isValid,sx:{mt:2,p:2},children:s("wallet.buyCryptocurrency")})})]})})]})})})}function eH(e){let{children:t,value:r,index:n,...l}=e;return(0,a.jsx)("div",{role:"tabpanel",hidden:r!==n,id:"simple-tabpanel-".concat(n),"aria-labelledby":"simple-tab-".concat(n),...l,children:r===n&&(0,a.jsx)(o.Z,{children:t})})}function eK(e){let{currencyType:t}=e,{t:r}
1=(0,l.i)(),m=(0,i.Z)(),[p,h]=(0,n.useState)(t||1),x=[{id:1,label:r("wallet.crypto"),component:(0,a.jsx)(eE,{}),disabled:!1},{id:2,label:r("wallet.buyCrypto"),component:(0,a.jsx)(eU,{}),disabled:!1},{id:3,label:r("wallet.fiat"),component:(0,a.jsx)(eS,{}),disabled:!1}];return(0,a.jsx)(o.Z,{sx:{width:"100%"},children:(0,a.jsxs)(o.Z,{sx:{width:"100%"},children:[(0,a.jsx)(s.Z,{position:"static",sx:{backgroundColor:"transparent",boxShadow:"none",px:1,borderBottom:1,borderColor:"divider"},children:(0,a.jsx)(d.Z,{value:p,onChange:(e,t)=>{h(t)},"aria-label":"Tabs-Crypto-Fiat-Deposit",variant:"fullWidth",scrollButtons:"auto",sx:{"& .MuiTabs-indicator":{backgroundColor:m.palette.primary.main,height:"2px"}},children:x.map((e,t)=>(0,a.jsx)(c.Z,{disabled:e.disabled,label:(0,a.jsx)(u.Z,{sx:{fontSize:"clamp(2px, 3.5vw, 0.875rem) !important",lineHeight:1.2,textAlign:"center",transition:"none",transform:"none",fontWeight:"600"},children:e.label}),value:e.id,id:"simple-tab-".concat(t),"aria-controls":"simple-tabpanel-".concat(t),sx:{textTransform:"none",color:p===e.id?m.palette.primary.main:m.palette.text.secondary,"&.Mui-selected":{color:m.palette.primary.main},"&:hover":{color:m.palette.primary.light}}},e.id))})}),x.map(e=>(0,a.jsx)(eH,{value:p,index:e.id,children:(0,a.jsx)(o.Z,{sx:{px:1,overflowX:"hidden",minHeight:"auto",overflowY:"scroll","&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-thumb":{backgroundColor:m.palette.primary.main,borderRadius:"2px"}},children:e.component})},e.id))]})})}},82354:function(e,t,r){r.d(t,{z5:function(){return k.default},FG:function(){return Z},ed:function(){return C.default},ZP:function(){return S}});var a=r(2265),n=r(57437),l=r(60033),o=r(76975),i=r(78948),s=r(43161),d=r(57099),c=r(42552),u=r(31691),m=r(82156),p=r(1899),h=r(19643),x=r(46387),v=r(8350),y=r(97312),b=r(73992);function f(){var e,t,r,a,o;let{t:f,getLang:g}=(0,l.i)(),w=(0,u.Z)(),j=(0,m.Z)(w.breakpoints.down("sm")),Z=g(),{getLink:S}=(0,s.m)(),{data:k}=(0,c.G)({populate:[{key:"populate[category][populate][link][populate]",value:"icon"},{key:"populate[disclaimer][populate]",value:"image"},{key:"populate[disclaimer][populate]",value:"mobileImage"},{key:"populate[disclaimer][populate]",value:"tabletImage"}],locale:{key:"locale",value:Z}}),{data:C}=(0,c.G)({populate:[{key:"populate[category][populate][link][populate]",value:"icon"},{key:"populate[disclaimer][populate]",value:"image"},{key:"populate[disclaimer][populate]",value:"mobileImage"},{key:"populate[disclaimer][populate]",value:"tabletImage"}],locale:{key:"locale",value:"en"}}),A=(null==k?void 0:null===(r=k.data)||void 0===r?void 0:null===(t=r.attributes)||void 0===t?void 0:null===(e=t.category)||void 0===e?void 0:e.length)?k:C,I=null==A?void 0:null===(o=A.data)||void 0===o?void 0:null===(a=o.attributes)||void 0===a?void 0:a.category.find(e=>"Social Media"===e.slug);return(0,n.jsxs)(p.Z,{children:[(0,n.jsx)(h.Z,{textAlign:"center",children:(0,n.jsx)(x.Z,{sx:{fontSize:{xs:"0.8em",sm:"0.85em",md:"0.85em",lg:"0.9em",xl:"0.9em"},color:"grey.400"},children:f("wallet.followUs")})}),(0,n.jsx)(v.Z,{sx:{mb:1}}),(0,n.jsx)(h.Z,{direction:"row",spacing:0,alignItems:"center",justifyContent:"space-between",sx:{flexWrap:"wrap",width:"100%"},children:null==I?void 0:I.link.map((e,t)=>{var r,a,l,o;return(0,n.jsx)(p.Z,{sx:{display:"flex",alignItems:"center"},children:(null===(a=e.icon.data)||void 0===a?void 0:null===(r=a.attributes)||void 0===r?void 0:r.url)?(0,n.jsx)(y.Z,{component:"a",href:e.isExternal?e.href||"":S((0,d.zS)(e.href)||""),target:e.isExternal?"_blank":void 0,rel:e.isExternal?"noopener noreferrer":void 0,color:w.palette.grey[400],sx:{display:"flex",alignItems:"center",background:i.y0.selectBG,border:"1px solid transparent",borderRadius:1,p:1,"&:hover":{transform:"scale(1.1)",transition:"transform 0.2s",border:"1px solid #fe7801"}},children:(0,n.jsx)(b.d3,{iconUrl:(null===(o=e.icon.data)||void 0===o?void 0:null===(l=o.attributes)||void 0===l?void 0:l.url)||"",style:{display:"block",objectFit:"contain"},width:j?15:24,height:j?15:24})}):(0,n.jsx)(y.Z,{color:w.palette.grey[400],href:e.isExternal?e.href||"":S((0,d.zS)(e.href)||""),target:e.isExternal?"_blank":void 0,rel:e.isExternal?"noopener noreferrer":void 0,sx:{display:"flex",alignItems:"center",px:1.5,py:.5,borderRadius:1,"&:hover":{bgcolor:"action.hover"}},children:e.translated?e.label:e.slug})},"link-".concat(t))})})]})}
1var g=r(12713),w=r(44811),j=r(73053);function Z(e){let{loading:t,handleRedeem:r}=e,{t:i}=(0,l.i)(),s=(0,u.Z)(),d=(0,m.Z)(s.breakpoints.down("sm")),[c,v]=(0,a.useState)("");return(0,n.jsxs)(p.Z,{sx:{width:"100%",p:d?1:3},children:[(0,n.jsx)(x.Z,{variant:"h2",children:i("wallet.useThePromocode")}),(0,n.jsxs)(h.Z,{direction:"column",spacing:1,sx:{my:2,minHeight:"500px"},children:[(0,n.jsx)(x.Z,{sx:{fontSize:{xs:"0.9em",sm:"0.9em",md:"1em",lg:"1.1em",xl:"1.1em"},color:"grey.400"},children:i("wallet.enterYourPromoCode")}),(0,n.jsxs)(p.Z,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"start",gap:1,mt:1,children:[(0,n.jsx)(o.Z,{icon:"solar:tag-price-linear",color:"primary.main",sx:{height:{xs:14,sm:14,md:16,lg:18,xl:20},width:{xs:14,sm:14,md:16,lg:18,xl:20}}}),(0,n.jsx)(x.Z,{sx:{fontSize:{xs:"0.8em",sm:"0.85em",md:"0.85em",lg:"0.9em",xl:"0.9em"},color:"grey.400"},children:i("wallet.enterThePromoCode")})]}),(0,n.jsx)(g.Z,{variant:"outlined",value:c,onChange:e=>{let t=e.target.value.replace(/\s+/g,"");/^[a-zA-Z0-9]*$/.test(t)&&t.length<=5&&v(t)},fullWidth:!0,placeholder:i("bonus.redeemBonusCodeHere"),sx:{mt:1,"& .MuiOutlinedInput-root":{color:"grey.400",fontSize:"0.875rem","& fieldset":{borderWidth:"1px",borderColor:"grey.600"},"& input::placeholder":{fontWeight:"bold"}}}}),(0,n.jsx)(p.Z,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",pb:2,children:(0,n.jsx)(w.Z,{variant:"header",fullWidth:!0,sx:{mt:1,fontSize:"clamp(2px, 2.9vw, 0.875rem) !important","&.MuiButtonBase-root:hover":{boxShadow:"none"},"&.MuiButton-contained":{backgroundColor:"#2A334A",borderRadius:"5px",borderWidth:"1px",borderColor:"primary.main"},"&.Mui-disabled":{borderColor:"grey.600"}},onClick:()=>{r(c),v("")},disabled:t||c.length<5,children:t?(0,n.jsx)(j.Z,{size:d?16:20}):i("bonus.redeem")})}),(0,n.jsx)(f,{})]})]})}var S=e=>{let{tabSelected:t,onTabChange:r}=e,{t:a}=(0,l.i)(),o=(0,u.Z)(),s=[{id:"deposit",label:a("wallet.deposit"),icon:"/assets/icons/wallet/ic_deposit_wallet.svg"},{id:"withdraw",label:a("wallet.withdraw"),icon:"/assets/icons/wallet/ic_withdraw_wallet.svg"},{id:"promo-code",label:a("wallet.promoCode"),icon:"/assets/icons/wallet/ic_promo_code_wallet.svg"}];return(0,n.jsx)(p.Z,{sx:{display:"flex",width:"100%",gap:"8px"},children:s.map((e,a)=>(0,n.jsx)(p.Z,{sx:{flex:1,minWidth:0},children:(0,n.jsxs)(w.Z,{variant:"outlinedPrimary",onClick:()=>r(e.id),size:"small",fullWidth:!0,sx:{height:"35px",color:t===e.id?o.palette.orange[900]:i.y0.buttonOutlinedColor,borderColor:t===e.id?o.palette.orange[900]:i.y0.buttonOutlinedBG,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"flex",alignItems:"center",justifyContent:"center",gap:"4px",padding:"3px 8px"},children:[(0,n.jsx)(b.d3,{iconUrl:e.icon,style:{flexShrink:0,width:"16px",height:"16px"}}),(0,n.jsx)(x.Z,{variant:"button",sx:{fontWeight:600,lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:e.label})]})},a))})},k=r(58629),C=r(422);r(78312),a.lazy(()=>Promise.resolve().then(r.bind(r,58629))),a.lazy(()=>Promise.resolve().then(r.bind(r,422))),a.lazy(()=>Promise.resolve().then(r.bind(r,78312)))},422:function(e,t,r){r.r(t),r.d(t,{default:function(){return em}});var a=r(57437),n=r(2265),l=r(60033),o=r(66274),i=r(1899),s=r(31691),d=r(71495),c=r(73904),u=r(10207),m=r(46387),p=r(34422),h=r(68651),x=r(68575),v=r(78948),y=r(76975),b=r(20418),f=r(48116),g=r(21770),w=r(43161),j=r(73842),Z=r(55447),S=r(66798),k=r(5047),C=r(29501),A=r(73222),I=r(82877),N=r(16593),F=r(45345),P=r(99719);let W=e=>{let t=(0,n.useMemo)(()=>(null==e?void 0:e.coinId)?new URL("".concat("https://api.xyes.com/api/v1"+Z.Hv.wallet.getNetworksByCurrency).concat(e.coinId)):null,[null==e?void 0:e.coinId]),r=async()=>{if(!t)throw Error("Coin ID is required");return(await Z.ZP.get(t.toString())).data};return(0,N.a)({queryKey:["useGetNetworkByCoinId",null==e?void 0:e.coinId],queryFn:r,placeholderData:F.Wk,refetchOnMount:!0,refetchOnWindowFocus:!0,enabled:!!(null==e?void 0:e.coinId)})},R=(e,t)=>{let r=(0,n.useMemo)(()=>e&&t?new URL("".concat("https://api.xyes.com/api","/v2/wallets/get-withdraw-fee/").concat(e,"/").concat(t)):null,[e,t]),a=async()=>
1{if(!r)throw Error("Currency and network are required");return(await Z.ZP.get(r.toString())).data},l=!!e&&!!t;return(0,N.a)({queryKey:["useGetFeeByNetwork",e,t],queryFn:a,placeholderData:F.Wk,enabled:l,staleTime:6e4})},O=(e,t)=>{let r=(0,n.useMemo)(()=>e&&t?"".concat(P.fS.wallet.getLastPendingWithdraw,"/").concat(e,"/").concat(t):null,[e,t]),a=async()=>{if(!r)throw Error("Type and currency are required");return(await P.ZP.get(r)).data},l=!!e&&!!t;return(0,N.a)({queryKey:["useGetLastPendingWithdrawV2",e,t],queryFn:a,placeholderData:F.Wk,refetchOnMount:!1,refetchOnWindowFocus:!1,enabled:l})};var D=r(17947),M=r(57099),z=r(67352),E=r(6809),V=r(82156),B=r(19643),q=r(44811),T=r(20184),G=r(85299),_=r(33460),L=r(19902),U=r(12713),H=r(23996),K=r(24021),Y=r(14616),$=r(87055),X=r(67116),Q=r(73126),J=r(89414),ee=r(88064),et=r(50290),er=r(57824),ea=r(36067);function en(e){var t,r,d,c,u,N,F,P;let{currencyParams:W,idParams:R}=e,{t:en}=(0,l.i)(),el=(0,s.Z)(),eo=(0,V.Z)(el.breakpoints.down("sm")),ei=(0,o.tv)(),{getLink:es}=(0,w.m)(),{showMessage:ed}=(0,ea.useSnackbar)(),{authenticated:ec,fetchBalance:eu}=(0,b.E)(),em=(0,x.v9)(e=>e.userBalance.fiat),ep=el.palette.primary.light,[eh,ex]=(0,n.useState)([]),[ev,ey]=(0,n.useState)(void 0),[eb,ef]=(0,n.useState)(!1),[eg,ew]=(0,n.useState)(!1),[ej,eZ]=(0,n.useState)({}
1),[eS,ek]=(0,n.useState)(),[eC,eA]=(0,n.useState)(),[eI,eN]=(0,n.useState)(),[eF,eP]=(0,n.useState)(["steps.enterYourInformation","steps.withdrawStatus"]),{data:eW}=(0,z.J)("fiat","deposit"),eR="".concat("https://api.xyes.com/api/v1"+Z.Hv.wallet.getBankDetailUser,"?page=",1,"&limit=",10),{data:eO,refetch:eD}=(0,D.DU)({fetchURL:eR},ec),eM=(0,n.useMemo)(()=>eO?eO.data.filter(e=>0!==e.status):[],[eO]),{data:ez,isFetching:eE,refetch:eV}=O("fiat",null==ev?void 0:ev.symbol),{data:eB}=(0,I.SG)({all:!0}),[eq,eT]=(0,n.useState)(0),[eG,e_]=(0,n.useState)({}),eL=()=>eF.length-1,eU=()=>Object.keys(eG).length,eH=()=>eq===eL()-1,eK=()=>eU()===eL(),[eY,e$]=(0,n.useState)(null),eX=()=>{eT(eH()&&!eK()?eF.findIndex((e,t)=>!(t in eG)):eq+1)},eQ=()=>{eT(e=>e-1)},eJ=e=>()=>{(!(e>eq)||eG[eq])&&eT(e)},e0=()=>{eG[eq]=!0,e_(eG),eX()},e1=async e=>{let t="https://api.xyes.com/api/v1"+Z.Hv.wallet.createFiatWithdraw;return(await (0,Z.ZP)({method:"post",url:t,data:e})).data},{lastMessage:e2}=(0,k.dK)(),e5=(0,g.D)({mutationFn:e1,onSuccess:e=>{ew(!1),e$(e),0===eq&&e0(),eK()},onError:e=>{ed(e.message||en("errors.anErrorOccurred"),"error"),ew(!1)}}),e4=async e=>{let t=(e=>{let t={};return e&&e7&&e7.forEach(r=>{let a=e[r.label];null!=a&&(t[r.label]=a)}),t})(e.otherInformation),r=Object.entries({...(null==eS?void 0:eS.other)?{...eS.other}:{},...t}).reduce((e,t)=>{let[r,a]=t;return null!=a&&""!==a&&(e[r]=a),e},{}),a={amount:e.amount,currency:ev.symbol,bank:(null==eS?void 0:eS.bankName)||"",country:(null==eS?void 0:eS.regionCode)||"",acc:null==eS?void 0:eS.acc,otherInformation:Object.keys(r).length>0?r:void 0,bankNo:null==eS?void 0:eS.bankNo};ew(!0),e5.mutate(a)},e8=p.Ry({currency:p.Z_().required(en("validations.isRequired",{type:en("validations.currency")})),accountNumber:p.Z_().required(en("validations.isRequired",{type:en("withdraw.accountNumber")})),amount:p.Z_().required(en("validations.isRequired",{type:en("validations.amount")})),otherInformation:p.Ry().shape(null==ev?void 0:null===(t=ev.otherInformation)||void 0===t?void 0:t.reduce((e,t)=>{var r;return e[t.label]=p.Z_().required("".concat(t.customName," is required")).min(Number(null!==(r=t.min)&&void 0!==r?r:0),"".concat(t.customName," must be at least ").concat(t.min," characters")).max(Number(t.max)||1/0,"".concat(t.customName," must be at most ").concat(t.max," characters")),e},{}))}),e7=((null==ev?void 0:ev.otherInformation)||[]).map(e=>({id:e.otherId||crypto.randomUUID(),type:e.type,min:Number(e.min),max:Number(e.max),regexValue:e.regexValue||void 0,warningMessage:e.warningMessage||void 0,customName:e.customName,otherId:e.otherId||"",values:e.values||[],required:e.required||!1,label:e.label||e.customName})),e3=e7.map(e=>({...e,required:!0})),e6=(0,C.cI)({resolver:(0,j.X)(e8),reValidateMode:"onChange",defaultValues:{currency:"",amount:"",accountNumber:"",totalWithdraw:"",feeAmount:"",otherInformation:{...e3.reduce((e,t)=>({...e,[t.customName]:""}),{})}}}),{control:e9,handleSubmit:te,setValue:tt,watch:tr,clearErrors:ta,getValues:tn,reset:tl,formState:{errors:to}}=e6,ti=(0,n.useCallback)(()=>{eT(0),e_({}),tt("currency",(null==ev?void 0:ev.symbol)||"",{shouldValidate:!1}),tt("accountNumber","",{shouldValidate:!1}),eP(["steps.enterYourInformation","steps.withdrawStatus"])},[eT,e_,tt,ev,eP]);(0,n.useEffect)(()=>{(null==e2?void 0:e2.type)==="WITHDRAW_UPDATE"&&(tl(),ti(),eV())},[e2,tl,eV,ti]);let ts=async()=>{let e=tr("otherInformation");if(0===eq){var t,r;let e=tr("accountNumber"),a=Number(tr("amount"));if(""===e||a<=0){""===e&&e6.setError("accountNumber",{type:"manual",message:en("validations.isRequired",{type:en("withdraw.accountNumber")})}),a<=0&&e6.setError("amount",{type:"manual",message:en("validations.amountMustBeGreaterThanZero")});return}if(a<(ev.minAmount||5)){e6.setError("amount",{type:"manual",message:en("validations.minAmountMustBe",{min:(0,f.dN)(null!==(t=ev.minAmount)&&void 0!==t?t:0,"fiat/")||5,symbol:ev.symbol||""})});return}if(a>(ev.maxAmount||100)){e6.setError("amount",{type:"manual",message:en("validations.maxAmountMustBe",{max:(0,f.dN)(null!==(r=ev.maxAmount)&&void 0!==r?r:0,"fiat/")||100,symbol:ev.symbol||""})});return}if(a>eI){e6.setError("amount",{type:"manual",message:en("validations.amountAvailable",{available:eI,symbol:ev.symbol||""})});return}if(0===ev.otherInformation.length)e0(),await e4(tr());else{let e=tr();ev.otherInformation.every(t=>{var r;let a=null===(r=e.otherInformation)||void 0===r?void 0:r[t.label];return null!=a&&""!==a})?await e4(e):(eS&&tu(eS),e0())}}if(1===eq&&e3){if(!tn("otherInformation")){ed(en("validations.someFieldsAreRequired"),"error");return}let t=!1;e3.forEach(r=>{let a="otherInformation.".concat(r.label),n=null==e?void 0:e[r.label];if(r.required&&(null==n||"string"==typeof n&&""===n.trim()||"object"==typeof n&&0===Object.keys(n).length)){e6.setError(a,{type:"manual",message:en("validations.requiredField")}),t=!0;return}r.regexValue&&"/^.*$/"!==r.regexValue&&"string"==typeof n&&""!==n.trim()&&(new RegExp(r.regexValue.slice(1,-1)).test(n)?e6.clearErrors(a):(e6.setError(a,{type:"manual",message:r.warningMessage||en("validations.invalidFormat")}),t=!0))}),t||(e0(),e4(tr()))}},td=()=>{ef(e=>!e)},tc=e=>{eZ(t=>({...t,[e]:!0}))},tu=(0,n.useCallback)(e=>{ek(e),tt("accountNumber",(0,M.FE)(e.acc),{shouldValidate:!0}),ta("accountNumber"),ef(!1);let t=null==eB?void 0:eB.data.fiats.find(t=>t.symbol===e.currency);if(t){var r,a,n;let l=null==t?void 0:null===(r=t.supportedAccount)||void 0===r?void 0:r.find(t=>t.customName===e.accountName);if(l){eT(0),e_({});let r=(null===(n=l.other)||void 0===n?void 0:null===(a=n.filter(t=>{let r=e.other&&void 0!==e.other[t.label]&&(""===e.other[t.label]||null===e.other[t.label]),a=!e.other||void 0===e.other[t.label];return r||a}))||void 0===a?void 0:a.map(e=>({...e,required:!0})))||[];if(em&&Array.isArray(em)){let a=em.find(e=>e.symbol===t.symbol);if(a){let n={...t,...a,otherInformation:r};ey(n),eA(n),tt("currency",n.symbol,{shouldValidate:!0}),eP(n.otherInformation.length>0?["steps.enterYourInformation","steps.withdrawDetails","steps.withdrawStatus"]:["steps.enterYourInformation","steps.withdrawStatus"]),tt("otherInformation",r.reduce((t,r)=>{var a;return t[r.label]=(null===(a=e.other)||void 0===a?void 0:a[r.label])||"",t},{}),{shouldValidate:!1})}}}}},[ta,null==eB?void 0:eB.data.fiats,tt,em]),tm=[...eM||[]].map(e=>({...e,isSelectedCurrency:e.currency===(null==ev?void 0:ev.symbol)})).sort((e,t)=>
1e.isSelectedCurrency&&!t.isSelectedCurrency?-1:(e.isSelectedCurrency||t.isSelectedCurrency,1)),tp=e=>{var t,r;let a=new h.Z(ev.amount).decimalPlaces(2,h.Z.ROUND_DOWN);if(a.isNaN())return;let n=new h.Z(0);switch(e){case"Min":n=a.isGreaterThan(0)?new h.Z(null!==(t=ev.minAmount)&&void 0!==t?t:0).decimalPlaces(2,h.Z.ROUND_DOWN):new h.Z(0);break;case"25%":n=a.isGreaterThan(0)?a.multipliedBy(.25).decimalPlaces(2,h.Z.ROUND_DOWN):new h.Z(0);break;case"50%":n=a.isGreaterThan(0)?a.multipliedBy(.5).decimalPlaces(2,h.Z.ROUND_DOWN):new h.Z(0);break;case"Max":{let e=new h.Z(null!==(r=ev.lockedAmount)&&void 0!==r?r:0).decimalPlaces(2,h.Z.ROUND_DOWN);(n=a.minus(e).decimalPlaces(2,h.Z.ROUND_DOWN)).isLessThan(0)&&(n=new h.Z(0));break}default:n=new h.Z(0)}tt("amount",n.toString(),{shouldValidate:!0});let l=ev.fee||0,o=Number(new h.Z(n).multipliedBy(l));tt("feeAmount",o),tt("totalWithdraw",new h.Z(n.toString()).minus(o).toString())},th=e=>{if(""!==e){let t=new h.Z(e),r=new h.Z(ev.fee||0),a=t.multipliedBy(r),n=t.minus(a);tt("feeAmount",a.toString()),tt("totalWithdraw",n.toString())}else tt("feeAmount",""),tt("totalWithdraw","")},tx=(0,a.jsx)(B.Z,{gap:1,direction:"row",justifyContent:"flex-end",children:(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",sx:M.AK,onClick:()=>tp("Max"),children:"Max"})});return(0,n.useEffect)(()=>{let e=e=>{let t=null==eB?void 0:eB.data.fiats.find(t=>t.symbol===e.symbol);return t?{...e,amount:e.amount||"0",minAmount:t.minAmount,maxAmount:t.maxAmount,otherInformation:t.otherInformation,fee:t.fee,supportsDecimals:t.supportsDecimals}:{...e,amount:e.amount||"0"}};if(em&&Array.isArray(em)){let n=em.filter(e=>parseFloat(e.amount)>0).sort((e,t)=>parseFloat(t.amount)-parseFloat(e.amount)).map(e),l=em.filter(e=>0>=parseFloat(e.amount)).map(e),o=[...n,...l];ex(o),W&&localStorage.setItem("fiatSelected",W);let i=localStorage.getItem("fiatSelected"),s=i?o.find(e=>e.symbol===i):null,d=null;if(W?d=o.find(e=>e.symbol===W):s?d=s:n.length>0?d=n[0]:l.length>0&&(d=l[0]),d){var t,r,a;ey(d),eA(d),tt("currency",d.symbol);let e=parseFloat(d.amount),n=parseFloat(null!==(r=null==d?void 0:null===(t=d.lockedAmount)||void 0===t?void 0:t.toString())&&void 0!==r?r:"");if(Number.isNaN(e)||Number.isNaN(n)||eN(e-n),eP((null==a?void 0:a.other)&&Object.values(a.other).some(e=>""===e||null==e)?["steps.enterYourInformation","steps.withdrawDetails","steps.withdrawStatus"]:["steps.enterYourInformation","steps.withdrawStatus"]),R&&eM.length>0){let e=eM.find(e=>e.systemNo===R&&e.currency===d.symbol);e&&tu(e)}}}},[tt,em,null==eW?void 0:eW.data,null==eB?void 0:eB.data.fiats,W,R,eM,tu]),(0,a.jsx)(C.RV,{...e6,children:(0,a.jsxs)(i.Z,{sx:{mt:1},component:"form",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),te(e4)(e)},children:[(0,a.jsx)(B.Z,{width:"100%",children:(0,a.jsx)(S.u,{name:"symbol",control:e9,options:eh||[],label:en("wallet.withdrawCurrency"),getOptionLabel:e=>{var t;return"".concat(e.symbol," - ").concat((0,f.dN)(Number(null!==(t=e.amount)&&void 0!==t?t:0),"fiat/"))},isOptionEqualToValue:(e,t)=>e.symbol===(null==t?void 0:t.symbol),onChange:e=>{if(null==e?void 0:e.symbol){let t=null==em?void 0:em.find(t=>t.symbol===(null==e?void 0:e.symbol));if(t){let e=parseFloat(t.amount),r=parseFloat(t.lockedAmount.toString());Number.isNaN(e)||Number.isNaN(r)||(eA(t),eN(e-r))}ey(e),tt("currency",e.symbol,{shouldValidate:!0}),tt("amount","",{shouldValidate:!1}),e$(null),localStorage.setItem("fiatSelected",e.symbol)}ti(),tl()},showAvatar:!0,avatarKey:"logoUrl",variant:"currency",value:ev,isDisableSearch:eo,t:en,sx:{backgroundColor:v.y0.selectBG}})}),eE?(0,a.jsx)(i.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:eo?"600px":"auto"},children:(0,a.jsx)(A.AG,{})}):(0,a.jsxs)(a.Fragment,{children:[(null==ez?void 0:ez.data)&&(0,a.jsx)(er.default,{createdAt:null==ez?void 0:ez.data.createdAt,depositAmount:null==ez?void 0:ez.data.realityamount,expiryTime:0,orderId:null==ez?void 0:ez.data.billNo,currency:null==ez?void 0:ez.data.currency,method:null==ez?void 0:ez.data.type,refetch:()=>{eV(),tl(),eu(),eD()},type:"withdraw",row:null==ez?void 0:ez.data,fee:null==ez?void 0:ez.data.fee}),ev&&!(null==ez?void 0:ez.data)&&(0,a.jsxs)(i.Z,{sx:{width:"100%",mt:1},children:[(0,a.jsx)(T.Z,{nonLinear:!0,activeStep:eq,alternativeLabel:!0,children:eF.map((e,t)=>(0,a.jsx)(G.Z,{completed:eG[t],children:(0,a.jsx)(_.Z,{onClick:eJ(t),sx:{"& .MuiStepLabel-label":{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important","&.Mui-completed":{color:"primary.main"},"&.Mui-active":{color:"primary.main",fontWeight:"bold"}}},children:en(e)})},e))}),(0,a.jsx)(i.Z,{children:eK()?(0,a.jsxs)(L.Z,{sx:{bgcolor:"transparent",p:0,mt:1},children:[eg&&(0,a.jsx)(i.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:eo?"600px":"auto"},children:(0,a.jsx)(A.AG,{})}),eY&&(0,a.jsx)(er.default,{createdAt:eY.data.createdAt,depositAmount:eY.data.realityamount,expiryTime:0,currency:eY.data.currency,orderId:eY.data.billNo,method:eY.data.type,row:eY.data,fee:eY.data.fee,refetch:()=>{e$(null),ti(),tl(),eV()},type:"withdraw"})]}):(0,a.jsxs)(L.Z,{sx:{bgcolor:"transparent",p:0,mt:1},children:[0===eq&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{children:(0,a.jsx)(C.Qr,{name:"accountNumber",control:e9,render:e=>{var t;let{field:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},color:"text.secondary",id:"AccountNumber",children:en("withdraw.accountNumber")}),(0,a.jsx)(U.Z,{...r,fullWidth:!0,label:"",id:"AccountNumber",disabled:!0,placeholder:en("withdraw.enterYourBankWalletAccountNumber"),error:!!to.accountNumber,helperText:null===(t=to.accountNumber)||void 0===t?void 0:t.message,sx:{mb:1,"& .MuiInputBase-input::placeholder":{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"}},InputProps:{startAdornment:(0,a.jsx)(H.Z,{position:"start",className:"custom-disabled-icon",children:(0,a.jsx)(y.Z,{icon:"solar:card-linear",sx:{color:"primary.main"}})}),endAdornment:(0,a.jsx)(H.Z,{position:"end",children:eM&&eM.length>0?(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",className:"custom-btn",onClick:()=>td(),sx:{minWidth:"auto",width:{xs:35,sm:35,md:45},height:{xs:25,sm:25,md:30},fontSize:"0.875rem"},children:(0,a.jsx)(y.Z,{icon:"solar:book-bookmark-linear"})}):(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",className:"custom-btn",onClick:()=>{ei.replace(es("account-management/payment-address"))},sx:{minWidth:"auto",width:{xs:35,sm:35,md:45},height:{xs:25,sm:25,md:30},fontSize:"0.875rem"},children:(0,a.jsx)(y.Z,{icon:"icons8:plus"})})})}})]})}})}),(0,a.jsx)(a.Fragment,{children:eb&&(0,a.jsx)(K.d,{onClickAway:()=>ef(!1),children:(0,a.jsx)(L.Z,{sx:{background:v.y0.header,border:"2px s
1olid #1a4151",borderRadius:1,mb:2},children:(0,a.jsx)(i.Z,{sx:{maxHeight:210,overflowY:"auto","&::-webkit-scrollbar":{width:"2px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#888",borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:"#555"}},children:(0,a.jsxs)(Y.Z,{sx:{width:eo?"fit-content":"100%",borderRadius:2,p:0},children:[null==tm?void 0:tm.map((e,t)=>{var r,n,l;return(0,a.jsxs)($.ZP,{onClick:()=>e.isSelectedCurrency&&tu(e),sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2,p:{xs:1,sm:1,md:2},cursor:"pointer","&:hover":{bgcolor:"rgba(255, 255, 255, 0.05)"},borderBottom:"1px solid rgba(255, 255, 255, 0.05)","&:last-child":{borderBottom:"none"},opacity:e.isSelectedCurrency?1:.5,bgcolor:e.isSelectedCurrency?"transparent":"rgba(255, 255, 255, 0.1)"},children:[(0,a.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",width:40,height:40,borderRadius:1,bgcolor:"rgba(255, 255, 255, 0.05)"},children:(0,a.jsx)(X.Z,{alt:null==e?void 0:e.currency,src:ej[null!==(l=null==e?void 0:e.currency)&&void 0!==l?l:"default"]?"".concat("https://img.xyes.com/","assets/fallback-2.png"):Array.isArray(em)&&(null===(r=em.find(t=>t.symbol===(null==e?void 0:e.currency)))||void 0===r?void 0:r.logoUrl)||void 0,sx:{height:25,width:25},onError:()=>{var t;return tc(null!==(t=null==e?void 0:e.currency)&&void 0!==t?t:"default")}})}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1,maxWidth:{xs:"80px",sm:"80px",md:"200px"}},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",display:"block",mb:.5},children:en("wallet.table.bankName")}),(0,a.jsx)(m.Z,{variant:"body1",sx:{color:"#fff"},children:e.bankName})]}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",display:"block",mb:.5},children:en("wallet.table.cardNumber")}),(0,a.jsx)(m.Z,{variant:"body2",sx:{color:"#fff"},children:(0,M.FE)(e.acc)})]}),(0,a.jsxs)(i.Z,{sx:{flexGrow:0,textAlign:"center"},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",fontSize:"0.75rem"},children:en("wallet.table.cardHolderName")}),(0,a.jsx)(m.Z,{variant:"body2",sx:{color:"#fff"},children:(null==e?void 0:null===(n=e.other)||void 0===n?void 0:n.name)||"-"})]}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1,textAlign:"center"},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",fontSize:"0.75rem"},children:en("wallet.table.remark")}),(0,a.jsx)(m.Z,{variant:"body2",sx:{color:"#fff"},children:e.control.remark||"-"})]})]},t)}),(0,a.jsx)(B.Z,{p:2,children:(0,a.jsxs)(q.Z,{fullWidth:!0,variant:"headerSecondary",className:"custom-btn",onClick:()=>{ei.replace(es("account-management/payment-address"))},sx:{minWidth:"auto",fontSize:"0.875rem",border:"1px solid #fe7801"},children:[(0,a.jsx)(m.Z,{children:en("actions.addCard")}),(0,a.jsx)(y.Z,{icon:"icons8:plus"})]})})]})})})})}),(0,a.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:"".concat(en("withdraw.withdrawAmount")," ").concat((F=null==ev?void 0:ev.minAmount,P=null==ev?void 0:ev.maxAmount,void 0===F||void 0===P?"Invalid range":"".concat((0,f.dN)(F,"/fiat")," ~ ").concat((0,f.dN)(P,"/fiat")))," ").concat(ev.symbol)}),(0,a.jsx)(U.Z,{name:"amount",label:"",type:"number",fullWidth:!0,sx:{mb:2},error:!!to.amount,helperText:null===(r=to.amount)||void 0===r?void 0:r.message,onChange:e=>{let{value:t}=e.target;ev.supportsDecimals&&(""===t||/^\d*\.?\d{0,2}$/.test(t))&&(tt("amount",t,{shouldValidate:!0}),th(t)),(""===t||/^[0-9]+$/.test(t))&&(tt("amount",t,{shouldValidate:!0}),th(t))},value:tn("amount"),required:!0,InputProps:{inputProps:{min:Number((null==ev?void 0:ev.minAmount)||0),max:Number((null==ev?void 0:ev.maxAmount)||0),pattern:ev.supportsDecimals?"^\\d*(\\.\\d{0,2})?$":"^\\d*$"},startAdornment:(0,a.jsx)(H.Z,{position:"start",children:(0,a.jsx)(y.Z,{icon:"solar:dollar-linear",color:ep})}),endAdornment:(0,a.jsx)(H.Z,{position:"end",children:tx})}}),(0,a.jsxs)(i.Z,{sx:{borderBottom:2,borderColor:"divider",mb:1,pb:.5},children:[(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",whiteSpace:"nowrap"},children:[en("wallet.available"),":"]}),(0,a.jsxs)(m.Z,{sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",fontWeight:600,color:"#fff",textAlign:"right"},children:[Number(eI)>=0?(0,f.dN)(null!=eI?eI:0,"fiat/"):0," ",null==eC?void 0:eC.symbol]})]}),(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",color:"primary.main",fontWeight:"bold",textDecoration:"underline",whiteSpace:"nowrap"},children:[en("wallet.lockedFunds"),":"]}),(0,a.jsxs)(m.Z,{sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",fontWeight:600,color:"#fff",textAlign:"right"},children:[Number(null==eC?void 0:eC.lockedAmount)>Number(null==eC?void 0:eC.amount)?(0,f.dN)(null!==(d=null==eC?void 0:eC.amount)&&void 0!==d?d:0,"fiat/"):(0,f.dN)(null!==(c=null==eC?void 0:eC.lockedAmount)&&void 0!==c?c:0,"fiat/")," ",null==eC?void 0:eC.symbol]})]}),(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",color:"text.secondary",fontWeight:"bold",whiteSpace:"nowrap"},children:[en("wallet.wagerRequirements"),":"]}),(0,a.jsxs)(m.Z,{sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem)",color:"#fff",textAlign:"right"},children:[(0,f.dN)(null!==(u=null==eC?void 0:eC.lockedAmount)&&void 0!==u?u:0,"fiat/")," ",null==eC?void 0:eC.symbol]})]}),(0,a.jsx)(Q.Z,{severity:"info",sx:{my:1,padding:0,px:2},children:(0,a.jsx)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:en("wallet.someGamesMayExperienceSettlementDelays")})})]}),(0,a.jsx)(L.Z,{sx:{pb:2,background:"transparent",border:"none"},children:(0,a.jsxs)(J.ZP,{spacing:1,alignItems:"center",sx:{p:0,background:"transparent"},children:[(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsxs)(m.Z,{component:"span",sx:{color:"primary.main",fontWeight:"bold",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[en("wallet.withdrawAmount")," "," "]}),(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",color:"primary.main",fontWeight:"bold",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"}
1,variant:"h6",children:[Number(tr("amount")).toLocaleString("en-US")," ",ev.symbol]})]})}),(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsxs)(m.Z,{component:"span",sx:{color:el.palette.grey[400],fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[en("wallet.fee")," (",100*Number(null!==(N=ev.fee)&&void 0!==N?N:0),"%"," ",ev.symbol,")"]}),(0,a.jsx)(B.Z,{direction:{xs:"column",sm:"row"},children:(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},variant:"h6",children:["â ",Number(tr("feeAmount")).toLocaleString("en-US")," ",ev.symbol]})})]})}),(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsxs)(m.Z,{component:"span",sx:{color:el.palette.grey[400],fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[en("wallet.actuallyReceivedAmount")," "]}),(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:0===Number(tn("totalWithdraw"))?"#fff":Number(tn("totalWithdraw"))>0?"#008000":"#ff0000"},variant:"h6",children:["â ",Number(tr("totalWithdraw")).toLocaleString("en-US")," ",ev.symbol]})]})})]})})]}),1===eq&&e7.length>0&&(0,a.jsx)(J.ZP,{container:!0,mt:2,spacing:eo?0:1,children:e7.map((e,t)=>{var r,n,l,o,s,d,c,u,m,p,h,x,v,y,b,f,g,w,j,Z;let S="otherInformation.".concat(e.label);return e.values&&Array.isArray(e.values)&&e.values.length>0?(0,a.jsx)(J.ZP,{item:!0,xs:12,sm:e7.length%2!=0&&t===e7.length-1?12:6,children:(0,a.jsx)(i.Z,{sx:{width:"100%"},children:(0,a.jsx)(U.Z,{select:!0,fullWidth:!0,name:S,label:en(e.customName),value:(null===(h=e6.getValues("otherInformation"))||void 0===h?void 0:h[e.label])||"",onChange:t=>{let r={...e6.getValues("otherInformation")||{},[e.label]:t.target.value};e6.clearErrors(S),e6.setValue("otherInformation",r,{shouldValidate:!0,shouldDirty:!0})},error:!!(null===(v=e6.formState.errors)||void 0===v?void 0:null===(x=v.otherInformation)||void 0===x?void 0:x[e.label]),helperText:(null===(f=e6.formState.errors)||void 0===f?void 0:null===(b=f.otherInformation)||void 0===b?void 0:null===(y=b[e.label])||void 0===y?void 0:y.message)||en(e.warningMessage),InputLabelProps:{shrink:!0,sx:{color:"#fff !important",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"}},sx:{"& .MuiOutlinedInput-root":{border:(null===(w=e6.formState.errors)||void 0===w?void 0:null===(g=w.otherInformation)||void 0===g?void 0:g[e.label])?"none":"2px solid",borderColor:(0,ee.Fq)(el.palette.grey[500],.32),borderRadius:"8px"}},FormHelperTextProps:{sx:{color:(null===(Z=e6.formState.errors)||void 0===Z?void 0:null===(j=Z.otherInformation)||void 0===j?void 0:j[e.label])?"error.main":"text.secondary",marginLeft:0,fontSize:eo?"10px":"14px"}},children:e.values.map(e=>(0,a.jsx)(et.Z,{value:e.value,children:en(e.key)},e.value))})})},t):(0,a.jsx)(J.ZP,{item:!0,xs:12,sm:e7.length%2!=0&&t===e7.length-1?12:6,children:(0,a.jsx)(i.Z,{sx:{width:"100%"},children:(0,a.jsx)(U.Z,{name:S,label:en(e.customName),type:(0,M.kv)(e.type),value:(null===(r=e6.getValues("otherInformation"))||void 0===r?void 0:r[e.label])||"",error:!!(null===(l=e6.formState.errors)||void 0===l?void 0:null===(n=l.otherInformation)||void 0===n?void 0:n[e.label]),helperText:null===(d=e6.formState.errors)||void 0===d?void 0:null===(s=d.otherInformation)||void 0===s?void 0:null===(o=s[e.label])||void 0===o?void 0:o.message,placeholder:en(e.warningMessage),onChange:t=>{let r={...e6.getValues("otherInformation")||{},[e.label]:t.target.value};e.regexValue&&!new RegExp(e.regexValue).test(t.target.value)?e6.setError(S,{type:"manual",message:en(e.warningMessage)}):e6.clearErrors(S),e6.setValue("otherInformation",r,{shouldValidate:!0,shouldDirty:!0})},InputLabelProps:{shrink:!0,sx:{color:"#fff !important",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"}},inputProps:{min:e.min,max:e.max,pattern:e.regexValue},fullWidth:!0,sx:{"& .MuiOutlinedInput-root":{border:(null===(u=e6.formState.errors)||void 0===u?void 0:null===(c=u.otherInformation)||void 0===c?void 0:c[e.label])?"none":"2px s
1olid",borderColor:(0,ee.Fq)(el.palette.grey[500],.32),borderRadius:"8px"}},FormHelperTextProps:{sx:{color:(null===(p=e6.formState.errors)||void 0===p?void 0:null===(m=p.otherInformation)||void 0===m?void 0:m[e.label])?"error.main":"text.secondary",marginLeft:0,fontSize:eo?"10px":"14px"}}})})},t)})}),(0,a.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"row",py:1,gap:2},children:[0!==eq&&(0,a.jsx)(q.Z,{color:"inherit",variant:"outlinedSecondary",disabled:0===eq,onClick:()=>{eQ()},sx:{mr:1},children:en("actions.back")}),(0,a.jsx)(i.Z,{sx:{flex:"1 1 auto"}}),(0,a.jsx)(E.Z,{onClick:()=>ts(),sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},variant:2===eF.length||eq>=1?"header":"headerSecondary",disabled:eg,children:en(2===eF.length?"actions.submit":eq?"actions.submit":"actions.next")})]})]})})]})]})]})})}var el=r(43577),eo=r(4074),ei=r(73053),es=r(33833),ed=r(69459);function ec(){var e,t,r,d,c,u;let{t:k}=(0,l.i)(),I=(0,s.Z)(),N=(0,V.Z)(I.breakpoints.down("sm")),F=(0,o.tv)(),{getLink:P}=(0,w.m)(),{showMessage:z}=(0,ea.useSnackbar)(),{authenticated:ee,fetchBalance:en}=(0,b.E)(),ec="".concat("https://api.xyes.com/api/v1"+Z.Hv.wallet.getCryptoWalletUser,"?page=",1,"&limit=",10),{data:eu,refetch:em}=(0,D.BQ)({fetchURL:ec},ee),ep=(0,x.v9)(e=>e.userBalance.crypto),eh=I.palette.primary.light,[ex,ev]=(0,n.use
1State)(void 0),[ey,eb]=(0,n.useState)(!1),[ef,eg]=(0,n.useState)(!1),[ew,ej]=(0,n.useState)({}),[eZ,eS]=(0,n.useState)(),[ek,eC]=(0,n.useState)(),[eA,eI]=(0,n.useState)([]),[eN]=(0,n.useState)(["steps.enterYourInformation","steps.withdrawStatus"]),[eF,eP]=(0,n.useState)(null),{data:eW}=W(ex),{data:eR,refetch:eO,isFetching:eD}=R(null==ex?void 0:ex.symbol,null==eF?void 0:eF.chain),{data:eM,isFetching:ez,refetch:eE}=O("crypto",null==ex?void 0:ex.symbol),[eV,eB]=(0,n.useState)((null==eR?void 0:eR.fee.amount)||""),[eq,eT]=(0,n.useState)(0),[eG,e_]=(0,n.useState)({}),eL=()=>eN.length-1,eU=()=>Object.keys(eG).length,eH=()=>eq===eL()-1,eK=()=>eU()===eL(),[eY,e$]=(0,n.useState)(null),eX=()=>{eT(eH()&&!eK()?eN.findIndex((e,t)=>!(t in eG)):eq+1)},eQ=e=>()=>{(!(e>eq)||eG[eq])&&eT(e)},eJ=()=>{eG[eq]=!0,e_(eG),eX()},e0=()=>{eT(0),e_({})},e1=async e=>{let t="https://api.xyes.com/api/v1"+Z.Hv.wallet.createCryptoWithdraw;return(await (0,Z.ZP)({method:"post",url:t,data:e})).data},e2=(0,g.D)({mutationFn:e1,onSuccess:e=>{eg(!1),e$(e),en(),eJ(),eE(),em()},onError:e=>{if(eg(!1),e instanceof el.d7){var t,r;z((null===(r=e.response)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.message)||e.message,"error")}else"Invalid crypto address"===e.message?e8.setError("withdrawAddress",{type:"manual",message:k("validators.invalidCryptoAddress")}):z(e.message||k("errors.anErrorOccurred"),"error")}}),e5=async e=>{let t={amount:e.amount,coinId:ex.coinId,address:e.withdrawAddress,chain:eF.chain,fee:eV};e2.mutate(t)},e4=p.Ry({currency:p.Z_().required(k("validations.isRequired",{type:k("validations.currency")})),network:p.Z_().required(k("validations.isRequired",{type:k("validations.network")})),withdrawAddress:p.Z_().required(k("validations.isRequired",{type:k("wallet.withdrawAddress")})).test("is-valid-address",k("validators.invalidCryptoAddress"),function(e){let{currency:t,network:r}=this.parent,a=(0,M.GB)(r);if("NEAR"===t||"near protocol"===a)return!!/^[a-z0-9._-]{2,64}$/.test(e)||this.createError({message:k("validators.invalidCryptoAddress")});try{return(0,eo.validate)(e,t,{chainType:a})}catch(e){return this.createError({message:k("validators.invalidCryptoAddress")})}}),amount:p.Z_().required(k("validations.isRequired",{type:k("validations.amount")}))}),e8=(0,C.cI)({resolver:(0,j.X)(e4),reValidateMode:"onChange",defaultValues:{currency:"",network:"",amount:"",withdrawAddress:"",totalWithdraw:"",feeAmount:""}}),{control:e7,handleSubmit:e3,setValue:e6,watch:e9,clearErrors:te,getValues:tt,reset:tr,trigger:ta,formState:{errors:tn}}=e8,tl=()=>{eb(e=>!e)},to=e=>{ej(t=>({...t,[e]:!0}))},ti=e=>{eP(null==eW?void 0:eW.data.find(t=>t.chain===e.network)),e6("withdrawAddress",e.address,{shouldValidate:!0}),e6("network",e.network,{shouldValidate:!0}),e6("currency",e.currency,{shouldValidate:!0}),ta("withdrawAddress"),ta("feeAmount"),te("withdrawAddress"),eb(!1)},ts=async()=>{if(0===eq){let e,t,r,a;let n=e9("withdrawAddress"),l=e9("network"),o=Number(e9("amount")),i=Number(e9("totalWithdraw")),s=(e,t)=>{e8.setError(e,{type:"manual",message:t})},d=(e,t,r)=>!!e||(s(t,k("validations.isRequired",{type:k(r)})),!1);if(e=!0,d(l,"network","withdraw.network")||(e=!1),d(eF,"network","withdraw.network")||(e=!1),t=!0,!n&&o<=0&&(s("withdrawAddress",k("validations.isRequired",{type:k("wallet.withdrawAddress")})),s("amount",k("validations.amountMustBeGreaterThanZero")),t=!1),t||(e=!1),r=(null==eF?void 0:eF.minimumWithdrawAmount)||1,a=(null==ex?void 0:ex.symbol)||"",!(o<r)||(s("amount",k("validations.minAmountMustBe",{min:(0,f.dN)(r,"crypto/"),symbol:a})),0)||(e=!1),!(i<0)||(s("amount",k("validations.amountCantBeNegative")),0)||(e=!1),!(i<Number(eV))||(s("amount",k("validations.theAmountCannotBeLessThanFee")),0)||(e=!1),e){if(o>ek){e8.setError("amount",{type:"manual",message:k("validations.amountAvailable",{available:ek,symbol:(null==ex?void 0:ex.symbol)||""})});return}ex&&e5(e9())}}},td=[...(null==eu?void 0:eu.data)||[]].map(e=>({...e,isSelectedCurrency:e.currency===(null==ex?void 0:ex.symbol)})).sort((e,t)=>e.isSelectedCurrency&&!t.isSelectedCurrency?-1:(e.isSelectedCurrency||t.isSelectedCurrency,1)),tc=e=>{let t=null==ep?void 0:ep.find(e=>e.symbol===tt("currency"));if(!t)return;let r=new h.Z((null==t?void 0:t.available)||0).decimalPlaces(6,h.Z.ROUND_DOWN);if(r.isNaN())return;let a=new h.Z(0);switch(e){case"Min":var n;a=r.isGreaterThan(0)?new h.Z(null!==(n=null==eF?void 0:eF.minimumWithdrawAmount)&&void 0!==n?n:0).decimalPlaces(6,h.Z.ROUND_DOWN):new h.Z(0);break;case"25%":a=r.isGreaterThan(0)?r.multipliedBy(.25).decimalPlaces(6,h.Z.ROUND_DOWN):new h.Z(0);break;case"50%":a=r.isGreaterThan(0)?r.multipliedBy(.5).decimalPlaces(6,h.Z.ROUND_DOWN):new h.Z(0);break;case"Max":(a=new h.Z((null==t?void 0:t.available)||0).decimalPlaces(6,h.Z.ROUND_DOWN)).isLessThan(0)&&(a=new h.Z(0));break;default:a=new h.Z(0)}let l=(null==eR?void 0:eR.fee.amount)||0,o=(0,h.Z)(a).minus(l).decimalPlaces(6,h.Z.ROUND_DOWN).toString();e6("amount",a.toString(),{shouldValidate:!0}),e6("feeAmount",l),e6("totalWithdraw",o)};(0,n.useEffect)(()=>
1{if(ep&&Array.isArray(ep)){let e=ep.filter(e=>parseFloat(e.amount)>0).sort((e,t)=>parseFloat(t.amount)-parseFloat(e.amount)),t=ep.filter(e=>0>=parseFloat(e.amount));eI([...e,...t]);let r=e=>{var t,r;ev(e),eS(e),e6("currency",e.symbol),eB("0"),eP(null),e6("network",""),e6("feeAmount",""),e6("totalWithdraw","");let a=parseFloat(e.amount),n=parseFloat(null!==(r=null==e?void 0:null===(t=e.lockedAmount)||void 0===t?void 0:t.toString())&&void 0!==r?r:"");Number.isNaN(a)||Number.isNaN(n)?eC(0):eC(e.available)};if(e.length>0){let t=localStorage.getItem("cryptoSelected");if(t){let a=e.find(e=>e.symbol===t);a&&r(a)}else r(e[0])}else t.length>0&&r(t[0])}},[e6,ep]),(0,n.useEffect)(()=>{let e=!0;return(null==ex?void 0:ex.symbol)&&(null==eF?void 0:eF.chain)&&eO().then(t=>{var r;let{data:a}=t;if(e&&(null==a?void 0:null===(r=a.fee)||void 0===r?void 0:r.amount)){let e=a.fee.amount;eB(e),e6("feeAmount",e);let t=tt("amount");t&&e6("totalWithdraw",(0,h.Z)(t||0).minus(e).decimalPlaces(6,h.Z.ROUND_DOWN).toString())}}),()=>{e=!1}},[null==ex?void 0:ex.symbol,null==eF?void 0:eF.chain,eO,e6,tt]),(0,n.useEffect)(()=>{(null==eR?void 0:eR.fee.amount)&&eB(null==eR?void 0:eR.fee.amount)},[null==eR?void 0:eR.fee.amount]);let tu=(0,a.jsx)(i.Z,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,a.jsx)(ei.Z,{size:10})}),tm=(0,a.jsx)(B.Z,{gap:1,direction:"row",justifyContent:"flex-end",children:(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",sx:M.AK,onClick:()=>tc("Max"),children:"Max"})});return(0,a.jsx)(C.RV,{...e8,children:(0,a.jsxs)(i.Z,{sx:{mt:1},component:"form",onSubmit:e=>{e.preventDefault(),e.stopPropagation(),e3(e5)(e)},children:[(0,a.jsx)(B.Z,{width:"100%",children:(0,a.jsx)(S.u,{name:"symbol",control:e7,options:eA||[],label:k("wallet.withdrawCurrency"),getOptionLabel:e=>{var t;return"".concat(e.symbol," - ").concat((0,f.dN)(Number(null!==(t=e.amount)&&void 0!==t?t:0),"crypto/"))},isDisableSearch:N,isOptionEqualToValue:(e,t)=>e.symbol===(null==t?void 0:t.symbol),onChange:e=>{if(eP(null),eB("0"),null==e?void 0:e.symbol){let a=null==ep?void 0:ep.find(t=>t.symbol===(null==e?void 0:e.symbol));if(a){var t,r;let n=parseFloat(a.amount),l=parseFloat(null!==(r=null==a?void 0:null===(t=a.lockedAmount)||void 0===t?void 0:t.toString())&&void 0!==r?r:"");Number.isNaN(n)||Number.isNaN(l)||(eS(a),eC(n-l),e6("withdrawAddress","",{shouldValidate:!1})),localStorage.setItem("cryptoSelected",e.symbol)}ev(e),e6("currency",e.symbol),te(),eE()}e0(),e6("totalWithdraw","",{shouldValidate:!1}),e6("network","",{shouldValidate:!1}),e6("amount","",{shouldValidate:!1}),e6("feeAmount","",{shouldValidate:!1})},showAvatar:!0,avatarKey:"cryptoIcon",variant:"currency",value:ex,t:k,sx:{backgroundColor:v.y0.selectBG}})}),ez?(0,a.jsx)(i.Z,{sx:{width:"100%",mx:"auto",textAlign:"center",p:10,height:N?"600px":"auto"},children:(0,a.jsx)(A.AG,{})}):(0,a.jsxs)(a.Fragment,{children:[(null==eM?void 0:eM.data)&&(0,a.jsx)(er.default,{createdAt:null==eM?void 0:eM.data.createdAt,depositAmount:null==eM?void 0:eM.data.amount,totalAmount:null==eM?void 0:eM.data.realityamount,expiryTime:0,currency:null==eM?void 0:eM.data.currency,orderId:null==eM?void 0:eM.data.billNo,method:null==eM?void 0:eM.data.type,row:null==eM?void 0:eM.data,fee:null==eM?void 0:eM.data.fee,refetch:()=>{tr(),e0(),em(),eE()},type:"withdraw"}),ex&&!(null==eM?void 0:eM.data)&&(0,a.jsxs)(i.Z,{sx:{width:"100%",mt:1},children:[(0,a.jsx)(T.Z,{nonLinear:!0,activeStep:eq,alternativeLabel:!0,children:eN.map((e,t)=>(0,a.jsx)(G.Z,{completed:eG[t],children:(0,a.jsx)(_.Z,{onClick:eQ(t),sx:{"& .MuiStepLabel-label":{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important","&.Mui-completed":{color:"primary.main"},"&.Mui-active":{color:"primary.main",fontWeight:"bold"}}},children:k(e)})},e))}),(0,a.jsx)(i.Z,{children:eK()?(0,a.jsx)(L.Z,{sx:{bgcolor:"transparent",p:0,mt:1},children:eY&&(0,a.jsx)(er.default,{createdAt:eY.createdAt,depositAmount:eY.amount,totalAmount:eY.realityamount,expiryTime:0,currency:eY.currency,orderId:eY.generated.systemNo,method:eY.type,row:eY,fee:eY.fee,refetch:()=>{e$(null),tr(),e0(),eE()},type:"withdraw"})}):(0,a.jsxs)(L.Z,{sx:{bgcolor:"transparent",p:0,mt:1},children:[0===eq&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{children:(0,a.jsx)(C.Qr,{name:"withdrawAddress",control:e7,render:e=>{var t;let{field:r}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},color:"text.secondary",id:"AccountNumber",children:k("wallet.withdrawAddress")}),(0,a.jsx)(U.Z,{...r,fullWidth:!0,label:"",id:"AccountNumber",placeholder:k("wallet.fillInCarefullyAccording"),error:!!tn.withdrawAddress,helperText:null===(t=tn.withdrawAddress)||void 0===t?void 0:t.message,onChange:e=>{r.onChange(e.target.value),e6("withdrawAddress",e.target.value,{shouldValidate:!0})},sx:{mb:1,"& .MuiInputBase-input::placeholder":{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"}},InputProps:{startAdornment:(0,a.jsx)(H.Z,{position:"start",className:"custom-disabled-icon",children:(0,a.jsx)(y.Z,{icon:"solar:card-linear",sx:{color:"primary.main"}})}),endAdornment:(0,a.jsx)(H.Z,{position:"end",children:eu&&(null==eu?void 0:eu.data.length)>0?(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",onClick:()=>tl(),sx:{minWidth:"auto",width:{xs:35,sm:35,md:45},height:{xs:25,sm:25,md:30},fontSize:"0.875rem"},children:(0,a.jsx)(y.Z,{icon:"solar:book-bookmark-linear"})}):(0,a.jsx)(q.Z,{size:"small",variant:"headerSecondary",onClick:()=>{F.replace(P("account-management/payment-address"))},sx:{minWidth:"auto",width:{xs:35,sm:35,md:45},height:{xs:25,sm:25,md:30},fontSize:"0.875rem"},children:(0,a.jsx)(y.Z,{icon:"icons8:plus"})})})}})]})}})}),(0,a.jsx)(a.Fragment,{children:ey&&(0,a.jsx)(K.d,{onClickAway:()=>eb(!1),children:(0,a.jsx)(L.Z,{sx:{background:v.y0.header,border:"2px s
1olid #1a4151",borderRadius:1,mb:2},children:(0,a.jsx)(i.Z,{sx:{maxHeight:210,overflowY:"auto","&::-webkit-scrollbar":{width:"2px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"#888",borderRadius:"4px"},"&::-webkit-scrollbar-thumb:hover":{background:"#555"}},children:(0,a.jsxs)(Y.Z,{sx:{width:N?"fit-content":"100%",borderRadius:2,p:0},children:[null==td?void 0:td.map((e,t)=>{var r,n;return(0,a.jsxs)($.ZP,{onClick:()=>e.isSelectedCurrency&&ti(e),sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2,p:{xs:1,sm:1,md:2},cursor:"pointer","&:hover":{bgcolor:"rgba(255, 255, 255, 0.05)"},borderBottom:"1px solid rgba(255, 255, 255, 0.05)","&:last-child":{borderBottom:"none"},opacity:e.isSelectedCurrency?1:.5,bgcolor:e.isSelectedCurrency?"transparent":"rgba(255, 255, 255, 0.1)"},children:[(0,a.jsxs)(i.Z,{sx:{display:"flex",gap:2,alignItems:"center"},children:[(0,a.jsx)(i.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center",height:40,borderRadius:1,bgcolor:"rgba(255, 255, 255, 0.05)"},children:(0,a.jsx)(X.Z,{alt:null==e?void 0:e.currency,src:ew[null!==(n=null==e?void 0:e.currency)&&void 0!==n?n:"default"]?"".concat("https://img.xyes.com/","assets/fallback-2.png"):Array.isArray(ep)&&(null===(r=ep.find(t=>t.symbol===(null==e?void 0:e.currency)))||void 0===r?void 0:r.cryptoIcon)||void 0,sx:{height:25,width:25},onError:()=>{var t;return to(null!==(t=null==e?void 0:e.currency)&&void 0!==t?t:"default")}})}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1,maxWidth:{xs:"80px",sm:"80px",md:"200px"}},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",display:"block",mb:.5},children:k("wallet.table.currency")}),(0,a.jsx)(m.Z,{variant:"body1",sx:{color:"#fff"},children:e.currency})]}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1,maxWidth:{xs:"80px",sm:"80px",md:"200px"}},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",display:"block",mb:.5},children:k("wallet.table.network")}),(0,a.jsx)(m.Z,{variant:"body1",sx:{color:"#fff"},children:e.network})]})]}),(0,a.jsxs)(i.Z,{sx:{flexGrow:1,textAlign:"right"},children:[(0,a.jsx)(m.Z,{variant:"caption",sx:{color:"rgba(255, 255, 255, 0.5)",display:"block",mb:.5},children:k("wallet.table.address")}),(0,a.jsx)(m.Z,{variant:"body2",sx:{color:"#fff"},children:e.address})]})]},t)}),(0,a.jsx)(B.Z,{p:2,children:(0,a.jsxs)(q.Z,{fullWidth:!0,variant:"headerSecondary",onClick:()=>{F.replace(P("account-management/payment-address"))},sx:{minWidth:"auto",fontSize:"0.875rem",border:"1px solid #fe7801"},children:[(0,a.jsx)(m.Z,{children:k("actions.addWallet")}),(0,a.jsx)(y.Z,{icon:"icons8:plus"})]})})]})})})})}),(0,a.jsx)(C.Qr,{name:"network",control:e7,render:e=>{var t;let{field:r}=e;return(0,a.jsxs)(i.Z,{sx:{mb:1},children:[(0,a.jsx)(m.Z,{variant:"body2",color:"text.secondary",id:"network-label",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:k("wallet.chooseNetwork")}),(0,a.jsx)(es.Z,{...r,fullWidth:!0,labelId:"network-label",id:"network-select",value:e9("network"),error:!!tn.network,onChange:e=>{r.onChange(e.target.value);let t=null==eW?void 0:eW.data.find(t=>t.chain===e.target.value);eP(t),e6("network",null==t?void 0:t.chain,{shouldValidate:!0}),ta("withdrawAddress"),e6("feeAmount",""),e6("totalWithdraw","")},renderValue:e=>{var t;return e?(0,a.jsx)(B.Z,{direction:"row",spacing:0,children:null==eW?void 0:null===(t=eW.data.find(t=>t.chain===e))||void 0===t?void 0:t.chainFullName}):(0,a.jsx)(m.Z,{children:k("wallet.chooseNetwork")})},children:null==eW?void 0:null===(t=eW.data)||void 0===t?void 0:t.map(e=>(0,a.jsx)(et.Z,{value:e.chain,children:e.chainFullName},e._id))}),(0,a.jsx)(ed.Z,{sx:{color:"#ba3619"},children:tn.network?k("validators.networkIsRequired"):""})]})}}),(0,a.jsx)(m.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:"".concat(k("withdraw.withdrawAmount")," ")}),(0,a.jsx)(U.Z,{name:"amount",label:"",type:"number",fullWidth:!0,sx:{mb:1},error:!!tn.amount,helperText:null===(e=tn.amount)||void 0===e?void 0:e.message,onChange:e=>{if(e6("amount",e.target.value,{shouldValidate:!0}),""!==e.target.value){let t=parseFloat(e.target.value);e6("totalWithdraw",(0,h.Z)(t).minus(eV).decimalPlaces(6,h.Z.ROUND_DOWN).toString())}else e6("totalWithdraw","");e6("feeAmount",(0,f.dN)(Number(eV),"crypto/"))},value:tt("amount"),required:!0,InputProps:{inputProps:{min:Number((null==eF?void 0:eF.minimumDepositAmount)||0),max:Number((null==eF?void 0:eF.maximumWithdrawAmount)||0),pattern:"^\\d*(\\.\\d{0,2})?$"},startAdornment:(0,a.jsx)(H.Z,{position:"start",children:(0,a.jsx)(y.Z,{icon:"solar:dollar-linear",color:eh})}),endAdornment:(0,a.jsx)(H.Z,{position:"end",children:tm})}}),(0,a.jsxs)(i.Z,{sx:{borderBottom:2,borderColor:"divider",mb:1,pb:.5},children:[(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",gap:.5,alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",color:"text.secondary",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[k("wallet.available"),":"]}),(0,a.jsxs)(m.Z,{variant:"h6",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",fontWeight:"bold",color:"#fff"},children:[Number(ek)>=0?(0,f.dN)(null!=ek?ek:0,"crypto/"):0," ",null==eZ?void 0:eZ.symbol]})]}),(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",gap:.5,alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:"primary.main",fontWeight:"bold",textDecoration:"underline"},children:[k("wallet.lockedFunds"),":"]}),(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:"#fff",fontWeight:"bold"},children:[Number(null==eZ?void 0:eZ.lockedAmount)>Number(null==eZ?void 0:eZ.amount)?(0,f.dN)(null!==(t=null==eZ?void 0:eZ.amount)&&void 0!==t?t:0,"crypto/"):(0,f.dN)(null!==(r=null==eZ?void 0:eZ.lockedAmount)&&void 0!==r?r:0,"crypto/")," ",null==eZ?void 0:eZ.symbol]})]}),(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",gap:.5,alignItems:"baseline",children:[(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:"text.secondary",fontWeight:"bold"},children:[k("wallet.wagerRequirements"),":"]}),(0,a.jsxs)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:"#fff"},children:[(0,f.dN)(null!==(d=null==eZ?void 0:eZ.lockedAmount)&&void 0!==d?d:0,"crypto/")," ",null==eZ?void 0:eZ.symbol]})]}),(0,a.jsx)(Q.Z,{severity:"info",sx:{my:1,padding:0,px:2},children:(0,a.jsx)(m.Z,{variant:"body2",sx:{fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:k("wallet.someGamesMayExperienceSettlementDelays")})})]}),(0,a.jsx)(L.Z,{sx:{pb:2,background:"transparent",border:"none"},children:(0,a.jsxs)(J.ZP,{spacing:1,alignItems:"center",sx:{p:0,background:"transparent"},children:[(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsxs)(m.Z,{component:"span",sx:{color:"primary.main",fontWeight:"bold",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[k("wallet.withdrawAmount")," "," "]}),(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",display:"flex",gap:1,fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},variant:"h6",children:[eD?tu:(0,a.jsxs)(i.Z,{mx:.1,children:[(0,f.dN)(Number(null!==(c=e9("amount"))&&void 0!==c?c:0),"crypto/")," "]}),ex.symbol]})]})}),(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsx)(m.Z,{component:"span",sx:{color:I.palette.grey[400],fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:k("wallet.fee")}),(0,a.jsx)(B.Z,{direction:{xs:"column",sm:"row"},children:(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",display:"flex",gap:1,fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},variant:"h6",children:[eD?tu:(0,a.jsxs)(i.Z,{mx:.1,children:["â"," ",(0,f.dN)(Number(eV),"crypto/")," "]}),ex.symbol]})})]})}),(0,a.jsx)(J.ZP,{item:!0,xs:12,children:(0,a.jsxs)(B.Z,{direction:"row",justifyContent:"space-between",children:[(0,a.jsxs)(m.Z,{component:"span",sx:{color:I.palette.grey[400],fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},children:[k("wallet.actuallyReceivedAmount")," "]}),(0,a.jsxs)(m.Z,{sx:{wordBreak:"break-word",display:"flex",gap:1,fontSize:"clamp(12px, 3.4vw, 0.875rem) !important",color:Number(e9("totalWithdraw"))>0?"green":0>Number(e9("totalWithdraw"))?"#c10000":"#fff"},variant:"h6",children:[eD?tu:(0,a.jsxs)(i.Z,{mx:.1,children:["â"," ",(0,f.dN)(Number(null!==(u=e9("totalWithdraw"))&&void 0!==u?u:0),"crypto/")," "]}),ex.symbol]})]})})]})})]}),(0,a.jsxs)(i.Z,{sx:{display:"flex",flexDirection:"row",gap:2,py:1},children:[0!==eq&&(0,a.jsx)(q.Z,{color:"inherit",variant:"outlinedSecondary",disabled:0===eq,onClick:()=>{eT(e=>e-1)},sx:{mr:1},children:k("actions.back")}),(0,a.jsx)(i.Z,{sx:{flex:"1 1 auto"}}),(0,a.jsx)(E.Z,{onClick:()=>ts(),sx:{border:"1px solid #fe7801",fontSize:"clamp(12px, 3.4vw, 0.875rem) !important"},variant:2===eN.length||eq>=1?"header":"headerSecondary",disabled:ef,children:k(2===eN.length?"actions.submit":eq?"actions.submit":"actions.next")})]})]})})]})]})]})})}function eu(e){let{children:t,value:r,tabValue:n,...l}=e;return(0,a.jsx)("div",{role:"tabpanel",hidden:r!==n,id:"withdraw-tabpanel-".concat(n),"aria-labelledby":"withdraw-tab-".concat(n),...l,children:r===n&&(0,a.jsx)(i.Z,{sx:{pt:2},children:t})})}function em(){let{t:e}=(0,l.i)(),t=(0,s.Z)(),r=(0,o.lr)(),p=r.get("type")||"crypto",h=r.get("currency")||"",x=r.get("id")||"",[v,y]=n.useState(p),b=(0,o.tv)(),f=[{id:"crypto",label:e("wallet.crypto"),component:(0,a.jsx)(ec,{}),disabled:!1},{id:"fiat",label:e("wallet.fiat"),component:(0,a.jsx)(en,{currencyParams:h,idParams:x}),disabled:!1}];return(0,a.jsx)(i.Z,{sx:{width:"100%"},children:(0,a.jsxs)(i.Z,{sx:{width:"100%"},children:[(0,a.jsx)(d.Z,{position:"static",sx:{backgroundColor:"transparent",boxShadow:"none",px:1,borderBottom:1,borderColor:"divider"}
1,children:(0,a.jsx)(c.Z,{value:v,onChange:(e,t)=>{let a=new URLSearchParams(r);a.set("type",t),b.push("".concat(window.location.pathname,"?").concat(a.toString())),y(t)},"aria-label":"Withdrawal method tabs",variant:"fullWidth",scrollButtons:"auto",sx:{"& .MuiTabs-indicator":{backgroundColor:t.palette.primary.main,height:"2px"}},children:f.map(e=>{var r;return(0,a.jsx)(u.Z,{disabled:e.disabled,label:(0,a.jsx)(m.Z,{sx:{fontSize:"clamp(2px, 3.5vw, 0.875rem) !important",lineHeight:1.2,textAlign:"center",transition:"none",transform:"none",fontWeight:"600"},children:e.label}),value:e.id,...(r=e.id,{id:"withdraw-tab-".concat(r),"aria-controls":"withdraw-tabpanel-".concat(r)}),sx:{textTransform:"none",color:v===e.id?t.palette.primary.main:t.palette.text.secondary,"&.Mui-selected":{color:t.palette.primary.main}}},e.id)})})}),f.map(e=>(0,a.jsx)(eu,{value:v,tabValue:e.id,children:(0,a.jsx)(i.Z,{sx:{px:1,overflowX:"hidden",minHeight:"auto",overflowY:"scroll","&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-thumb":{backgroundColor:t.palette.primary.main,borderRadius:"2px"}},children:e.component})},e.id))]})})}},8149:function(e,t,r){r.d(t,{q:function(){return a}});function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0";if(Number.isNaN(Number(e))||null===e)return t;let[r,a]=e.toString().split("."),n=r.replace(/\B(?=(\d{3})+(?!\d))/g,",");return a?"".concat(n,".").concat(a):n}}}]);
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.