"use strict";(this.webpackChunkdiscord_app=this.webpackChunkdiscord_app||[]).push([["52030"],{48550:function(e,t,n){n.d(t,{P:()=>r});var l=n(388032);let r={get webauthn(){return l.intl.string(l.t.gTH4Dg)},get totp(){return l.intl.string(l.t.nXKmyc)},get sms(){return l.intl.string(l.t.ZbVwZW)},get password(){return l.intl.string(l.t["8F6hKS"])},get backup(){return l.intl.string(l.t.vhSRKS)}}},124860:function(e,t,n){n.d(t,{Cd:()=>g,YR:()=>p}),n(388685),n(415506);var l=n(255367),r=n(73800),i=n(481060),s=n(447097),a=n(873124),o=n(248902),d=n(160511),c=n(51693),u=n(973810),h=n(388032);function f(e){for(var t=1;t{let{mfaType:t,data:n}=e;await g({mfaType:t,data:n,ticket:h.ticket}),null!=p&&p()},Z={mfaChallenge:h,finish:C,setSlide:y,onClose:x};return(0,l.jsxs)(i.MyZ,{activeSlide:b,width:j,onSlideReady:v,children:[(0,l.jsx)(i.Mi4,{id:"select",children:(0,l.jsx)(o.Z,f({},Z))}),(0,l.jsx)(i.Mi4,{id:"webauthn",children:(0,l.jsx)(u.Z,f({},Z))}),(0,l.jsx)(i.Mi4,{id:"totp",children:(0,l.jsx)(c.Z,m(f({},Z),{isSlideReady:"totp"===S}))}),(0,l.jsx)(i.Mi4,{id:"sms",children:(0,l.jsx)(d.Z,m(f({},Z),{isSlideReady:"sms"===S}))}),(0,l.jsx)(i.Mi4,{id:"backup",children:(0,l.jsx)(s.Z,m(f({},Z),{isSlideReady:"backup"===S}))}),(0,l.jsx)(i.Mi4,{id:"password",children:(0,l.jsx)(a.Z,m(f({},Z),{isSlideReady:"password"===S}))})]})}function x(e){let{mfaChallenge:t,finish:n,transitionState:r,onClose:s}=e;return(0,l.jsx)(i.Y0X,{transitionState:r,size:i.CgR.SMALL,"aria-label":h.intl.string(h.t.saHocH),parentComponent:"MFAModal",children:(0,l.jsx)(g,{mfaChallenge:t,mfaFinish:n,onClose:s,onEarlyClose:s})})}function p(e,t,n){(0,i.h7j)(n=>(0,l.jsx)(x,f({finish:t,mfaChallenge:e},n)),{onCloseCallback:()=>{n(Error(h.intl.string(h.t.N2yb9f)))}})}},507453:function(e,t,n){n.d(t,{Z:()=>o});var l=n(255367);n(73800);var r=n(481060),i=n(600164),s=n(388032),a=n(895453);let o={SlideContent:function(e){let{children:t,scrollbarType:n}=e;return(0,l.jsx)(r.hzk,{className:a.content,scrollbarType:n,children:t})},SlideError:function(e){let{error:t}=e;return null==t?null:(0,l.jsx)(r.Text,{className:a.error,variant:"text-sm/normal",color:"text-danger",children:t})},SlideFooter:function(e){let{mfaChallenge:t,setSlide:n,leadingButton:i,showConfirm:a=!1,disabled:o,submitting:d}=e,c=t.methods.length>1;return null!=i||c||a?(0,l.jsx)(r.mzw,{children:(0,l.jsxs)(r.hE2,{fullWidth:!0,children:[i,c&&(0,l.jsx)(r.zxk,{variant:"secondary",text:s.intl.string(s.t.Tot4EB),onClick:()=>n("select")}),a&&(0,l.jsx)(r.zxk,{type:"submit",variant:"primary",text:s.intl.string(s.t["cY+Ooa"]),disabled:o,loading:d})]})}):null},SlideHeader:function(e){let{subtitle:t,onClose:n}=e;return(0,l.jsxs)(r.xBx,{direction:i.Z.Direction.VERTICAL,className:a.header,separator:!1,children:[(0,l.jsx)(r.X6q,{variant:"heading-xl/semibold",children:s.intl.string(s.t.saHocH)}),null!=t&&(0,l.jsx)(r.Text,{color:"header-secondary",variant:"text-md/normal",className:a.subtitle,children:t}),(0,l.jsx)(r.olH,{className:a.closeButton,onClick:n})]})}}},447097:function(e,t,n){n.d(t,{Z:()=>d}),n(704826),n(35282),n(388685),n(457542);var l=n(255367),r=n(73800),i=n(658550),s=n(481060),a=n(507453),o=n(388032);function d(e){let{mfaChallenge:t,finish:n,setSlide:d,onClose:c,isSlideReady:u}=e,[h,f]=r.useState(!1),[m,g]=r.useState(null),[x,p]=r.useState(""),j=r.useRef(null),b=o.intl.string(o.t["C/ZAw8"]),y=o.intl.string(o.t.fZSi1N),S=r.useCallback(e=>{p(e),g(null)},[p,g]);return r.useEffect(()=>{if(u){var e;null==(e=j.current)||e.focus()}},[u]),(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),f(!0),n({mfaType:"backup",data:x.replace(/-/g,"")}).catch(e=>{var t,n;g(null!=(n=null==(t=e.body)?void 0:t.message)?n:e.message)}).finally(()=>{f(!1)})},children:[(0,l.jsx)(a.Z.SlideHeader,{onClose:c}),(0,l.jsx)(a.Z.SlideContent,{children:(0,l.jsxs)(s.xJW,{title:b,children:[(0,l.jsx)(s.oil,{inputRef:j,onChange:S,placeholder:y,maxLength:i.tL,minLength:i.th,value:x,spellCheck:"false",disabled:h}),(0,l.jsx)(a.Z.SlideError,{error:m})]})}),(0,l.jsx)(a.Z.SlideFooter,{mfaChallenge:t,setSlide:d,showConfirm:!0,disabled:x.length<8,submitting:h})]})}},873124:function(e,t,n){n.d(t,{Z:()=>o}),n(388685),n(457542);var l=n(255367),r=n(73800),i=n(481060),s=n(507453),a=n(388032);function o(e){let{mfaChallenge:t,finish:n,setSlide:o,onClose:d,isSlideReady:c}=e,[u,h]=r.useState(!1),[f,m]=r.useState(null),[g,x]=r.useState(""),p=r.useRef(null);return r.useEffect(()=>{if(c){var e;null==(e=p.current)||e.focus()}},[c]),(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),h(!0),n({mfaType:"password",data:g}).catch(e=>{var t,n;m(null!=(n=null==(t=e.body)?void 0:t.message)?n:e.message)}).finally(()=>{h(!1)})},children:[(0,l.jsx)(s.Z.SlideHeader,{onClose:d}),(0,l.jsx)(s.Z.SlideContent,{children:(0,l.jsxs)(i.xJW,{title:a.intl.string(a.t["CIGa+/"]),children:[(0,l.jsx)(i.oil,{inputRef:p,onChange:x,value:g,type:"password",autoComplete:"password",spellCheck:"false",disabled:u}),(0,l.jsx)(s.Z.SlideError,{error:f})]})}),(0,l.jsx)(s.Z.SlideFooter,{mfaChallenge:t,setSlide:o,showConfirm:!0,disabled:0===g.length,submitting:u})]})}},248902:function(e,t,n){n.d(t,{Z:()=>d});var l=n(255367);n(73800);var r=n(481060),i=n(507453),s=n(48550),a=n(388032),o=n(895453);function d(e){let{mfaChallenge:t,setSlide:n,onClose:d}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i.Z.SlideHeader,{subtitle:a.intl.string(a.t["XQaT+/"]),onClose:d}),(0,l.jsx)(i.Z.SlideContent,{children:t.methods.map(e=>(0,l.jsxs)(r.P3F,{className:o.listItemContainer,onClick:()=>{n(e.type)},children:[(0,l.jsx)(r.Text,{className:o.listItemText,variant:"text-md/semibold",children:s.P[e.type]}),(0,l.jsx)(r.Fbu,{size:"custom",color:"currentColor",width:20,height:20,className:o.listItemArrow})]},e.type))})]})}},160511:function(e,t,n){n.d(t,{Z:()=>h}),n(388685),n(457542);var l=n(255367),r=n(73800),i=n(658550),s=n(544891),a=n(481060),o=n(507453),d=n(981631),c=n(388032),u=n(895453);function h(e){let{mfaChallenge:t,finish:n,setSlide:h,onClose:f,isSlideReady:m}=e,[g,x]=r.useState(!1),[p,j]=r.useState(null),[b,y]=r.useState(!1),[S,v]=r.useState(null),[C,Z]=r.useState(""),w=r.useRef(null);r.useEffect(()=>{x(!0),s.tn.post({url:d.ANM.LOGIN_SMS_SEND,body:{ticket:t.ticket},oldFormErrors:!0,rejectWithError:!1}).then(e=>{j(e.body.phone)}).catch(e=>{var t,n;v(null!=(n=null==(t=e.body)?void 0:t.message)?n:e.message)}).finally(()=>{x(!1)})},[t.ticket]),r.useEffect(()=>{if(m){var e;null==(e=w.current)||e.focus()}},[m]);let k=null==p?c.intl.string(c.t.LQdCQE):c.intl.formatToPlainString(c.t["8r6h7+"],{phoneNumber:p});return(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),y(!0),n({mfaType:"sms",data:C}).catch(e=>{var t,n;v(null!=(n=e.message)?n:null==(t=e.body)?void 0:t.message)}).finally(()=>{y(!1)})},children:[(0,l.jsx)(o.Z.SlideHeader,{subtitle:k,onClose:f}),(0,l.jsx)(o.Z.SlideContent,{children:(0,l.jsxs)(a.xJW,{title:c.intl.string(c.t.HZPBOT),children:[(0,l.jsxs)("div",{className:u.smsInputContainer,children:[(0,l.jsx)(a.oil,{className:u.smsInput,inputRef:w,onChange:Z,placeholder:c.intl.string(c.t.tARzgo),maxLength:10,value:C,autoComplete:"one-time-code",spellCheck:"false",disabled:b}),(0,l.jsx)(a.zxk,{variant:"secondary",text:c.intl.string(c.t.ZF29Ly),loading:g,onClick:()=>{s.tn.post({url:d.ANM.LOGIN_SMS_SEND,body:{ticket:t.ticket},oldFormErrors:!0,rejectWithError:!1}).then(e=>{j(e.body.phone)}).catch(e=>{var t;v(e.message||(null==(t=e.body)?void 0:t.message))})}})]}),(0,l.jsx)(o.Z.SlideError,{error:S})]})}),(0,l.jsx)(o.Z.SlideFooter,{mfaChallenge:t,setSlide:h,showConfirm:!0,disabled:C.length!==i.Gz,submitting:b})]})}},51693:function(e,t,n){n.d(t,{Z:()=>d}),n(388685),n(457542);var l=n(255367),r=n(73800),i=n(658550),s=n(481060),a=n(507453),o=n(388032);function d(e){let{mfaChallenge:t,finish:n,setSlide:d,onClose:c,isSlideReady:u}=e,[h,f]=r.useState(!1),[m,g]=r.useState(null),[x,p]=r.useState(""),j=r.useRef(null);return r.useEffect(()=>{if(u){var e;null==(e=j.current)||e.focus()}},[u]),(0,l.jsxs)("form",{onSubmit:e=>{e.preventDefault(),f(!0),g(null),n({mfaType:"totp",data:x}).catch(e=>{var t,n;g(null!=(n=null==(t=e.body)?void 0:t.message)?n:e.message)}).finally(()=>{f(!1)})},children:[(0,l.jsx)(a.Z.SlideHeader,{onClose:c}),(0,l.jsx)(a.Z.SlideContent,{scrollbarType:"none",children:(0,l.jsxs)(s.xJW,{title:o.intl.string(o.t.HZPBOT),children:[(0,l.jsx)(s.oil,{inputRef:j,onChange:p,placeholder:o.intl.string(o.t.tARzgo),maxLength:i.gH,minLength:i.gH,value:x,autoComplete:"one-time-code",spellCheck:"false",disabled:h}),(0,l.jsx)(a.Z.SlideError,{error:m})]})}),(0,l.jsx)(a.Z.SlideFooter,{mfaChallenge:t,setSlide:d,showConfirm:!0,disabled:x.length!==i.gH,submitting:h})]})}},973810:function(e,t,n){n.d(t,{Z:()=>m}),n(388685),n(49124);var l=n(255367),r=n(73800),i=n(849055),s=n(544891),a=n(481060),o=n(358085),d=n(960048),c=n(998502),u=n(507453),h=n(981631),f=n(388032);function m(e){let{mfaChallenge:t,finish:n,setSlide:m,onClose:g}=e,[x,p]=r.useState(!1),[j,b]=r.useState(null),{challenge:y}=t.methods.find(e=>"webauthn"===e.type),S=async()=>{p(!0),b(null);let e=o.isPlatformEmbedded&&c.ZP.supportsFeature(h.eRX.WEBAUTHN)?c.ZP.webAuthnAuthenticate(y):i.U2(JSON.parse(y)).then(e=>JSON.stringify(e)),t=async e=>{try{await n({mfaType:"webauthn",data:e})}catch(e){e instanceof s.Pd?b(f.intl.string(f.t.xSCvBQ)):b(e.message)}};try{let n=await e;await t(n)}catch(e){d.Z.captureException(e),b(f.intl.string(f.t.xSCvBQ))}finally{p(!1)}};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.Z.SlideHeader,{onClose:g}),null!=j&&(0,l.jsx)(u.Z.SlideContent,{children:(0,l.jsx)(u.Z.SlideError,{error:j})}),(0,l.jsx)(u.Z.SlideFooter,{mfaChallenge:t,setSlide:m,leadingButton:(0,l.jsx)(a.zxk,{variant:"primary",text:f.intl.string(f.t.Xr3Ekp),loading:x,onClick:S,fullWidth:!0})})]})}},658550:function(e,t,n){n.d(t,{Gz:()=>a,P0:()=>d,gH:()=>s,tL:()=>i,th:()=>r}),n(415506);var l=n(544891);let r=8,i=11,s=6,a=6;async function o(e){let{ticket:t,mfaType:n,data:r}=e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;try{return(await l.tn.post({url:"/mfa/finish",body:{ticket:t,mfa_type:n,data:r},retries:i,rejectWithError:!1})).body}catch(e){var s;if(null==(s=e.body)?void 0:s.message)throw Error(e.body.message);throw e}}async function d(e,t){let{token:n}=await o(e);return new Promise((e,l)=>{t({"X-Discord-MFA-Authorization":n},t=>{var n,r;return(null==(n=t.body)?void 0:n.code)===60008||(null==(r=t.body)?void 0:r.code)===60003?(l(Error(t.body.message)),!0):(e(),!1)})})}}}]); //# sourceMappingURL=11ea1d1605fdfdc8.js.map