1import{a as i,j as e}from"./vendor-core.DkahmlU8.js";import{a6 as F,X as O,aA as W,B as D,d0 as H,as as _,S as x,d as g}from"./bootstrap.KUFis_Od.js";import{aU as $,aV as q,L as z,n as G,B as m}from"./App.C7HhiLEI.js";import{y as u,aI as R,aL as V,ae as L}from"./vendor-mui-x.BZ8Y4adA.js";import"./vendor-firebase.dbYXL2Q0.js";const X=6e4,U=()=>{var k,I;const{handleChangeEmail:p}=F(),{workspace:b}=O(),r=(k=W)==null?void 0:k.currentUser,v=(I=r==null?void 0:r.email)!=null?I:"",w=i.useMemo(()=>{var n;return((n=r==null?void 0:r.providerData)!=null?n:[]).filter(t=>t!==null).map(t=>{switch(t.providerId){case"google.com":return{id:t.providerId,label:"Google",email:t.email};case"github.com":return{id:t.providerId,label:"GitHub",email:t.email};case"microsoft.com":return{id:t.providerId,label:"Microsoft",email:t.email};case"password":return{id:t.providerId,label:"Email/Password",email:t.email};default:return{id:t.providerId,label:t.providerId,email:t.email}}})},[r]),[S,y]=i.useState(!1),[l,j]=i.useState(""),[s,C]=i.useState(""),[o,c]=i.useState("idle"),[f,h]=i.useState(""),[A,N]=i.useState(0),d=i.useMemo(()=>$(s),[s]),E=s.trim()!==""&&s.trim().toLowerCase()===v.toLowerCase(),B=l.trim()!==""&&s.trim()!==""&&!d&&!E&&o!=="submitting"&&Date.now()-A>=X,M=i.useCallback(async a=>{var n;a.preventDefault(),c("submitting"),h("");try{await p(l,s.trim()),c("success"),N(Date.now())}catch(t){c("error");const T=(n=t==null?void 0:t.code)!=null?n:"";h(q(T,t==null?void 0:t.message))}},[l,s,p]),P=i.useCallback(()=>{y(!1),j(""),C(""),c("idle"),h("")},[]);return e.jsx(z,{EnhancedPageHeaderProps:{title:"Login Methods",description:"Manage how you sign in to Inworld Studio."},children:e.jsxs(D,{component:"div",sx:{maxWidth:H.page,mx:"auto",width:"100%",px:{xs:0,sm:3},pb:4},children:[b&&e.jsx(u,{"aria-label":"Back to Account Settings",component:_,to:`/workspaces/${b}/settings/account`,variant:"body2",sx:{color:"text.secondary",display:"inline-flex",alignItems:"center",gap:.5,mt:2,mb:1,textDecoration:"none","&:hover":{color:"text.primary"}},children:"â Back to Account Settings"}),e.jsx(u,{variant:"h6",sx:{mt:2,mb:1},children:"Current login methods"}),e.jsxs(x,{direction:"row",spacing:1,sx:{mb:3,flexWrap:"wrap"},children:[w.map(a=>e.jsx(R,{label:a.email?`${a.label} (${a.email})`:a.label,variant:"outlined"},a.id)),w.length===0&&e.jsx(G,{icon:null,density:"compact",title:"No providers found."})]}),e.jsx(V,{}),e.jsx(u,{variant:"h6",sx:{mt:3,mb:1},children:"Change email address"}),e.jsxs(u,{variant:"body2",sx:{color:"text.secondary",mb:2},children:["Your current email is ",e.jsx("strong",{children:v}),". Change the email you use to sign in."]}),o==="success"?e.jsxs(m,{severity:"success",sx:{mb:2},children:["Verification sent to ",e.jsx("strong",{children:s.trim()}),". Check your inbox to complete the change. Billing will update automatically once you click the link."]}):null,!S&&o!=="success"&&e.jsx(g,{"aria-label":"Change email",onClick:()=>y(!0),sx:{alignSelf:"flex-start"},children:"Change email"}),S&&o!=="success"&&e.jsxs(D,{component:"form",onSubmit:M,children:[f&&e.jsx(m,{severity:"error",sx:{mb:2},children:f}),d&&s.trim()!==""&&e.jsxs(m,{severity:"warning",sx:{mb:2},children:[d.providerName," addresses should sign in with"," ",d.providerName," instead of email and password."]}),E&&e.jsx(m,{severity:"info",sx:{mb:2},children:"This is already your current email."}),e.jsxs(x,{spacing:2,sx:{maxWidth:400},children:[e.jsx(L,{label:"Current password",type:"password",value:l,onChange:a=>j(a.target.value),autoComplete:"current-password",required:!0,size:"small"}),e.jsx(L,{label:"New email address",type:"email",value:s,onChange:a=>C(a.target.value),autoComplete:"email",required:!0,size:"small"}),e.jsxs(x,{direction:"row",spacing:1,children:[e.jsx(g,{"aria-label":"Send verification",type:"submit",loading:o==="submitting",disabled:!B,children:"Send verification"}),e.jsx(g,{intent:"ghost","aria-label":"Cancel",onClick:P,disabled:o==="submitting",children:"Cancel"})]})]})]})]})})};export{U as PortalSettingsLoginMethods};
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.