1import{r as i,fl as k,B as N,A as e,b2 as B,S as x}from"./index.02f3d9ef.1790259279201.js";import{u as G,r as I}from"./agentation.c08165d4.1790259279201.js";import{l as C}from"./index.88ec5daf.1790259279201.js";import $ from"./breadcrumbs.4e8b44b5.1790259279201.js";import{p as E,q as M}from"./oddsFeedModules.b26a1629.1790259279201.js";import{h as q}from"./registerModules.119935e2.1790259279201.js";import"./index.87112539.1790259279201.js";import"./dayjs.min.a261b5dd.1790259279201.js";const D=()=>{const[o,n]=i.useState({provider:"",newPassword:"",confirmPassword:""}),[u,P]=i.useState({newPassword:"",confirmPassword:""}),[p,g]=i.useState({}),[b,d]=i.useState({}),[v,w]=i.useState(!1),[l,c]=i.useState([]),[f,m]=i.useState(!1),[j,_]=i.useState([]),{t}=G(["liteChangeGamePassword"]);i.useEffect(()=>{E().then(a=>{a.length>0&&(c(a),y(a?.[0]?.provider),n(r=>({...r,provider:String(a?.[0]?.provider)})))}).catch(a=>{console.error(a)}).finally(()=>{m(!0)})},[]);const S=(a,r)=>{n(h=>({...h,[a]:r})),a==="newPassword"&&_(q(r))},W=a=>{P(r=>({...r,[a]:!r[a]}))},y=a=>{w(!1),M({provider:a}).then(r=>d(r)).catch(r=>{console.error(r),d(null)}).finally(()=>w(!0))};return{uiFields:o,toggleHideShow:W,onProviderChange:a=>{const r=typeof a=="string"||typeof a=="number"?l?.find(h=>String(h?.provider)===String(a)):a;if(!r){console.warn("onProviderChange: provider not found for value:",a);return}y(r?.provider),g(r),n(h=>({...h,provider:String(r?.provider)}))},selectedProvider:p,providerWallet:b,loadProviderWallet:v,providerList:l,loadProvider:f,submitChangeGamePassword:()=>{const a={provider:o?.provider,password:o?.confirmPassword};k(a).then(()=>{N.toast.success(t("liteChangeGamePassword:passwordChanged","Password changed!")),n(r=>({...r,newPassword:"",confirmPassword:""}))}).catch(r=>{N.toast.error(t(r,"Sorry, we couldn't change your password due to an error. Please contact our customer support for assistance."))})},handleOnChange:S,showPassword:u,setShowPassword:P,newPasswordValidation:j}},O="_changeGamePasswordContainer_m21p1_9",V="_topbar_m21p1_15",A="_formCard_m21p1_18",F="_field_m21p1_21",R="_label_m21p1_24",L="_req_m21p1_31",T="_inputWrap_m21p1_34",H="_input_m21p1_34",U="_error_m21p1_49",z="_skeleton_m21p1_55",J="_icon_m21p1_69",K="_suffixBtn_m21p1_97",Q="_errorMsg_m21p1_114",X="_actions_m21p1_119",Y="_btn_m21p1_125",Z="_btnGhost_m21p1_133",ee="_btnPrimary_m21p1_141",se="_helperNote_m21p1_149",s={changeGamePasswordContainer:O,topbar:V,formCard:A,field:F,label:R,req:L,inputWrap:T,input:H,error:U,skeleton:z,"skeleton-loading-effect":"_skeleton-loading-effect_m21p1_1",icon:J,suffixBtn:K,errorMsg:Q,actions:X,btn:Y,btnGhost:Z,btnPrimary:ee,helperNote:se},pe=()=>{const{t:o}=G(["liteChangeGamePassword"]),{uiFields:n,toggleHideShow:u,onProviderChange:P,providerWallet:p,loadProviderWallet:g,providerList:b,loadProvider:d,submitChangeGamePassword:v,handleOnChange:w,showPassword:l,newPasswordValidation:c}=D(),f=I.useHistory(),m=!!n?.newPassword&&!!n?.confirmPassword&&n?.newPassword!==n?.confirmPassword,_=!(!!(n?.provider&&n?.newPassword&&n?.confirmPassword)&&!m&&c.length===0);return e.jsxs("div",{className:s?.changeGamePasswordContainer,children:[e.jsx("div",{className:s?.topbar,children:e.jsx($,{title:o("liteChangeGamePassword:changeGamePassword","Change Game Password"),backAction:()=>f.push("/myaccount/profile")})}),e.jsxs("div",{className:s?.formCard,children:[e.jsxs("div",{className:s?.field,children:[e.jsxs("label",{className:s?.label,children:[o("liteChangeGamePassword:provider","Provider")," ",e.jsx("span",{className:s?.req,children:"*"})]}),e.jsx("div",{className:s?.inputWrap,children:e.jsxs("select",{value:String(n?.provider??""),onChange:t=>P(t.target.value),disabled:!d,children:[!d&&e.jsx("option",{className:s?.skeleton}),d&&e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"",disabled:!0,hidden:!0,children:o("liteChangeGamePassword:provider","Provider")}),b?.map(t=>e.jsx("option",{value:String(t?.provider),children:t?.name},t?.id))]})]})})]}),e.jsxs("div",{className:s?.field,children:[e.jsxs("label",{className:s?.label,children:[o("liteChangeGamePassword:name","Name")," ",e.jsx("span",{className:s?.req,children:"*"})]}),e.jsxs("div",{className:s?.inputWrap,children:[e.jsx(C.DebounceInput,{disabled:!0,className:s?.input,id:"name",placeholder:o("liteChangeGamePassword:name","Name"),value:g?p?.playId??"":""}),e.jsx("button",{type:"button",className:s?.suffixBtn,onClick:()=>{p?.playId&&(B(p.playId),N.toast.info(o("liteProfile:copied","Copied")))},"aria-label":"Copy",children:e.jsx(x,{category:"SVGDeposit",name:"D-copy",className:s.icon})})]})]}),e.jsxs("div",{className:s?.field,children:[e.jsxs("label",{className:s?.label,children:[o("liteChangeGamePassword:newPassword","New Password")," ",e.jsx("span",{className:s?.req,children:"*"})]}),e.jsxs("div",{className:s?.inputWrap,children:[e.jsx(C.DebounceInput,{className:`${s.input} ${c.length>0&&s.error}`,type:l.newPassword?"text":"password",id:"newPassword",placeholder:o("liteChangeGamePassword:newPassword","New Password"),value:n?.newPassword??"",onChange:t=>w("newPassword",t.target.value)}),e.jsx("button",{type:"button",onClick:()=>u("newPassword"),className:s?.suffixBtn,"aria-label":"Toggle password visibility",children:e.jsx(x,{category:"SVGReactIcons",name:l.newPassword?"AiOutlineEye":"AiOutlineEyeInvisible",className:s?.icon})})]}),c.length>0&&e.jsx("p",{className:s?.errorMsg,children:o(`liteChangeGamePassword:validate.password.${c[0]}`,"New password and confirm password do not match")})]}),e.jsxs("div",{className:`${s?.field} ${m?s?.error:""}`,children:[e.jsxs("label",{className:s?.label,children:[o("liteChangeGamePassword:confirmNewPassword","Confirm New Password")," ",e.jsx("span",{className:s?.req,children:"*"})]}),e.jsxs("div",{className:s?.inputWrap,children:[e.jsx(C.DebounceInput,{className:`${s.input} ${m&&s.error}`,type:l.confirmPassword?"text":"password",id:"confirmPassword",placeholder:o("liteChangeGamePassword:confirmNewPassword","Confirm New Password"),value:n?.confirmPassword??"",onChange:t=>w("confirmPassword",t.target.value)}),e.jsx("button",{type:"button",onClick:()=>u("confirmPassword"),className:s?.suffixBtn,"aria-label":"Toggle password visibility",children:e.jsx(x,{category:"SVGReactIcons",name:l.confirmPassword?"AiOutlineEye":"AiOutlineEyeInvisible",className:s?.icon})})]}),m&&e.jsx("p",{className:s?.errorMsg,children:o("liteChangeGamePassword:validate.password.mismatch","New password and confirm password do not match")})]}),e.jsxs("div",{className:s?.actions,children:[e.jsx("button",{type:"button",className:`${s?.btn} ${s?.btnGhost}`,onClick:()=>f.push("/myaccount/profile"),children:o("liteChangeGamePassword:cancel","Cancel")}),e.jsx("button",{type:"button",className:`${s?.btn} ${s?.btnPrimary}`,disabled:_,onClick:v,children:o("liteChangeGamePassword:confirm","Confirm")})]}),e.jsx("p",{className:s?.helperNote,children:o("liteChangeGamePassword:passwordRules","Password with minimum 6 letters or digits. Special character is not allow.")})]})]})};export{pe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.